# Ongoing packages' rebuild with Python 3.13 in Fedora

**URL:** <https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134>\
**Category:** Core Development\
**Created:** [November 7, 2023, 12:29pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134 "2023-11-07T12:29:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ksurma](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ksurma/32/30818_2.png) [@ksurma](https://discuss.python.org/u/ksurma)\
**Post date:** [November 7, 2023, 12:29pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/1 "2023-11-07T12:29:14Z")

</div>

Hello,  
In Fedora, we’re rebuilding a set of around 4000 packages with Python 3.13.0 alpha 1.  
Here’s the current status.

- ~2600 packages were rebuilt successfully so far.
- ~1400 packages were not rebuilt yet, because their dependencies didn’t build.
  - current biggest blocker: [numpy](https://github.com/numpy/numpy/issues/25035) (blocks ~500 packages)
  - previous biggest blocker: [Cython](https://github.com/cython/cython/pull/5767) (fixed in Cython and [CPython](https://github.com/python/cpython/pull/111162) – we’ve backported both changes)

- ~220 failed to build. This includes test failures, for packages where we run the test suite.
  - Some failures were already fixed; 158 still fail to build

Here is a rough breakdown of the failures we encountered.

## Removal of C APIs with names prefixed by `_Py` or `_PY`

5 fail with: implicit declaration of function ‘\_Py\_IDENTIFIER‘: `python-zodbpickle`, `python-drgn`, `btrfs-progs`, `python3-typed_ast`, `python-multidict`

5 fail with: ‘\_PyThreadState\_UncheckedGet’ was not declared in this scope: `python-wsaccel`, `pybind11`, `pythia8`, `HepMC3`, `python-cffi`

4 fail with: implicit declaration of function ‘\_PyUnicode\_AsString: `python-gstreamer1`, `kernel-tools`, `python-cffi`, `python-cvxopt`

3 fail with: ‘\_PyLong\_Copy’ was not declared in this scope; did you mean ‘PyLong\_Type’?: `python-pyroaring`, `fonttools`, `python-cradox`

3 fail with: ‘\_PyObject\_EXTRA\_INIT’ undeclared here (not in a function): `python-dukpy`, `pysvn`, `python-cbor2`

2 fail with: implicit declaration of function ‘\_PyObject\_CallMethodId’: `python-multidict`, `python3-typed_ast`

2 fail with: implicit declaration of function ‘\_PyStack\_AsDict’: `setools`, `python-asyncmy`

2 fail with: implicit declaration of functions ‘\_PyUnicodeWriter\_Init’, ‘\_PyUnicodeWriter\_WriteASCIIString’, ‘\_PyUnicodeWriter\_Finish’, ‘\_PyUnicodeWriter\_Dealloc’, : `python-recordclass`, `python-immutables`

2 fail with: implicit declaration of function ‘\_PyLong\_FromByteArray’, ‘\_PyLong\_AsByteArray’: `python-wsaccel`, `python-drgn`

2 fail with: implicit declaration of function ‘\_PyLong\_New’: `python-crypto`, `python-gmpy2`

2 fail with: implicit declaration of function ‘\_PyObject\_GetAttrId’: `python-drgn`, `python3-typed_ast`

1 fails with: implicit declaration of functions ‘\_PyDict\_GetItem\_KnownHash’, ‘\_PyVectorcall\_Function’: `python-wsaccel`

2 fail with: implicit declaration of function ‘\_PyDict\_NewPresized’: `python-wsaccel`, `mercurial`

1 fails with: implicit declaration of function ‘\_PyList\_Extend’: `python-pyrsistent`

1 fails with: implicit declaration of function ‘\_PyUnicodeWriter\_WriteChar’: `python-recordclass`

1 fails with: implicit declaration of function ‘\_PyThread\_CurrentFrames’: `mod_wsgi`

1 fails with: implicit declaration of function ‘\_PyLong\_Sign’, ‘\_Py\_HashPointer’, ‘\_PyErr\_WriteUnraisable’: `python-cffi`

## Removals of deprecated C APIs

21 fail with: implicit declaration of function ‘PyEval\_InitThreads’: `grpc`,  
`gnumeric`, `gnofract4d`, `collectd`, `python-cradox`, `libsigrokdecode`, `lldb`, `profanity`, `python-subvertpy`, `pyotherside`, `sigil`, `python-simpleaudio`, `OpenIPMI`, `libesedb`, `libcec`, `python-gphoto2`, `python-bsddb3`, `python-confluent-kafka`, `python-alsaaudio`, `freeradius`, `pyliblo`

17 fail with: missing \<unistd.h\> declaration: `onboard`, `dbus-python`, `opae`, `borgbackup`, `python-schedutils`, `mercurial`, `python-maxminddb`, `rdiff-backup`, `python-zstandard`, `python-pywayland`, `python-kerberos`, `pyicu`, `python-apt`, `py-spidev`, `python-netifaces`, `i2c-tools`, `python-yara`

13 fail with: implicit declaration of function ‘PyEval\_CallObject’; did you mean ‘PyObject\_CallObject’?: `dionaea`, `audit`, `gdcm`, `jsonnet`, `med`, `newt`, `pcapy`, `python-pivy`, `recoll`, `python-cups`, `m2crypto`, `libsolv`, `libcec`

8 fail with: implicit declaration of function ‘PySys\_SetArgv’: `python-caja`, `nemo-extensions`, `gnumeric`, `nautilus-python`, `collectd`, `remmina`, `kernel-tools`, `pyotherside`

8 fail with: missing \<ctype.h\> declaration: `pyodbc`, `python-cx-oracle`, `proxmark3`, `python-gammu`, `python-igraph`, `sudo`, `python-cffi`, `python-bitstruct`

4 fail with: implicit declaration of function `Py_SetProgramName`: `glade`, `dionaea`, `fontforge`, `perl-Inline-Python`

2 fail with: implicit declaration of function PySys\_SetArgvEx: `glade`, `pyotherside`

2 fail with: implicit declaration of function ‘Py\_TRASHCAN\_SAFE\_BEGIN’, ‘Py\_TRASHCAN\_SAFE\_END’: `python-multidict`, `python-pyrsistent`

2 fail with: ‘PyEval\_CallObject’ was not declared in this scope; did you mean ‘PyObject\_CallObject’?: `vrpn`, `libprelude`

1 fails with: implicit declaration of function ‘PyObject\_AsWriteBuffer’, ‘PyObject\_AsCharBuffer’: `cryptlib`

1 fails with: implicit declaration of function ‘PyUnicode\_AS\_DATA’: `python-alsaaudio`

1 fails with: implicit declaration of function ‘PyEval\_AcquireLock’, ‘PyEval\_ReleaseLock’: `freeradius`

1 fails with: implicit declaration of function ‘PyUnicode\_GetSize’, ‘PyUnicode\_AS\_UNICODE’: `python-scss`

1 fails with: #error “this header requires Py\_BUILD\_CORE define”: `python-greenlet`

1 fails with: ‘PyCFunction\_Call’ was not declared in this scope: `PyQt4`

1 fails with: implicit declaration of function ‘PyObject\_AsReadBuffer’: `python-intbitset`

1 fails with: ‘PySys\_SetPath’ was not declared in this scope: `insight`

## Optimization changes impact

4 fail with docstring indentation not matching the expected: `python-parameterized`, `python-oauthlib`, `python-zope-interface`, `python-toolz`

## Removal of Python modules and functions

24 fail with 2to3 removal: `swig`, `uwsgi`, `wavextract`, `workrave`, `tuxpaint-stamps`, `python-yaql`, `libsbml`, `mftrace`, `b43-tools`, `TeXmacs`, `fail2ban`, `flow-tools`, `gnu-free-fonts`, `octave-miscellaneous`, `python-MultipartPostHandler2`, `python-amico`, `python-demjson`, `python-mglob`, `python-minimock`, `python-nose`, `python-openoffice`, `python-openopt`, `python-straight-plugin`, `python-x2go`

10 fail with unittest-related removals: `python-lxml`, `python-ptyprocess`, `python-random2`, `python-transaction`, `python-genshi`, `python-zope-i18nmessageid`, `pyserial`, `python-jsonpointer`, `python-iniparse`, `python-defusedxml`

5 fail with: AttributeError: module ‘importlib.resources’ has no attribute ‘read\_text’, ‘path’, ‘open\_binary’ or ‘read\_binary’: `pre-commit`, `numpy`, `python-netaddr`, `meson`, `python-installer`

5 fail with: ‘Logger’ object has no attribute ‘warn’: `python-grabbit`, `python-etcd`, `python-idstools`, `pyzor`, `mom`

2 fail with: ImportError: cannot import name ‘resetlocale’ from ‘locale’: `python-fdb`, `pykickstart`

1 fails with: ImportError: cannot import name ‘re’ from ‘typing’: `python-ndjson-testrunner`

1 fails with implicit declaration of function ‘getpid’ / ‘gettimeofday’: `qpid-dispatch`

---

<div class="post-metadata">

**Author:** ![guido](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/guido/32/21_2.png) [@guido](https://discuss.python.org/u/guido)\
**Post date:** [November 7, 2023, 6:58pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/2 "2023-11-07T18:58:24Z")

</div>

@vstinner ^^

(IIRC the SC recommended somewhere to just restore any removed “private” API that is still being used.)

---

<div class="post-metadata">

**Author:** ![pitrou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pitrou/32/28_2.png) [@pitrou](https://discuss.python.org/u/pitrou)\
**Post date:** [November 7, 2023, 8:55pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/3 "2023-11-07T20:55:19Z")

</div>

> [@ksurma](#):
>
> 17 fail with: missing \<unistd.h\> declaration: `onboard`, `dbus-python`, `opae`, `borgbackup`, `python-schedutils`, `mercurial`, `python-maxminddb`, `rdiff-backup`, `python-zstandard`, `python-pywayland`, `python-kerberos`, `pyicu`, `python-apt`, `py-spidev`, `python-netifaces`, `i2c-tools`, `python-yara`
> 
> 8 fail with: missing \<ctype.h\> declaration: `pyodbc`, `python-cx-oracle`, `proxmark3`, `python-gammu`, `python-igraph`, `sudo`, `python-cffi`, `python-bitstruct`

Those two look like bugs in the CPython include headers?

---

<div class="post-metadata">

**Author:** ![pf\_moore](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pf_moore/32/35_2.png) [@pf\_moore](https://discuss.python.org/u/pf_moore)\
**Post date:** [November 7, 2023, 8:59pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/4 "2023-11-07T20:59:10Z")

</div>

… or packages incorrectly assuming that the Python headers always included certain standard headers.

---

<div class="post-metadata">

**Author:** ![ksurma](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/ksurma/32/30818_2.png) [@ksurma](https://discuss.python.org/u/ksurma)\
**Post date:** [November 8, 2023, 10:20am UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/5 "2023-11-08T10:20:35Z")

</div>

This is in fact a feature documented in [What’s new in Python 3.13](https://docs.python.org/dev/whatsnew/3.13.html#id8):

> `Python.h` no longer includes the `<unistd.h>` standard header file. If needed, it should now be included explicitly. For example, it provides the functions: `read()`, `write()`, `close()`, `isatty()`, `lseek()`, `getpid()`, `getcwd()`, `sysconf()`, `getpagesize()`, `alarm()` and `pause()`. As a consequence, `_POSIX_SEMAPHORES` and `_POSIX_THREADS` macros are no longer defined by `Python.h`. The `HAVE_UNISTD_H` and `HAVE_PTHREAD_H` macros defined by `Python.h` can be used to decide if `<unistd.h>` and `<pthread.h>` header files can be included. (Contributed by Victor Stinner in [gh-108765](https://github.com/python/cpython/issues/108765).)

> `Python.h` no longer includes the `<ctype.h>` standard header file. If needed, it should now be included explicitly. For example, it provides `isalpha()` and `tolower()` functions which are locale dependent. Python provides locale independent functions, like `Py_ISALPHA()` and `Py_TOLOWER()`. (Contributed by Victor Stinner in [gh-108765](https://github.com/python/cpython/issues/108765).)

---

<div class="post-metadata">

**Author:** ![vstinner](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/vstinner/32/15130_2.png) [@vstinner](https://discuss.python.org/u/vstinner)\
**Post date:** [November 13, 2023, 5:08pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/6 "2023-11-13T17:08:16Z")

</div>

I created [gh-112026: Add again \<unistd.h\> include in Python.h by vstinner · Pull Request #112046 · python/cpython · GitHub](https://github.com/python/cpython/pull/112046) to add again \<ctype.h\> and \<unistd.h\> to Python.h since their removal impacted many projects (8 and 17 projects).

---

<div class="post-metadata">

**Author:** ![steve.dower](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/steve.dower/32/56_2.png) [@steve.dower](https://discuss.python.org/u/steve.dower)\
**Post date:** [November 13, 2023, 8:12pm UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/7 "2023-11-13T20:12:25Z")

</div>

Is it possible for distros to use the `-include` option to force these into packages that are not updated?

I’d rather not make the Python headers be responsible for including other system headers, and there isn’t really any way to warn people that they’re relying on it. Eventually they’ll be removed in another alpha 1 to provide the maximum time to catch up.

---

<div class="post-metadata">

**Author:** ![pitrou](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/pitrou/32/28_2.png) [@pitrou](https://discuss.python.org/u/pitrou)\
**Post date:** [November 14, 2023, 8:23am UTC](https://discuss.python.org/t/ongoing-packages-rebuild-with-python-3-13-in-fedora/38134/8 "2023-11-14T08:23:35Z")

</div>

> [@steve.dower](#):
>
> I’d rather not make the Python headers be responsible for including other system headers

Agreed. The Python headers should only include those system headers that are necessary for the headers to work properly. Including `Python.h` is not an excuse for not including the system headers that you use in your own code.
