MagicStack / asyncpg

A fast PostgreSQL Database Client Library for Python/asyncio.
Apache License 2.0
6.88k stars 399 forks source link

Replace obsolete, unsafe Py_TRASHCAN_SAFE_BEGIN/END #1150

Closed musicinmybrain closed 2 months ago

musicinmybrain commented 4 months ago

Use Py_TRASHCAN_BEGIN/END instead.

https://bugs.python.org/issue44874

These are removed from the limited C API in Python 3.9, deprecated in 3.11, and removed in Python 3.13:

https://docs.python.org/3.13/whatsnew/3.13.html#id8

musicinmybrain commented 4 months ago

When combined with https://github.com/MagicStack/asyncpg/pull/1101, this allows me to build the python-asyncpg Fedora package for Python 3.13, although I do see two test failures on Python 3.13:

=========================== short test summary info ============================
FAILED tests/test_connect.py::TestClientSSLConnection::test_ssl_connection_client_auth_custom_context
FAILED tests/test_connect.py::TestClientSSLConnection::test_ssl_connection_client_auth_fails_with_wrong_setup
= 2 failed, 300 passed, 2 skipped, 2 deselected, 2 warnings in 151.11s (0:02:31) =

Both are due to something like:

ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: Basic Constraints of CA cert not marked critical (_ssl.c:1020)

I presume this is due to a deficiency of the test certificates in tests/certs/.

musicinmybrain commented 2 months ago

Rebased on master; no other changes.