[Python-checkins] r65757 - python/branches/tlee-ast-optimize/Modules/pyexpat.c

thomas.lee python-checkins at python.org
Sun Aug 17 13:33:03 CEST 2008


Author: thomas.lee
Date: Sun Aug 17 13:33:03 2008
New Revision: 65757

Log:
Fix the PyCode_New call in pyexpat. Fixes most of the xml tests.

Modified:
   python/branches/tlee-ast-optimize/Modules/pyexpat.c

Modified: python/branches/tlee-ast-optimize/Modules/pyexpat.c
==============================================================================
--- python/branches/tlee-ast-optimize/Modules/pyexpat.c	(original)
+++ python/branches/tlee-ast-optimize/Modules/pyexpat.c	Sun Aug 17 13:33:03 2008
@@ -262,14 +262,18 @@
 getcode(enum HandlerTypes slot, char* func_name, int lineno)
 {
     PyObject *code = NULL;
+    PyObject *lnotab = NULL;
     PyObject *name = NULL;
     PyObject *nulltuple = NULL;
     PyObject *filename = NULL;
 
     if (handler_info[slot].tb_code == NULL) {
-        code = PyList_New(0);
+        code = PyString_FromString("");
         if (code == NULL)
             goto failed;
+        lnotab = PyList_New(0);
+        if (lnotab == NULL)
+            goto failed;
         name = PyString_FromString(func_name);
         if (name == NULL)
             goto failed;
@@ -293,11 +297,12 @@
                        filename,	/* filename */
                        name,		/* name */
                        lineno,		/* firstlineno */
-                       code		/* lnotab */
+                       lnotab		/* lnotab */
                        );
         if (handler_info[slot].tb_code == NULL)
             goto failed;
         Py_DECREF(code);
+        Py_DECREF(lnotab);
         Py_DECREF(nulltuple);
         Py_DECREF(filename);
         Py_DECREF(name);
@@ -305,6 +310,7 @@
     return handler_info[slot].tb_code;
  failed:
     Py_XDECREF(code);
+    Py_XDECREF(lnotab);
     Py_XDECREF(name);
     return NULL;
 }


More information about the Python-checkins mailing list