[Python-Dev] New Import Hook & New Zip Importer

Fredrik Lundh fredrik@pythonware.com
Thu, 5 Dec 2002 09:28:03 +0100


Just van Rossum wrote:

> zipimport.c todo:
>     - rework the zipimporter class as a subclass of str
>     - doco
>     - add a get_source(fullname) method (linecache.py could use that!)

have you tested the following code with uncompressed PY files?

    buf[data_size] = 'Z'; /* saw this in zipfile.py */
    data_size++;

    raw_data = PyString_FromStringAndSize(buf, data_size);

    PyMem_Free(buf);

    if (raw_data == NULL)
        return NULL;

    if (compress == 0) /* data is not compressed */
        return raw_data;

</F>