Skip to content

Commit 7f314dd

Browse files
authored
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<PyTypeRef>`. Its last users, `class()` and `lease_class()`, went away when `typ` became a `PyAtomicRef<PyType>` (#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
1 parent 206b090 commit 7f314dd

2 files changed

Lines changed: 2 additions & 44 deletions

File tree

‎Lib/test/test_httpservers.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ def test_large_content_length(self):
11311131
res = self.request('/cgi-bin/file7.py', 'POST', body, headers)
11321132
self.assertEqual(res.read(), b'%d %d' % (size, size) + self.linesep)
11331133

1134+
@unittest.skipIf(sys.platform == "darwin", "TODO: RUSTPYTHON; flaky: the 1ms handler timeout also bounds reading the request line")
11341135
def test_large_content_length_truncated(self):
11351136
with support.swap_attr(self.request_handler, 'timeout', 0.001):
11361137
for w in range(18, 65):

‎crates/vm/src/object/ext.rs‎

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ use super::{
22
core::{Py, PyObject, PyObjectRef, PyRef},
33
payload::PyPayload,
44
};
5-
use crate::common::{
6-
atomic::{Ordering, PyAtomic, Radium},
7-
lock::PyRwLockReadGuard,
8-
};
5+
use crate::common::atomic::{Ordering, PyAtomic, Radium};
96
use crate::{
107
VirtualMachine,
118
builtins::{PyBaseExceptionRef, PyStrInterned, PyType},
@@ -729,46 +726,6 @@ impl PyObject {
729726
// }
730727
// }
731728

732-
/// A borrow of a reference to a Python object. This avoids having clone the `PyRef<T>`/
733-
/// `PyObjectRef`, which isn't that cheap as that increments the atomic reference counter.
734-
// TODO: check if we still need this
735-
#[allow(dead_code)]
736-
pub struct PyLease<'a, T: PyPayload> {
737-
inner: PyRwLockReadGuard<'a, PyRef<T>>,
738-
}
739-
740-
impl<T: PyPayload> PyLease<'_, T> {
741-
#[inline(always)]
742-
#[must_use]
743-
pub fn into_owned(self) -> PyRef<T> {
744-
self.inner.clone()
745-
}
746-
}
747-
748-
impl<T: PyPayload> Borrow<PyObject> for PyLease<'_, T> {
749-
#[inline(always)]
750-
fn borrow(&self) -> &PyObject {
751-
self.inner.as_ref()
752-
}
753-
}
754-
755-
impl<T: PyPayload> Deref for PyLease<'_, T> {
756-
type Target = PyRef<T>;
757-
#[inline(always)]
758-
fn deref(&self) -> &Self::Target {
759-
&self.inner
760-
}
761-
}
762-
763-
impl<T> fmt::Display for PyLease<'_, T>
764-
where
765-
T: PyPayload + fmt::Display,
766-
{
767-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
768-
fmt::Display::fmt(&**self, f)
769-
}
770-
}
771-
772729
impl<T: PyPayload> ToPyObject for PyRef<T> {
773730
#[inline(always)]
774731
fn to_pyobject(self, _vm: &VirtualMachine) -> PyObjectRef {

0 commit comments

Comments
 (0)