A new patch is attached.  I'm a little worried about the NULL created 
using pynull() not getting garbage collected properly.  If there is a big 
slowdow with this change it could be due to that.  Probably just one NULL 
object could be created for this purpose and used over and over if this is 
a problem.

julia
diff -u -p a/pycaml/pycaml_ml.c  b/pycaml/pycaml_ml.c
--- a/pycaml/pycaml_ml.c        2009-03-18 08:26:35.000000000 +0100
+++ b/pycaml/pycaml_ml.c        2010-07-24 13:18:06.000000000 +0200
@@ -744,7 +744,10 @@ DL_IMPORT(int) PyImport_ImportFrozenModu
 /* 42 */
 DL_IMPORT(PyObject *) PyEval_CallObjectWithKeywords(PyObject *, PyObject *, 
PyObject *);
 /* 17 */
+#if 0
+// dropped in Python 2.7
 DL_IMPORT(PyObject *) PyEval_CallObject(PyObject *, PyObject *);
+#endif
 
 /* 29 */
 DL_IMPORT(PyObject *) PyEval_GetBuiltins(void);
@@ -1203,7 +1206,10 @@ python_func_table the_python_func_table[
 /* 42 */
 { (void *)PyEval_CallObjectWithKeywords, 42, "PyEval_CallObjectWithKeywords" },
 /* 17 */
+#if 0
+// dropped in Python 2.7
 { (void *)PyEval_CallObject, 17, "PyEval_CallObject" },
+#endif
 
 /* 29 */
 { (void *)PyEval_GetBuiltins, 29, "PyEval_GetBuiltins" },
diff -u -p a/pycocci/yes_pycocci.ml b/pycocci/yes_pycocci.ml
--- a/pycaml/pycaml.ml  2010-01-28 15:25:07.000000000 +0100
+++ b/pycaml/pycaml.ml  2010-07-24 13:18:36.000000000 +0200
@@ -398,7 +398,8 @@ let pyimport_importfrozenmodule = fmt5ca
 (* 42 *)
 let pyeval_callobjectwithkeywords = fmt42call (pnf ())
 (* 17 *)
-let pyeval_callobject = fmt17call (pnf ())
+(* dropped in Python 2.7
+let pyeval_callobject = fmt17call (pnf ()) *)
 
 (* 29 *)
 let pyeval_getbuiltins = fmt29call (pnf ())
diff -u -p a/pycocci/yes_pycocci.ml b/pycocci/yes_pycocci.ml
--- a/python/yes_pycocci.ml     2010-07-20 15:41:59.000000000 +0200
+++ b/python/yes_pycocci.ml     2010-07-24 13:16:12.000000000 +0200
@@ -107,7 +107,8 @@ let pycocci_get_class_type fqn =
 
 let pycocci_instantiate_class fqn args =
   let class_type = pycocci_get_class_type fqn in
-  let obj = pyeval_callobject(class_type, args) in
+  let obj =
+    pyeval_callobjectwithkeywords(class_type, args, pynull()) in
   check_return_value obj;
   obj
 
_______________________________________________
Cocci mailing list
[email protected]
http://lists.diku.dk/mailman/listinfo/cocci
(Web access from inside DIKUs LAN only)

Reply via email to