Python 2.4.2 using msvcrt71.dll on Win and compatibility issues

Christoph Zwerschke cito at online.de
Tue Feb 7 13:54:07 EST 2006


The latest Windows distribution of Python 2.4.2 is using the 
msvcrt71.dll, while PostgreSQL is using msvcrt.dll.

This lead to the following problem:

I was using PyGreSQL to connect to the PostgreSQL database. There is a 
function that prints a query object q simply by writing: "print q". What 
happens on the lower levels is that PyObject_Print(q, stdout) is called, 
where stdout is the stdout file descriptor of msvcrt71.dll. Then, 
PyGreSQL calls the PostgreSQL function PQprint, handing it over that 
stdout file descriptor. PQprint in turn calls fprintf of msvcrt.dll, 
with the same file descriptor of msvcrt71.dll. This leads to a Windows 
exception since the file descriptors of mscvrt.dll and msvcrt71.dll are 
obviously not compatible.

I can imagine that other C extensions which are using dlls based on 
msvcrt can run into the same problem.

Is there a general strategy to avoid this kind of problems?

-- Christoph



More information about the Python-list mailing list