File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -131,10 +131,38 @@ void do_file(const char *file) {
131131 }
132132}
133133
134+ void test_print (py_obj_t o_in ) {
135+ printf ("<test>" );
136+ }
137+
138+ py_obj_t test_get (py_obj_t o_in ) {
139+ py_obj_t d1 ;
140+ py_obj_t d2 ;
141+ py_user_get_data (o_in , & d1 , & d2 );
142+ return d1 ;
143+ }
144+
145+ py_obj_t test_set (py_obj_t o_in , py_obj_t arg ) {
146+ py_user_set_data (o_in , (machine_uint_t )arg , (machine_uint_t )arg );
147+ return py_const_none ;
148+ }
149+
150+ const py_user_info_t test_obj_info = {
151+ "Test" ,
152+ test_print ,
153+ {
154+ { "get" , 0 , test_get },
155+ { "set" , 1 , test_set },
156+ { NULL , 0 , NULL },
157+ }
158+ };
159+
134160int main (int argc , char * * argv ) {
135161 qstr_init ();
136162 rt_init ();
137163
164+ rt_store_name (qstr_from_str_static ("test" ), py_obj_new_user (& test_obj_info , py_obj_new_int (42 ), 0 ));
165+
138166 if (argc == 1 ) {
139167 do_repl ();
140168 } else if (argc == 2 ) {
You can’t perform that action at this time.
0 commit comments