[issue15849] PEP 3121, 384 Refactoring applied to xx module
Alexander Belopolsky
report at bugs.python.org
Mon Sep 3 01:37:12 CEST 2012
Alexander Belopolsky added the comment:
+#define xx_state_global
+ ((xxstate *)PyModule_GetState(PyState_FindModule(&xxmodule)))
This is unsafe: PyState_FindModule(&xxmodule) can return NULL. I think code should account for this possibility and not use this macro. For example, XxoObject_Check(v) should be defined as
(PyState_FindModule(&xxmodule) == NULL ? 0 : \
(Py_TYPE(v) == xx_state(PyState_FindModule(&xxmodule))->Xxo_Type))
(Should this also check PyModule_GetState() return?)
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15849>
_______________________________________
More information about the Python-bugs-list
mailing list