commit 47b84e8bbaaa446a15ee0f05011153c6ce02b432 Author: David Malcolm dmalcolm@redhat.com Date: Fri Sep 2 16:36:13 2011 -0400
cpychecker: implement PyModule_Add{IntConstant|Object|StringConstant}
This also covers the PyModule_AddIntMacro and PyModule_AddStringMacro macros
libcpychecker/refcounts.py | 43 ++ tests/cpychecker/refcounts/module_handling/input.c | 28 ++ .../refcounts/module_handling/stdout.txt | 477 +++++++++++++++++++- 3 files changed, 543 insertions(+), 5 deletions(-) --- diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py index 7fd80ad..37371f7 100644 --- a/libcpychecker/refcounts.py +++ b/libcpychecker/refcounts.py @@ -1054,6 +1054,49 @@ class MyState(State): return [success, failure]
######################################################################## + # PyModule_* + ######################################################################## + def impl_PyModule_AddIntConstant(self, stmt): + # http://docs.python.org/c-api/module.html#PyModule_AddIntConstant + + # (No externally-visible refcount changes) + s_success = self.mkstate_concrete_return_of(stmt, 0) + + # Can fail with memory error, overflow error: + s_failure = self.mkstate_concrete_return_of(stmt, -1) + s_failure.set_exception('PyExc_MemoryError') + + return self.make_transitions_for_fncall(stmt, s_success, s_failure) + + def impl_PyModule_AddObject(self, stmt): + # Steals a reference to the object if if succeeds: + # http://docs.python.org/c-api/module.html#PyModule_AddObject + # Implemented in Python/modsupport.c + v_module, v_name, v_value = self.eval_stmt_args(stmt) + + # On success, steals a ref from v_value: + s_success = self.mkstate_concrete_return_of(stmt, 0) + s_success.steal_reference(v_value.region) + + # Can fail with memory error, overflow error: + s_failure = self.mkstate_concrete_return_of(stmt, -1) + s_failure.set_exception('PyExc_MemoryError') + + return self.make_transitions_for_fncall(stmt, s_success, s_failure) + + def impl_PyModule_AddStringConstant(self, stmt): + # http://docs.python.org/c-api/module.html#PyModule_AddStringConstant + + # (No externally-visible refcount changes) + s_success = self.mkstate_concrete_return_of(stmt, 0) + + # Can fail with memory error, overflow error: + s_failure = self.mkstate_concrete_return_of(stmt, -1) + s_failure.set_exception('PyExc_MemoryError') + + return self.make_transitions_for_fncall(stmt, s_success, s_failure) + + ######################################################################## # PyObject_* ######################################################################## def impl_PyObject_IsTrue(self, stmt): diff --git a/tests/cpychecker/refcounts/module_handling/input.c b/tests/cpychecker/refcounts/module_handling/input.c index 4889329..dea28dc 100644 --- a/tests/cpychecker/refcounts/module_handling/input.c +++ b/tests/cpychecker/refcounts/module_handling/input.c @@ -37,17 +37,45 @@ static struct PyModuleDef example_module_def = { }; #endif
+#define MY_INT_MACRO (42) +#define MY_STRING_MACRO ("Arthur") + static PyMODINIT_FUNC PyInit_example(void) { PyObject *m; + PyObject *obj; #if PY_MAJOR_VERSION == 3 m = PyModule_Create(&example_module_def); #else m = Py_InitModule("example", ExampleMethods); #endif
+ if (!m) { + goto error; + } + + /* Exercise the various PyModule_Add* entrypoints: */ + obj = PyDict_New(); + if (!obj) { + goto error; + } + + /* We now own a ref on "obj", which PyModule_AddObject steals: */ + if (-1 == PyModule_AddObject(m, "obj", obj)) { + Py_DECREF(obj); + goto error; + } + + PyModule_AddIntConstant(m, "int_constant", 42); + PyModule_AddStringConstant(m, "string_constant", "Marvin"); + PyModule_AddIntMacro(m, MY_INT_MACRO); + PyModule_AddStringMacro(m, MY_STRING_MACRO); + + error: #if PY_MAJOR_VERSION == 3 return m; +#else + (void)0; /* to avoid "label at end of compound statement" error */ #endif }
diff --git a/tests/cpychecker/refcounts/module_handling/stdout.txt b/tests/cpychecker/refcounts/module_handling/stdout.txt index eb35af6..258f597 100644 --- a/tests/cpychecker/refcounts/module_handling/stdout.txt +++ b/tests/cpychecker/refcounts/module_handling/stdout.txt @@ -1,18 +1,485 @@ Trace 0: Transitions: 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' 'returning' - output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:46: - repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=46)) - str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:46 + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 r->ob_refcnt: refs: 0 + N where N >= 1 - r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=46), region=Region('PyTypeObject for output from Py_InitModule4')) + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) Exception: - (struct PyObject *)0 from tests/cpychecker/refcounts/module_handling/input.c:41 + (struct PyObject *)0 from tests/cpychecker/refcounts/module_handling/input.c:44
Trace 1: Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 2: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 3: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 4: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 5: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 6: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 7: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 8: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 9: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 10: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 11: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 12: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 13: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() succeeds' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 14: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() succeeds' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 15: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() succeeds' + 'taking False path' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'PyModule_AddIntConstant() fails' + 'PyModule_AddStringConstant() fails' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 16: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() fails' + 'taking True path' + 'taking True path' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: refs: 0 + N where N >= 0 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58), region=RegionForGlobal(gcc.VarDecl('PyDict_Type'))) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 17: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() succeeds' + 'taking False path' + 'PyModule_AddObject() fails' + 'taking True path' + 'taking False path' + 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58: + repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=58)) + str(): PyDictObject allocated at tests/cpychecker/refcounts/module_handling/input.c:58 + r->ob_refcnt: None + r->ob_type: None + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 18: + Transitions: + 'Py_InitModule4_64() succeeds' + 'taking False path' + 'PyDict_New() fails' + 'taking True path' + 'returning' + output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50: + repr(): RegionOnHeap('output from Py_InitModule4', gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50)) + str(): output from Py_InitModule4 allocated at tests/cpychecker/refcounts/module_handling/input.c:50 + r->ob_refcnt: refs: 0 + N where N >= 1 + r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/module_handling/input.c', line=50), region=Region('PyTypeObject for output from Py_InitModule4')) + Exception: + RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) + +Trace 19: + Transitions: 'Py_InitModule4_64() fails' + 'taking True path' 'returning' Exception: RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
gcc-python-plugin-commits@lists.stg.fedorahosted.org