File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -3040,9 +3040,15 @@ array_modexec(PyObject *m)
3040
3040
Py_TYPE (& PyArrayIter_Type ) = & PyType_Type ;
3041
3041
3042
3042
Py_INCREF ((PyObject * )& Arraytype );
3043
- PyModule_AddObject (m , "ArrayType" , (PyObject * )& Arraytype );
3043
+ if (PyModule_AddObject (m , "ArrayType" , (PyObject * )& Arraytype ) < 0 ) {
3044
+ Py_DECREF ((PyObject * )& Arraytype );
3045
+ return -1 ;
3046
+ }
3044
3047
Py_INCREF ((PyObject * )& Arraytype );
3045
- PyModule_AddObject (m , "array" , (PyObject * )& Arraytype );
3048
+ if (PyModule_AddObject (m , "array" , (PyObject * )& Arraytype ) < 0 ) {
3049
+ Py_DECREF ((PyObject * )& Arraytype );
3050
+ return -1 ;
3051
+ }
3046
3052
3047
3053
for (descr = descriptors ; descr -> typecode != '\0' ; descr ++ ) {
3048
3054
size ++ ;
@@ -3053,13 +3059,11 @@ array_modexec(PyObject *m)
3053
3059
* p ++ = (char )descr -> typecode ;
3054
3060
}
3055
3061
typecodes = PyUnicode_DecodeASCII (buffer , p - buffer , NULL );
3056
-
3057
- PyModule_AddObject (m , "typecodes" , typecodes );
3058
-
3059
- if (PyErr_Occurred ()) {
3060
- Py_DECREF (m );
3061
- m = NULL ;
3062
+ if (PyModule_AddObject (m , "typecodes" , typecodes ) < 0 ) {
3063
+ Py_XDECREF (typecodes );
3064
+ return -1 ;
3062
3065
}
3066
+
3063
3067
return 0 ;
3064
3068
}
3065
3069
You can’t perform that action at this time.
0 commit comments