summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2009-11-18 17:08:51 -0500
committerDavid Malcolm <dmalcolm@redhat.com>2009-11-18 17:08:51 -0500
commit3a78d17118fc648bfcb04f3f9e2c951621934b8f (patch)
tree7d6c070661c2b93cc7c43b3ddc9652898d92e83b
download2to3c-3a78d17118fc648bfcb04f3f9e2c951621934b8f.tar.gz
2to3c-3a78d17118fc648bfcb04f3f9e2c951621934b8f.tar.xz
2to3c-3a78d17118fc648bfcb04f3f9e2c951621934b8f.zip
Initial commit
-rw-r--r--int-to-long.cocci77
-rw-r--r--ob_type.cocci12
2 files changed, 89 insertions, 0 deletions
diff --git a/int-to-long.cocci b/int-to-long.cocci
new file mode 100644
index 0000000..b09c87c
--- /dev/null
+++ b/int-to-long.cocci
@@ -0,0 +1,77 @@
+@@
+expression E1;
+@@
+-PyInt_AsLong(E1)
++PyLong_AsLong(E1)
+
+@@
+expression E1;
+@@
+-PyInt_Check(E1)
++PyLong_Check(E1)
+
+@@
+expression E1, E2, E3;
+@@
+-PyInt_FromString(E1, E2, E3)
++PyLong_FromString(E1, E2, E3)
+
+@@
+expression E1, E2, E3;
+@@
+-PyInt_FromUnicode(E1, E2, E3)
++PyLong_FromUnicode(E1, E2, E3)
+
+@@
+expression E1;
+@@
+-PyInt_FromLong(E1)
++PyLong_FromLong(E1)
+
+@@
+expression E1;
+@@
+-PyInt_FromSize_t(E1)
++PyLong_FromSize_t(E1)
+
+@@
+expression E1;
+@@
+-PyInt_FromSsize_t(E1)
++PyLong_FromSsize_t(E1)
+
+@@
+expression E1;
+@@
+-PyInt_AsLong(E1)
++PyLong_AsLong(E1)
+
+@@
+expression E1;
+@@
+-PyInt_AsSsize_t(E1)
++PyLong_AsSsize_t(E1)
+
+@@
+expression E1;
+@@
+-PyInt_AsUnsignedLongMask(E1)
++PyLong_AsUnsignedLongMask(E1)
+
+@@
+expression E1;
+@@
+-PyInt_AsUnsignedLongLongMask(E1)
++PyLong_AsUnsignedLongLongMask(E1)
+
+@@
+expression E1;
+@@
+-PyInt_AS_LONG(E1)
++PyLong_AS_LONG(E1)
+
+@@
+expression E1;
+@@
+-PyNumber_Int(E1)
++PyNumber_Long(E1)
diff --git a/ob_type.cocci b/ob_type.cocci
new file mode 100644
index 0000000..9d8131d
--- /dev/null
+++ b/ob_type.cocci
@@ -0,0 +1,12 @@
+// Convert non-PyObject* deferences of "ob_type" to use Py_TYPE macro instead
+@@
+PyObject *py_obj_ptr;
+type T;
+T non_py_obj_ptr;
+@@
+(
+ py_obj_ptr->ob_type
+|
+- non_py_obj_ptr->ob_type
++ Py_TYPE(non_py_obj_ptr)
+)