From 7f314dd02b5ddfd0bb00eb18bc6947cf942c18e3 Mon Sep 17 00:00:00 2001 From: "Jeong, YunWon" <69878+youknowone@users.noreply.github.com> Date: Sat, 26 Sep 2026 11:13:38 +0900 Subject: [PATCH] Remove unused PyLease; skip flaky httpservers test on macOS (#8821) * Remove unused PyLease PyLease wrapped a read guard over the object's type when `typ` was a `PyRwLock`. Its last users, `class()` and `lease_class()`, went away when `typ` became a `PyAtomicRef` (#3828). Its field is private and it has no constructor, so it cannot be built anywhere. Assisted-by: Claude Code:claude-opus-5-5 * Skip test_large_content_length_truncated on macOS The test sets the CGI handler timeout to 1ms. That timeout also bounds reading the request line, so when the client has not sent the request within 1ms the server logs "Request timed out" and closes the connection. The client then gets ConnectionResetError or BrokenPipeError. This reproduces on macOS with both RustPython and CPython 3.14.6. The skip was removed in #8759 after Linux-only repeats. Assisted-by: Claude Code:claude-opus-5-5 --- Lib/test/test_httpservers.py | 1 + crates/vm/src/object/ext.rs | 45 +----------------------------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/Lib/test/test_httpservers.py b/Lib/test/test_httpservers.py index 7b58c5ef5..7bf4e8279 100644 --- a/Lib/test/test_httpservers.py +++ b/Lib/test/test_httpservers.py @@ -1131,6 +1131,7 @@ class CGIHTTPServerTestCase(BaseTestCase): res = self.request('/cgi-bin/file7.py', 'POST', body, headers) self.assertEqual(res.read(), b'%d %d' % (size, size) + self.linesep) + @unittest.skipIf(sys.platform == "darwin", "TODO: RUSTPYTHON; flaky: the 1ms handler timeout also bounds reading the request line") def test_large_content_length_truncated(self): with support.swap_attr(self.request_handler, 'timeout', 0.001): for w in range(18, 65): diff --git a/crates/vm/src/object/ext.rs b/crates/vm/src/object/ext.rs index eda0d7f4b..da68c1820 100644 --- a/crates/vm/src/object/ext.rs +++ b/crates/vm/src/object/ext.rs @@ -2,10 +2,7 @@ use super::{ core::{Py, PyObject, PyObjectRef, PyRef}, payload::PyPayload, }; -use crate::common::{ - atomic::{Ordering, PyAtomic, Radium}, - lock::PyRwLockReadGuard, -}; +use crate::common::atomic::{Ordering, PyAtomic, Radium}; use crate::{ VirtualMachine, builtins::{PyBaseExceptionRef, PyStrInterned, PyType}, @@ -729,46 +726,6 @@ impl PyObject { // } // } -/// A borrow of a reference to a Python object. This avoids having clone the `PyRef`/ -/// `PyObjectRef`, which isn't that cheap as that increments the atomic reference counter. -// TODO: check if we still need this -#[allow(dead_code)] -pub struct PyLease<'a, T: PyPayload> { - inner: PyRwLockReadGuard<'a, PyRef>, -} - -impl PyLease<'_, T> { - #[inline(always)] - #[must_use] - pub fn into_owned(self) -> PyRef { - self.inner.clone() - } -} - -impl Borrow for PyLease<'_, T> { - #[inline(always)] - fn borrow(&self) -> &PyObject { - self.inner.as_ref() - } -} - -impl Deref for PyLease<'_, T> { - type Target = PyRef; - #[inline(always)] - fn deref(&self) -> &Self::Target { - &self.inner - } -} - -impl fmt::Display for PyLease<'_, T> -where - T: PyPayload + fmt::Display, -{ - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - fmt::Display::fmt(&**self, f) - } -} - impl ToPyObject for PyRef { #[inline(always)] fn to_pyobject(self, _vm: &VirtualMachine) -> PyObjectRef {