[gcc-python-plugin] libcpychecker: implement PyLong_FromVoidPtr
by David Hugh Malcolm
commit 56f1cd14bd30832dda07ae6e5c85815b5a9204d6
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 17:18:46 2011 -0400
libcpychecker: implement PyLong_FromVoidPtr
libcpychecker/refcounts.py | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index ad989ed..2e561ad 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1079,6 +1079,12 @@ class MyState(State):
'PyLongObject', 'PyLong_Type')
return [success, failure]
+ def impl_PyLong_FromVoidPtr(self, stmt):
+ # http://docs.python.org/c-api/long.html#PyLong_FromVoidPtr
+ newobj, success, failure = self.impl_object_ctor(stmt,
+ 'PyLongObject', 'PyLong_Type')
+ return [success, failure]
+
########################################################################
# PyModule_*
########################################################################
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyInt_FromLong
by David Hugh Malcolm
commit 4d0fa8d022522637b748df983e91d58b1630c97f
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 17:15:18 2011 -0400
cpychecker: implement PyInt_FromLong
libcpychecker/refcounts.py | 26 +++++++++++
.../PyInt_FromLong/correct_large_int/input.c | 47 ++++++++++++++++++++
.../PyInt_FromLong/correct_large_int/script.py | 22 +++++++++
.../PyInt_FromLong/correct_large_int/stdout.txt | 41 +++++++++++++++++
.../PyInt_FromLong/correct_small_int/input.c | 44 ++++++++++++++++++
.../PyInt_FromLong/correct_small_int/script.py | 22 +++++++++
.../PyInt_FromLong/correct_small_int/stdout.txt | 21 +++++++++
7 files changed, 223 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 6a36ab3..ad989ed 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -937,6 +937,32 @@ class MyState(State):
return self.make_transitions_for_fncall(stmt, s_success, s_failure)
########################################################################
+ # Py_Int*
+ ########################################################################
+ def impl_PyInt_FromLong(self, stmt):
+ # Declared in intobject.h as:
+ # PyAPI_FUNC(PyObject *) PyInt_FromLong(long);
+ # Defined in Objects/intobject.c
+ #
+ # CPython2 shares objects for integers in the range:
+ # -5 <= ival < 257
+ # within intobject.c's "small_ints" array and these are preallocated
+ # by _PyInt_Init(). Thus, for these values, we know that the call
+ # cannot fail
+
+ args = self.eval_stmt_args(stmt)
+ v_ival = args[0]
+
+ newobj, success, failure = self.impl_object_ctor(stmt,
+ 'PyIntObject', 'PyInt_Type')
+ if isinstance(v_ival, ConcreteValue):
+ if v_ival.value >= -5 and v_ival.value < 257:
+ # We know that failure isn't possible:
+ return [success]
+
+ return [success, failure]
+
+ ########################################################################
# PyList_*
########################################################################
def impl_PyList_Append(self, stmt):
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c
new file mode 100644
index 0000000..6c8d198
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c
@@ -0,0 +1,47 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct reference-handling in a call to PyInt_FromLong for the
+ case where the int is large
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ /*
+ This call could fail, since we're outside the interval [-5..257)
+ 257 is the first value not to be in the "small_ints" array
+ */
+ return PyInt_FromLong(257);
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/script.py b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/stdout.txt b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/stdout.txt
new file mode 100644
index 0000000..9713530
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/stdout.txt
@@ -0,0 +1,41 @@
+Trace 0:
+ Transitions:
+ 'PyInt_FromLong() succeeds'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=34), region=RegionOnHeap('PyIntObject', gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=34)))
+ str(): (struct PyObject *)&RegionOnHeap('PyIntObject', gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=34)) from tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c:34
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=34), region=RegionForGlobal(gcc.VarDecl('PyInt_Type')))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c:29
+
+Trace 1:
+ Transitions:
+ 'PyInt_FromLong() fails'
+ 'returning'
+ Return value:
+ repr(): ConcreteValue(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=34), value=0)
+ str(): (struct PyObject *)0 from tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c:34
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_large_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c
new file mode 100644
index 0000000..220041f
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c
@@ -0,0 +1,44 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct reference-handling in a call to PyInt_FromLong for
+ the case where the int is small
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ /* This call can't fail, since we're in the interval [-5..257) */
+ return PyInt_FromLong(0);
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/script.py b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/stdout.txt b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/stdout.txt
new file mode 100644
index 0000000..e43c122
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/stdout.txt
@@ -0,0 +1,21 @@
+Trace 0:
+ Transitions:
+ 'PyInt_FromLong() succeeds'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=31), region=RegionOnHeap('PyIntObject', gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=31)))
+ str(): (struct PyObject *)&RegionOnHeap('PyIntObject', gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=31)) from tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c:31
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=31), region=RegionForGlobal(gcc.VarDecl('PyInt_Type')))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/PyInt_FromLong/correct_small_int/input.c:29
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyString_FromFormat
by David Hugh Malcolm
commit 8b14e06b49afac7248567a1a726f8acf43ecebd0
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 16:49:39 2011 -0400
cpychecker: implement PyString_FromFormat
libcpychecker/refcounts.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 37371f7..6a36ab3 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1163,6 +1163,19 @@ class MyState(State):
########################################################################
# PyString_*
########################################################################
+ def impl_PyString_FromFormat(self, stmt):
+ # Declared in stringobject.h as:
+ # PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...)
+ # Py_GCC_ATTRIBUTE((format(printf, 1, 2)));
+ # Returns a new reference
+ # http://docs.python.org/c-api/string.html#PyString_FromFormat
+ #
+ # (We do not yet check that the format string matches the types of the
+ # varargs)
+ newobj, t_success, t_failure = self.impl_object_ctor(stmt,
+ 'PyStringObject', 'PyString_Type')
+ return [t_success, t_failure]
+
def impl_PyString_FromString(self, stmt):
# Declared in stringobject.h as:
# PyAPI_FUNC(PyObject *) PyString_FromString(const char *);
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyModule_Add{IntConstant|Object|StringConstant}
by David Hugh Malcolm
commit 47b84e8bbaaa446a15ee0f05011153c6ce02b432
Author: David Malcolm <dmalcolm(a)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'))
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyObject_IsTrue
by David Hugh Malcolm
commit 64acdbd75cc219a030ebf547ffc32ca71493ad4b
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 16:10:14 2011 -0400
cpychecker: implement PyObject_IsTrue
libcpychecker/refcounts.py | 12 ++++
.../refcounts/PyObject_IsTrue/correct/input.c | 44 +++++++++++++
.../refcounts/PyObject_IsTrue/correct/script.py | 22 ++++++
.../refcounts/PyObject_IsTrue/correct/stdout.txt | 68 ++++++++++++++++++++
4 files changed, 146 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 0cf4d52..7fd80ad 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1056,6 +1056,18 @@ class MyState(State):
########################################################################
# PyObject_*
########################################################################
+ def impl_PyObject_IsTrue(self, stmt):
+ # http://docs.python.org/c-api/object.html#PyObject_IsTrue
+ s_true = self.mkstate_concrete_return_of(stmt, 1)
+ s_false = self.mkstate_concrete_return_of(stmt, 0)
+ s_failure = self.mkstate_concrete_return_of(stmt, -1)
+ s_failure.set_exception('PyExc_MemoryError') # arbitrarily chosen error
+
+ fnname = stmt.fn.operand.name
+ return [Transition(self, s_true, '%s() returns 1 (true)' % fnname),
+ Transition(self, s_false, '%s() returns 0 (false)' % fnname),
+ Transition(self, s_failure, '%s() returns -1 (failure)' % fnname)]
+
def impl__PyObject_New(self, stmt):
# Declaration in objimpl.h:
# PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *);
diff --git a/tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c
new file mode 100644
index 0000000..bd50f28
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c
@@ -0,0 +1,44 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct reference-handling in a call to PyObject_IsTrue
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ int is_true = PyObject_IsTrue(self);
+
+ return PyBool_FromLong(is_true);
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyObject_IsTrue/correct/script.py b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyObject_IsTrue/correct/stdout.txt b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/stdout.txt
new file mode 100644
index 0000000..f3da23e
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyObject_IsTrue/correct/stdout.txt
@@ -0,0 +1,68 @@
+Trace 0:
+ Transitions:
+ 'PyObject_IsTrue() returns 1 (true)'
+ 'PyBool_FromLong() returns'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)))
+ str(): (struct PyObject *)&RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)) from tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c:31
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=Region('PyTypeObject for PyBool_FromLong'))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c:28
+
+Trace 1:
+ Transitions:
+ 'PyObject_IsTrue() returns 0 (false)'
+ 'PyBool_FromLong() returns'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)))
+ str(): (struct PyObject *)&RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)) from tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c:31
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=Region('PyTypeObject for PyBool_FromLong'))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c:28
+
+Trace 2:
+ Transitions:
+ 'PyObject_IsTrue() returns -1 (failure)'
+ 'PyBool_FromLong() returns'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)))
+ str(): (struct PyObject *)&RegionOnHeap('PyBool_FromLong', gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31)) from tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c:31
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=31), region=Region('PyTypeObject for PyBool_FromLong'))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyObject_IsTrue/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyObject_Repr
by David Hugh Malcolm
commit 26bf0daec5e289aed38256b21a2c42565896f258
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 16:00:13 2011 -0400
cpychecker: implement PyObject_Repr
libcpychecker/refcounts.py | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index efb2f93..0cf4d52 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1087,6 +1087,15 @@ class MyState(State):
t_failure.dest.set_exception('PyExc_MemoryError')
return [t_success, t_failure]
+ def impl_PyObject_Repr(self, stmt):
+ # Declared in object.h as:
+ # PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *);
+ # Docs:
+ # http://docs.python.org/c-api/object.html#PyObject_Repr
+ newobj, t_success, t_failure = self.impl_object_ctor(stmt,
+ 'PyStringObject', 'PyString_Type')
+ return [t_success, t_failure]
+
def impl_PyObject_Str(self, stmt):
# Declared in object.h as:
# PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
12 years, 9 months
[gcc-python-plugin] cpychecker: make PyDict_New set the ob_type of the new object to &PyDict_Type
by David Hugh Malcolm
commit 1a17d75f688a0d235095fc8029288d1736f2d4e0
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 15:47:57 2011 -0400
cpychecker: make PyDict_New set the ob_type of the new object to &PyDict_Type
libcpychecker/refcounts.py | 4 +-
.../refcounts/PyDict_New/correct/stdout.txt | 6 +-
.../refcounts/PyDict_SetItem/correct/stdout.txt | 136 ++++++++++----------
.../refcounts/PyDict_SetItem/incorrect/stdout.txt | 112 ++++++++--------
.../PyDict_SetItemString/correct/stdout.txt | 60 +++++-----
.../PyDict_SetItemString/incorrect/stdout.txt | 54 ++++----
6 files changed, 187 insertions(+), 185 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 8c120ea..efb2f93 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -786,7 +786,9 @@ class MyState(State):
#t_memoryexc]
def impl_PyDict_New(self, stmt):
- return self.make_transitions_for_new_ref_or_fail(stmt)
+ newobj, t_success, t_failure = self.impl_object_ctor(stmt,
+ 'PyDictObject', 'PyDict_Type')
+ return [t_success, t_failure]
def impl_PyDict_SetItem(self, stmt):
# Declared in dictobject.h:
diff --git a/tests/cpychecker/refcounts/PyDict_New/correct/stdout.txt b/tests/cpychecker/refcounts/PyDict_New/correct/stdout.txt
index a942b69..7a0ba42 100644
--- a/tests/cpychecker/refcounts/PyDict_New/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_New/correct/stdout.txt
@@ -4,10 +4,10 @@ Trace 0:
'taking False path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30)) from tests/cpychecker/refcounts/PyDict_New/correct/input.c:30
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30)) from tests/cpychecker/refcounts/PyDict_New/correct/input.c:30
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_New/correct/input.c', line=30), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
diff --git a/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
index b09d395..cfd5d07 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
@@ -12,10 +12,10 @@ Trace 0:
'taking True path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -54,10 +54,10 @@ Trace 1:
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -96,10 +96,10 @@ Trace 2:
'taking True path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -139,10 +139,10 @@ Trace 3:
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -196,11 +196,11 @@ Trace 4:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -245,11 +245,11 @@ Trace 5:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -294,11 +294,11 @@ Trace 6:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -344,11 +344,11 @@ Trace 7:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -374,7 +374,7 @@ Trace 8:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking True path'
'taking False path'
@@ -393,9 +393,9 @@ Trace 8:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -423,7 +423,7 @@ Trace 9:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking True path'
'taking False path'
@@ -443,9 +443,9 @@ Trace 9:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -473,7 +473,7 @@ Trace 10:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38'
@@ -493,9 +493,9 @@ Trace 10:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -523,7 +523,7 @@ Trace 11:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38'
@@ -544,9 +544,9 @@ Trace 11:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -589,11 +589,11 @@ Trace 12:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -630,11 +630,11 @@ Trace 13:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
@@ -653,7 +653,7 @@ Trace 14:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking True path'
'taking True path'
@@ -671,9 +671,9 @@ Trace 14:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -694,7 +694,7 @@ Trace 15:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38'
@@ -713,9 +713,9 @@ Trace 15:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38:
@@ -750,11 +750,11 @@ Trace 16:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
@@ -766,7 +766,7 @@ Trace 17:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33'
'taking True path'
'taking True path'
'returning'
@@ -783,9 +783,9 @@ Trace 17:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:33
r->ob_refcnt: None
r->ob_type: None
Exception:
diff --git a/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
index f69cf1e..2729164 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
@@ -10,10 +10,10 @@ Trace 0:
'taking True path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -50,10 +50,10 @@ Trace 1:
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -90,10 +90,10 @@ Trace 2:
'taking True path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -131,10 +131,10 @@ Trace 3:
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -186,11 +186,11 @@ Trace 4:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
@@ -233,11 +233,11 @@ Trace 5:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
@@ -280,11 +280,11 @@ Trace 6:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
@@ -328,11 +328,11 @@ Trace 7:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
@@ -356,7 +356,7 @@ Trace 8:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
'taking False path'
'taking True path'
'taking False path'
@@ -375,9 +375,9 @@ Trace 8:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
@@ -403,7 +403,7 @@ Trace 9:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
'taking False path'
'taking True path'
'taking False path'
@@ -423,9 +423,9 @@ Trace 9:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
@@ -451,7 +451,7 @@ Trace 10:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38'
@@ -471,9 +471,9 @@ Trace 10:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
@@ -499,7 +499,7 @@ Trace 11:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38'
@@ -520,9 +520,9 @@ Trace 11:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
@@ -556,11 +556,11 @@ Trace 12:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=38))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
@@ -587,11 +587,11 @@ Trace 13:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=39))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39
@@ -618,11 +618,11 @@ Trace 14:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:33
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
diff --git a/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
index e03c648..7dbb800 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
@@ -9,10 +9,10 @@ Trace 0:
'taking True path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -43,10 +43,10 @@ Trace 1:
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -91,11 +91,11 @@ Trace 2:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=37))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37
@@ -131,11 +131,11 @@ Trace 3:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=37))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37
@@ -154,7 +154,7 @@ Trace 4:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
'taking False path'
'taking True path'
'returning'
@@ -171,9 +171,9 @@ Trace 4:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37:
@@ -194,7 +194,7 @@ Trace 5:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37'
@@ -212,9 +212,9 @@ Trace 5:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37:
@@ -248,11 +248,11 @@ Trace 6:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
@@ -264,7 +264,7 @@ Trace 7:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32'
'taking True path'
'returning'
Return value:
@@ -280,9 +280,9 @@ Trace 7:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:32
r->ob_refcnt: None
r->ob_type: None
Exception:
diff --git a/tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/stdout.txt
index 16dbaa3..41a5989 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/stdout.txt
@@ -8,10 +8,10 @@ Trace 0:
'taking False path'
'returning'
Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32)))
+ str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32)) from tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Region("region-for-arg-gcc.ParmDecl('self')"):
repr(): Region("region-for-arg-gcc.ParmDecl('self')")
str(): Region("region-for-arg-gcc.ParmDecl('self')")
@@ -56,11 +56,11 @@ Trace 1:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=37))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37
@@ -96,11 +96,11 @@ Trace 2:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37:
repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=37))
str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37
@@ -119,7 +119,7 @@ Trace 3:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
'taking False path'
'taking True path'
'returning'
@@ -136,9 +136,9 @@ Trace 3:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37:
@@ -159,7 +159,7 @@ Trace 4:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
'taking False path'
'taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37'
@@ -177,9 +177,9 @@ Trace 4:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: None
r->ob_type: None
PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:37:
@@ -213,11 +213,11 @@ Trace 5:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=Region('PyTypeObject for new ref from call to PyDict_New'))
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
Exception:
RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
@@ -229,7 +229,7 @@ Trace 6:
'taking True path'
'taking False path'
'taking False path'
- 'calling tp_dealloc on new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
+ 'calling tp_dealloc on PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32'
'taking True path'
'returning'
Return value:
@@ -245,9 +245,9 @@ Trace 6:
str(): Region("region-for-arg-gcc.ParmDecl('args')")
r->ob_refcnt: refs: 0 + N where N >= 1
r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
- repr(): RegionOnHeap('new ref from call to PyDict_New', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
- str(): new ref from call to PyDict_New allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
+ PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32:
+ repr(): RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c', line=32))
+ str(): PyDictObject allocated at tests/cpychecker/refcounts/PyDict_SetItemString/incorrect/input.c:32
r->ob_refcnt: None
r->ob_type: None
Exception:
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyTuple_New
by David Hugh Malcolm
commit ae66e6d87b54fd911641b1a7df133a46c78b984b
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 15:41:49 2011 -0400
cpychecker: implement PyTuple_New
libcpychecker/refcounts.py | 8 +++
.../refcounts/PyTuple_New/correct/input.c | 49 ++++++++++++++++++++
.../refcounts/PyTuple_New/correct/script.py | 22 +++++++++
.../refcounts/PyTuple_New/correct/stdout.txt | 43 +++++++++++++++++
4 files changed, 122 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 343d233..8c120ea 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1105,6 +1105,14 @@ class MyState(State):
return [t_success, t_failure]
########################################################################
+ # PyTuple_*
+ ########################################################################
+ def impl_PyTuple_New(self, stmt):
+ newobj, t_success, t_failure = self.impl_object_ctor(stmt,
+ 'PyTupleObject', 'PyTuple_Type')
+ return [t_success, t_failure]
+
+ ########################################################################
# (end of Python API implementations)
########################################################################
diff --git a/tests/cpychecker/refcounts/PyTuple_New/correct/input.c b/tests/cpychecker/refcounts/PyTuple_New/correct/input.c
new file mode 100644
index 0000000..bf2bada
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyTuple_New/correct/input.c
@@ -0,0 +1,49 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct reference-handling in a call to PyTuple_New
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ PyObject *tuple;
+ tuple = PyTuple_New(0);
+ if (!tuple) {
+ return NULL;
+ }
+
+ /* "tuple" should now have an ob_refcnt of 1 */
+ return tuple;
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyTuple_New/correct/script.py b/tests/cpychecker/refcounts/PyTuple_New/correct/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyTuple_New/correct/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyTuple_New/correct/stdout.txt b/tests/cpychecker/refcounts/PyTuple_New/correct/stdout.txt
new file mode 100644
index 0000000..b957a57
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyTuple_New/correct/stdout.txt
@@ -0,0 +1,43 @@
+Trace 0:
+ Transitions:
+ 'PyTuple_New() succeeds'
+ 'taking False path'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=30), region=RegionOnHeap('PyTupleObject', gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=30)))
+ str(): (struct PyObject *)&RegionOnHeap('PyTupleObject', gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=30)) from tests/cpychecker/refcounts/PyTuple_New/correct/input.c:30
+ r->ob_refcnt: refs: 1 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=30), region=RegionForGlobal(gcc.VarDecl('PyTuple_Type')))
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/PyTuple_New/correct/input.c:28
+
+Trace 1:
+ Transitions:
+ 'PyTuple_New() fails'
+ 'taking True path'
+ 'returning'
+ Return value:
+ repr(): ConcreteValue(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=32), value=0)
+ str(): (struct PyObject *)0 from tests/cpychecker/refcounts/PyTuple_New/correct/input.c:32
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyTuple_New/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyErr_SetFromErrno[WithFilename]
by David Hugh Malcolm
commit 0ac0afb457fd3dd609ed4d4ea05dad2c85c2c1b5
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 15:28:00 2011 -0400
cpychecker: implement PyErr_SetFromErrno[WithFilename]
libcpychecker/refcounts.py | 23 +++++++++++
.../refcounts/PyErr_SetFromErrno/correct/input.c | 42 ++++++++++++++++++++
.../refcounts/PyErr_SetFromErrno/correct/script.py | 22 ++++++++++
.../PyErr_SetFromErrno/correct/stdout.txt | 19 +++++++++
4 files changed, 106 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index f56f029..343d233 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -881,6 +881,29 @@ class MyState(State):
t_next.dest.exception_rvalue = make_null_pyobject_ptr(stmt)
return [t_next]
+ def impl_PyErr_SetFromErrno(self, stmt):
+ # API docs:
+ # http://docs.python.org/c-api/exceptions.html#PyErr_SetFromErrno
+ #
+ args = self.eval_stmt_args(stmt)
+ v_exc = args[0]
+ # It always returns NULL:
+ t_next = self.mktrans_assignment(stmt.lhs,
+ make_null_pyobject_ptr(stmt),
+ 'PyErr_SetFromErrno()')
+ t_next.dest.exception_rvalue = v_exc
+ return [t_next]
+
+ def impl_PyErr_SetFromErrnoWithFilename(self, stmt):
+ args = self.eval_stmt_args(stmt)
+ v_exc = args[0]
+ # It always returns NULL:
+ t_next = self.mktrans_assignment(stmt.lhs,
+ make_null_pyobject_ptr(stmt),
+ 'PyErr_SetFromErrnoWithFilename()')
+ t_next.dest.exception_rvalue = v_exc
+ return [t_next]
+
def impl_PyErr_SetString(self, stmt):
# Declared in pyerrors.h:
# PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);
diff --git a/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c
new file mode 100644
index 0000000..5116119
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c
@@ -0,0 +1,42 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct usage of PyErr_SetFromErrno
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ return PyErr_SetFromErrno(PyExc_IOError);
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/script.py b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/stdout.txt b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/stdout.txt
new file mode 100644
index 0000000..d1ade08
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/stdout.txt
@@ -0,0 +1,19 @@
+Trace 0:
+ Transitions:
+ 'PyErr_SetFromErrno()'
+ 'returning'
+ Return value:
+ repr(): ConcreteValue(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c', line=29), value=0)
+ str(): (struct PyObject *)0 from tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c:29
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_SetFromErrno/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ unknown struct PyObject * from /usr/include/python2.7/pyerrors.h:131
12 years, 9 months
[gcc-python-plugin] cpychecker: implement PyErr_NoMemory
by David Hugh Malcolm
commit daa72acc5f534832cab336231f806b0c0d240c04
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 15:18:18 2011 -0400
cpychecker: implement PyErr_NoMemory
libcpychecker/refcounts.py | 13 ++++++
.../refcounts/PyErr_NoMemory/correct/input.c | 42 ++++++++++++++++++++
.../refcounts/PyErr_NoMemory/correct/script.py | 22 ++++++++++
.../refcounts/PyErr_NoMemory/correct/stdout.txt | 19 +++++++++
4 files changed, 96 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 30a2482..f56f029 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -848,6 +848,19 @@ class MyState(State):
t_next.dest.exception_rvalue = v_exc
return [t_next]
+ def impl_PyErr_NoMemory(self, stmt):
+ # Declared in pyerrors.h:
+ # PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);
+ #
+ # Defined in Python/errors.c
+ #
+ # It always returns NULL:
+ t_next = self.mktrans_assignment(stmt.lhs,
+ make_null_pyobject_ptr(stmt),
+ 'PyErr_NoMemory()')
+ t_next.dest.set_exception('PyExc_MemoryError')
+ return [t_next]
+
def impl_PyErr_Print(self, stmt):
# Declared in pythonrun.h:
# PyAPI_FUNC(void) PyErr_Print(void);
diff --git a/tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c
new file mode 100644
index 0000000..d771119
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c
@@ -0,0 +1,42 @@
+/*
+ Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2011 Red Hat, Inc.
+
+ This is free software: you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see
+ <http://www.gnu.org/licenses/>.
+*/
+
+#include <Python.h>
+
+/*
+ Test of correct reference-handling in a call to PyErr_NoMemory
+*/
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ return PyErr_NoMemory();
+}
+static PyMethodDef test_methods[] = {
+ {"test_method", test, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL} /* Sentinel */
+};
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/PyErr_NoMemory/correct/script.py b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/script.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011 Red Hat, Inc.
+#
+# This is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see
+# <http://www.gnu.org/licenses/>.
+
+from libcpychecker import main
+main(verify_refcounting=True,
+ dump_traces=True,
+ show_traces=False)
diff --git a/tests/cpychecker/refcounts/PyErr_NoMemory/correct/stdout.txt b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/stdout.txt
new file mode 100644
index 0000000..6840b2c
--- /dev/null
+++ b/tests/cpychecker/refcounts/PyErr_NoMemory/correct/stdout.txt
@@ -0,0 +1,19 @@
+Trace 0:
+ Transitions:
+ 'PyErr_NoMemory()'
+ 'returning'
+ Return value:
+ repr(): ConcreteValue(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c', line=29), value=0)
+ str(): (struct PyObject *)0 from tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c:29
+ Region("region-for-arg-gcc.ParmDecl('self')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('self')")
+ str(): Region("region-for-arg-gcc.ParmDecl('self')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('self')"))
+ Region("region-for-arg-gcc.ParmDecl('args')"):
+ repr(): Region("region-for-arg-gcc.ParmDecl('args')")
+ str(): Region("region-for-arg-gcc.ParmDecl('args')")
+ r->ob_refcnt: refs: 0 + N where N >= 1
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PyErr_NoMemory/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ RegionForGlobal(gcc.VarDecl('PyExc_MemoryError'))
12 years, 9 months