Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0ecc35

Browse files
committed
unbox tp_buffer
1 parentdf78720 commitc0ecc35

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

‎derive/src/pyclass.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -334,23 +334,22 @@ where
334334
let slot_ident = item_meta.slot_name()?;
335335
let slot_name = slot_ident.to_string();
336336
let tokens ={
337-
if slot_name =="new"{
338-
let into_func =quote_spanned!{ident.span() =>
337+
let into_func =if slot_name =="new"{
338+
quote_spanned!{ident.span() =>
339339
::rustpython_vm::function::IntoPyNativeFunc::into_func(Self::#ident)
340-
};
341-
quote!{
342-
slots.#slot_ident =Some(#into_func);
343340
}
344-
}elseif slot_name =="buffer"{
345-
let into_func =quote_spanned!{ident.span() =>
346-
::std::boxed::Box::new(Self::#ident)
347-
};
341+
}else{
342+
quote_spanned!{ident.span() =>
343+
Self::#identas _
344+
}
345+
};
346+
if slot_name =="new" || slot_name =="buffer"{
348347
quote!{
349348
slots.#slot_ident =Some(#into_func);
350349
}
351350
}else{
352351
quote!{
353-
slots.#slot_ident.store(Some(Self::#identas _))
352+
slots.#slot_ident.store(Some(#into_func))
354353
}
355354
}
356355
};

‎vm/src/slots.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ pub struct PyClassSlots {
6767
}
6868

6969
typeBufferFunc =
70-
Box<py_dyn_fn!(dynFn(PyObjectRef,&VirtualMachine) ->PyResult<Box<dynBufferProtocol>>)>;
70+
fn(PyObjectRef,&VirtualMachine) ->PyResult<Box<dynBufferProtocol>>;
7171

7272
implPyClassSlots{
7373
pubfnfrom_flags(flags:PyTpFlags) ->Self{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp