File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,10 @@ extern "C" {
88#endif
99
1010PyAPI_FUNC (PyObject * ) PySys_GetObject (const char * );
11+ PyAPI_FUNC (PyObject * ) _PySys_GetObjectId (_Py_Identifier * key );
1112PyAPI_FUNC (int ) PySys_SetObject (const char * , PyObject * );
13+ PyAPI_FUNC (int ) _PySys_SetObjectId (_Py_Identifier * key , PyObject * );
14+
1215PyAPI_FUNC (void ) PySys_SetArgv (int , wchar_t * * );
1316PyAPI_FUNC (void ) PySys_SetArgvEx (int , wchar_t * * , int );
1417PyAPI_FUNC (void ) PySys_SetPath (const wchar_t * );
Original file line number Diff line number Diff line change @@ -41,6 +41,16 @@ extern const char *PyWin_DLLVersionString;
4141#include <langinfo.h>
4242#endif
4343
44+ PyObject *
45+ _PySys_GetObjectId (_Py_Identifier * key )
46+ {
47+ PyThreadState * tstate = PyThreadState_GET ();
48+ PyObject * sd = tstate -> interp -> sysdict ;
49+ if (sd == NULL )
50+ return NULL ;
51+ return _PyDict_GetItemId (sd , key );
52+ }
53+
4454PyObject *
4555PySys_GetObject (const char * name )
4656{
@@ -51,6 +61,21 @@ PySys_GetObject(const char *name)
5161 return PyDict_GetItemString (sd , name );
5262}
5363
64+ int
65+ _PySys_SetObjectId (_Py_Identifier * key , PyObject * v )
66+ {
67+ PyThreadState * tstate = PyThreadState_GET ();
68+ PyObject * sd = tstate -> interp -> sysdict ;
69+ if (v == NULL ) {
70+ if (_PyDict_GetItemId (sd , key ) == NULL )
71+ return 0 ;
72+ else
73+ return _PyDict_DelItemId (sd , key );
74+ }
75+ else
76+ return _PyDict_SetItemId (sd , key , v );
77+ }
78+
5479int
5580PySys_SetObject (const char * name , PyObject * v )
5681{
You can’t perform that action at this time.
0 commit comments