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
8 changes: 0 additions & 8 deletions Lib/test/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ def loads(self, buf, **kwds):
u = self.unpickler(f, **kwds)
return u.load()

Comment thread
1ndahous3 marked this conversation as resolved.
Resolved
@unittest.expectedFailure # TODO: RUSTPYTHON
def test_c_methods(self):
return super().test_c_methods()

@unittest.expectedFailureIf(sys.getrecursionlimit() == 256, "TODO: RUSTPYTHON; default debug recursion limit is 256")
def test_deep_nested_struct_frozendict(self):
return super().test_deep_nested_struct_frozendict()
Expand All @@ -126,10 +122,6 @@ def loads(self, buf, **kwds):
test_find_class = None
test_custom_find_class = None

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_c_methods(self):
return super().test_c_methods()


class PersistentPicklerUnpicklerMixin(object):

Expand Down
4 changes: 0 additions & 4 deletions Lib/test/test_pickletools.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,6 @@ def test_optimize_binput_and_memoize(self):
self.assertIs(unpickled2[1], unpickled2[2])
self.assertNotIn(pickle.BINPUT, pickled2)

@unittest.expectedFailure # TODO: RUSTPYTHON
def test_c_methods(self):
return super().test_c_methods()


class SimpleReader:
def __init__(self, data):
Expand Down
6 changes: 4 additions & 2 deletions crates/vm/src/function/method.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{
Context, Py, PyObjectRef, PyPayload, PyRef, VirtualMachine,
builtins::{
PyType,
PyStaticMethod, PyType,
builtin_func::{PyNativeFunction, PyNativeMethod},
descriptor::{PyClassMethodDescriptor, PyMethodDescriptor},
},
Expand Down Expand Up @@ -183,7 +183,9 @@ impl PyMethodDef {
} else if self.flags.contains(PyMethodFlags::CLASS) {
self.build_classmethod(ctx, class).into()
} else if self.flags.contains(PyMethodFlags::STATIC) {
self.build_staticmethod(ctx, class).into()
PyStaticMethod::new(self.build_staticmethod(ctx, class).into())
.into_ref(ctx)
.into()
} else {
unreachable!()
}
Expand Down
8 changes: 8 additions & 0 deletions extra_tests/snippets/builtin_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -817,3 +817,11 @@ class Diamond(FirstChild, SecondChild):
value = Diamond()
value.left = 43
assert value.left == 43

# Native static methods retain their descriptor in the class dictionary.
native_static = str.__dict__["maketrans"]
assert isinstance(native_static, staticmethod)
assert native_static.__func__ is str.maketrans
assert native_static.__wrapped__ is str.maketrans
assert str.maketrans("a", "b") == {97: 98}
assert "".maketrans("a", "b") == {97: 98}
Loading