Bug 1912903 - boost fails to build with Python 3.10: error: '_Py_fopen' was not declared in this scope; did you mean '_Py_wfopen'?
Summary: boost fails to build with Python 3.10: error: '_Py_fopen' was not declared i...
Alias: None
Product: Fedora
Classification: Fedora
Component: boost
Version: rawhide
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
Assignee: Jonathan Wakely
QA Contact: Fedora Extras Quality Assurance
: 1912917 (view as bug list)
Depends On:
Blocks: PYTHON3.10 1912917
TreeView+ depends on / blocked
Reported: 2021-01-05 14:58 UTC by Tomáš Hrnčiar
Modified: 2021-02-09 15:27 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2021-02-08 16:11:36 UTC
Type: Bug

Attachments (Terms of Use)

Description Tomáš Hrnčiar 2021-01-05 14:58:47 UTC
boost fails to build with Python 3.10.0a4.

libs/python/src/exec.cpp:109:14: error: '_Py_fopen' was not declared in this scope; did you mean '_Py_wfopen'?
  109 |   FILE *fs = _Py_fopen(f, "r");
      |              ^~~~~~~~~
      |              _Py_wfopen

bpo-32381: Remove the private _Py_fopen() function which is no longer needed. Use _Py_wfopen() or _Py_fopen_obj() instead.


For the build logs, see:

For all our attempts to build boost with Python 3.10, see:

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.10:

Let us know here if you have any questions.

Python 3.10 will be included in Fedora 35. To make that update smoother, we're building Fedora packages with early pre-releases of Python 3.10.
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 Kevin Kofler 2021-01-05 16:25:04 UTC
*** Bug 1912917 has been marked as a duplicate of this bug. ***

Comment 2 Victor Stinner 2021-01-06 08:40:42 UTC
Third party projects should not rely on the private C API: functions starting with "_Py". Boost can use fopen() instead.

If Boost needs a C API for https://www.python.org/dev/peps/pep-0446/ it should be requested and it would be a new Python feature.

For curious people, see https://bugs.python.org/issue32381 for the rationale of _Py_fopen() removal. In short, using bytes strings for filenames is causing encoding issues. Python now uses wide character strings instead internally: _Py_wfopen().

Comment 3 Victor Stinner 2021-01-06 09:12:39 UTC
I proposed https://github.com/boostorg/python/pull/344 to fix boost-python.

Comment 6 Victor Stinner 2021-02-09 15:27:12 UTC
Oh, it's good to see it fixed ;-)

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