Bug 2245673 - python-psycopg2 fails to build with Python 3.13: error: implicit declaration of function ‘_PyInterpreterState_Get’; did you mean ‘PyInterpreterState_Get’
Summary: python-psycopg2 fails to build with Python 3.13: error: implicit declaration ...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: python-psycopg2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: ---
Assignee: Ales Nezbeda
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.13
TreeView+ depends on / blocked
 
Reported: 2023-10-23 14:58 UTC by Karolina Surma
Modified: 2024-06-05 07:52 UTC (History)
8 users (show)

Fixed In Version: python-psycopg2-2.9.9-5.fc41
Clone Of:
Environment:
Last Closed: 2024-06-05 07:52:06 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Fedora Package Sources python-psycopg2 pull-request 16 0 None None None 2024-06-05 07:51:33 UTC
Github psycopg psycopg2 issues 1692 0 None open Psycopg2 doesn't install on Python 3.13 alpha 2024-04-23 14:07:34 UTC

Description Karolina Surma 2023-10-23 14:58:45 UTC
python-psycopg2 fails to build with Python 3.13.0a1.

psycopg/connection_int.c:395:14: error: implicit declaration of function ‘isalnum’ [-Werror=implicit-function-declaration]
  395 |         if (!isalnum(*i)) {
      |              ^~~~~~~
psycopg/connection_int.c:35:1: note: include ‘<ctype.h>’ or provide a declaration of ‘isalnum’
   34 | #include "psycopg/notify.h"
  +++ |+#include <ctype.h>
   35 | 
psycopg/connection_int.c:399:20: error: implicit declaration of function ‘toupper’ [-Werror=implicit-function-declaration]
  399 |             *j++ = toupper(*i++);
      |                    ^~~~~~~

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

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.13/fedora-rawhide-x86_64/06551100-python-psycopg2/

For all our attempts to build python-psycopg2 with Python 3.13, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.13/package/python-psycopg2/

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

Let us know here if you have any questions.

Python 3.13 is planned to be included in Fedora 41.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.13.
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 Aoife Moloney 2024-02-15 23:00:35 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 40 development cycle.
Changing version to 40.

Comment 2 Karolina Surma 2024-04-23 12:50:45 UTC
The failure is different now with alpha6:

psycopg/utils.c: In function ‘psyco_is_main_interp’:
psycopg/utils.c:397:12: error: implicit declaration of function ‘_PyInterpreterState_Get’; did you mean ‘PyInterpreterState_Get’? [-Wimplicit-function-declaration]
  397 |     return _PyInterpreterState_Get() == PyInterpreterState_Main();
      |            ^~~~~~~~~~~~~~~~~~~~~~~
      |            PyInterpreterState_Get
psycopg/utils.c:397:38: warning: comparison between pointer and integer
  397 |     return _PyInterpreterState_Get() == PyInterpreterState_Main();
      |                                      ^~
error: command '/usr/bin/gcc' failed with exit code 1

Comment 3 Karolina Surma 2024-04-23 13:12:38 UTC
After a naive sed removing the underscore two tests fail:

======================================================================
FAIL: test_cidr_adapt (tests.test_ipaddress.NetworkingTestCase.test_cidr_adapt)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/psycopg2-2.9.9/tests/test_ipaddress.py", line 112, in test_cidr_adapt
    self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '::ffff:1.2.3.0/128' != '::ffff:102:300/128'
- ::ffff:1.2.3.0/128
?         ^ ^ ^
+ ::ffff:102:300/128
?         ^ ^ ^


======================================================================
FAIL: test_inet_adapt (tests.test_ipaddress.NetworkingTestCase.test_inet_adapt)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/builddir/build/BUILD/psycopg2-2.9.9/tests/test_ipaddress.py", line 71, in test_inet_adapt
    self.assertEquals(cur.fetchone()[0], '::ffff:102:300/128')
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '::ffff:1.2.3.0/128' != '::ffff:102:300/128'
- ::ffff:1.2.3.0/128
?         ^ ^ ^
+ ::ffff:102:300/128
?         ^ ^ ^


----------------------------------------------------------------------
Ran 742 tests in 20.673s

Comment 4 Karolina Surma 2024-04-24 08:36:06 UTC
Upstream PR: https://github.com/psycopg/psycopg2/pull/1695


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