Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-133644: remove deprecated global configuration variables#133654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
picnixz wants to merge29 commits intopython:main
base:main
Choose a base branch
Loading
frompicnixz:cleanup/315/deprecated-globals-133644

Conversation

picnixz
Copy link
Member

@picnixzpicnixz commentedMay 8, 2025
edited
Loading

Ok, this one is really tricky and I really need more eyes to be sure about it, namely@vstinner's eyes.

There are two global configuration variables that were marked as deprecated but not explicitly slated for removal in the docs, namelyPy_UTF8Mode andPy_InteractiveFlag. As such, I've left them untouched. They were however mentioned in the "pending removals" documents so I don't know if we can just remove them (note that users are more likely to land on the C API page rather than the what's new page when they are looking for docs).

I'll write a NEWS entry afterwards.


📚 Documentation preview 📚:https://cpython-previews--133654.org.readthedocs.build/

picnixz added19 commitsMay 8, 2025 09:33
@picnixz
Copy link
MemberAuthor

I may have held the GIL for too long on Windows builds or something like that. Will investigate.

Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This PR is wrong. You cannot simply remove symbols from the stable ABI. Instead, you should only move variables declaration from the public C API to the internal C API. Also, you should keep tests on these variables whenever possible.

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 8, 2025
edited
Loading

You cannot simply remove symbols from the stable ABI

Yeah, I actually wondered whether they were stable or not but apparently they are :') I only thought about this when I wrote the other PRs...

However, this makes my life much easier then!

@vstinner
Copy link
Member

vstinner commentedMay 8, 2025
edited
Loading

UPDATE: I added matching lines and I ignored Pillow which is up to date.

A code search on PyPI top 8,000 projects finds matchs in20 projects:

  • Nuitka (2.6)
  • SimpleParse (2.2.4)
  • catboost (1.2.7)
  • cffi (1.17.1)
  • cx_freeze (7.2.8)
  • cython (3.0.11)
  • hunspell (0.5.5)
  • lmdb (1.6.2)
  • mpi4py (4.0.1)
  • nanobind (2.4.0)
  • numpy (2.2.2)
  • orjson (3.10.15)
  • pygame (2.6.1)
  • pygit2 (1.17.0)
  • pythonnet (3.0.5)
  • pyuwsgi-2.0.28.post1
  • rook (0.1.209)
  • scandir (1.10.0)
  • subprocess32 (3.5.4)
  • uwsgi (2.0.28)
catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/deprecated/python/scandir/_scandir.c: // Because on PyPy, Py_FileSystemDefaultEncoding is (was) defined to be NULLcatboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/deprecated/python/scandir/_scandir.c: #define FS_ENCODING (Py_FileSystemDefaultEncoding ? Py_FileSystemDefaultEncoding : "UTF-8")catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/deprecated/python/subprocess32/_posixsubprocess_helpers.c: if (Py_FileSystemDefaultEncoding)catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/deprecated/python/subprocess32/_posixsubprocess_helpers.c: Py_FileSystemDefaultEncoding,catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/deprecated/python/win-unicode-console/win_unicode_console/runner.py: inspect_flag = cast(pythonapi.Py_InspectFlag, POINTER(c_long)).contentscatboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py2/numpy/core/src/multiarray/compiled_base.c: if (Py_OptimizeFlag > 1) {catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py3/numpy/core/src/multiarray/compiled_base.c: if (Py_OptimizeFlag > 1) {catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py3/numpy/core/tests/test_numerictypes.py: reason="no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1")catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py3/numpy/ma/tests/test_core.py: reason="no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1")catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py3/numpy/random/tests/test_direct.py: # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/python/numpy/py3/numpy/random/tests/test_extending.py: # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/tools/cython/Cython/Utility/Exceptions.c: #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/tools/cython/Cython/Utility/Exceptions.c: #define __pyx_assertions_enabled() (!Py_OptimizeFlag)catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/tools/cython/Cython/Utility/Exceptions.c: // Py_OptimizeFlag is deprecated in Py3.12+catboost-1.2.7.tar.gz: catboost-1.2.7/catboost_all_src/contrib/tools/cython/Cython/Utility/Exceptions.c: #define __pyx_assertions_enabled() (!Py_OptimizeFlag)cffi-1.17.1.tar.gz: cffi-1.17.1/src/c/_cffi_backend.c: Py_FileSystemDefaultEncoding, &filename_or_null, &flags))cx_freeze-7.2.8.tar.gz: cx_freeze-7.2.8/source/bases/common.c: Py_NoSiteFlag = 1;cx_freeze-7.2.8.tar.gz: cx_freeze-7.2.8/source/bases/common.c: Py_FrozenFlag = 1;cx_freeze-7.2.8.tar.gz: cx_freeze-7.2.8/source/bases/common.c: Py_IgnoreEnvironmentFlag = 1;cython-3.0.11.tar.gz: cython-3.0.11/Cython/Utility/Exceptions.c: #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)cython-3.0.11.tar.gz: cython-3.0.11/Cython/Utility/Exceptions.c: // Py_OptimizeFlag is deprecated in Py3.12+ and not available in the Limited API.cython-3.0.11.tar.gz: cython-3.0.11/Cython/Utility/Exceptions.c: #define __pyx_assertions_enabled()  (!Py_OptimizeFlag)hunspell-0.5.5.tar.gz: hunspell-0.5.5/hunspell.cpp: /* TODO: Please review if there is any shorter/nicer;less clumsy way to convert args to  PyStrings using Py_FileSystemDefaultEncoding in python 2.x */hunspell-0.5.5.tar.gz: hunspell-0.5.5/hunspell.cpp: if (!PyArg_ParseTuple(args, "etet", Py_FileSystemDefaultEncoding, &dpath_ptr, Py_FileSystemDefaultEncoding, &apath_ptr))hunspell-0.5.5.tar.gz: hunspell-0.5.5/hunspell.cpp: if (!PyArg_ParseTuple(args, "et", Py_FileSystemDefaultEncoding, &dpath_ptr))lmdb-1.6.2.tar.gz: lmdb-1.6.2/lmdb/cpython.c: return PyUnicode_AsEncodedString(src, Py_FileSystemDefaultEncoding,mpi4py-4.0.1.tar.gz: mpi4py-4.0.1/src/mpi4py/MPI.src/atimport.pxi: #  define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s))nanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-cpython.sym: -U _Py_FileSystemDefaultEncodeErrorsnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-cpython.sym: -U _Py_FileSystemDefaultEncodingnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-cpython.sym: -U _Py_HasFileSystemDefaultEncodingnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-cpython.sym: -U _Py_UTF8Modenanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_BytesWarningFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_DebugFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_DontWriteBytecodeFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_FrozenFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_HashRandomizationFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_IgnoreEnvironmentFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_InspectFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_InteractiveFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_IsolatedFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_NoSiteFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_NoUserSiteDirectorynanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_OptimizeFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_QuietFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_UnbufferedStdioFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _PyPy_VerboseFlagnanobind-2.4.0.tar.gz: nanobind-2.4.0/cmake/darwin-ld-pypy.sym: -U _Py_FileSystemDefaultEncodingNuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/InspectPatcher.c: if (Py_NoSiteFlag == 0) {Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_DebugFlag = 0;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_InspectFlag = 0;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_InteractiveFlag = 0;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_OptimizeFlag = SYSFLAG_OPTIMIZE;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_DontWriteBytecodeFlag = SYSFLAG_DONTWRITEBYTECODE;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_NoUserSiteDirectory = SYSFLAG_NO_SITE;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_IgnoreEnvironmentFlag = 0;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_VerboseFlag = SYSFLAG_VERBOSE;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_BytesWarningFlag = SYSFLAG_BYTES_WARNING;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_UnbufferedStdioFlag = SYSFLAG_UNBUFFERED;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_HashRandomizationFlag = 0;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_UTF8Mode = SYSFLAG_UTF8;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: if (Py_UTF8Mode) {Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: if (Py_FileSystemDefaultEncoding == NULL) {Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_FileSystemDefaultEncoding = "utf-8";Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_HasFileSystemDefaultEncoding = 1;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_FrozenFlag = 1;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_NoSiteFlag = 1;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MainProgram.c: Py_NoSiteFlag = SYSFLAG_NO_SITE;Nuitka-2.6.tar.gz: Nuitka-2.6/nuitka/build/static_src/MetaPathBasedLoader.c: static inline bool isVerbose(void) { return Py_VerboseFlag != 0; }numpy-2.2.2.tar.gz: numpy-2.2.2/numpy/_core/src/multiarray/compiled_base.c: if (Py_OptimizeFlag > 1) {numpy-2.2.2.tar.gz: numpy-2.2.2/numpy/_core/tests/test_numerictypes.py: reason="no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1")numpy-2.2.2.tar.gz: numpy-2.2.2/numpy/ma/tests/test_core.py: reason="no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1")numpy-2.2.2.tar.gz: numpy-2.2.2/numpy/random/tests/test_direct.py: # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1numpy-2.2.2.tar.gz: numpy-2.2.2/numpy/random/tests/test_extending.py: # no docstrings present to inspect when PYTHONOPTIMIZE/Py_OptimizeFlag > 1orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_DebugFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_DebugFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_VerboseFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_VerboseFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_QuietFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_InteractiveFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_InteractiveFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_InspectFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_InspectFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_OptimizeFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_OptimizeFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_NoSiteFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_NoSiteFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_BytesWarningFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_BytesWarningFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_FrozenFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_FrozenFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_IgnoreEnvironmentFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_IgnoreEnvironmentFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_DontWriteBytecodeFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_DontWriteBytecodeFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_NoUserSiteDirectory")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_NoUserSiteDirectory: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_UnbufferedStdioFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: #[cfg_attr(PyPy, link_name = "PyPy_HashRandomizationFlag")]orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_HashRandomizationFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_IsolatedFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_LegacyWindowsFSEncodingFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: pub static mut Py_LegacyWindowsStdioFlag: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/cpython/pydebug.rs: if Py_IgnoreEnvironmentFlag != 0 {orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/fileobject.rs: pub static mut Py_FileSystemDefaultEncoding: *const c_char;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/fileobject.rs: pub static mut Py_FileSystemDefaultEncodeErrors: *const c_char;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/fileobject.rs: pub static mut Py_HasFileSystemDefaultEncoding: c_int;orjson-3.10.15.tar.gz: orjson-3.10.15/include/pyo3/pyo3-ffi/src/fileobject.rs: // skipped 3.12-deprecated Py_UTF8Modepygame-2.6.1.tar.gz: pygame-2.6.1/setup.py: # because Py_FileSystemDefaultEncoding is deprecated in 3.12.0a7pygame-2.6.1.tar.gz: pygame-2.6.1/src_c/rwobject.c: PyObject *result = pg_EncodeString(obj, Py_FileSystemDefaultEncoding,pygit2-1.17.0.tar.gz: pygit2-1.17.0/src/utils.h: #define Py_FileSystemDefaultEncodeErrors "surrogateescape"pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/PythonEngine.cs: /// https://docs.python.org/3/c-api/init.html#c.Py_NoSiteFlagpythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: Py_NoSiteFlag = (int*)GetFunctionByName(nameof(Py_NoSiteFlag), GetUnmanagedDll(_PythonDll));pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.Delegates.cs: internal static int* Py_NoSiteFlag { get; }pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.cs: *Delegates.Py_NoSiteFlag = 1;pythonnet-3.0.5.tar.gz: pythonnet-3.0.5/src/runtime/Runtime.cs: return *Delegates.Py_NoSiteFlag;pyuwsgi-2.0.28.post1.tar.gz: pyuwsgi-2.0.28.post1/plugins/python/python_plugin.c: {"no-site", no_argument, 0, "do not import site module", uwsgi_opt_true, &Py_NoSiteFlag, 0},pyuwsgi-2.0.28.post1.tar.gz: pyuwsgi-2.0.28.post1/plugins/python/python_plugin.c: Py_OptimizeFlag = up.optimize;rook-0.1.209.tar.gz: rook-0.1.209/rook/native_extensions/cpython_importhook.cc: if ((exception == NULL) || Py_VerboseFlag) {scandir-1.10.0.tar.gz: scandir-1.10.0/_scandir.c: // Because on PyPy, Py_FileSystemDefaultEncoding is (was) defined to be NULLscandir-1.10.0.tar.gz: scandir-1.10.0/_scandir.c: #define FS_ENCODING (Py_FileSystemDefaultEncoding ? Py_FileSystemDefaultEncoding : "UTF-8")SimpleParse-2.2.4.tar.gz: SimpleParse-2.2.4/simpleparse/stt/TextTools/mxTextTools/mx.h: if (!Py_DebugFlag)SimpleParse-2.2.4.tar.gz: SimpleParse-2.2.4/simpleparse/stt/TextTools/mxTextTools/mx.h: if (!Py_DebugFlag)SimpleParse-2.2.4.tar.gz: SimpleParse-2.2.4/simpleparse/stt/TextTools/mxTextTools/mxstdlib.h: #  define DPRINTF if (Py_DebugFlag) mxDebugPrintfSimpleParse-2.2.4.tar.gz: SimpleParse-2.2.4/simpleparse/stt/TextTools/mxTextTools/mxstdlib.h: #  define IF_DEBUGGING if (Py_DebugFlag)SimpleParse-2.2.4.tar.gz: SimpleParse-2.2.4/simpleparse/stt/TextTools/mxTextTools/mxstdlib.h: #  define DEBUGGING (Py_DebugFlag > 0)subprocess32-3.5.4.tar.gz: subprocess32-3.5.4/_posixsubprocess_helpers.c: if (Py_FileSystemDefaultEncoding)subprocess32-3.5.4.tar.gz: subprocess32-3.5.4/_posixsubprocess_helpers.c: Py_FileSystemDefaultEncoding,uwsgi-2.0.28.tar.gz: uwsgi-2.0.28/plugins/python/python_plugin.c: {"no-site", no_argument, 0, "do not import site module", uwsgi_opt_true, &Py_NoSiteFlag, 0},uwsgi-2.0.28.tar.gz: uwsgi-2.0.28/plugins/python/python_plugin.c: Py_OptimizeFlag = up.optimize;

It would feel safer to merge such change once the number of affected projects would be 10 or less.

Porting code toPyConfig_Get() is not trivial, since this function was only added to Python 3.14 and it has a different API (more complex than reading a variable). The pythoncapi-compat project can be used to get this function on Python 3.13 and older.

Cython has such complex code just to replace the deprecatedPy_OptimizeFlag function:

#ifCYTHON_COMPILING_IN_LIMITED_API||  (CYTHON_COMPILING_IN_CPYTHON&&PY_VERSION_HEX >=0x030C0000)// Py_OptimizeFlag is deprecated in Py3.12+ and not available in the Limited API.staticint__pyx_assertions_enabled_flag;#define__pyx_assertions_enabled() (__pyx_assertions_enabled_flag)staticint__Pyx_init_assertions_enabled(void) {PyObject*builtins,*debug,*debug_str;intflag;builtins=PyEval_GetBuiltins();if (!builtins) gotobad;// Not using PYIDENT() here because we probably don't need the string more than this once.debug_str=PyUnicode_FromStringAndSize("__debug__",9);if (!debug_str) gotobad;debug=PyObject_GetItem(builtins,debug_str);Py_DECREF(debug_str);if (!debug) gotobad;flag=PyObject_IsTrue(debug);Py_DECREF(debug);if (flag==-1) gotobad;__pyx_assertions_enabled_flag=flag;return0;bad:__pyx_assertions_enabled_flag=1;// We (rarely) may not have an exception set, but the calling code will call PyErr_Occurred() either way.return-1;  }#else#define__Pyx_init_assertions_enabled()  (0)#define__pyx_assertions_enabled()  (!Py_OptimizeFlag)#endif

@picnixz
Copy link
MemberAuthor

It would feel safer to merge such change once the number of affected projects would be 10 or less.

Let's do it that way. For now, I'll only keep the docs changes and revert the runtime changes (I'll anyway need to do that eventually).

@picnixzpicnixz marked this pull request as draftMay 8, 2025 12:56
@hugovk
Copy link
Member

hugovk commentedMay 8, 2025
edited
Loading

I'll only keep the docs changes

How will people know these are deprecated, if it's not documented?

We have 12 months until 3.15's feature freeze (and and 17 until 3.15's release), things may have changed in that time. We can also open issues/PRs with the above projects.

  • pillow (11.1.0)

Which deprecated variables is Pillow using? I don't recall any deprecation warnings.

zooba reacted with thumbs up emoji

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 8, 2025
edited
Loading

How will people know these are deprecated, if it's not documented?

The symbols are marked with__attribute__((deprecated)), so the compiler would have warned them (I guess?) Do you mean that we should keep the documentation entries? I thought we removed them in general

@hugovk
Copy link
Member

The symbols are marked with__attribute__((deprecated)), so the compiler would have warned them (I guess?)

Hmm, nothing athttps://github.com/python-pillow/Pillow/actions/runs/14906674072/job/41870605210?pr=8948

Do you mean that we should keep the documentation entries?

Yes.

This PR isn't removing any deprecations, it's only removing documentation about them.

If we only remove the docs, we might end up keeping the deprecations in 3.15, making their status unclear.

Let's remove the deprecations and their docs at the same time.

@picnixz
Copy link
MemberAuthor

If we only remove the docs, we might end up keeping the deprecations in 3.15, making their status unclear.

Ah, I see what you mean. Ok let's remove them in one go. Or if someone else has a cleaner PR for the runtime changes, they can just merge this one into theirs and they don't need to update the docs themselves.

hugovk reacted with thumbs up emoji

@vstinner
Copy link
Member

Which deprecated variables is Pillow using? I don't recall any deprecation warnings.

Pillow usesPy_FileSystemDefaultEncoding:source.

if (!PyArg_ParseTupleAndKeywords(args,kw,"etf|nsy#n",kwlist,Py_FileSystemDefaultEncoding,  # <====HERE====&filename,&size,&index,&encoding,&font_bytes,&font_bytes_size,&layout_engine        )) {returnNULL;    }

Oh, but this code path is only taken on Python 3.10 and older! So you can ignore Pillow which is up to date!

hugovk reacted with hooray emoji

@hugovk
Copy link
Member

Hooray! Although I don't see any deprecations in the3.9 build logs, should there be?

@vstinner
Copy link
Member

Hooray! Although I don't see any deprecations in the3.9 build logs, should there be?

No, the deprecation was added later.

hugovk reacted with thumbs up emoji

@hugovk
Copy link
Member

OK, thanks.


Unrelated to this issue, I wanted to see what the deprecation looks like. Just for testing, I edited the Pillow code so it only has a code path hitting the deprecation. A normalpip install -e . on Python 3.14.0b1 doesn't show any warnings, but it does with--verbose:

  src/_imagingft.c:145:13: warning: 'Py_FileSystemDefaultEncoding' is deprecated [-Wdeprecated-declarations]    145 |             Py_FileSystemDefaultEncoding,        |             ^  /Library/Frameworks/Python.framework/Versions/3.14/include/python3.14/fileobject.h:22:1: note: 'Py_FileSystemDefaultEncoding' has been explicitly marked deprecated here     22 | Py_DEPRECATED(3.12) PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding;        | ^  /Library/Frameworks/Python.framework/Versions/3.14/include/python3.14/pyport.h:280:54: note: expanded from macro 'Py_DEPRECATED'    280 | #define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__))        |                                                      ^

Neitheruv pip install -e . nor with--verbose showed the deprecation.

It's unfortunate that neither show the warning in normal use, as their maintainers will be less likely to see them. Perhaps something to raise with pip and uv.

@picnixz
Copy link
MemberAuthor

It's unfortunate that neither show the warning in normal use, as their maintainers will be less likely to see them. Perhaps something to raise with pip and uv.

I think it'd be a good idea yes. Should we raise it for both? or is uv bundling part of pip and it suffices to just change pip?

@picnixz
Copy link
MemberAuthor

@vstinner@hugovk Actually, there were two variables that were slated for removal and notified in 3.12 What's New I think but they never had adeprecated-removed directive and only the deprecation version is rendered. Those arePy_UTF8Mode andPy_InteractiveFlag.

Should we push the removal version to 3.16 or just delay the removal of all variables?

@vstinner
Copy link
Member

Actually, there were two variables that were slated for removal and notified in 3.12 What's New I think but they never had a deprecated-removed directive and only the deprecation version is rendered. Those are Py_UTF8Mode and Py_InteractiveFlag.

Both variables emit deprecation warnings using Py_DEPRECATED():

Py_DEPRECATED(3.12)PyAPI_DATA(int)Py_UTF8Mode;Py_DEPRECATED(3.12)PyAPI_DATA(int)Py_InteractiveFlag;

I don't think that the doc is a big deal here, Py_DEPRECATED() is more important.

@vstinner
Copy link
Member

Also, all global configuration variables are documented in "Pending removal in Python 3.15":https://docs.python.org/dev/whatsnew/3.14.html#id13

@picnixz
Copy link
MemberAuthor

picnixz commentedMay 9, 2025
edited
Loading

Ok, I'll update the docs first for 3.13 and 3.14. I always hate doing backports, so would it be fine for me to first update main and let the bot make the backports automatically? that way, even 3.15 is consistent.

One way why I can think of why it's annoying to users is that they don't necessarily land on the What's New page if they make a Google search.

@hugovk
Copy link
Member

I think it'd be a good idea yes. Should we raise it for both?

Yes, raised in the PyPA/pip Discord and they asked to comment here:pypa/pyproject-hooks#157 (comment)

or is uv bundling part of pip and it suffices to just change pip?

uv is all Rust, no Python.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@vstinnervstinnervstinner left review comments

@zoobazoobazooba left review comments

@encukouencukouAwaiting requested review from encukou

@ericsnowcurrentlyericsnowcurrentlyAwaiting requested review from ericsnowcurrently

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@picnixz@vstinner@hugovk@zooba

[8]ページ先頭

©2009-2025 Movatter.jp