This adds support for PySequence_DelItem.
---
docs/cpychecker.rst | 1 +
libcpychecker/refcounts.py | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)
diff --git a/docs/cpychecker.rst b/docs/cpychecker.rst
index 200536a..8cd699e 100644
--- a/docs/cpychecker.rst
+++ b/docs/cpychecker.rst
@@ -717,6 +717,7 @@ known to the checker are:
`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_DelItem
<
http://docs.python.org/c-api/sequence.html#PySequence_DelItem>`_,
`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>`_,
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index c331822..d6f4c55 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -3088,6 +3088,27 @@ class CPython(Facet):
fnmeta,
'new ref from %s' %
fnmeta.name)
+ def impl_PySequence_DelItem(self, stmt, v_o, v_i):
+ fnmeta = FnMeta(name='PySequence_DelItem',
+
docurl='http://docs.python.org/c-api/sequence.html#PySequence_DelItem...;,
+ declared_in='abstract.h',
+ prototype='int PySequence_DelItem(PyObject *o, Py_ssize_t
i);',
+ defined_in='Objects/abstract.c')
+ # safely handles NULL via null_error():
+ t_err = self.handle_null_error(stmt, 0, v_o, rawreturnvalue=-1)
+ if t_err:
+ return [t_err]
+
+ # can fail with -1, setting an exception
+ s_failure = self.state.mkstate_concrete_return_of(stmt, -1)
+ s_failure.cpython.set_exception('PyExc_TypeError', stmt.loc)
+
+ # otherwise, expect zero
+ s_success = self.state.mkstate_concrete_return_of(stmt, 0)
+
+ return self.state.make_transitions_for_fncall(stmt, fnmeta,
+ s_success, s_failure)
+
def impl_PySequence_GetItem(self, stmt, v_o, v_i):
fnmeta = FnMeta(name='PySequence_GetItem',
docurl='http://docs.python.org/c-api/sequence.html#PySequence_GetItem...;,
--
1.8.1.4