File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change 11/* Errno module */
22
3- // Need limited C API version 3.13 for Py_mod_gil
4- #include "pyconfig.h" // Py_GIL_DISABLED
5- #ifndef Py_GIL_DISABLED
6- # define Py_LIMITED_API 0x030d0000
7- #endif
8-
93#include "Python.h"
104#include <errno.h> // EPIPE
115
@@ -96,10 +90,6 @@ errno_exec(PyObject *module)
9690 if (error_dict == NULL ) {
9791 return -1 ;
9892 }
99- if (PyDict_SetItemString (module_dict , "errorcode" , error_dict ) < 0 ) {
100- Py_DECREF (error_dict );
101- return -1 ;
102- }
10393
10494/* Macro so I don't have to edit each and every line below... */
10595#define add_errcode (name , code , comment ) \
@@ -947,6 +937,18 @@ errno_exec(PyObject *module)
947937 add_errcode ("ENOTCAPABLE" , ENOTCAPABLE , "Capabilities insufficient" );
948938#endif
949939
940+ PyObject * frozendict = PyFrozenDict_New (error_dict );
941+ if (frozendict == NULL ) {
942+ Py_DECREF (error_dict );
943+ return -1 ;
944+ }
945+ if (PyDict_SetItemString (module_dict , "errorcode" , frozendict ) < 0 ) {
946+ Py_DECREF (error_dict );
947+ Py_DECREF (frozendict );
948+ return -1 ;
949+ }
950+ Py_DECREF (frozendict );
951+
950952 Py_DECREF (error_dict );
951953 return 0 ;
952954}
You can’t perform that action at this time.
0 commit comments