mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
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
This commit is contained in:
1 parent
206b090358
commit
7f314dd02b
2 files changed
+2
-44
No files matched your search
Vendored
+1
@@ -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):
|
||||
|
||||
@@ -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<T>`/
|
||||
/// `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<T>>,
|
||||
}
|
||||
|
||||
impl<T: PyPayload> PyLease<'_, T> {
|
||||
#[inline(always)]
|
||||
#[must_use]
|
||||
pub fn into_owned(self) -> PyRef<T> {
|
||||
self.inner.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PyPayload> Borrow<PyObject> for PyLease<'_, T> {
|
||||
#[inline(always)]
|
||||
fn borrow(&self) -> &PyObject {
|
||||
self.inner.as_ref()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: PyPayload> Deref for PyLease<'_, T> {
|
||||
type Target = PyRef<T>;
|
||||
#[inline(always)]
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.inner
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> 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<T: PyPayload> ToPyObject for PyRef<T> {
|
||||
#[inline(always)]
|
||||
fn to_pyobject(self, _vm: &VirtualMachine) -> PyObjectRef {
|
||||
|
||||
Reference in new issue
Block a user