File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ What's New in Python 3.6.0 beta 1
1010Core and Builtins
1111-----------------
1212
13+ - Issue #27587: Fix another issue found by PVS-Studio: Null pointer check
14+ after use of 'def' in _PyState_AddModule().
15+ Initial patch by Christian Heimes.
16+
1317- Issue #27792: The modulo operation applied to ``bool`` and other
1418 ``int`` subclasses now always returns an ``int``. Previously
1519 the return type depended on the input values. Patch by Xiang Zhang.
Original file line number Diff line number Diff line change @@ -285,14 +285,16 @@ int
285285_PyState_AddModule (PyObject * module , struct PyModuleDef * def )
286286{
287287 PyInterpreterState * state ;
288+ if (!def ) {
289+ assert (PyErr_Occurred ());
290+ return -1 ;
291+ }
288292 if (def -> m_slots ) {
289293 PyErr_SetString (PyExc_SystemError ,
290294 "PyState_AddModule called on module with slots" );
291295 return -1 ;
292296 }
293297 state = GET_INTERP_STATE ();
294- if (!def )
295- return -1 ;
296298 if (!state -> modules_by_index ) {
297299 state -> modules_by_index = PyList_New (0 );
298300 if (!state -> modules_by_index )
You can’t perform that action at this time.
0 commit comments