File tree Expand file tree Collapse file tree 3 files changed +5
-16
lines changed Expand file tree Collapse file tree 3 files changed +5
-16
lines changed Original file line number Diff line number Diff line change @@ -64,17 +64,6 @@ pub fn derive_from_args(input: TokenStream) -> TokenStream {
64
64
/// but so does any object that implements `PyValue`.
65
65
/// Consider using `OptionalArg` for optional arguments.
66
66
/// #### Arguments
67
- /// - `magic`: marks the method as a magic method: the method name is surrounded with double underscores.
68
- /// ```rust, ignore
69
- /// #[pyclass]
70
- /// impl MyStruct {
71
- /// // This will be called as the `__add__` method in Python.
72
- /// #[pymethod]
73
- /// fn add(&self, other: &Self) -> PyResult<i32> {
74
- /// ...
75
- /// }
76
- /// }
77
- /// ```
78
67
/// - `name`: the name of the method in Python,
79
68
/// by default it is the same as the Rust method, or surrounded by double underscores if magic is present.
80
69
/// This overrides `magic` and the default name and cannot be used with `magic` to prevent ambiguity.
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ impl PyProperty {
150
150
}
151
151
152
152
#[ pymethod]
153
- fn set___name__ ( & self , args : PosArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
153
+ fn __set_name__ ( & self , args : PosArgs , vm : & VirtualMachine ) -> PyResult < ( ) > {
154
154
let func_args = args. into_args ( vm) ;
155
155
let func_args_len = func_args. args . len ( ) ;
156
156
let ( _owner, name) : ( PyObjectRef , PyObjectRef ) = func_args. bind ( vm) . map_err ( |_e| {
Original file line number Diff line number Diff line change @@ -132,7 +132,7 @@ impl VirtualMachine {
132
132
exc : & PyBaseExceptionRef ,
133
133
) -> Result < ( ) , W :: Error > {
134
134
let vm = self ;
135
- if let Some ( tb) = exc. __traceback__ ( ) . clone ( ) {
135
+ if let Some ( tb) = exc. traceback . read ( ) . clone ( ) {
136
136
writeln ! ( output, "Traceback (most recent call last):" ) ?;
137
137
for tb in tb. iter ( ) {
138
138
write_traceback_entry ( output, & tb) ?;
@@ -1098,21 +1098,21 @@ impl serde::Serialize for SerializeException<'_, '_> {
1098
1098
s. end ( )
1099
1099
}
1100
1100
}
1101
- self . exc . traceback ( ) . map ( Tracebacks )
1101
+ self . exc . __traceback__ ( ) . map ( Tracebacks )
1102
1102
} ;
1103
1103
struc. serialize_field ( "traceback" , & tbs) ?;
1104
1104
struc. serialize_field (
1105
1105
"cause" ,
1106
1106
& self
1107
1107
. exc
1108
- . cause ( )
1108
+ . __cause__ ( )
1109
1109
. map ( |exc| SerializeExceptionOwned { vm : self . vm , exc } ) ,
1110
1110
) ?;
1111
1111
struc. serialize_field (
1112
1112
"context" ,
1113
1113
& self
1114
1114
. exc
1115
- . context ( )
1115
+ . __context__ ( )
1116
1116
. map ( |exc| SerializeExceptionOwned { vm : self . vm , exc } ) ,
1117
1117
) ?;
1118
1118
struc. serialize_field ( "suppress_context" , & self . exc . get_suppress_context ( ) ) ?;
You can’t perform that action at this time.
0 commit comments