Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions newsfragments/5333.removed.md
Original file line number Diff line number Diff line change
@@ -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.
55 changes: 4 additions & 51 deletions pyo3-ffi/src/cpython/pydebug.rs
Original file line number Diff line number Diff line change
@@ -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" {
Expand All @@ -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 {
Expand Down
11 changes: 0 additions & 11 deletions pyo3-ffi/src/fileobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading