@@ -117,7 +117,7 @@ pub(crate) fn impl_pyimpl(attr: AttributeArgs, item: Item) -> Result<TokenStream
117117
118118 fn impl_extend_class(
119119 ctx: & :: rustpython_vm:: Context ,
120- class: & :: rustpython_vm:: builtins:: PyTypeRef ,
120+ class: & ' static :: rustpython_vm:: Py < :: rustpython_vm :: builtins:: PyType > ,
121121 ) {
122122 #getset_impl
123123 #extend_impl
@@ -150,7 +150,7 @@ pub(crate) fn impl_pyimpl(attr: AttributeArgs, item: Item) -> Result<TokenStream
150150 parse_quote! {
151151 fn __extend_py_class(
152152 ctx: & :: rustpython_vm:: Context ,
153- class: & :: rustpython_vm:: builtins:: PyTypeRef ,
153+ class: & ' static :: rustpython_vm:: Py < :: rustpython_vm :: builtins:: PyType > ,
154154 ) {
155155 #getset_impl
156156 #extend_impl
@@ -238,7 +238,7 @@ fn generate_class_def(
238238 }
239239 . map ( |typ| {
240240 quote ! {
241- fn static_baseclass( ) -> & ' static :: rustpython_vm:: builtins:: PyTypeRef {
241+ fn static_baseclass( ) -> & ' static :: rustpython_vm:: Py < :: rustpython_vm :: builtins:: PyType > {
242242 use rustpython_vm:: class:: StaticType ;
243243 #typ:: static_type( )
244244 }
@@ -248,7 +248,7 @@ fn generate_class_def(
248248 let meta_class = metaclass. map ( |typ| {
249249 let typ = Ident :: new ( & typ, ident. span ( ) ) ;
250250 quote ! {
251- fn static_metaclass( ) -> & ' static :: rustpython_vm:: builtins:: PyTypeRef {
251+ fn static_metaclass( ) -> & ' static :: rustpython_vm:: Py < :: rustpython_vm :: builtins:: PyType > {
252252 use rustpython_vm:: class:: StaticType ;
253253 #typ:: static_type( )
254254 }
@@ -368,8 +368,8 @@ pub(crate) fn impl_define_exception(exc_def: PyExceptionDef) -> Result<TokenStre
368368
369369 // We need this to make extend mechanism work:
370370 impl :: rustpython_vm:: PyPayload for #class_name {
371- fn class( vm: & :: rustpython_vm:: VirtualMachine ) -> & :: rustpython_vm:: builtins:: PyTypeRef {
372- & vm. ctx. exceptions. #ctx_name
371+ fn class( vm: & :: rustpython_vm:: VirtualMachine ) -> & ' static :: rustpython_vm:: Py < :: rustpython_vm :: builtins:: PyType > {
372+ vm. ctx. exceptions. #ctx_name
373373 }
374374 }
375375
@@ -491,9 +491,9 @@ where
491491 quote ! ( . with_doc( #doc. to_owned( ) , ctx) )
492492 } ) ;
493493 let build_func = match self . inner . attr_name {
494- AttrName :: Method => quote ! ( . build_method( ctx, class. clone ( ) ) ) ,
495- AttrName :: ClassMethod => quote ! ( . build_classmethod( ctx, class. clone ( ) ) ) ,
496- AttrName :: StaticMethod => quote ! ( . build_staticmethod( ctx, class. clone ( ) ) ) ,
494+ AttrName :: Method => quote ! ( . build_method( ctx, class) ) ,
495+ AttrName :: ClassMethod => quote ! ( . build_classmethod( ctx, class) ) ,
496+ AttrName :: StaticMethod => quote ! ( . build_staticmethod( ctx, class) ) ,
497497 other => unreachable ! (
498498 "Only 'method', 'classmethod' and 'staticmethod' are supported, got {:?}" ,
499499 other
@@ -735,10 +735,10 @@ impl ToTokens for GetSetNursery {
735735 class. set_str_attr(
736736 #name,
737737 :: rustpython_vm:: PyRef :: new_ref(
738- :: rustpython_vm:: builtins:: PyGetSet :: new( #name. into( ) , class. clone ( ) )
738+ :: rustpython_vm:: builtins:: PyGetSet :: new( #name. into( ) , class)
739739 . with_get( & Self :: #getter)
740740 #setter #deleter,
741- ctx. types. getset_type. clone ( ) , None ) ,
741+ ctx. types. getset_type. to_owned ( ) , None ) ,
742742 ctx
743743 ) ;
744744 }
0 commit comments