[Cocci] [PATCH] Enable Python 2.6 in coccinelle

Richard W.M. Jones rjones at redhat.com
Tue Mar 17 18:11:41 CET 2009


I genuinely can't remember if I sent this patch to you before.  Anyway
here is a patch which enables Python 2.6 support for coccinelle ...

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
-------------- next part --------------
diff -ur /tmp/coccinelle-0.1.4/pycaml/pycaml.ml pycaml/pycaml.ml
--- /tmp/coccinelle-0.1.4/pycaml/pycaml.ml	2008-11-13 16:03:42.000000000 +0000
+++ pycaml/pycaml.ml	2009-01-26 15:40:17.000000000 +0000
@@ -381,8 +381,10 @@
 (* 28 *)
 let pyimport_addmodule = fmt28call (pnf ())
 let pyimport_importmodule = fmt28call (pnf ())
+(* - disabled, see comment in pycaml_ml.c.  - RWMJ
 (* 51 *)
 let pyimport_importmoduleex = fmt51call (pnf ())
+*)
 (* 28 *)
 let pyimport_import = fmt28call (pnf ())
 (* 14 *)
diff -ur /tmp/coccinelle-0.1.4/pycaml/pycaml_ml.c pycaml/pycaml_ml.c
--- /tmp/coccinelle-0.1.4/pycaml/pycaml_ml.c	2008-03-29 20:25:26.000000000 +0000
+++ pycaml/pycaml_ml.c	2009-01-26 15:40:02.000000000 +0000
@@ -173,7 +173,7 @@
     int fd;
     int x;
     int ret_int;
-    char *rvs;
+    const char *rvs;
     int fmt = Int_val(Field(format,1));
     PyObject *ob1,*ob2,*ob3;
     void *func = getcustom(Field(format,0));
@@ -1184,7 +1184,12 @@
 { (void *)PyImport_AddModule, 28, "PyImport_AddModule" },
 { (void *)PyImport_ImportModule, 28, "PyImport_ImportModule" },
 /* 51 */
+#if 0
+    /* In Python 2.6, this because a #define so we cannot take
+     * the address of the function.  - RWMJ.
+     */
 { (void *)PyImport_ImportModuleEx, 51, "PyImport_ImportModuleEx" },
+#endif
 /* 28 */
 { (void *)PyImport_Import, 28, "PyImport_Import" },
 /* 14 */


More information about the Cocci mailing list