summaryrefslogtreecommitdiffstats
path: root/lib2to3c/repr.cocci
diff options
context:
space:
mode:
Diffstat (limited to 'lib2to3c/repr.cocci')
-rw-r--r--lib2to3c/repr.cocci27
1 files changed, 27 insertions, 0 deletions
diff --git a/lib2to3c/repr.cocci b/lib2to3c/repr.cocci
new file mode 100644
index 0000000..dfa1ef4
--- /dev/null
+++ b/lib2to3c/repr.cocci
@@ -0,0 +1,27 @@
+// tp_repr functions should return unicode in py3k
+// FIXME: need to restrict to just tp_repr functions:
+@@
+type T;
+function FN_repr;
+expression E;
+@@
+PyObject *
+FN_repr(T *self)
+{
+ ...
+- return PyString_FromString(E);
++ return PyUnicode_FromString(E);
+}
+
+@@
+type T;
+function FN_repr;
+expression E1, E2;
+@@
+PyObject *
+FN_repr(T *self)
+{
+ ...
+- return PyString_FromFormat(E1, E2);
++ return PyUnicode_FromFormat(E1, E2);
+}