commit 97ecf1643d3dbdc81ce4f3c6e1439cf4997b2f36
Author: David Malcolm <dmalcolm(a)redhat.com>
Date: Fri Sep 2 13:29:40 2011 -0400
cpychecker: implement refcount tracking for the PY_SSIZE_T_CLEAN variants of PyArg_ParseTuple and PyArg_ParseTupleAndKeywords
libcpychecker/refcounts.py | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/libcpychecker/refcounts.py b/libcpychecker/refcounts.py
index 1e83a73..00f357d 100644
--- a/libcpychecker/refcounts.py
+++ b/libcpychecker/refcounts.py
@@ -671,6 +671,18 @@ class MyState(State):
v_varargs = args[2:]
return self._handle_PyArg_function(stmt, v_fmt, v_varargs, with_size_t=False)
+ def impl__PyArg_ParseTuple_SizeT(self, stmt):
+ # Declared in modsupport.h:
+ # PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3);
+ # Also, with #ifdef PY_SSIZE_T_CLEAN
+ # #define PyArg_ParseTuple _PyArg_ParseTuple_SizeT
+
+ args = self.eval_stmt_args(stmt)
+ v_args = args[0]
+ v_fmt = args[1]
+ v_varargs = args[2:]
+ return self._handle_PyArg_function(stmt, v_fmt, v_varargs, with_size_t=True)
+
def impl_PyArg_ParseTupleAndKeywords(self, stmt):
# Declared in modsupport.h:
# PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
@@ -687,6 +699,21 @@ class MyState(State):
v_varargs = args[4:]
return self._handle_PyArg_function(stmt, v_fmt, v_varargs, with_size_t=False)
+ def impl_PyArg_ParseTupleAndKeywords_SizeT(self, stmt):
+ # Declared in modsupport.h:
+ # PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *,
+ # const char *, char **, ...);
+ #
+ # Also, with #ifdef PY_SSIZE_T_CLEAN
+ # #define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT
+
+ args = self.eval_stmt_args(stmt)
+ v_args = args[0]
+ v_kwargs = args[1]
+ v_fmt = args[2]
+ v_keywords = args[3]
+ v_varargs = args[4:]
+ return self._handle_PyArg_function(stmt, v_fmt, v_varargs, with_size_t=True)
########################################################################
# PyDict_*