File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3010,13 +3010,13 @@ impl<'a> PyClassImplsBuilder<'a> {
30103010 type BaseNativeType = #base_nativetype;
30113011
30123012 fn items_iter( ) -> #pyo3_path:: impl_:: pyclass:: PyClassItemsIter {
3013- use #pyo3_path:: impl_ :: pyclass :: * ;
3014- let collector = PyClassImplCollector :: <Self >:: new( ) ;
3015- static INTRINSIC_ITEMS : PyClassItems = PyClassItems {
3013+ use #pyo3_path:: types :: PyAnyMethods as _ ;
3014+ let collector = #pyo3_path :: impl_ :: pyclass :: PyClassImplCollector :: <Self >:: new( ) ;
3015+ static INTRINSIC_ITEMS : #pyo3_path :: impl_ :: pyclass :: PyClassItems = #pyo3_path :: impl_ :: pyclass :: PyClassItems {
30163016 methods: & [ #( #default_method_defs) , * ] ,
30173017 slots: & [ #( #default_slot_defs) , * #( #freelist_slots) , * ] ,
30183018 } ;
3019- PyClassItemsIter :: new( & INTRINSIC_ITEMS , #pymethods_items)
3019+ #pyo3_path :: impl_ :: pyclass :: PyClassItemsIter :: new( & INTRINSIC_ITEMS , #pymethods_items)
30203020 }
30213021
30223022 const RAW_DOC : & ' static :: std:: ffi:: CStr = #doc;
Original file line number Diff line number Diff line change 11#![ deny( unused_imports) ]
22use pyo3:: prelude:: * ;
33
4- #[ pyclass]
5- pub struct Probe { }
6-
7- #[ pymethods]
8- impl Probe {
9- #[ new]
10- fn new ( ) -> Self {
11- Self { }
4+ #[ pymodule]
5+ mod probe_no_fields {
6+ use pyo3:: prelude:: * ;
7+ #[ pyclass]
8+ pub struct Probe { }
9+
10+ #[ pymethods]
11+ impl Probe {
12+ #[ new]
13+ fn new ( ) -> Self {
14+ Self { }
15+ }
1216 }
1317}
1418
1519#[ pymodule]
16- fn probe ( _py : Python < ' _ > , m : & Bound < ' _ , PyModule > ) -> PyResult < ( ) > {
17- m. add_class :: < Probe > ( ) ?;
18- Ok ( ( ) )
20+ mod probe_with_fields {
21+ use pyo3:: prelude:: * ;
22+ #[ pyclass( get_all) ]
23+ pub struct Probe {
24+ field : u8 ,
25+ }
26+
27+ #[ pymethods]
28+ impl Probe {
29+ #[ new]
30+ fn new ( ) -> Self {
31+ Self { field : 0 }
32+ }
33+ }
1934}
2035
2136#[ pyclass]
You can’t perform that action at this time.
0 commit comments