Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_invalid_input fails with Python 3.10.0a7. #750

Closed
musicinmybrain opened this issue Apr 26, 2021 · 0 comments · Fixed by #751
Closed

test_invalid_input fails with Python 3.10.0a7. #750

musicinmybrain opened this issue Apr 26, 2021 · 0 comments · Fixed by #751

Comments

@musicinmybrain
Copy link
Contributor

musicinmybrain commented Apr 26, 2021

  • asyncpg version: 0.22.0 or commit 6cfdb3a (latest as of this report)
  • PostgreSQL version: 12.6, not running.
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce
    the issue with a local PostgreSQL install?
    : N/A
  • Python version: 3.10.0a7
  • Platform: Fedora Linux 33 (x86_64) or 35
  • Do you use pgbouncer?: No
  • Did you install asyncpg with pip?: Built from source with pip install -e . as directed in docs/installation.rs; or, built from source without using pip as part of the Fedora Linux RPM build process.
  • If you built asyncpg locally, which version of Cython did you use?: 0.29.23; or, 0.29.22
  • Can the issue be reproduced under both asyncio and
    uvloop?
    : I think this question does not make sense in this case.

On Python 3.10.0a7, test_invalid_input fails because the TypeError has message ('str' object cannot be interpreted as an integer), but the test code expects .*an integer is required.

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='2', typname='int2')
----------------------------------------------------------------------
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)
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:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
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)"

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='aa', typname='int2')
----------------------------------------------------------------------
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)
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: 'aa' ('str' object cannot be interpreted as an integer)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
AssertionError: "invalid input for query argument \$1:.*an integer is required" does not match "invalid input for query argument $1: 'aa' ('str' object cannot be interpreted as an integer)"

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='2', typname='int4')
----------------------------------------------------------------------
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)
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:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
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)"

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='aa', typname='int4')
----------------------------------------------------------------------
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)
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: 'aa' ('str' object cannot be interpreted as an integer)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
AssertionError: "invalid input for query argument \$1:.*an integer is required" does not match "invalid input for query argument $1: 'aa' ('str' object cannot be interpreted as an integer)"

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='2', typname='int8')
----------------------------------------------------------------------
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)
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:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
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)"

======================================================================
FAIL: test_invalid_input (test_codecs.TestCodecs) (sample='aa', typname='int8')
----------------------------------------------------------------------
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)
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: 'aa' ('str' object cannot be interpreted as an integer)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/ben/src/asyncpg/tests/test_codecs.py", line -1, in test_invalid_input
AssertionError: "invalid input for query argument \$1:.*an integer is required" does not match "invalid input for query argument $1: 'aa' ('str' object cannot be interpreted as an integer)"

----------------------------------------------------------------------

See also downstream Fedora Linux bug 1953538 for more details. I am the maintainer of the python-asyncpg package in Fedora.

I am preparing a PR that would fix this by adjusting the test to accept either message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant