| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -95,11 +95,6 @@ def test_buffer_callback_error(self): # TODO: RUSTPYTHON, remove when this passe | |||
| 95 | 95 | def test_buffers_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 96 | 96 | super().test_buffers_error() # TODO: RUSTPYTHON, remove when this passes | |
| 97 | 97 | ||
| 98 | - # TODO: RUSTPYTHON, TypeError: cannot pickle 'method' object | ||
| 99 | - @unittest.expectedFailure | ||
| 100 | - def test_c_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 101 | - super().test_c_methods() # TODO: RUSTPYTHON, remove when this passes | ||
| 102 | - | ||
| 103 | 98 | # TODO: RUSTPYTHON, AssertionError | |
| 104 | 99 | @unittest.expectedFailure | |
| 105 | 100 | def test_complex_newobj_ex(self): # TODO: RUSTPYTHON, remove when this passes | |
@@ -130,11 +125,6 @@ def test_optional_frames(self): # TODO: RUSTPYTHON, remove when this passes | |||
| 130 | 125 | def test_picklebuffer_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 131 | 126 | super().test_picklebuffer_error() # TODO: RUSTPYTHON, remove when this passes | |
| 132 | 127 | ||
| 133 | - # TODO: RUSTPYTHON, pickle.PicklingError | ||
| 134 | - @unittest.expectedFailure | ||
| 135 | - def test_py_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 136 | - super().test_py_methods() # TODO: RUSTPYTHON, remove when this passes | ||
| 137 | - | ||
| 138 | 128 | def dumps(self, arg, proto=None, **kwargs): | |
| 139 | 129 | f = io.BytesIO() | |
| 140 | 130 | p = self.pickler(f, proto, **kwargs) | |
@@ -171,11 +161,6 @@ def test_buffer_callback_error(self): # TODO: RUSTPYTHON, remove when this passe | |||
| 171 | 161 | def test_buffers_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 172 | 162 | super().test_buffers_error() # TODO: RUSTPYTHON, remove when this passes | |
| 173 | 163 | ||
| 174 | - # TODO: RUSTPYTHON, TypeError: cannot pickle 'method' object | ||
| 175 | - @unittest.expectedFailure | ||
| 176 | - def test_c_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 177 | - super().test_c_methods() # TODO: RUSTPYTHON, remove when this passes | ||
| 178 | - | ||
| 179 | 164 | # TODO: RUSTPYTHON, AssertionError | |
| 180 | 165 | @unittest.expectedFailure | |
| 181 | 166 | def test_complex_newobj_ex(self): # TODO: RUSTPYTHON, remove when this passes | |
@@ -216,11 +201,6 @@ def test_optional_frames(self): # TODO: RUSTPYTHON, remove when this passes | |||
| 216 | 201 | def test_picklebuffer_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 217 | 202 | super().test_picklebuffer_error() # TODO: RUSTPYTHON, remove when this passes | |
| 218 | 203 | ||
| 219 | - # TODO: RUSTPYTHON, pickle.PicklingError | ||
| 220 | - @unittest.expectedFailure | ||
| 221 | - def test_py_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 222 | - super().test_py_methods() # TODO: RUSTPYTHON, remove when this passes | ||
| 223 | - | ||
| 224 | 204 | def dumps(self, arg, protocol=None, **kwargs): | |
| 225 | 205 | return pickle.dumps(arg, protocol, **kwargs) | |
| 226 | 206 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,11 +17,6 @@ def test_buffer_callback_error(self): # TODO: RUSTPYTHON, remove when this passe | |||
| 17 | 17 | def test_buffers_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 18 | 18 | super().test_buffers_error() | |
| 19 | 19 | ||
| 20 | - # TODO: RUSTPYTHON, TypeError: cannot pickle 'method' object | ||
| 21 | - @unittest.expectedFailure | ||
| 22 | - def test_c_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 23 | - super().test_c_methods() | ||
| 24 | - | ||
| 25 | 20 | def test_compat_pickle(self): # TODO: RUSTPYTHON, remove when this passes | |
| 26 | 21 | super().test_compat_pickle() | |
| 27 | 22 | ||
@@ -58,11 +53,6 @@ def test_optional_frames(self): # TODO: RUSTPYTHON, remove when this passes | |||
| 58 | 53 | def test_picklebuffer_error(self): # TODO: RUSTPYTHON, remove when this passes | |
| 59 | 54 | super().test_picklebuffer_error() | |
| 60 | 55 | ||
| 61 | - # TODO: RUSTPYTHON, pickle.PicklingError | ||
| 62 | - @unittest.expectedFailure | ||
| 63 | - def test_py_methods(self): # TODO: RUSTPYTHON, remove when this passes | ||
| 64 | - super().test_py_methods() | ||
| 65 | - | ||
| 66 | 56 | def dumps(self, arg, proto=None, **kwargs): | |
| 67 | 57 | return pickletools.optimize(pickle.dumps(arg, proto, **kwargs)) | |
| 68 | 58 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -254,6 +254,15 @@ impl PyBuiltinMethod { | |||
| 254 | 254 | self.class.name() | |
| 255 | 255 | ) | |
| 256 | 256 | } | |
| 257 | + #[pymethod(magic)] | ||
| 258 | + fn reduce( | ||
| 259 | + &self, | ||
| 260 | + vm: &VirtualMachine, | ||
| 261 | + ) -> (Option<PyObjectRef>, (Option<PyObjectRef>, PyStrRef)) { | ||
| 262 | + let builtinfunc_getattr = vm.builtins.get_attr("getattr", vm).ok(); | ||
| 263 | + let classname = vm.builtins.get_attr(self.class.name().to_string(), vm).ok(); | ||
| 264 | + (builtinfunc_getattr, (classname, self.value.name.clone())) | ||
| 265 | + } | ||
| 257 | 266 | } | |
| 258 | 267 | impl Unconstructible for PyBuiltinMethod {} | |
| 259 | 268 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -552,6 +552,17 @@ impl PyBoundMethod { | |||
| 552 | 552 | )) | |
| 553 | 553 | } | |
| 554 | 554 | ||
| 555 | + #[pymethod(magic)] | ||
| 556 | + fn reduce( | ||
| 557 | + &self, | ||
| 558 | + vm: &VirtualMachine, | ||
| 559 | + ) -> (Option<PyObjectRef>, (PyObjectRef, Option<PyObjectRef>)) { | ||
| 560 | + let builtinfunc_getattr = vm.builtins.get_attr("getattr", vm).ok(); | ||
| 561 | + let funcself = self.object.clone(); | ||
| 562 | + let funcname = self.function.get_attr("__name__", vm).ok(); | ||
| 563 | + (builtinfunc_getattr, (funcself, funcname)) | ||
| 564 | + } | ||
| 565 | + | ||
| 555 | 566 | #[pygetset(magic)] | |
| 556 | 567 | fn doc(&self, vm: &VirtualMachine) -> PyResult { | |
| 557 | 568 | self.function.get_attr("__doc__", vm) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments