[Python-3000] Two new test failures (one OSX PPC only)

Christian Heimes lists at cheimes.de
Fri Aug 17 14:41:07 CEST 2007


Guido van Rossum wrote:
> There's still one leak that Neal would like to see fixed, in
> test_zipimport. Instructions to reproduce: in a *debug* build, run
> this command:
> 
>   ./python Lib/test/regrtest.py -R1:1: test_zipimport
> 
> This reports 29 leaked references.
> 

I found the problem in Modules/zipimport.c around line 850. raw_data
wasn't DECREFed.

LC_ALL=C svn diff Modules/zipimport.c
Index: Modules/zipimport.c
===================================================================
--- Modules/zipimport.c (revision 57115)
+++ Modules/zipimport.c (working copy)
@@ -851,10 +851,11 @@
        }
        buf[data_size] = '\0';

-       if (compress == 0) {  /* data is not compressed */
-               raw_data = PyBytes_FromStringAndSize(buf, data_size);
-               return raw_data;
-       }
+       if (compress == 0) { /* data is not compressed */
+               decompress = PyBytes_FromStringAndSize(buf, data_size);
+               Py_DECREF(raw_data);
+               return decompress;
+    }

        /* Decompress with zlib */
        decompress = get_decompress_func();

Christian


More information about the Python-3000 mailing list