Bug 2050093 - python-simplewrap fails to build with Python 3.11: TypeError: 'float' object cannot be interpreted as an integer
Summary: python-simplewrap fails to build with Python 3.11: TypeError: 'float' object ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-simplewrap
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Igor Raits
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.11
TreeView+ depends on / blocked
 
Reported: 2022-02-03 08:56 UTC by Tomáš Hrnčiar
Modified: 2022-04-12 14:24 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-04-12 14:24:17 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2022-02-03 08:56:48 UTC
python-simplewrap fails to build with Python 3.11.0a4.


======================================================================
ERROR: test_callback (simplewrap.tests.test_all.TestSimpleWrap)
Wrap a simple function that calls a Python callback.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/simplewrap-0.3.3/simplewrap/tests/test_all.py", line 37, in test_callback
    B = random.randint(1,1e6)
        ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/random.py", line 330, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/random.py", line 306, in randrange
    istop = _index(stop)
            ^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

======================================================================
ERROR: test_int (simplewrap.tests.test_all.TestSimpleWrap)
Wrap a simple function with integer parameters.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/simplewrap-0.3.3/simplewrap/tests/test_all.py", line 27, in test_int
    number = random.randint(1,1e6)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/random.py", line 330, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/random.py", line 306, in randrange
    istop = _index(stop)
            ^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

----------------------------------------------------------------------
Ran 4 tests in 0.003s

FAILED (errors=2)

https://docs.python.org/3.11/whatsnew/3.11.html

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.11/fedora-rawhide-x86_64/03272504-python-simplewrap/

For all our attempts to build python-simplewrap with Python 3.11, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-simplewrap/

Testing and mass rebuild of packages is happening in copr. You can follow these instructions to test locally in mock if your package builds with Python 3.11:
https://copr.fedorainfracloud.org/coprs/g/python/python3.11/

Let us know here if you have any questions.

Python 3.11 is planned to be included in Fedora 37. To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.11.
A build failure prevents us from testing all dependent packages (transitive [Build]Requires), so if this package is required a lot, it's important for us to get it fixed soon.
We'd appreciate help from the people who know this package best, but if you don't want to work on this now, let us know so we can try to work around it on our side.

Comment 1 Miro Hrončok 2022-02-03 10:12:52 UTC
$ python3.10
>>> import random
>>> random.randint(1, 1e6)

$ python3.11
>>> import random
>>> random.randint(1, 1e6)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.11/random.py", line 330, in randint
    return self.randrange(a, b+1)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/random.py", line 306, in randrange
    istop = _index(stop)
            ^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer

Comment 2 Miro Hrončok 2022-02-03 10:40:21 UTC
https://bugs.python.org/issue42222
https://github.com/python/cpython/commit/5afa0a411243210a30526c7459a0ccff5cb88494

randrange: Remove deprecated support for non-integer values

Comment 3 Miro Hrončok 2022-02-03 10:53:08 UTC
The randint/randrange change in Python violates Python's own policy for incompatible changes. I've asked the maintainer to revert it: https://bugs.python.org/issue46624

Comment 4 Ben Cotton 2022-02-08 20:17:48 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 5 Ben Beasley 2022-04-12 13:04:06 UTC
Looking at the COPR[1], it seems like there was finally a successful build[2], but now there is a new problem:

> <frozen importlib._bootstrap>:241: RuntimeWarning: builtins.type size changed, may indicate binary incompatibility. Expected 896 from C header, got 904 from PyObject
> /var/tmp/rpm-tmp.QKo0J6: line 43:   499 Segmentation fault      (core dumped) /usr/bin/python3 setup.py test

[1] https://copr.fedorainfracloud.org/coprs/g/python/python3.11/package/python-simplewrap/
[2] https://copr.fedorainfracloud.org/coprs/g/python/python3.11/build/3846738/

Comment 6 Miro Hrončok 2022-04-12 14:00:55 UTC
That is a transient issue. A new pre-release version of Python 3.11 has landed in our copr out and until every extension module in the dependency tree has been rebuilt with the new one, this can happen. In this case, this is probably caused by numpy.

Comment 7 Ben Beasley 2022-04-12 14:20:45 UTC
(In reply to Miro Hrončok from comment #6)
> That is a transient issue. A new pre-release version of Python 3.11 has
> landed in our copr out and until every extension module in the dependency
> tree has been rebuilt with the new one, this can happen. In this case, this
> is probably caused by numpy.

Thanks. I thought I had seen it before in another package, but had never figured out exactly what was happening.

Comment 8 Ben Beasley 2022-04-12 14:24:17 UTC
I’m going to close this even though the build doesn’t currently succeed, since the one successful COPR build does seem to confirm the original Python change was properly reverted.


Note You need to log in before you can comment on or make changes to this bug.