Bug 2584234 - pygame fails to build with Python 3.16: src_c/rwobject.c:245:45: error: ‘Py_FileSystemDefaultEncoding’ undeclared (first use in this function); did you mean ‘PyUnicode_GetDefaultEncoding’
Summary: pygame fails to build with Python 3.16: src_c/rwobject.c:245:45: error: ‘Py_F...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: pygame
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jaroslav Škarvada
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: PYTHON3.16
TreeView+ depends on / blocked
 
Reported: 2026-11-25 16:21 UTC by Karolina Surma
Modified: 2026-11-25 16:21 UTC (History)
4 users (show)

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


Attachments (Terms of Use)

Description Karolina Surma 2026-11-25 16:21:48 UTC
pygame fails to build with Python 3.16.0a2.

  src_c/rwobject.c: In function ‘pg_EncodeFilePath’:
  src_c/rwobject.c:245:45: error: ‘Py_FileSystemDefaultEncoding’ undeclared (first use in this function); did you mean ‘PyUnicode_GetDefaultEncoding’?
    245 |     PyObject *result = pg_EncodeString(obj, Py_FileSystemDefaultEncoding,
        |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
        |                                             PyUnicode_GetDefaultEncoding

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.)

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

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

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.


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