Bug 2414801 - python-psycopg2 fails to build with Python 3.15: error: implicit declaration of function ‘PyWeakref_GetObject’; did you mean ‘PyWeakref_GetRef’?
Summary: python-psycopg2 fails to build with Python 3.15: error: implicit declaration ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: python-psycopg2
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Filip Januš
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.15
TreeView+ depends on / blocked
 
Reported: 2025-11-13 10:38 UTC by Karolina Surma
Modified: 2025-11-13 10:38 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Karolina Surma 2025-11-13 10:38:01 UTC
python-psycopg2 fails to build with Python 3.15.0a1.

  psycopg/connection_int.c: In function ‘_conn_get_async_cursor’:
  psycopg/connection_int.c:1050:21: error: implicit declaration of function ‘PyWeakref_GetObject’; did you mean ‘PyWeakref_GetRef’? [-Wimplicit-function-declaration]
   1050 |     if (!(py_curs = PyWeakref_GetObject(self->async_cursor))) {
        |                     ^~~~~~~~~~~~~~~~~~~
        |                     PyWeakref_GetRef
  psycopg/connection_int.c:1050:19: error: assignment to ‘PyObject *’ {aka ‘struct _object *’} from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   1050 |     if (!(py_curs = PyWeakref_GetObject(self->async_cursor))) {
        |                   ^
  error: command '/usr/bin/gcc' failed with exit code 1

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

PyWeakref_GetObject() and PyWeakref_GET_OBJECT: use PyWeakref_GetRef() instead. The pythoncapi-compat project can be used to get PyWeakref_GetRef() on Python 3.12 and older. (Contributed by Bénédikt Tran in gh-133644.)

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

For all our attempts to build python-psycopg2 with Python 3.15, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/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.15:
https://copr.fedorainfracloud.org/coprs/g/python/python3.15/

Let us know here if you have any questions.

Python 3.15 is planned to be included in Fedora 45.
To make that update smoother, we're building Fedora packages with all pre-releases of Python 3.15.
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.


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