Bug 1953538 - python-asyncpg fails to build with Python 3.10: AssertionError: "invalid input for query argument \$1:.*an integer is required" does not match "invalid input for query argument $1: '2' ('str' object cannot be interpreted as an integer)"
Summary: python-asyncpg fails to build with Python 3.10: AssertionError: "invalid inpu...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-asyncpg
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ben Beasley
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.10
TreeView+ depends on / blocked
 
Reported: 2021-04-26 10:43 UTC by Tomáš Hrnčiar
Modified: 2021-04-27 12:59 UTC (History)
3 users (show)

Fixed In Version: 0.22.0-5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-04-27 09:13:43 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-04-26 10:43:45 UTC
python-asyncpg fails to build with Python 3.10.0a7.

=================================== FAILURES ===================================
________________________ TestCodecs.test_invalid_input _________________________

>   codec.encode(self.settings, writer, arg)

asyncpg/protocol/prepared_stmt.pyx:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   return self.encoder(self, settings, buf, obj)

asyncpg/protocol/codecs/base.pyx:193: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   self.c_encoder(settings, buf, obj)

asyncpg/protocol/codecs/base.pyx:104: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   val = cpython.PyLong_AsLong(obj)
E   TypeError: 'str' object cannot be interpreted as an integer

asyncpg/pgproto/codecs/int.pyx:30: TypeError

The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "asyncpg/protocol/prepared_stmt.pyx", line 155, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
    codec.encode(self.settings, writer, arg)
  File "asyncpg/protocol/codecs/base.pyx", line 193, in asyncpg.protocol.protocol.Codec.encode
    return self.encoder(self, settings, buf, obj)
  File "asyncpg/protocol/codecs/base.pyx", line 104, in asyncpg.protocol.protocol.Codec.encode_scalar
    self.c_encoder(settings, buf, obj)
  File "asyncpg/pgproto/./codecs/int.pyx", line 30, in asyncpg.pgproto.pgproto.int2_encode
    val = cpython.PyLong_AsLong(obj)
TypeError: 'str' object cannot be interpreted as an integer

The above exception was the direct cause of the following exception:

asyncpg.exceptions.DataError: invalid input for query argument $1: '2' ('str' object cannot be interpreted as an integer)

During handling of the above exception, another exception occurred:

self = <tests.test_codecs.TestCodecs testMethod=test_invalid_input>

>   ???
E   AssertionError: "invalid input for query argument \$1:.*an integer is required" does not match "invalid input for query argument $1: '2' ('str' object cannot be interpreted as an integer)"

tests/test_codecs.py:-1: AssertionError
=========================== short test summary info ============================
FAILED tests/test_codecs.py::TestCodecs::test_invalid_input - AssertionError:...
=========== 1 failed, 271 passed, 2 skipped, 1 deselected in 55.35s ============

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.10/fedora-rawhide-x86_64/02148392-python-asyncpg/

For all our attempts to build python-asyncpg with Python 3.10, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/package/python-asyncpg/

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.10:
https://copr.fedorainfracloud.org/coprs/g/python/python3.10/

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Ben Beasley 2021-04-26 12:33:29 UTC
Reported upstream (https://github.com/MagicStack/asyncpg/issues/750) and patched (see PR https://github.com/MagicStack/asyncpg/pull/751).

The latest koji build in Rawhide failed, as did the build in the Python 3.10 COPR—but right now every build with %{pypi_source} in the spec file is failing!

I will close this issue after the external problem is fixed and I can get a build done.

Comment 2 Miro Hrončok 2021-04-26 21:28:32 UTC
Interesting. Looking into the %{pypi_source} problme, might be related to RPM 4.17.

Comment 4 Miro Hrončok 2021-04-27 09:13:43 UTC
Built in Copr with fixed macros.

Comment 5 Ben Beasley 2021-04-27 12:57:52 UTC
Thanks for looking into this. I’ve now built the package in Rawhide too.

Comment 6 Ben Beasley 2021-04-27 12:59:56 UTC
Linking the bug for the %{pypi_source} problem for the benefit of any future Bugzilla archaeologists: https://bugzilla.redhat.com/show_bug.cgi?id=1953910


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