[gcc-python-plugin: 1/2] misc/fedora: rewrite generate_index_html as a new Index class
by David Hugh Malcolm
commit 1e0d13c7d3137cf411f10e0d59075fc02b2581a5
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Wed Feb 29 12:14:59 2012 -0500
misc/fedora: rewrite generate_index_html as a new Index class
misc/fedora/makeindex.py | 133 ++++++++++++++++++++++---------------------
misc/fedora/mass-rebuild.py | 20 +++++-
2 files changed, 85 insertions(+), 68 deletions(-)
---
diff --git a/misc/fedora/makeindex.py b/misc/fedora/makeindex.py
index 06c71df..9f23aa6 100644
--- a/misc/fedora/makeindex.py
+++ b/misc/fedora/makeindex.py
@@ -258,60 +258,61 @@ class BuildLog:
if "AttributeError: 'NoneType' object has no attribute 'vars'" in line:
self.cplusplus_failure = True
-def generate_index_html(path, title):
- outpath = os.path.join(path, 'index.html')
- with open(outpath, 'w') as f:
- f.write('<html><head><title>%s</title></head>\n' % title)
- f.write(' <body>\n')
-
- f.write(' <h1>%s</h1>\n' % title)
- f.write(" <p>This is a summary of errors seen when compiling with <a href='https://fedorahosted.org/gcc-python-plugin/'>an experimental static analysis tool</a></p>")
- f.write(' <p>Raw build logs can be seen <a href="build.log">here</a></p>\n')
-
- buildlog = BuildLog(path)
- if not buildlog.seen_plugin:
- f.write(' <p>The GCC arguments for invoking the plugin were\n'
- ' not seen in the build logs: did the plugin actually\n'
- ' get run?</p>')
- srpm = Srpm.from_path(path)
- BugReportDb.add_status(srpm,
- "TODO: isn't being built with the correct build flags, so plugin is not run")
-
- if buildlog.cplusplus_failure:
- f.write(' <p>C++ failure</p>\n')
- srpm = Srpm.from_path(path)
- BugReportDb.add_status(srpm, "FIXME: C++")
-
- # Gather the ErrorReport by severity
- triager = Triager()
-
- # mapping from Severity to list of ErrorReport
- severities = {}
- num_reports = 0
-
- for dirpath, dirnames, filenames in os.walk(path):
- #print dirpath, dirnames, filenames
- for filename in filenames:
- if filename.endswith('-refcount-errors.html'):
- #print ' ', os.path.join(dirpath, filename)
- htmlpath = os.path.join(dirpath, filename)
- for er in get_errors_from_file(htmlpath):
- #print(er.filename)
- #print(er.function)
- #print(er.errmsg)
- sev = triager.classify(er)
- #print(sev)
- if sev in severities:
- severities[sev].append(er)
- else:
- severities[sev] = [er]
-
- for sev in sorted(severities.keys())[::-1]:
+class Index:
+ def __init__(self, path, title):
+ outpath = os.path.join(path, 'index.html')
+ with open(outpath, 'w') as f:
+ f.write('<html><head><title>%s</title></head>\n' % title)
+ f.write(' <body>\n')
+
+ f.write(' <h1>%s</h1>\n' % title)
+ f.write(" <p>This is a summary of errors seen when compiling with <a href='https://fedorahosted.org/gcc-python-plugin/'>an experimental static analysis tool</a></p>")
+ f.write(' <p>Raw build logs can be seen <a href="build.log">here</a></p>\n')
+
+ buildlog = BuildLog(path)
+ if not buildlog.seen_plugin:
+ f.write(' <p>The GCC arguments for invoking the plugin were\n'
+ ' not seen in the build logs: did the plugin actually\n'
+ ' get run?</p>')
+ srpm = Srpm.from_path(path)
+ BugReportDb.add_status(srpm,
+ "TODO: isn't being built with the correct build flags, so plugin is not run")
+
+ if buildlog.cplusplus_failure:
+ f.write(' <p>C++ failure</p>\n')
+ srpm = Srpm.from_path(path)
+ BugReportDb.add_status(srpm, "FIXME: C++")
+
+ # Gather the ErrorReport by severity
+ triager = Triager()
+
+ # mapping from Severity to list of ErrorReport
+ self.severities = {}
+ self.num_reports = 0
+
+ for dirpath, dirnames, filenames in os.walk(path):
+ #print dirpath, dirnames, filenames
+ for filename in filenames:
+ if filename.endswith('-refcount-errors.html'):
+ #print ' ', os.path.join(dirpath, filename)
+ htmlpath = os.path.join(dirpath, filename)
+ for er in get_errors_from_file(htmlpath):
+ #print(er.filename)
+ #print(er.function)
+ #print(er.errmsg)
+ sev = triager.classify(er)
+ #print(sev)
+ if sev in self.severities:
+ self.severities[sev].append(er)
+ else:
+ self.severities[sev] = [er]
+
+ for sev, issues in self.iter_severities():
f.write(' <h2>%s</h2>\n' % sev.title)
f.write(' %s\n' % sev.description)
f.write(' <table>\n')
- for er in severities[sev]:
- num_reports += 1
+ for er in issues:
+ self.num_reports += 1
href = os.path.relpath(er.href(), path)
f.write(' <tr> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> <td><a href=%s>%s</a></td> </tr>'
% (href, er.filename,
@@ -319,20 +320,24 @@ def generate_index_html(path, title):
href, er.errmsg))
f.write(' </table>\n')
- if buildlog.unimplemented_functions:
- f.write(' <h2>Implementation notes for gcc-with-cpychecker</h2>\n')
- f.write(' <p>The following "Py" functions were used but aren\'t\n'
- ' yet explicitly handled by gcc-with-cpychecker</p>\n'
- ' <ul>\n')
- for fnname in sorted(buildlog.unimplemented_functions):
- f.write(' <li><pre>%s</pre></li>\n' % fnname)
- f.write(' </ul>\n')
+ if buildlog.unimplemented_functions:
+ f.write(' <h2>Implementation notes for gcc-with-cpychecker</h2>\n')
+ f.write(' <p>The following "Py" functions were used but aren\'t\n'
+ ' yet explicitly handled by gcc-with-cpychecker</p>\n'
+ ' <ul>\n')
+ for fnname in sorted(buildlog.unimplemented_functions):
+ f.write(' <li><pre>%s</pre></li>\n' % fnname)
+ f.write(' </ul>\n')
- if num_reports == 0 and not buildlog.unimplemented_functions:
- f.write(' <p>Nothing was reported; did the plugin run correctly?\n')
+ if self.num_reports == 0 and not buildlog.unimplemented_functions:
+ f.write(' <p>Nothing was reported; did the plugin run correctly?\n')
- f.write(' </body>\n')
- f.write('</html>\n')
+ f.write(' </body>\n')
+ f.write('</html>\n')
+
+ def iter_severities(self):
+ for sev in sorted(self.severities.keys())[::-1]:
+ yield sev, self.severities[sev]
def main():
# locate .html
@@ -340,7 +345,7 @@ def main():
for resultdir in os.listdir('LOGS'):
resultpath = os.path.join('LOGS', resultdir)
print(resultpath)
- generate_index_html(resultpath, 'Errors seen in %s' % resultdir)
+ index = Index(resultpath, 'Errors seen in %s' % resultdir)
if __name__ == '__main__':
main()
diff --git a/misc/fedora/mass-rebuild.py b/misc/fedora/mass-rebuild.py
index b435aa3..c929daa 100644
--- a/misc/fedora/mass-rebuild.py
+++ b/misc/fedora/mass-rebuild.py
@@ -15,6 +15,7 @@
# along with this program. If not, see
# <http://www.gnu.org/licenses/>.
+import commands
import datetime
import glob
import os
@@ -25,7 +26,7 @@ import sys
import webbrowser
from bugreporting import NewBug, BugReportDb
-from makeindex import generate_index_html
+from makeindex import Index
def nvr_from_srpm_path(path):
filename = os.path.basename(path)
@@ -163,7 +164,7 @@ def local_rebuild_of_srpm_in_mock(srpmpath, mockcfg):
PLUGIN_PATH='gcc-python2-plugin-0.9-1.fc16.x86_64.rpm'
MOCK_CONFIG='fedora-16-x86_64'
-def prepare_bug_report(srpmpath):
+def prepare_bug_report(srpmpath, index):
srpmname, version, release = nvr_from_srpm_path(srpmpath)
resultdir = get_result_dir(srpmpath)
@@ -183,8 +184,16 @@ def prepare_bug_report(srpmpath):
reporturl = 'http://fedorapeople.org/~dmalcolm/gcc-python-plugin/%(datestr)s/%(srpmnam...' % locals()
+ gitversion = commands.getoutput('git rev-parse HEAD')
+
# FIXME:
- gitversion='073d390de53ef52136bd90e5ac06f1ef833d047d'
+ categorized_notes = ''
+ for sev, issues in index.iter_severities():
+ categorized_notes += ('Within the category "%s" the %i issues reported\n'
+ % (sev.title, len(issues)))
+ for er in issues:
+ categorized_notes += ('%s:%s:%s\n' % (er.filename, er.function, er.errmsg))
+ categorized_notes += '\n'
comment = """
Description of problem:
@@ -199,7 +208,10 @@ I ran the latest version of the tool (in git master; post 0.9) on
You can see a list of errors here, triaged into categories (from most significant to least significant):
%(reporturl)s
-FIXME: add notes on the bugs here
+I've manually reviewed the issues reported by the tool.
+
+FIXME:
+%(categorized_notes)s
There may of course be other bugs in my checker tool.
12 years, 2 months
[gcc-python-plugin] cpychecker: in Cython-generated code, __Pyx_GetStdout returns a borrowed reference
by David Hugh Malcolm
commit 39668618cc613064fcb5761def4d911e858dad20
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Wed Feb 29 14:59:15 2012 -0500
cpychecker: in Cython-generated code, __Pyx_GetStdout returns a borrowed reference
libcpychecker/attributes.py | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libcpychecker/attributes.py b/libcpychecker/attributes.py
index d76020c..7f70404 100644
--- a/libcpychecker/attributes.py
+++ b/libcpychecker/attributes.py
@@ -1,5 +1,5 @@
-# Copyright 2011 David Malcolm <dmalcolm(a)redhat.com>
-# Copyright 2011 Red Hat, Inc.
+# Copyright 2011, 2012 David Malcolm <dmalcolm(a)redhat.com>
+# Copyright 2011, 2012 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
@@ -19,8 +19,10 @@ import gcc
from gccutils import check_isinstance
from libcpychecker.types import register_type_object
-# Recorded attribute data:
-fnnames_returning_borrowed_refs = set()
+# Recorded attribute data, primed with some special-case knowledge about
+# the code that Cython generates:
+fnnames_returning_borrowed_refs = set(['__Pyx_GetStdout'])
+
fnnames_setting_exception = set()
fnnames_setting_exception_on_negative_result = set()
12 years, 2 months
[gcc-python-plugin] cpychecker: implement PyFile_WriteObject
by David Hugh Malcolm
commit 5b9c38fd25af01c5f52c1bf691ec5083c0facd27
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Wed Feb 29 14:57:22 2012 -0500
cpychecker: implement PyFile_WriteObject
docs/cpychecker.rst | 1 +
libcpychecker/refcounts.py | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/docs/cpychecker.rst b/docs/cpychecker.rst
index 013dffa..525b2ad 100644
--- a/docs/cpychecker.rst
+++ b/docs/cpychecker.rst
@@ -637,6 +637,7 @@ known to the checker are:
`PyEval_SaveThread <http://docs.python.org/c-api/init.html#PyEval_SaveThread>`_,
`Py_FatalError <http://docs.python.org/c-api/sys.html#Py_FatalError>`_,
`PyFile_SoftSpace <http://docs.python.org/c-api/file.html#PyFile_SoftSpace>`_,
+`PyFile_WriteObject <http://docs.python.org/c-api/file.html#PyFile_WriteObject>`_,
`PyFile_WriteString <http://docs.python.org/c-api/file.html#PyFile_WriteString>`_,
`Py_Finalize <http://docs.python.org/c-api/init.html#Py_Finalize>`_,
`PyFrame_New`,
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 4a47e59..98fcab0 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -1662,6 +1662,22 @@ class CPython(Facet):
UnknownValue.make(returntype, stmt.loc),
fnmeta.name)]
+ def impl_PyFile_WriteObject(self, stmt, v_obj, v_p, v_flags):
+ fnmeta = FnMeta(name='PyFile_WriteObject',
+ docurl='http://docs.python.org/c-api/file.html#PyFile_WriteObject',
+ prototype='int PyFile_WriteObject(PyObject *obj, PyObject *p, int flags)',
+ defined_in='Objects/fileobject.c')
+ # used in Cython-generated code, in static int __Pyx_Print()
+ returntype = stmt.fn.type.dereference.type
+
+ # FIXME: gracefully handles NULL for second argument, but not for first
+ s_success = self.state.mkstate_concrete_return_of(stmt, 0)
+ s_failure = self.state.mkstate_concrete_return_of(stmt, -1)
+ # Various errors can happen; this is just one:
+ s_failure.cpython.set_exception('PyExc_IOError', stmt.loc)
+ return self.state.make_transitions_for_fncall(stmt, fnmeta,
+ s_success, s_failure)
+
def impl_PyFile_WriteString(self, stmt, v_s, v_p):
fnmeta = FnMeta(name='PyFile_WriteString',
docurl='http://docs.python.org/c-api/file.html#PyFile_WriteString',
12 years, 2 months
[gcc-python-plugin] misc/fedora: update status of mass rebuild
by David Hugh Malcolm
commit c3290270af585113f80507e46c9d1a46bf9c1baa
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Wed Feb 29 12:09:16 2012 -0500
misc/fedora: update status of mass rebuild
misc/fedora/bugreports.txt | 54 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 51 insertions(+), 3 deletions(-)
---
diff --git a/misc/fedora/bugreports.txt b/misc/fedora/bugreports.txt
index c18dd2c..1fcebb6 100644
--- a/misc/fedora/bugreports.txt
+++ b/misc/fedora/bugreports.txt
@@ -48,10 +48,26 @@ deltarpm-3.6-0.7.20110223git.fc17 rhbz#791359 http://fedorapeople.org/~dm
font-manager-0.5.7-4.fc17 rhbz#794528 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-16/font-manag...
ganglia-3.1.7-5.fc17 rhbz#794532 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-16/ganglia-3....
+# 2012-02-17
+libewf-20100226-4.fc17 rhbz#794874 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-17/libewf-201...
+
+libopensync-plugin-python-0.22-6.fc17 rhbz#794879 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-17/libopensyn...
+
+# 2012-02-18
+libpwquality-1.0.0-2.fc17 rhbz#794989 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/libpwquali...
+libtdb-1.2.9-14.fc17 rhbz#794991 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/libtdb-1.2...
+lunatic-python-1.0.1-0.6.20090917bzr.fc17 rhbz#794995 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/lunatic-py...
+nautilus-python-1.1-1.fc17 rhbz#795001 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/nautilus-p...
+net-snmp-5.7.1-4.fc17 rhbz#795002 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/net-snmp-5...
+postgresql-9.1.2-2.fc17 rhbz#795011 http://fedorapeople.org/~dmalcolm/gcc-python-plugin/2012-02-18/postgresql...
+
+
############################################################################
# The following are grouped by rough category:
############################################################################
+
+
# False positives:
Mayavi-3.4.0-2.fc15 Only false positives
PyYAML-3.10-2.fc17 Only false positives
@@ -60,6 +76,10 @@ dbus-python-0.83.0-9.fc17 Only false positives
python-pycurl-7.19.0-9.fc15 Only false positives
brltty-4.3-4.fc17 Only false positives
dracut-modules-olpc-0.6.1-2.fc17 Appear to all be false positives
+mod_scgi-1.13-5.fc15 Only a false positive
+ntop-4.1.0-3.fc17 Only false positives
+numpy-1.6.1-2.fc17 Only false positives (bugs in cpychecker's union-handling)
+opensips-1.7.1-3.fc17 Only false positives
# Not worth fixing:
calibre-0.8.39-1.fc17 Only when module initialization fails
@@ -67,6 +87,7 @@ cwiid-0.6.00-18.20100505gitfadf11e.fc17 Only in module initialization
fonttools-2.3-4.fc17 Only in module initialization
freeipa-2.1.90-0.1.fc17 Only in module initialization
glade3-3.10.2-3.fc17 Only in module initialization
+mirage-0.9.5.2-2.fc17 Signedness of PyArg_Parse
# FIXMEs:
libsemanage-2.1.6-2.fc17.src.rpm FIXME: build.log has: error: File /builddir/build/SOURCES/libsemanage-rhat.patch is smaller than 13 bytes
@@ -104,6 +125,9 @@ libtevent-0.9.15-1.fc17 TODO: isn't being built with the correct build flags, s
listen-0.6.5-7.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
marble-4.8.0-6.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
mercurial-2.1-1.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
+mx-3.2.1-2.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
+mypaint-1.0.0-2.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
+newt-0.52.14-2.fc17 TODO: the python code isn't being built with the correct flags
policycoreutils-2.1.10-21.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
py-bcrypt-0.2-6.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
py-radix-0.5-9.fc17 TODO: isn't being built with the correct build flags, so plugin is not run
@@ -243,6 +267,8 @@ cyphesis-0.5.26-5.fc17 FIMXE: configure: error: C++ compiler cannot create exec
gdl-0.9.2-3.fc17 FIXME: configure: error: C++ compiler cannot create executables
glom-1.18.6-1.fc17 FIXME: configure: error: Failed to compile test program for Python embedding.
inkscape-0.48.2-1.fc17 FIXME: configure: error: C++ compiler cannot create executables
+nordugrid-arc-1.1.0-2.fc17 FIXME: configure: error: C++ compiler cannot create executables
+
# Fortran support:
getdata-0.7.3-2.fc17 FIXME: configure: error: cannot compile a simple Fortran program
@@ -262,7 +288,9 @@ freeradius-2.1.12-5.fc17 FIXME: some tracebacks during build
gcompris-12.01-1.fc17 FIXME: lots of tracebacks during build
gnome-hearts-0.3-10.fc17 FIXME: some tracebacks during build
gtkparasite-0-0.8.20090120git928494e5.fc17 FIXME: some tracebacks during build
-
+libdmtx-0.7.2-6.fc17 FIXME: some tracebacks during build
+linkchecker-6.5-4.fc17 FIXME: lots of tracebacks during build
+mod_wsgi-3.3-2.fc17 FIXME: lots of tracebacks during build
# To be reported:
PyGreSQL-4.0-4.fc17 FIXME: to be reported
@@ -287,12 +315,20 @@ autobuild-applet-1.0.3-14.fc17 FIXME: false positive?
bzr-2.5-0.2.b5.fc17 FIXME: various false positives (I think) in Cython-generated code
+mpi4py-1.3-2.fc17 FIXME: Cython-generated; various false positives (I think)
+pocketsphinx-0.7-4.fc17 FIXME: Cython-generated
+
-gdal-1.7.3-12.fc17 FIXME:
+gdal-1.7.3-12.fc17 FIXME: new build flags broke a "sed"
# it's confused by the /test.py in the build flags:
# + sed -i -e 's/$(LD)/g++ -L..\/..\/.libs\/ -fplugin=python2 -fplugin-arg-python2-script=/test.py -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic/g' swig/ruby/RubyMakefile.mk
# sed: -e expression #1, char 77: unknown option to `s'
+lcgdm-1.8.2-2.fc17 FIXME: new build flags broke a "sed"
+# sed: -e expression #1, char 58: unknown option to `s'
+# + sed 's/^CC +=/& -fplugin=python2 -fplugin-arg-python2-script=/test.py -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing/' -i config/linux.cf
+
+libftdi-0.19-3.fc17 FIXME: checking if we can build the C++ wrapper... ./configure: line 382: test: we: integer expression expected
kernel-3.3.0-0.rc3.git5.1.fc17 FIXME:
# only reference to python seems to be:
@@ -307,9 +343,21 @@ gnubg-0.9.0.1-14.fc17 FIXME: wrong mock config? configure: error: Package re
guake-0.4.2-6.fc17 TODO
h5py-2.0.1-1.fc17 TODO
iscsi-initiator-utils-6.2.0.872-18.fc17 TODO
+libpeas-1.2.0-2.fc17 TODO
+libtalloc-2.0.7-4.fc17 TODO
-
+# Various packages using SWIG; I probably need to add some specialcasing
+# to the checker for SWIG:
ibus-anthy-1.2.6-5.fc17 TODO: SWIG-built
input-pad-1.0.1-3.fc17 TODO: SWIG-built
+libopensync-0.22-11.fc17 TODO: SWIG-built
+libpreludedb-1.0.0-10.fc17 TODO: SWIG-built
+libteam-0.1-3.20120130gitb5cf2a8.fc17 TODO: SWIG-built
+m2crypto-0.21.1-6.fc17 TODO: SWIG-built
+obexftp-0.23-9.fc17 TODO: SWIG-built
ldns-1.6.12-1.fc17 FIXME: many errors
+
+mod_python-3.3.1-17.fc17 FIXME: Was only partially run
+
+mysql-workbench-5.2.37-4.fc17 FIXME: configure: error: "BOOST library is missing"
12 years, 2 months
[gcc-python-plugin] cpychecker: update RefcountValue equality to exclude cases prevented by the external value
by David Hugh Malcolm
commit 32667b73f1881c6486b6b6f07e7f296cad970c4e
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Tue Feb 28 17:11:39 2012 -0500
cpychecker: update RefcountValue equality to exclude cases prevented by the external value
Update RefcountValue.eval_comparison('eq', rhs) to use get_min_value() rather
than relvalue, thus taking self.min_external into account.
This fixes some cases where the checker erroneously considered the case
of a deallocation by:
Py_DECREF(obj)
where "obj" provably had other references not owned by the function being
analyzed, and thus for the case where obj->ob_refcnt > 1 the deallocation
could not happen.
libcpychecker/refcounts.py | 2 +-
.../refcounts/PyDict_SetItem/correct/stdout.txt | 119 +++-----------------
.../refcounts/PyDict_SetItem/incorrect/stdout.txt | 109 +++----------------
.../PyDict_SetItemString/correct/stdout.txt | 48 +-------
.../refcounts/PySys_SetObject/correct/stdout.txt | 37 +------
.../Py_BuildValue/correct-code-O/stdout.txt | 37 +------
tests/cpychecker/refcounts/loop_n_times/stdout.txt | 47 +-------
.../refcounts/object_from_callback/stdout.txt | 99 +++--------------
8 files changed, 66 insertions(+), 432 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 1318ad8..4a47e59 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -177,7 +177,7 @@ class RefcountValue(AbstractValue):
if isinstance(rhs, ConcreteValue):
log('comparing refcount value %s with concrete value: %s', self, rhs)
# The actual value of ob_refcnt >= lhs.relvalue
- if self.relvalue > rhs.value:
+ if self.get_min_value() > rhs.value:
# (Equality is thus not possible for this case)
return False
diff --git a/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
index 992f4d9..f83eb4f 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItem/correct/stdout.txt
@@ -9,7 +9,7 @@ Trace 0:
'when PyDict_SetItem() succeeds'
'taking False path'
'when taking True path'
- 'when taking True path'
+ '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('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
@@ -49,51 +49,9 @@ Trace 1:
'taking False path'
'when PyDict_SetItem() succeeds'
'taking False path'
- 'when taking True path'
- 'when taking False path'
- '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('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=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')")
- 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('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/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- 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
- 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=38), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
- PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=43))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:28
-
-Trace 2:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
'when taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38'
- 'when taking True path'
+ '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('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=33)))
@@ -123,50 +81,7 @@ Trace 2:
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:28
-Trace 3:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
- 'when taking False path'
- 'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38'
- 'when taking False path'
- '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('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=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')")
- 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('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/PyDict_SetItem/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- 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
- r->ob_refcnt: None
- r->ob_type: None
- PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c', line=43))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:28
-
-Trace 4:
+Trace 2:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -214,7 +129,7 @@ Trace 4:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 5:
+Trace 3:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -263,7 +178,7 @@ Trace 5:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 6:
+Trace 4:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -312,7 +227,7 @@ Trace 6:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 7:
+Trace 5:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -362,7 +277,7 @@ Trace 7:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 8:
+Trace 6:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -411,7 +326,7 @@ Trace 8:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 9:
+Trace 7:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -461,7 +376,7 @@ Trace 9:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 10:
+Trace 8:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -511,7 +426,7 @@ Trace 10:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 11:
+Trace 9:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -562,7 +477,7 @@ Trace 11:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:48
-Trace 12:
+Trace 10:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -602,7 +517,7 @@ Trace 12:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
-Trace 13:
+Trace 11:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -643,7 +558,7 @@ Trace 13:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
-Trace 14:
+Trace 12:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -684,7 +599,7 @@ Trace 14:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
-Trace 15:
+Trace 13:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -726,7 +641,7 @@ Trace 15:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:43
-Trace 16:
+Trace 14:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -758,7 +673,7 @@ Trace 16:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
-Trace 17:
+Trace 15:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -791,7 +706,7 @@ Trace 17:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/correct/input.c:38
-Trace 18:
+Trace 16:
Transitions:
'when PyDict_New() fails'
'taking True path'
diff --git a/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
index ee046ce..42b2ff1 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItem/incorrect/stdout.txt
@@ -7,7 +7,7 @@ Trace 0:
'when PyDict_SetItem() succeeds'
'taking False path'
'when taking True path'
- 'when taking True path'
+ '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('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
@@ -45,49 +45,9 @@ Trace 1:
'when PyLong_FromLong() succeeds'
'when PyDict_SetItem() succeeds'
'taking False path'
- 'when taking True path'
- 'when taking False path'
- '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('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=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')")
- 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('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/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- 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
- 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=38), region=RegionForGlobal(gcc.VarDecl('PyLong_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
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:28
-
-Trace 2:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'when PyLong_FromLong() succeeds'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
'when taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38'
- 'when taking True path'
+ '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('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c', line=33)))
@@ -117,48 +77,7 @@ Trace 2:
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:28
-Trace 3:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'when PyLong_FromLong() succeeds'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
- 'when taking False path'
- 'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38'
- 'when taking False path'
- '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('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=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')")
- 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('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/PyDict_SetItem/incorrect/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- 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
- r->ob_refcnt: None
- r->ob_type: None
- 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
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:28
-
-Trace 4:
+Trace 2:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -204,7 +123,7 @@ Trace 4:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 5:
+Trace 3:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -251,7 +170,7 @@ Trace 5:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 6:
+Trace 4:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -298,7 +217,7 @@ Trace 6:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 7:
+Trace 5:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -346,7 +265,7 @@ Trace 7:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 8:
+Trace 6:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -393,7 +312,7 @@ Trace 8:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 9:
+Trace 7:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -441,7 +360,7 @@ Trace 9:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 10:
+Trace 8:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -489,7 +408,7 @@ Trace 10:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 11:
+Trace 9:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -538,7 +457,7 @@ Trace 11:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:45
-Trace 12:
+Trace 10:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -569,7 +488,7 @@ Trace 12:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39
-Trace 13:
+Trace 11:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -600,7 +519,7 @@ Trace 13:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:38
-Trace 14:
+Trace 12:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -626,7 +545,7 @@ Trace 14:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItem/incorrect/input.c:39
-Trace 15:
+Trace 13:
Transitions:
'when PyDict_New() fails'
'taking True path'
diff --git a/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt b/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
index 48f23db..53061f4 100644
--- a/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PyDict_SetItemString/correct/stdout.txt
@@ -6,7 +6,7 @@ Trace 0:
'taking False path'
'when PyDict_SetItemString() succeeds'
'taking False path'
- 'when taking True path'
+ '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('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c', line=32)))
@@ -37,40 +37,6 @@ Trace 1:
'taking False path'
'when PyLong_FromLong() succeeds'
'taking False path'
- 'when PyDict_SetItemString() succeeds'
- 'taking False path'
- 'when taking False path'
- '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('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=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')")
- 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('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/PyDict_SetItemString/correct/input.c', line=27), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- 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
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:28
-
-Trace 2:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
'when PyDict_SetItemString() fails'
'taking True path'
'taking False path'
@@ -104,7 +70,7 @@ Trace 2:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:42
-Trace 3:
+Trace 2:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -144,7 +110,7 @@ Trace 3:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:42
-Trace 4:
+Trace 3:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -184,7 +150,7 @@ Trace 4:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:42
-Trace 5:
+Trace 4:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -225,7 +191,7 @@ Trace 5:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:42
-Trace 6:
+Trace 5:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -256,7 +222,7 @@ Trace 6:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37
-Trace 7:
+Trace 6:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -288,7 +254,7 @@ Trace 7:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PyDict_SetItemString/correct/input.c:37
-Trace 8:
+Trace 7:
Transitions:
'when PyDict_New() fails'
'taking True path'
diff --git a/tests/cpychecker/refcounts/PySys_SetObject/correct/stdout.txt b/tests/cpychecker/refcounts/PySys_SetObject/correct/stdout.txt
index f883342..6bf678a 100644
--- a/tests/cpychecker/refcounts/PySys_SetObject/correct/stdout.txt
+++ b/tests/cpychecker/refcounts/PySys_SetObject/correct/stdout.txt
@@ -3,7 +3,7 @@ Trace 0:
'when PyString_FromString() succeeds'
'taking False path'
'when PySys_SetObject() succeeds'
- 'when taking True path'
+ 'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PySys_SetObject/correct/input.c', line=40), region=RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')))
@@ -32,37 +32,6 @@ Trace 1:
Transitions:
'when PyString_FromString() succeeds'
'taking False path'
- 'when PySys_SetObject() succeeds'
- 'when taking False path'
- 'calling tp_dealloc on PyStringObject allocated at tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:31'
- 'returning'
- Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/PySys_SetObject/correct/input.c', line=40), region=RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')))
- str(): (struct PyObject *)&RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')) from tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:40
- r->ob_refcnt: refs: 1 + N where N >= 1
- r->ob_type: None
- 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/PySys_SetObject/correct/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/PySys_SetObject/correct/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- PyStringObject allocated at tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:31:
- repr(): RegionOnHeap('PyStringObject', gcc.Location(file='tests/cpychecker/refcounts/PySys_SetObject/correct/input.c', line=31))
- str(): PyStringObject allocated at tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:31
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:29
-
-Trace 2:
- Transitions:
- 'when PyString_FromString() succeeds'
- 'taking False path'
'when PySys_SetObject() fails'
'when taking True path'
'returning'
@@ -89,7 +58,7 @@ Trace 2:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:37
-Trace 3:
+Trace 2:
Transitions:
'when PyString_FromString() succeeds'
'taking False path'
@@ -120,7 +89,7 @@ Trace 3:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/PySys_SetObject/correct/input.c:37
-Trace 4:
+Trace 3:
Transitions:
'when PyString_FromString() fails'
'taking True path'
diff --git a/tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/stdout.txt b/tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/stdout.txt
index ec41f9d..8105fef 100644
--- a/tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/stdout.txt
+++ b/tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/stdout.txt
@@ -3,7 +3,7 @@ Trace 0:
'when PyLong_FromLong() succeeds'
'when Py_BuildValue() succeeds'
'taking False path'
- 'when taking True path'
+ 'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37), region=RegionOnHeap('new ref from call to Py_BuildValue', gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37)))
@@ -31,37 +31,6 @@ Trace 0:
Trace 1:
Transitions:
'when PyLong_FromLong() succeeds'
- 'when Py_BuildValue() succeeds'
- 'taking False path'
- 'when taking False path'
- 'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:34'
- 'returning'
- Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37), region=RegionOnHeap('new ref from call to Py_BuildValue', gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37)))
- str(): (struct PyObject *)&RegionOnHeap('new ref from call to Py_BuildValue', gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37)) from tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:37
- r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=37), region=Region('PyTypeObject for new ref from call to Py_BuildValue'))
- 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/Py_BuildValue/correct-code-O/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/Py_BuildValue/correct-code-O/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- PyLongObject allocated at tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:34:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c', line=34))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:34
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:29
-
-Trace 2:
- Transitions:
- 'when PyLong_FromLong() succeeds'
'when Py_BuildValue() fails'
'taking False path'
'when taking True path'
@@ -87,7 +56,7 @@ Trace 2:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:37
-Trace 3:
+Trace 2:
Transitions:
'when PyLong_FromLong() succeeds'
'when Py_BuildValue() fails'
@@ -116,7 +85,7 @@ Trace 3:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/Py_BuildValue/correct-code-O/input.c:37
-Trace 4:
+Trace 3:
Transitions:
'when PyLong_FromLong() fails'
'when Py_BuildValue() fails'
diff --git a/tests/cpychecker/refcounts/loop_n_times/stdout.txt b/tests/cpychecker/refcounts/loop_n_times/stdout.txt
index 27e8165..6ae249f 100644
--- a/tests/cpychecker/refcounts/loop_n_times/stdout.txt
+++ b/tests/cpychecker/refcounts/loop_n_times/stdout.txt
@@ -82,7 +82,7 @@ Trace 2:
'PyList_SetItem() succeeds'
'when considering value == (int)1 from tests/cpychecker/refcounts/loop_n_times/input.c:34'
'taking False path'
- 'when taking True path'
+ 'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38), region=RegionOnHeap('PyListObject', gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38)))
@@ -113,45 +113,6 @@ Trace 3:
'taking False path'
'when PyList_New() succeeds'
'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when considering range: 1 <= value <= 0x7fffffff'
- 'taking True path'
- 'PyList_SetItem() succeeds'
- 'when considering value == (int)1 from tests/cpychecker/refcounts/loop_n_times/input.c:34'
- 'taking False path'
- 'when taking False path'
- 'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/loop_n_times/input.c:42'
- 'returning'
- Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38), region=RegionOnHeap('PyListObject', gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38)))
- str(): (struct PyObject *)&RegionOnHeap('PyListObject', gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38)) from tests/cpychecker/refcounts/loop_n_times/input.c:38
- r->ob_refcnt: refs: 1 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=38), region=RegionForGlobal(gcc.VarDecl('PyList_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/loop_n_times/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/loop_n_times/input.c', line=28), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
- PyLongObject allocated at tests/cpychecker/refcounts/loop_n_times/input.c:42:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/loop_n_times/input.c', line=42))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/loop_n_times/input.c:42
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/loop_n_times/input.c:29
-
-Trace 4:
- Transitions:
- 'when PyArg_ParseTuple() succeeds'
- 'taking False path'
- 'when PyList_New() succeeds'
- 'taking False path'
'when PyLong_FromLong() fails'
'taking True path'
'when taking True path'
@@ -177,7 +138,7 @@ Trace 4:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/loop_n_times/input.c:42
-Trace 5:
+Trace 4:
Transitions:
'when PyArg_ParseTuple() succeeds'
'taking False path'
@@ -209,7 +170,7 @@ Trace 5:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/loop_n_times/input.c:42
-Trace 6:
+Trace 5:
Transitions:
'when PyArg_ParseTuple() succeeds'
'taking False path'
@@ -232,7 +193,7 @@ Trace 6:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/loop_n_times/input.c:38
-Trace 7:
+Trace 6:
Transitions:
'when PyArg_ParseTuple() fails'
'taking True path'
diff --git a/tests/cpychecker/refcounts/object_from_callback/stdout.txt b/tests/cpychecker/refcounts/object_from_callback/stdout.txt
index 3c7ec6a..3a2fa75 100644
--- a/tests/cpychecker/refcounts/object_from_callback/stdout.txt
+++ b/tests/cpychecker/refcounts/object_from_callback/stdout.txt
@@ -9,7 +9,7 @@ Trace 0:
'when PyDict_SetItem() succeeds'
'taking False path'
'when taking True path'
- 'when taking True path'
+ 'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)))
@@ -39,41 +39,9 @@ Trace 1:
'taking False path'
'when PyDict_SetItem() succeeds'
'taking False path'
- 'when taking True path'
- 'when taking False path'
- 'calling tp_dealloc on new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48'
- 'returning'
- Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)))
- str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)) from tests/cpychecker/refcounts/object_from_callback/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/object_from_callback/input.c', line=34), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
- PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=39))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39
- r->ob_refcnt: refs: 0 + N where N >= 0
- r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=39), region=RegionForGlobal(gcc.VarDecl('PyLong_Type')))
- new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48:
- repr(): RegionOnHeap('new ref from call through function pointer', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=48))
- str(): new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/object_from_callback/input.c:29
-
-Trace 2:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when call succeeds'
- 'taking False path'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
'when taking False path'
'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39'
- 'when taking True path'
+ 'taking True path'
'returning'
Return value:
repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)))
@@ -93,40 +61,7 @@ Trace 2:
Exception:
(struct PyObject *)0 from tests/cpychecker/refcounts/object_from_callback/input.c:29
-Trace 3:
- Transitions:
- 'when PyDict_New() succeeds'
- 'taking False path'
- 'when PyLong_FromLong() succeeds'
- 'taking False path'
- 'when call succeeds'
- 'taking False path'
- 'when PyDict_SetItem() succeeds'
- 'taking False path'
- 'when taking False path'
- 'calling tp_dealloc on PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39'
- 'when taking False path'
- 'calling tp_dealloc on new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48'
- 'returning'
- Return value:
- repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34), region=RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)))
- str(): (struct PyObject *)&RegionOnHeap('PyDictObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=34)) from tests/cpychecker/refcounts/object_from_callback/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/object_from_callback/input.c', line=34), region=RegionForGlobal(gcc.VarDecl('PyDict_Type')))
- PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39:
- repr(): RegionOnHeap('PyLongObject', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=39))
- str(): PyLongObject allocated at tests/cpychecker/refcounts/object_from_callback/input.c:39
- r->ob_refcnt: None
- r->ob_type: None
- new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48:
- repr(): RegionOnHeap('new ref from call through function pointer', gcc.Location(file='tests/cpychecker/refcounts/object_from_callback/input.c', line=48))
- str(): new ref from call through function pointer allocated at tests/cpychecker/refcounts/object_from_callback/input.c:48
- r->ob_refcnt: None
- r->ob_type: None
- Exception:
- (struct PyObject *)0 from tests/cpychecker/refcounts/object_from_callback/input.c:29
-
-Trace 4:
+Trace 2:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -164,7 +99,7 @@ Trace 4:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 5:
+Trace 3:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -203,7 +138,7 @@ Trace 5:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 6:
+Trace 4:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -242,7 +177,7 @@ Trace 6:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 7:
+Trace 5:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -282,7 +217,7 @@ Trace 7:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 8:
+Trace 6:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -321,7 +256,7 @@ Trace 8:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 9:
+Trace 7:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -361,7 +296,7 @@ Trace 9:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 10:
+Trace 8:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -401,7 +336,7 @@ Trace 10:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 11:
+Trace 9:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -442,7 +377,7 @@ Trace 11:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:54
-Trace 12:
+Trace 10:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -472,7 +407,7 @@ Trace 12:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:48
-Trace 13:
+Trace 11:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -503,7 +438,7 @@ Trace 13:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:48
-Trace 14:
+Trace 12:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -534,7 +469,7 @@ Trace 14:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:48
-Trace 15:
+Trace 13:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -566,7 +501,7 @@ Trace 15:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:48
-Trace 16:
+Trace 14:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -588,7 +523,7 @@ Trace 16:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:39
-Trace 17:
+Trace 15:
Transitions:
'when PyDict_New() succeeds'
'taking False path'
@@ -611,7 +546,7 @@ Trace 17:
Exception:
(struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/object_from_callback/input.c:39
-Trace 18:
+Trace 16:
Transitions:
'when PyDict_New() fails'
'taking True path'
12 years, 2 months
[gcc-python-plugin] cpychecker: add more docurl metadata
by David Hugh Malcolm
commit f0c48054a0202333bbc3b696cef4d02e8eb3abb8
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Tue Feb 28 16:26:49 2012 -0500
cpychecker: add more docurl metadata
docs/cpychecker.rst | 42 ++++++++++++++++++------------------------
libcpychecker/refcounts.py | 22 ++++++++++++++++++++--
2 files changed, 38 insertions(+), 26 deletions(-)
---
diff --git a/docs/cpychecker.rst b/docs/cpychecker.rst
index 5dcd699..013dffa 100644
--- a/docs/cpychecker.rst
+++ b/docs/cpychecker.rst
@@ -599,17 +599,13 @@ function. This brings with it some shortcomings:
Only a subset of the CPython API has been modelled so far. The functions
known to the checker are:
-`PyArg_Parse`,
-`_PyArg_Parse_SizeT`,
-`PyArg_ParseTuple`,
-`_PyArg_ParseTuple_SizeT`,
-`PyArg_ParseTupleAndKeywords`,
-`_PyArg_ParseTupleAndKeywords_SizeT`,
+`PyArg_Parse and _PyArg_Parse_SizeT <http://docs.python.org/c-api/arg.html#PyArg_Parse>`_,
+`PyArg_ParseTuple and _PyArg_ParseTuple_SizeT <http://docs.python.org/c-api/arg.html#PyArg_ParseTuple>`_,
+`PyArg_ParseTupleAndKeywords and _PyArg_ParseTupleAndKeywords_SizeT <http://docs.python.org/c-api/arg.html#PyArg_ParseTupleAndKeywords>`_,
`PyArg_UnpackTuple <http://docs.python.org/c-api/arg.html#PyArg_UnpackTuple>`_,
`Py_AtExit <http://docs.python.org/c-api/sys.html#Py_AtExit>`_,
-`PyBool_FromLong`,
-`Py_BuildValue <http://docs.python.org/c-api/arg.html#Py_BuildValue>`_,
-`_Py_BuildValue_SizeT <http://docs.python.org/c-api/arg.html#Py_BuildValue>`_,
+`PyBool_FromLong <http://docs.python.org/c-api/bool.html#PyBool_FromLong>`_,
+`Py_BuildValue and _Py_BuildValue_SizeT <http://docs.python.org/c-api/arg.html#Py_BuildValue>`_,
`PyCallable_Check <http://docs.python.org/c-api/object.html#PyCallable_Check>`_,
`PyCapsule_GetPointer <http://docs.python.org/c-api/capsule.html#PyCapsule_GetPointer>`_,
`PyCObject_AsVoidPtr <http://docs.python.org/c-api/cobject.html#PyCObject_AsVoidPtr>`_,
@@ -617,22 +613,22 @@ known to the checker are:
`PyCObject_FromVoidPtrAndDesc <http://docs.python.org/c-api/cobject.html#PyCObject_FromVoidPtrAndDesc>`_,
`PyCode_New <http://docs.python.org/c-api/code.html#PyCode_New>`_,
`PyDict_GetItem <http://docs.python.org/c-api/dict.html#PyDict_GetItem>`_,
-`PyDict_GetItemString`,
-`PyDict_New`,
+`PyDict_GetItemString <http://docs.python.org/c-api/dict.html#PyDict_GetItemString>`_,
+`PyDict_New <http://docs.python.org/c-api/dict.html#PyDict_New>`_,
`PyDict_SetItem <http://docs.python.org/c-api/dict.html#PyDict_SetItem>`_,
`PyDict_SetItemString <http://docs.python.org/c-api/dict.html#PyDict_SetItemString>`_,
`PyDict_Size <http://docs.python.org/c-api/dict.html#PyDict_Size>`_,
-`PyErr_Format`,
+`PyErr_Format <http://docs.python.org/c-api/exceptions.html#PyErr_Format>`_,
`PyErr_NewException <http://docs.python.org/c-api/exceptions.html#PyErr_NewException>`_,
-`PyErr_NoMemory`,
+`PyErr_NoMemory <http://docs.python.org/c-api/exceptions.html#PyErr_NoMemory>`_,
`PyErr_Occurred <http://docs.python.org/c-api/exceptions.html#PyErr_Occurred>`_,
-`PyErr_Print`,
-`PyErr_PrintEx`,
+`PyErr_Print <http://docs.python.org/c-api/exceptions.html#PyErr_Print>`_,
+`PyErr_PrintEx <http://docs.python.org/c-api/exceptions.html#PyErr_PrintEx>`_,
`PyErr_SetFromErrno <http://docs.python.org/c-api/exceptions.html#PyErr_SetFromErrno>`_,
`PyErr_SetFromErrnoWithFilename <http://docs.python.org/c-api/exceptions.html#PyErr_SetFromErrnoWithFilename>`_,
`PyErr_SetNone <http://docs.python.org/c-api/exceptions.html#PyErr_SetNone>`_,
`PyErr_SetObject <http://docs.python.org/c-api/exceptions.html#PyErr_SetObject>`_,
-`PyErr_SetString`,
+`PyErr_SetString <http://docs.python.org/c-api/exceptions.html#PyErr_SetString>`_,
`PyErr_WarnEx <http://docs.python.org/c-api/exceptions.html#PyErr_WarnEx>`_,
`PyEval_CallMethod`,
`PyEval_CallObjectWithKeywords`,
@@ -653,13 +649,13 @@ known to the checker are:
`Py_Initialize <http://docs.python.org/c-api/init.html#Py_Initialize>`_,
`Py_InitModule4_64`,
`PyInt_AsLong <http://docs.python.org/c-api/int.html#PyInt_AsLong>`_,
-`PyInt_FromLong`,
+`PyInt_FromLong <http://docs.python.org/c-api/int.html#PyInt_FromLong>`_,
`PyList_Append <http://docs.python.org/c-api/list.html#PyList_Append>`_,
`PyList_GetItem <http://docs.python.org/c-api/list.html#PyList_GetItem>`_,
-`PyList_New`,
+`PyList_New <http://docs.python.org/c-api/list.html#PyList_New>`_,
`PyList_SetItem <http://docs.python.org/c-api/list.html#PyList_SetItem>`_,
`PyList_Size <http://docs.python.org/c-api/list.html#PyList_Size>`_,
-`PyLong_FromLong`,
+`PyLong_FromLong <http://docs.python.org/c-api/long.html#PyLong_FromLong>`_,
`PyLong_FromLongLong <http://docs.python.org/c-api/long.html#PyLong_FromLongLong>`_,
`PyLong_FromString <http://docs.python.org/c-api/long.html#PyLong_FromString>`_,
`PyLong_FromVoidPtr <http://docs.python.org/c-api/long.html#PyLong_FromVoidPtr>`_,
@@ -674,11 +670,9 @@ known to the checker are:
`PyNumber_Remainer <http://docs.python.org/c-api/number.html#PyNumber_Remainder>`_,
`PyObject_AsFileDescriptor <http://docs.python.org/c-api/object.html#PyObject_AsFileDescriptor>`_,
`PyObject_Call <http://docs.python.org/c-api/object.html#PyObject_Call>`_,
-`PyObject_CallFunction <http://docs.python.org/c-api/object.html#PyObject_CallFunction>`_,
-`_PyObject_CallFunction_SizeT <http://docs.python.org/c-api/object.html#PyObject_CallFunction>`_,
+`PyObject_CallFunction and _PyObject_CallFunction_SizeT <http://docs.python.org/c-api/object.html#PyObject_CallFunction>`_,
`PyObject_CallFunctionObjArgs <http://docs.python.org/c-api/object.html#PyObject_CallFunctionObjArgs>`_,
-`PyObject_CallMethod <http://docs.python.org/c-api/object.html#PyObject_CallMethod>`_,
-`_PyObject_CallMethod_SizeT`,
+`PyObject_CallMethod and _PyObject_CallMethod_SizeT <http://docs.python.org/c-api/object.html#PyObject_CallMethod>`_,
`PyObject_CallMethodObjArgs <http://docs.python.org/c-api/object.html#PyObject_CallMethodObjArgs>`_,
`PyObject_CallObject <http://docs.python.org/c-api/object.html#PyObject_CallObject>`_,
`PyObject_GetAttr <http://docs.python.org/c-api/object.html#PyObject_GetAttr>`_,
@@ -692,7 +686,7 @@ known to the checker are:
`PyObject_Repr <http://docs.python.org/c-api/object.html#PyObject_Repr>`_,
`PyObject_SetAttr <http://docs.python.org/c-api/object.html#PyObject_SetAttr>`_,
`PyObject_SetAttrString <http://docs.python.org/c-api/object.html#PyObject_SetAttrString>`_,
-`PyObject_Str`,
+`PyObject_Str <http://docs.python.org/c-api/object.html#PyObject_Str>`_,
`PyOS_snprintf <http://docs.python.org/c-api/conversion.html#PyOS_snprintf>`_,
`PyRun_SimpleFileExFlags <http://docs.python.org/c-api/veryhigh.html#PyRun_SimpleFileExFlags>`_,
`PyRun_SimpleStringFlags <http://docs.python.org/c-api/veryhigh.html#PyRun_SimpleStringFlags>`_,
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 7fbd1ea..1318ad8 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -887,6 +887,7 @@ class CPython(Facet):
def impl_PyArg_Parse(self, stmt, v_args, v_fmt, *v_varargs):
fnmeta = FnMeta(name='PyArg_Parse',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_Parse',
declared_in='modsupport.h',
prototype='PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);',)
# Also, with #ifdef PY_SSIZE_T_CLEAN
@@ -896,6 +897,7 @@ class CPython(Facet):
def impl__PyArg_Parse_SizeT(self, stmt, v_args, v_fmt, *v_varargs):
fnmeta = FnMeta(name='_PyArg_Parse_SizeT',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_Parse',
declared_in='modsupport.h',
prototype='PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...);',)
# Also, with #ifdef PY_SSIZE_T_CLEAN
@@ -905,6 +907,7 @@ class CPython(Facet):
def impl_PyArg_ParseTuple(self, stmt, v_args, v_fmt, *v_varargs):
fnmeta = FnMeta(name='PyArg_ParseTuple',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_ParseTuple',
declared_in='modsupport.h',
prototype='PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);',)
# Also, with #ifdef PY_SSIZE_T_CLEAN
@@ -915,6 +918,7 @@ class CPython(Facet):
def impl__PyArg_ParseTuple_SizeT(self, stmt, v_args, v_fmt, *v_varargs):
fnmeta = FnMeta(name='_PyArg_ParseTuple_SizeT',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_ParseTuple',
declared_in='modsupport.h',
prototype='PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);',)
# Also, with #ifdef PY_SSIZE_T_CLEAN
@@ -926,6 +930,7 @@ class CPython(Facet):
def impl_PyArg_ParseTupleAndKeywords(self, stmt, v_args, v_kwargs,
v_fmt, v_keywords, *v_varargs):
fnmeta = FnMeta(name='PyArg_ParseTupleAndKeywords',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_ParseTupleAndKeywords',
declared_in='modsupport.h',
prototype=('PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,\n'
' const char *, char **, ...);'),)
@@ -939,6 +944,7 @@ class CPython(Facet):
def impl__PyArg_ParseTupleAndKeywords_SizeT(self, stmt, v_args, v_kwargs,
v_fmt, v_keywords, *v_varargs):
fnmeta = FnMeta(name='_PyArg_ParseTupleAndKeywords_SizeT',
+ docurl='http://docs.python.org/c-api/arg.html#PyArg_ParseTupleAndKeywords',
declared_in='modsupport.h',
prototype=('PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,\n'
' const char *, char **, ...);'),)
@@ -1028,6 +1034,7 @@ class CPython(Facet):
########################################################################
def impl_PyBool_FromLong(self, stmt, v_long):
fnmeta = FnMeta(name='PyBool_FromLong',
+ docurl='http://docs.python.org/c-api/bool.html#PyBool_FromLong',
declared_in='boolobject.h',
prototype='PyAPI_FUNC(PyObject *) PyBool_FromLong(long);',
defined_in='Objects/boolobject.c',
@@ -1295,6 +1302,7 @@ class CPython(Facet):
def impl_PyDict_GetItemString(self, stmt, v_dp, v_key):
fnmeta = FnMeta(name='PyDict_GetItemString',
+ docurl='http://docs.python.org/c-api/dict.html#PyDict_GetItemString',
declared_in='dictobject.h',
prototype='PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);',
defined_in='Objects/dictobject.c',
@@ -1322,7 +1330,8 @@ class CPython(Facet):
#t_memoryexc]
def impl_PyDict_New(self, stmt):
- fnmeta = FnMeta(name='PyDict_New')
+ fnmeta = FnMeta(name='PyDict_New',
+ docurl='http://docs.python.org/c-api/dict.html#PyDict_New')
r_newobj, t_success, t_failure = self.object_ctor(stmt,
'PyDictObject',
'PyDict_Type')
@@ -1407,6 +1416,7 @@ class CPython(Facet):
########################################################################
def impl_PyErr_Format(self, stmt, v_exc, v_fmt, *v_args):
fnmeta = FnMeta(name='PyErr_Format',
+ docurl='http://docs.python.org/c-api/exceptions.html#PyErr_Format',
declared_in='pyerrors.h',
prototype='PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);',
defined_in='Python/errors.c',
@@ -1433,6 +1443,7 @@ class CPython(Facet):
def impl_PyErr_NoMemory(self, stmt):
fnmeta = FnMeta(name='PyErr_NoMemory',
+ docurl='http://docs.python.org/c-api/exceptions.html#PyErr_NoMemory',
declared_in='pyerrors.h',
prototype='PyAPI_FUNC(PyObject *) PyErr_NoMemory(void);',
defined_in='Python/errors.c',
@@ -1458,6 +1469,7 @@ class CPython(Facet):
def impl_PyErr_Print(self, stmt):
fnmeta = FnMeta(name='PyErr_Print',
+ docurl='http://docs.python.org/c-api/exceptions.html#PyErr_Print',
declared_in='pythonrun.h',
prototype='PyAPI_FUNC(void) PyErr_Print(void);',
defined_in='Python/pythonrun.c',)
@@ -1469,6 +1481,7 @@ class CPython(Facet):
def impl_PyErr_PrintEx(self, stmt, v_int):
fnmeta = FnMeta(name='PyErr_PrintEx',
+ docurl='http://docs.python.org/c-api/exceptions.html#PyErr_PrintEx',
declared_in='pythonrun.h',
prototype='PyAPI_FUNC(void) PyErr_PrintEx(int);',
defined_in='Python/pythonrun.c',)
@@ -1538,6 +1551,7 @@ class CPython(Facet):
def impl_PyErr_SetString(self, stmt, v_exc, v_string):
fnmeta = FnMeta(name='PyErr_SetString',
+ docurl='http://docs.python.org/c-api/exceptions.html#PyErr_SetString',
declared_in='pyerrors.h',
prototype='PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *);',
defined_in='Python/errors.c',)
@@ -1819,6 +1833,7 @@ class CPython(Facet):
def impl_PyInt_FromLong(self, stmt, v_ival):
fnmeta = FnMeta(name='PyInt_FromLong',
+ docurl='http://docs.python.org/c-api/int.html#PyInt_FromLong',
declared_in='intobject.h',
prototype='PyAPI_FUNC(PyObject *) PyInt_FromLong(long);',
defined_in='Objects/intobject.c')
@@ -1923,6 +1938,7 @@ class CPython(Facet):
def impl_PyList_New(self, stmt, v_len):
fnmeta = FnMeta(name='PyList_New',
+ docurl='http://docs.python.org/c-api/list.html#PyList_New',
prototype='PyObject* PyList_New(Py_ssize_t len)',
notes='Returns a new reference, or raises MemoryError')
@@ -2016,7 +2032,8 @@ class CPython(Facet):
# PyLong_*
########################################################################
def impl_PyLong_FromLong(self, stmt, v_long):
- fnmeta = FnMeta(name='PyLong_FromLong')
+ fnmeta = FnMeta(name='PyLong_FromLong',
+ docurl='http://docs.python.org/c-api/long.html#PyLong_FromLong')
r_newobj, t_success, t_failure = self.object_ctor(stmt,
'PyLongObject',
'PyLong_Type')
@@ -2623,6 +2640,7 @@ class CPython(Facet):
def impl_PyObject_Str(self, stmt, v_o):
fnmeta = FnMeta(name='PyObject_Str',
+ docurl='http://docs.python.org/c-api/object.html#PyObject_Str',
declared_in='object.h')
# PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *);
# also with:
12 years, 2 months
[gcc-python-plugin] docs: add list of functions known to the cpychecker code
by David Hugh Malcolm
commit d7864d5f6a5aa0f56ab3198f935e62206e5824af
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Tue Feb 28 16:07:41 2012 -0500
docs: add list of functions known to the cpychecker code
docs/cpychecker.rst | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 127 insertions(+), 1 deletions(-)
---
diff --git a/docs/cpychecker.rst b/docs/cpychecker.rst
index ebbfb04..5dcd699 100644
--- a/docs/cpychecker.rst
+++ b/docs/cpychecker.rst
@@ -596,7 +596,133 @@ function. This brings with it some shortcomings:
affects multiple traces in the trace tree can lead to duplicate error
reports.
-Only a subset of the CPython API has been modelled so far.
+Only a subset of the CPython API has been modelled so far. The functions
+known to the checker are:
+
+`PyArg_Parse`,
+`_PyArg_Parse_SizeT`,
+`PyArg_ParseTuple`,
+`_PyArg_ParseTuple_SizeT`,
+`PyArg_ParseTupleAndKeywords`,
+`_PyArg_ParseTupleAndKeywords_SizeT`,
+`PyArg_UnpackTuple <http://docs.python.org/c-api/arg.html#PyArg_UnpackTuple>`_,
+`Py_AtExit <http://docs.python.org/c-api/sys.html#Py_AtExit>`_,
+`PyBool_FromLong`,
+`Py_BuildValue <http://docs.python.org/c-api/arg.html#Py_BuildValue>`_,
+`_Py_BuildValue_SizeT <http://docs.python.org/c-api/arg.html#Py_BuildValue>`_,
+`PyCallable_Check <http://docs.python.org/c-api/object.html#PyCallable_Check>`_,
+`PyCapsule_GetPointer <http://docs.python.org/c-api/capsule.html#PyCapsule_GetPointer>`_,
+`PyCObject_AsVoidPtr <http://docs.python.org/c-api/cobject.html#PyCObject_AsVoidPtr>`_,
+`PyCObject_FromVoidPtr <http://docs.python.org/c-api/cobject.html#PyCObject_FromVoidPtr>`_,
+`PyCObject_FromVoidPtrAndDesc <http://docs.python.org/c-api/cobject.html#PyCObject_FromVoidPtrAndDesc>`_,
+`PyCode_New <http://docs.python.org/c-api/code.html#PyCode_New>`_,
+`PyDict_GetItem <http://docs.python.org/c-api/dict.html#PyDict_GetItem>`_,
+`PyDict_GetItemString`,
+`PyDict_New`,
+`PyDict_SetItem <http://docs.python.org/c-api/dict.html#PyDict_SetItem>`_,
+`PyDict_SetItemString <http://docs.python.org/c-api/dict.html#PyDict_SetItemString>`_,
+`PyDict_Size <http://docs.python.org/c-api/dict.html#PyDict_Size>`_,
+`PyErr_Format`,
+`PyErr_NewException <http://docs.python.org/c-api/exceptions.html#PyErr_NewException>`_,
+`PyErr_NoMemory`,
+`PyErr_Occurred <http://docs.python.org/c-api/exceptions.html#PyErr_Occurred>`_,
+`PyErr_Print`,
+`PyErr_PrintEx`,
+`PyErr_SetFromErrno <http://docs.python.org/c-api/exceptions.html#PyErr_SetFromErrno>`_,
+`PyErr_SetFromErrnoWithFilename <http://docs.python.org/c-api/exceptions.html#PyErr_SetFromErrnoWithFilename>`_,
+`PyErr_SetNone <http://docs.python.org/c-api/exceptions.html#PyErr_SetNone>`_,
+`PyErr_SetObject <http://docs.python.org/c-api/exceptions.html#PyErr_SetObject>`_,
+`PyErr_SetString`,
+`PyErr_WarnEx <http://docs.python.org/c-api/exceptions.html#PyErr_WarnEx>`_,
+`PyEval_CallMethod`,
+`PyEval_CallObjectWithKeywords`,
+`PyEval_InitThreads <http://docs.python.org/c-api/init.html#PyEval_InitThreads>`_,
+`PyEval_RestoreThread <http://docs.python.org/c-api/init.html#PyEval_RestoreThread>`_,
+`PyEval_SaveThread <http://docs.python.org/c-api/init.html#PyEval_SaveThread>`_,
+`Py_FatalError <http://docs.python.org/c-api/sys.html#Py_FatalError>`_,
+`PyFile_SoftSpace <http://docs.python.org/c-api/file.html#PyFile_SoftSpace>`_,
+`PyFile_WriteString <http://docs.python.org/c-api/file.html#PyFile_WriteString>`_,
+`Py_Finalize <http://docs.python.org/c-api/init.html#Py_Finalize>`_,
+`PyFrame_New`,
+`Py_GetVersion <http://docs.python.org/c-api/init.html#Py_GetVersion>`_,
+`PyGILState_Ensure <http://docs.python.org/c-api/init.html#PyGILState_Ensure>`_,
+`PyGILState_Release <http://docs.python.org/c-api/init.html#PyGILState_Release>`_,
+`PyImport_AddModule <http://docs.python.org/c-api/import.html#PyImport_AddModule>`_,
+`PyImport_AppendInittab <http://docs.python.org/c-api/import.html#PyImport_AppendInittab>`_,
+`PyImport_ImportModule <http://docs.python.org/c-api/import.html#PyImport_ImportModule>`_,
+`Py_Initialize <http://docs.python.org/c-api/init.html#Py_Initialize>`_,
+`Py_InitModule4_64`,
+`PyInt_AsLong <http://docs.python.org/c-api/int.html#PyInt_AsLong>`_,
+`PyInt_FromLong`,
+`PyList_Append <http://docs.python.org/c-api/list.html#PyList_Append>`_,
+`PyList_GetItem <http://docs.python.org/c-api/list.html#PyList_GetItem>`_,
+`PyList_New`,
+`PyList_SetItem <http://docs.python.org/c-api/list.html#PyList_SetItem>`_,
+`PyList_Size <http://docs.python.org/c-api/list.html#PyList_Size>`_,
+`PyLong_FromLong`,
+`PyLong_FromLongLong <http://docs.python.org/c-api/long.html#PyLong_FromLongLong>`_,
+`PyLong_FromString <http://docs.python.org/c-api/long.html#PyLong_FromString>`_,
+`PyLong_FromVoidPtr <http://docs.python.org/c-api/long.html#PyLong_FromVoidPtr>`_,
+`PyMapping_Size <http://docs.python.org/c-api/mapping.html#PyMapping_Size>`_,
+`PyMem_Free <http://docs.python.org/c-api/memory.html#PyMem_Free>`_,
+`PyMem_Malloc <http://docs.python.org/c-api/memory.html#PyMem_Malloc>`_,
+`PyModule_AddIntConstant <http://docs.python.org/c-api/module.html#PyModule_AddIntConstant>`_,
+`PyModule_AddObject <http://docs.python.org/c-api/module.html#PyModule_AddObject>`_,
+`PyModule_AddStringConstant <http://docs.python.org/c-api/module.html#PyModule_AddStringConstant>`_,_,
+`PyModule_GetDict <http://docs.python.org/c-api/module.html#PyModule_GetDict>`_,
+`PyNumber_Int <http://docs.python.org/c-api/number.html#PyNumber_Int>`_,
+`PyNumber_Remainer <http://docs.python.org/c-api/number.html#PyNumber_Remainder>`_,
+`PyObject_AsFileDescriptor <http://docs.python.org/c-api/object.html#PyObject_AsFileDescriptor>`_,
+`PyObject_Call <http://docs.python.org/c-api/object.html#PyObject_Call>`_,
+`PyObject_CallFunction <http://docs.python.org/c-api/object.html#PyObject_CallFunction>`_,
+`_PyObject_CallFunction_SizeT <http://docs.python.org/c-api/object.html#PyObject_CallFunction>`_,
+`PyObject_CallFunctionObjArgs <http://docs.python.org/c-api/object.html#PyObject_CallFunctionObjArgs>`_,
+`PyObject_CallMethod <http://docs.python.org/c-api/object.html#PyObject_CallMethod>`_,
+`_PyObject_CallMethod_SizeT`,
+`PyObject_CallMethodObjArgs <http://docs.python.org/c-api/object.html#PyObject_CallMethodObjArgs>`_,
+`PyObject_CallObject <http://docs.python.org/c-api/object.html#PyObject_CallObject>`_,
+`PyObject_GetAttr <http://docs.python.org/c-api/object.html#PyObject_GetAttr>`_,
+`PyObject_GetAttrString <http://docs.python.org/c-api/object.html#PyObject_GetAttrString>`_,
+`PyObject_GetItem <http://docs.python.org/c-api/object.html#PyObject_GetItem>`_,
+`PyObject_GenericGetAttr <http://docs.python.org/c-api/object.html#PyObject_GenericGetAttr>`_,
+`PyObject_GenericSetAttr <http://docs.python.org/c-api/object.html#PyObject_GenericSetAttr>`_,
+`PyObject_HasAttrString <http://docs.python.org/c-api/object.html#PyObject_HasAttrString>`_,
+`PyObject_IsTrue <http://docs.python.org/c-api/object.html#PyObject_IsTrue>`_,
+`_PyObject_New`,
+`PyObject_Repr <http://docs.python.org/c-api/object.html#PyObject_Repr>`_,
+`PyObject_SetAttr <http://docs.python.org/c-api/object.html#PyObject_SetAttr>`_,
+`PyObject_SetAttrString <http://docs.python.org/c-api/object.html#PyObject_SetAttrString>`_,
+`PyObject_Str`,
+`PyOS_snprintf <http://docs.python.org/c-api/conversion.html#PyOS_snprintf>`_,
+`PyRun_SimpleFileExFlags <http://docs.python.org/c-api/veryhigh.html#PyRun_SimpleFileExFlags>`_,
+`PyRun_SimpleStringFlags <http://docs.python.org/c-api/veryhigh.html#PyRun_SimpleStringFlags>`_,
+`PySequence_Concat <http://docs.python.org/c-api/sequence.html#PySequence_Concat>`_,
+`PySequence_GetItem <http://docs.python.org/c-api/sequence.html#PySequence_GetItem>`_,
+`PySequence_GetSlice <http://docs.python.org/c-api/sequence.html#PySequence_GetSlice>`_,
+`PySequence_SetItem <http://docs.python.org/c-api/sequence.html#PySequence_SetItem>`_,
+`PyString_AsString <http://docs.python.org/c-api/string.html#PyString_AsString>`_,
+`PyString_Concat <http://docs.python.org/c-api/string.html#PyString_Concat>`_,
+`PyString_ConcatAndDel <http://docs.python.org/c-api/string.html#PyString_ConcatAndDel>`_,
+`PyString_FromFormat <http://docs.python.org/c-api/string.html#PyString_FromFormat>`_,
+`PyString_FromString <http://docs.python.org/c-api/string.html#PyString_FromString>`_,
+`PyString_FromStringAndSize <http://docs.python.org/c-api/string.html#PyString_FromStringAndSize>`_,
+`PyString_InternFromString <http://docs.python.org/c-api/string.html#PyString_InternFromString>`_,
+`PyString_Size <http://docs.python.org/c-api/string.html#PyString_Size>`_,
+`PyStructSequence_InitType`,
+`PyStructSequence_New`,
+`PySys_GetObject <http://docs.python.org/c-api/sys.html#PySys_GetObject>`_,
+`PySys_SetObject <http://docs.python.org/c-api/sys.html#PySys_SetObject>`_,
+`PyTraceBack_Here`,
+`PyTuple_GetItem <http://docs.python.org/c-api/tuple.html#PyTuple_GetItem>`_,
+`PyTuple_New <http://docs.python.org/c-api/tuple.html#PyTuple_New>`_,
+`PyTuple_Pack <http://docs.python.org/c-api/tuple.html#PyTuple_Pack>`_,
+`PyTuple_SetItem <http://docs.python.org/c-api/tuple.html#PyTuple_SetItem>`_,
+`PyTuple_Size <http://docs.python.org/c-api/tuple.html#PyTuple_Size>`_,
+`PyType_IsSubtype <http://docs.python.org/dev/c-api/type.html#PyType_IsSubtype>`_,
+`PyType_Ready <http://docs.python.org/dev/c-api/type.html#PyType_Ready>`_,
+`PyUnicodeUCS4_AsUTF8String <http://docs.python.org/c-api/unicode.html#PyUnicode_AsUTF8String>`_,
+`PyUnicodeUCS4_DecodeUTF8 <http://docs.python.org/c-api/unicode.html#PyUnicode_DecodeUTF8>`_,
+`PyWeakref_GetObject <http://docs.python.org/c-api/weakref.html#PyWeakref_GetObject>`_
Ideas for future tests
12 years, 2 months
[gcc-python-plugin] cpychecker: improved handling of unknown functions that return a PyObject * subclass In 90d237c02bb8
by David Hugh Malcolm
commit ef9cdb8bb9af87e6b4b310ffd152b0dbc280ceba
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Tue Feb 28 15:14:02 2012 -0500
cpychecker: improved handling of unknown functions that return a PyObject * subclass
In 90d237c02bb8fe6bd7b40aa6c2420652c87ce906 unknown functions that return
a PyObject* are assumed to return either a new reference, or return NULL
setting an exception.
Generalize this for functions returning PyObject subclasses.
Fixes a false warning for psycopg:
psycopg/connection_type.c: In function ‘psyco_conn_tpc_begin’:
psycopg/connection_type.c:228:1: warning: returning (PyObject*)NULL without setting an exception
libcpychecker/absinterp.py | 10 ++-
.../refcounts/unrecognized_function4/input.c | 51 +++++++++++++
.../refcounts/unrecognized_function4/script.py | 22 ++++++
.../refcounts/unrecognized_function4/stdout.txt | 79 ++++++++++++++++++++
4 files changed, 158 insertions(+), 4 deletions(-)
---
diff --git a/libcpychecker/absinterp.py b/libcpychecker/absinterp.py
index a7295d7..d7ecb89 100644
--- a/libcpychecker/absinterp.py
+++ b/libcpychecker/absinterp.py
@@ -211,8 +211,9 @@ class AbstractValue(object):
check_isinstance(stmt, gcc.GimpleCall)
returntype = stmt.fn.type.dereference.type
- if str(returntype) == 'struct PyObject *':
- log('Invocation of function pointer returning PyObject *')
+ from libcpychecker.refcounts import type_is_pyobjptr_subclass
+ if type_is_pyobjptr_subclass(returntype):
+ log('Invocation of function pointer returning PyObject * (or subclass)')
# Assume that all such functions either:
# - return a new reference, or
# - return NULL and set an exception (e.g. MemoryError)
@@ -2212,8 +2213,9 @@ class State(object):
raise NotImplementedError('not yet implemented: %s' % fnname)
# Unknown function returning (PyObject*):
- if str(stmt.fn.operand.type.type) == 'struct PyObject *':
- log('Invocation of unknown function returning PyObject *: %r' % fnname)
+ from libcpychecker.refcounts import type_is_pyobjptr_subclass
+ if type_is_pyobjptr_subclass(stmt.fn.operand.type.type):
+ log('Invocation of unknown function returning PyObject * (or subclass): %r' % fnname)
fnmeta = FnMeta(name=fnname)
diff --git a/tests/cpychecker/refcounts/unrecognized_function4/input.c b/tests/cpychecker/refcounts/unrecognized_function4/input.c
new file mode 100644
index 0000000..e691582
--- /dev/null
+++ b/tests/cpychecker/refcounts/unrecognized_function4/input.c
@@ -0,0 +1,51 @@
+/*
+ Copyright 2012 David Malcolm <dmalcolm(a)redhat.com>
+ Copyright 2012 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>
+
+/*
+ Ensure that the checker can cope with calls to a function that it doesn't
+ recognize that returns a PyObject subclass:
+*/
+typedef struct FooObject {
+ PyObject_HEAD
+ int i;
+} FooObject;
+
+extern FooObject *make_foo(int i);
+
+PyObject *
+test(PyObject *self, PyObject *args)
+{
+ FooObject *f = make_foo(42);
+ if (NULL == f) {
+ return NULL; /* we assume an exception was set by make_foo() */
+ }
+ Py_DECREF(f);
+
+ Py_RETURN_NONE;
+}
+
+/*
+ PEP-7
+Local variables:
+c-basic-offset: 4
+indent-tabs-mode: nil
+End:
+*/
diff --git a/tests/cpychecker/refcounts/unrecognized_function4/script.py b/tests/cpychecker/refcounts/unrecognized_function4/script.py
new file mode 100644
index 0000000..fdd5ba3
--- /dev/null
+++ b/tests/cpychecker/refcounts/unrecognized_function4/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/unrecognized_function4/stdout.txt b/tests/cpychecker/refcounts/unrecognized_function4/stdout.txt
new file mode 100644
index 0000000..c6479c7
--- /dev/null
+++ b/tests/cpychecker/refcounts/unrecognized_function4/stdout.txt
@@ -0,0 +1,79 @@
+Trace 0:
+ Transitions:
+ 'when make_foo() succeeds'
+ 'taking False path'
+ 'when taking True path'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=42), region=RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')))
+ str(): (struct PyObject *)&RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')) from tests/cpychecker/refcounts/unrecognized_function4/input.c:42
+ r->ob_refcnt: refs: 1 + N where N >= 1
+ r->ob_type: None
+ 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/unrecognized_function4/input.c', line=34), 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/unrecognized_function4/input.c', line=34), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ new ref from (unknown) make_foo allocated at tests/cpychecker/refcounts/unrecognized_function4/input.c:36:
+ repr(): RegionOnHeap('new ref from (unknown) make_foo', gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=36))
+ str(): new ref from (unknown) make_foo allocated at tests/cpychecker/refcounts/unrecognized_function4/input.c:36
+ r->ob_refcnt: refs: 0 + N where N >= 0
+ r->ob_type: PointerToRegion(gcctype='struct PyTypeObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=36), region=Region('PyTypeObject for new ref from (unknown) make_foo'))
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/unrecognized_function4/input.c:35
+
+Trace 1:
+ Transitions:
+ 'when make_foo() succeeds'
+ 'taking False path'
+ 'when taking False path'
+ 'calling tp_dealloc on new ref from (unknown) make_foo allocated at tests/cpychecker/refcounts/unrecognized_function4/input.c:36'
+ 'returning'
+ Return value:
+ repr(): PointerToRegion(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=42), region=RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')))
+ str(): (struct PyObject *)&RegionForGlobal(gcc.VarDecl('_Py_NoneStruct')) from tests/cpychecker/refcounts/unrecognized_function4/input.c:42
+ r->ob_refcnt: refs: 1 + N where N >= 1
+ r->ob_type: None
+ 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/unrecognized_function4/input.c', line=34), 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/unrecognized_function4/input.c', line=34), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ new ref from (unknown) make_foo allocated at tests/cpychecker/refcounts/unrecognized_function4/input.c:36:
+ repr(): RegionOnHeap('new ref from (unknown) make_foo', gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=36))
+ str(): new ref from (unknown) make_foo allocated at tests/cpychecker/refcounts/unrecognized_function4/input.c:36
+ r->ob_refcnt: None
+ r->ob_type: None
+ Exception:
+ (struct PyObject *)0 from tests/cpychecker/refcounts/unrecognized_function4/input.c:35
+
+Trace 2:
+ Transitions:
+ 'when make_foo() fails'
+ 'taking True path'
+ 'returning'
+ Return value:
+ repr(): ConcreteValue(gcctype='struct PyObject *', loc=gcc.Location(file='tests/cpychecker/refcounts/unrecognized_function4/input.c', line=38), value=0)
+ str(): (struct PyObject *)0 from tests/cpychecker/refcounts/unrecognized_function4/input.c:38
+ 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/unrecognized_function4/input.c', line=34), 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/unrecognized_function4/input.c', line=34), region=Region("region-for-type-of-arg-gcc.ParmDecl('args')"))
+ Exception:
+ (struct PyObject *)&RegionForGlobal(gcc.VarDecl('PyExc_MemoryError')) from tests/cpychecker/refcounts/unrecognized_function4/input.c:36
12 years, 2 months