File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
graalpython/com.oracle.graal.python.cext/src Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -62,3 +62,36 @@ UPCALL_ID(PyState_FindModule)
62
62
PyObject * PyState_FindModule (struct PyModuleDef * module ) {
63
63
return UPCALL_CEXT_O (_jls_PyState_FindModule , polyglot_from_string (module -> m_name , SRC_CS ));
64
64
}
65
+
66
+ int PyState_AddModule (PyObject * module , struct PyModuleDef * def ) {
67
+ Py_ssize_t index ;
68
+ if (!def ) {
69
+ Py_FatalError ("PyState_AddModule: Module Definition is NULL" );
70
+ return -1 ;
71
+ }
72
+ // TODO(fa): check if module was already added
73
+
74
+ if (def -> m_slots ) {
75
+ PyErr_SetString (PyExc_SystemError ,
76
+ "PyState_AddModule called on module with slots" );
77
+ return -1 ;
78
+ }
79
+
80
+ // TODO(fa): implement
81
+ return 0 ;
82
+ }
83
+
84
+ int PyState_RemoveModule (struct PyModuleDef * def ) {
85
+ Py_ssize_t index = def -> m_base .m_index ;
86
+ if (def -> m_slots ) {
87
+ PyErr_SetString (PyExc_SystemError ,
88
+ "PyState_RemoveModule called on module with slots" );
89
+ return -1 ;
90
+ }
91
+ if (index == 0 ) {
92
+ Py_FatalError ("PyState_RemoveModule: Module index invalid." );
93
+ return -1 ;
94
+ }
95
+ // TODO(fa): implement
96
+ return 0 ;
97
+ }
You can’t perform that action at this time.
0 commit comments