PyMarshal Commands crash on Windows

spammaster.10.webmaster at spamgourmet.com spammaster.10.webmaster at spamgourmet.com
Sun Sep 14 07:28:01 EDT 2008


Hi!

Can anyone help me with this issue?

int main (int argc, char * const argv[]) {
    Py_Initialize();

    FILE* fp = fopen("/Users/test/Desktop/123.pyc","wb");
    PyCodeObject* op = (PyCodeObject*)Py_CompileString("import sys
\nprint 'hello'","<string.py>",Py_file_input);
    PyMarshal_WriteObjectToFile((PyObject *)op, fp,
Py_MARSHAL_VERSION);

    Py_Finalize();

    return 0;
}

This Code crashs on Windows, and I can't explain why. I want to
convert a PyCodeObject to a PyObject and save it to the harddisk.
PyMarshal_ReadObjectFromFile(FILE *P) crashs too if I want to read a
byte-compiled object.


Thank your for your help.

donnerChecker



More information about the Python-list mailing list