[Pythonmac-SIG] weirdness with Mac OS 9 extension

Robin Becker robin at reportlab.com
Sat Aug 23 10:53:32 EDT 2003


Hi I'm throwing this out in the hope that someone else has seen the ssame kind of
problem.

With Just van Rossum and Jack Jansen's help we've created a compact python+reportlab
distro for a client, but so far all our attempts at getting the extensions built in
house (rather than by Just) have failed. We have Code Warrior patched to 8.3 and
have been using the mcp files contributed by Just (with file paths changed to match
our system).

Even so in at least one module _renderPM we get a strange error at run time in the
following code

    f = fopen (filename, "rb"); /*f is non NULL supposedly a good descriptor*/
    if (f == NULL) return NULL;

    pfb_size = 0;
    pfb_size_max = 32768;
    pfb = gt1_new (char, pfb_size_max);
    while (1)
        {
            bytes_read = fread (pfb + pfb_size, 1, pfb_size_max - pfb_size, f);
            /*the first fread returns zero*/
            if (bytes_read == 0) break;
            pfb_size += bytes_read;
            gt1_double (pfb, char, pfb_size_max);
        }
    /*errno here is 9 (ie bad file descriptor)*/
    fclose (f);

ie we get a non null descriptor, but the first fread seems to treat it as bad.
We have GUSI2 & Python/include on the paths list and supposedly the right things on
the linker path, but this code just doesn't work.

If I try the above in a console linked in the standard way things work as expected
as does the binary created by Just.

Anyone with any good ideas?
-- 
Robin Becker



More information about the Pythonmac-SIG mailing list