Skip to content
Merged
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
1 change: 1 addition & 0 deletions Lib/test/test_httpservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1131,6 +1131,7 @@ def test_large_content_length(self):
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):
Expand Down
45 changes: 1 addition & 44 deletions crates/vm/src/object/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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>
#[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 {
Expand Down
Loading