@@ -15,7 +15,6 @@ Data members:
1515*/
1616
1717#include "Python.h"
18- #include "pycore_abiinfo.h" // _PyAbiInfo_GetInfo()
1918#include "pycore_audit.h" // _Py_AuditHookEntry
2019#include "pycore_call.h" // _PyObject_CallNoArgs()
2120#include "pycore_ceval.h" // _PyEval_SetAsyncGenFinalizer()
@@ -3632,6 +3631,56 @@ make_impl_info(PyObject *version_info)
36323631 return NULL ;
36333632}
36343633
3634+
3635+ PyObject *
3636+ make_abi_info (void )
3637+ {
3638+ int res ;
3639+ PyObject * abi_info , * value , * ns ;
3640+ abi_info = PyDict_New ();
3641+ if (abi_info == NULL ) {
3642+ goto error ;
3643+ }
3644+
3645+ value = PyLong_FromLong (sizeof (void * ) * 8 );
3646+ if (value == NULL ) {
3647+ goto error ;
3648+ }
3649+ res = PyDict_SetItemString (abi_info , "pointer_bits" , value );
3650+ Py_DECREF (value );
3651+ if (res < 0 ) {
3652+ goto error ;
3653+ }
3654+
3655+ #ifdef Py_GIL_DISABLED
3656+ value = Py_True ;
3657+ #else
3658+ value = Py_False ;
3659+ #endif
3660+ res = PyDict_SetItemString (abi_info , "Py_GIL_DISABLED" , value );
3661+ if (res < 0 ) {
3662+ goto error ;
3663+ }
3664+
3665+ #ifdef Py_DEBUG
3666+ value = Py_True ;
3667+ #else
3668+ value = Py_False ;
3669+ #endif
3670+ res = PyDict_SetItemString (abi_info , "Py_DEBUG" , value );
3671+ if (res < 0 ) {
3672+ goto error ;
3673+ }
3674+
3675+ ns = _PyNamespace_New (abi_info );
3676+ Py_DECREF (abi_info );
3677+ return ns ;
3678+
3679+ error :
3680+ Py_CLEAR (abi_info );
3681+ return NULL ;
3682+ }
3683+
36353684#ifdef __EMSCRIPTEN__
36363685
36373686PyDoc_STRVAR (emscripten_info__doc__ ,
@@ -3857,7 +3906,7 @@ _PySys_InitCore(PyThreadState *tstate, PyObject *sysdict)
38573906
38583907 SET_SYS ("thread_info" , PyThread_GetInfo ());
38593908
3860- SET_SYS ("abi_info" , _PyAbiInfo_GetInfo ());
3909+ SET_SYS ("abi_info" , make_abi_info ());
38613910
38623911 /* initialize asyncgen_hooks */
38633912 if (_PyStructSequence_InitBuiltin (interp , & AsyncGenHooksType ,
0 commit comments