From 43b37109deaa2f97b03e9f86fbeaab3b4dc67485 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:41:22 +0100 Subject: [PATCH 1/5] Revert "Fix the pydebug with trace refs and count_allocs for python > 3.7" This reverts commit c780aa931ddd9c961f47f51f36149f7dfbc6ddc8. --- newsfragments/3387.packaging.md | 1 + pyo3-build-config/src/impl_.rs | 35 +++++++++++---------------------- 2 files changed, 13 insertions(+), 23 deletions(-) create mode 100644 newsfragments/3387.packaging.md diff --git a/newsfragments/3387.packaging.md b/newsfragments/3387.packaging.md new file mode 100644 index 00000000..d776b757 --- /dev/null +++ b/newsfragments/3387.packaging.md @@ -0,0 +1 @@ +Drop support for debug builds of Python 3.7. diff --git a/pyo3-build-config/src/impl_.rs b/pyo3-build-config/src/impl_.rs index 159f999a..21b65b6e 100644 --- a/pyo3-build-config/src/impl_.rs +++ b/pyo3-build-config/src/impl_.rs @@ -300,7 +300,7 @@ print("ext_suffix", get_config_var("EXT_SUFFIX")) lib_dir, executable: map.get("executable").cloned(), pointer_width: Some(calcsize_pointer * 8), - build_flags: BuildFlags::from_interpreter(interpreter)?.fixup(version), + build_flags: BuildFlags::from_interpreter(interpreter)?, suppress_build_script_link_lines: false, extra_build_script_lines: vec![], }) @@ -349,7 +349,7 @@ print("ext_suffix", get_config_var("EXT_SUFFIX")) let pointer_width = parse_key!(sysconfigdata, "SIZEOF_VOID_P") .map(|bytes_width: u32| bytes_width * 8) .ok(); - let build_flags = BuildFlags::from_sysconfigdata(sysconfigdata).fixup(version); + let build_flags = BuildFlags::from_sysconfigdata(sysconfigdata); Ok(InterpreterConfig { implementation, @@ -1019,6 +1019,7 @@ impl BuildFlags { }) .collect(), ) + .fixup() } /// Examine python's compile flags to pass to cfg by launching @@ -1053,16 +1054,12 @@ impl BuildFlags { .map(|(flag, _)| flag.clone()) .collect(); - Ok(Self(flags)) + Ok(Self(flags).fixup()) } - fn fixup(mut self, version: PythonVersion) -> Self { + fn fixup(mut self) -> Self { if self.0.contains(&BuildFlag::Py_DEBUG) { self.0.insert(BuildFlag::Py_REF_DEBUG); - if version <= PythonVersion::PY37 { - // Py_DEBUG only implies Py_TRACE_REFS until Python 3.7 - self.0.insert(BuildFlag::Py_TRACE_REFS); - } } self @@ -1935,25 +1932,17 @@ mod tests { } #[test] - fn build_flags_fixup_py37_debug() { + fn build_flags_fixup() { let mut build_flags = BuildFlags::new(); + + build_flags = build_flags.fixup(); + assert!(build_flags.0.is_empty()); + build_flags.0.insert(BuildFlag::Py_DEBUG); - build_flags = build_flags.fixup(PythonVersion { major: 3, minor: 7 }); + build_flags = build_flags.fixup(); - // On 3.7, Py_DEBUG implies Py_REF_DEBUG and Py_TRACE_REFS - assert!(build_flags.0.contains(&BuildFlag::Py_REF_DEBUG)); - assert!(build_flags.0.contains(&BuildFlag::Py_TRACE_REFS)); - } - - #[test] - fn build_flags_fixup_py38_debug() { - let mut build_flags = BuildFlags::new(); - build_flags.0.insert(BuildFlag::Py_DEBUG); - - build_flags = build_flags.fixup(PythonVersion { major: 3, minor: 8 }); - - // On 3.8, Py_DEBUG implies Py_REF_DEBUG + // Py_DEBUG implies Py_REF_DEBUG assert!(build_flags.0.contains(&BuildFlag::Py_REF_DEBUG)); } From 5ad55d2dc7d748b655cd22b051e87ec7e70d12c0 Mon Sep 17 00:00:00 2001 From: David Hewitt <1939362+davidhewitt@users.noreply.github.com> Date: Tue, 15 Aug 2023 08:55:41 +0100 Subject: [PATCH 4/5] Revert "Fix typos and other minor touchups to guide" This reverts commit 24eee46128359796b7546123b7cb07c09f180923. --- guide/src/exception.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/exception.md b/guide/src/exception.md index 93498a7a..75647795 100644 --- a/guide/src/exception.md +++ b/guide/src/exception.md @@ -2,7 +2,7 @@ ## Defining a new exception -You can use the [`create_exception!`] macro to define a new exception type: +Use the [`create_exception!`] macro: ```rust use pyo3::create_exception;