PyPayload::class takes ctx instead of vm

This commit is contained in:
Jeong YunWon committed 2023-03-20 21:03:40 +09:00
1 parent 70fb78d031
commit 7b99df6c48
78 files changed
+372 -353

No files matched your search

+2 -2
View File
@@ -482,8 +482,8 @@ pub(crate) fn impl_define_exception(exc_def: PyExceptionDef) -> Result<TokenStre
// We need this to make extend mechanism work:
impl ::rustpython_vm::PyPayload for #class_name {
fn class(vm: &::rustpython_vm::VirtualMachine) -> &'static ::rustpython_vm::Py<::rustpython_vm::builtins::PyType> {
vm.ctx.exceptions.#ctx_name
fn class(ctx: &::rustpython_vm::vm::Context) -> &'static ::rustpython_vm::Py<::rustpython_vm::builtins::PyType> {
ctx.exceptions.#ctx_name
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ pub(crate) fn impl_pypayload(input: DeriveInput) -> Result<TokenStream> {
let ret = quote! {
impl ::rustpython_vm::PyPayload for #ty {
fn class(_vm: &::rustpython_vm::VirtualMachine) -> &'static rustpython_vm::Py<::rustpython_vm::builtins::PyType> {
fn class(_ctx: &::rustpython_vm::vm::Context) -> &'static rustpython_vm::Py<::rustpython_vm::builtins::PyType> {
<Self as ::rustpython_vm::class::StaticType>::static_type()
}
}