File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed
Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -304,17 +304,22 @@ PyInit_sonyflake_turbo(void)
304304 }
305305
306306#if defined(Py_GIL_DISABLED ) && !defined(Py_LIMITED_API )
307- if (PyUnstable_Module_SetGIL (module , Py_MOD_GIL_NOT_USED )) {
308- return NULL ;
309- }
307+ PyUnstable_Module_SetGIL (module , Py_MOD_GIL_NOT_USED );
310308#endif
311309
312310 PyObject * sonyflake_cls = PyType_FromSpec (& sonyflake_type_spec );
313311
314- if (!sonyflake_cls )
312+ if (!sonyflake_cls ) {
313+ Py_DECREF (module );
314+ return NULL ;
315+ }
316+
317+ if (PyModule_AddObject (module , "SonyFlake" , sonyflake_cls ) < 0 ) {
318+ Py_DECREF (sonyflake_cls );
319+ Py_DECREF (module );
315320 return NULL ;
321+ }
316322
317- PyModule_AddObject (module , "SonyFlake" , sonyflake_cls );
318323 PyModule_AddIntMacro (module , SONYFLAKE_EPOCH );
319324 PyModule_AddIntMacro (module , SONYFLAKE_SEQUENCE_BITS );
320325 PyModule_AddIntMacro (module , SONYFLAKE_SEQUENCE_MAX );
You can’t perform that action at this time.
0 commit comments