Skip to content

Commit ee5b32b

Browse files
committed
fix
1 parent 69e46c4 commit ee5b32b

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

derive/src/lib.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ pub fn derive_from_args(input: TokenStream) -> TokenStream {
6464
/// but so does any object that implements `PyValue`.
6565
/// Consider using `OptionalArg` for optional arguments.
6666
/// #### 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-
/// ```
7867
/// - `name`: the name of the method in Python,
7968
/// by default it is the same as the Rust method, or surrounded by double underscores if magic is present.
8069
/// This overrides `magic` and the default name and cannot be used with `magic` to prevent ambiguity.

vm/src/builtins/property.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ impl PyProperty {
150150
}
151151

152152
#[pymethod]
153-
fn set___name__(&self, args: PosArgs, vm: &VirtualMachine) -> PyResult<()> {
153+
fn __set_name__(&self, args: PosArgs, vm: &VirtualMachine) -> PyResult<()> {
154154
let func_args = args.into_args(vm);
155155
let func_args_len = func_args.args.len();
156156
let (_owner, name): (PyObjectRef, PyObjectRef) = func_args.bind(vm).map_err(|_e| {

vm/src/exceptions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ impl VirtualMachine {
132132
exc: &PyBaseExceptionRef,
133133
) -> Result<(), W::Error> {
134134
let vm = self;
135-
if let Some(tb) = exc.__traceback__().clone() {
135+
if let Some(tb) = exc.traceback.read().clone() {
136136
writeln!(output, "Traceback (most recent call last):")?;
137137
for tb in tb.iter() {
138138
write_traceback_entry(output, &tb)?;
@@ -1098,21 +1098,21 @@ impl serde::Serialize for SerializeException<'_, '_> {
10981098
s.end()
10991099
}
11001100
}
1101-
self.exc.traceback().map(Tracebacks)
1101+
self.exc.__traceback__().map(Tracebacks)
11021102
};
11031103
struc.serialize_field("traceback", &tbs)?;
11041104
struc.serialize_field(
11051105
"cause",
11061106
&self
11071107
.exc
1108-
.cause()
1108+
.__cause__()
11091109
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
11101110
)?;
11111111
struc.serialize_field(
11121112
"context",
11131113
&self
11141114
.exc
1115-
.context()
1115+
.__context__()
11161116
.map(|exc| SerializeExceptionOwned { vm: self.vm, exc }),
11171117
)?;
11181118
struc.serialize_field("suppress_context", &self.exc.get_suppress_context())?;

0 commit comments

Comments
 (0)