diff --git a/newsfragments/5333.removed.md b/newsfragments/5333.removed.md new file mode 100644 index 00000000000..421ae3cda8b --- /dev/null +++ b/newsfragments/5333.removed.md @@ -0,0 +1,3 @@ +removed `Py_DebugFlag`, `Py_VerboseFlag`, `Py_QuietFlag`, `Py_InteractiveFlag`, `Py_InspectFlag`, `Py_OptimizeFlag`, `Py_NoSiteFlag`, `Py_BytesWarningFlag`, `Py_UseClassExceptionsFlag`, `Py_FrozenFlag`, `Py_IgnoreEnvironmentFlag`, `Py_DontWriteBytecodeFlag`, `Py_NoUserSiteDirectory`, `Py_UnbufferedStdioFlag`, `Py_HashRandomizationFlag`, `Py_IsolatedFlag`, `Py_LegacyWindowsFSEncodingFlag`, `Py_LegacyWindowsStdioFlag`, `Py_FileSystemDefaultEncoding`, `Py_FileSystemDefaultEncodeErrors`, `Py_HasFileSystemDefaultEncoding` + +these have all been deprecated in CPython since 3.12, will be removed in 3.14, and we've deprecated them for more than 2 years. diff --git a/pyo3-ffi/src/cpython/pydebug.rs b/pyo3-ffi/src/cpython/pydebug.rs index 6878554aead..8cd662c7915 100644 --- a/pyo3-ffi/src/cpython/pydebug.rs +++ b/pyo3-ffi/src/cpython/pydebug.rs @@ -1,58 +1,12 @@ -use std::ffi::{c_char, c_int}; +use std::ffi::c_char; +#[cfg(all(not(Py_LIMITED_API), not(Py_3_11)))] +use std::ffi::c_int; -#[cfg(not(Py_LIMITED_API))] +#[cfg(all(not(Py_LIMITED_API), not(Py_3_11)))] #[cfg_attr(windows, link(name = "pythonXY"))] extern "C" { - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_DebugFlag")] - pub static mut Py_DebugFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_VerboseFlag")] - pub static mut Py_VerboseFlag: c_int; - #[deprecated(note = "Python 3.12")] - pub static mut Py_QuietFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_InteractiveFlag")] - pub static mut Py_InteractiveFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_InspectFlag")] - pub static mut Py_InspectFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_OptimizeFlag")] - pub static mut Py_OptimizeFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_NoSiteFlag")] - pub static mut Py_NoSiteFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_BytesWarningFlag")] - pub static mut Py_BytesWarningFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_UseClassExceptionsFlag")] - pub static mut Py_UseClassExceptionsFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_FrozenFlag")] - pub static mut Py_FrozenFlag: c_int; - #[deprecated(note = "Python 3.12")] #[cfg_attr(PyPy, link_name = "PyPy_IgnoreEnvironmentFlag")] pub static mut Py_IgnoreEnvironmentFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_DontWriteBytecodeFlag")] - pub static mut Py_DontWriteBytecodeFlag: c_int; - #[deprecated(note = "Python 3.12")] - #[cfg_attr(PyPy, link_name = "PyPy_NoUserSiteDirectory")] - pub static mut Py_NoUserSiteDirectory: c_int; - #[deprecated(note = "Python 3.12")] - pub static mut Py_UnbufferedStdioFlag: c_int; - #[cfg_attr(PyPy, link_name = "PyPy_HashRandomizationFlag")] - pub static mut Py_HashRandomizationFlag: c_int; - #[deprecated(note = "Python 3.12")] - pub static mut Py_IsolatedFlag: c_int; - #[cfg(windows)] - #[deprecated(note = "Python 3.12")] - pub static mut Py_LegacyWindowsFSEncodingFlag: c_int; - #[cfg(windows)] - #[deprecated(note = "Python 3.12")] - pub static mut Py_LegacyWindowsStdioFlag: c_int; } extern "C" { @@ -63,7 +17,6 @@ extern "C" { #[cfg(not(Py_3_11))] #[inline(always)] pub unsafe fn Py_GETENV(name: *const c_char) -> *mut c_char { - #[allow(deprecated)] if Py_IgnoreEnvironmentFlag != 0 { std::ptr::null_mut() } else { diff --git a/pyo3-ffi/src/fileobject.rs b/pyo3-ffi/src/fileobject.rs index ec3a0409930..4faf58c2b15 100644 --- a/pyo3-ffi/src/fileobject.rs +++ b/pyo3-ffi/src/fileobject.rs @@ -24,15 +24,4 @@ extern "C" { pub fn PyObject_AsFileDescriptor(arg1: *mut PyObject) -> c_int; } -#[cfg_attr(windows, link(name = "pythonXY"))] -extern "C" { - #[deprecated(note = "Python 3.12")] - pub static mut Py_FileSystemDefaultEncoding: *const c_char; - #[deprecated(note = "Python 3.12")] - pub static mut Py_FileSystemDefaultEncodeErrors: *const c_char; - #[deprecated(note = "Python 3.12")] - pub static mut Py_HasFileSystemDefaultEncoding: c_int; - // skipped 3.12-deprecated Py_UTF8Mode -} - // skipped _PyIsSelectable_fd