Bug 2584220

Summary: uwsgi fails to build with Python 3.16: Deprecated CAPI removals: Py_NoSiteFlag, Py_SetPythonHome, Py_SetProgramName, Py_OptimizeFlag, PySys_SetArgv
Product: [Fedora] Fedora Reporter: Karolina Surma <ksurma>
Component: uwsgiAssignee: Ralf Ertzinger <redhat-bugzilla>
Status: NEW --- QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: ksurma, mhroncok, python-packagers-sig, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2567340    

Description Karolina Surma 2026-11-25 15:37:42 UTC
uwsgi fails to build with Python 3.16.0a2.

+ /usr/bin/python3 uwsgiconfig.py --verbose --plugin plugins/python fedora python3
plugins/python/python_plugin.c:138:83: error: ‘Py_NoSiteFlag’ undeclared here (not in a function)
  138 |         {"no-site", no_argument, 0, "do not import site module", uwsgi_opt_true, &Py_NoSiteFlag, 0},
      |                                                                                   ^~~~~~~~~~~~~
plugins/python/python_plugin.c: In function ‘uwsgi_python_init’:
plugins/python/python_plugin.c:202:27: warning: initialization discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
  202 |         char *pyversion = strchr(Py_GetVersion(), '\n');
      |                           ^~~~~~
plugins/python/python_plugin.c:239:17: error: implicit declaration of function ‘Py_SetPythonHome’ [-Wimplicit-function-declaration]
  239 |                 Py_SetPythonHome(wpyhome);
      |                 ^~~~~~~~~~~~~~~~
plugins/python/python_plugin.c:263:9: error: implicit declaration of function ‘Py_SetProgramName’ [-Wimplicit-function-declaration]
  263 |         Py_SetProgramName(pname);
      |         ^~~~~~~~~~~~~~~~~
plugins/python/python_plugin.c:269:9: error: ‘Py_OptimizeFlag’ undeclared (first use in this function)
  269 |         Py_OptimizeFlag = up.optimize;
      |         ^~~~~~~~~~~~~~~
plugins/python/python_plugin.c:269:9: note: each undeclared identifier is reported only once for each function it appears in
plugins/python/pyutils.c: In function ‘init_pyargv’:
plugins/python/pyutils.c:391:9: error: implicit declaration of function ‘PySys_SetArgv’; did you mean ‘PySys_GetAttr’? [-Wimplicit-function-declaration]
  391 |         PySys_SetArgv(up.argc, up.py_argv);
      |         ^~~~~~~~~~~~~
      |         PySys_GetAttr


https://docs.python.org/3.16/whatsnew/3.16.html:
Remove 21 global configuration variables, deprecated in Python 3.12. To initialize Python, the PyInitConfig C API can be used instead. To read these variables at runtime, PyConfig_Get() can be used instead. Removed variables with their PyInitConfig C API and PyConfig_Get() replacement:

    Py_DebugFlag: Use "parser_debug" instead.

    Py_VerboseFlag: Use "verbose" instead.

    Py_QuietFlag: Use "quiet" instead.

    Py_InteractiveFlag: Use "interactive" instead.

    Py_InspectFlag: Use "inspect" instead.

    Py_OptimizeFlag: Use "optimization_level" instead.

    Py_NoSiteFlag: Use "site_import" instead (opposite value).

    Py_BytesWarningFlag: Use "bytes_warning" instead.

    Py_FrozenFlag: Use "pathconfig_warnings" instead (opposite value).

    Py_IgnoreEnvironmentFlag: Use "use_environment" instead (opposite value).

    Py_DontWriteBytecodeFlag: Use "write_bytecode" instead (opposite value).

    Py_NoUserSiteDirectory: Use "user_site_directory" instead (opposite value).

    Py_UnbufferedStdioFlag: Use "buffered_stdio" instead (opposite value).

    Py_HashRandomizationFlag: Use "hash_seed" instead.

    Py_IsolatedFlag: Use "isolated" instead.

    Py_LegacyWindowsFSEncodingFlag: Use "legacy_windows_fs_encoding" instead.

    Py_LegacyWindowsStdioFlag: Use "legacy_windows_stdio" instead.

    Py_FileSystemDefaultEncoding, Py_HasFileSystemDefaultEncoding: Use "filesystem_encoding" instead.

    Py_FileSystemDefaultEncodeErrors: Use "filesystem_errors" instead.

    Py_UTF8Mode: Use "utf8_mode" instead.

(Contributed by Victor Stinner in gh-158001.)

Remove Py_SetProgramName() and Py_SetPythonHome() functions, deprecated since Python 3.11. Instead, use PyInitConfig C API to set respectively "program_name" and "home". (Contributed by Victor Stinner in gh-158001.)

Remove PySys_SetArgv() and PySys_SetArgvEx() functions, deprecated since Python 3.11. Instead, set directly sys.argv, and maybe also sys.path. (Contributed by Victor Stinner in gh-158001.)

For the build logs, see:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.16/fedora-rawhide-x86_64/11359741-uwsgi/

For all our attempts to build uwsgi with Python 3.16, see:
https://copr.fedorainfracloud.org/coprs/g/python/python3.16/package/uwsgi/

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

Let us know here if you have any questions.

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