This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author christian.heimes
Recipients christian.heimes, georg.brandl, loewis, pitrou
Date 2012-09-08.13:35:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1347111302.92.0.306708953598.issue15883@psf.upfronthosting.co.za>
In-reply-to
Content
errno is usually implemented as thread local variable, more precisely as a macro that calls a function which returns the memory address of a thread local variable. Each C runtime library has its own function and TLS which introduces an issue when a Python extension uses a different CRT than the core. AFAIK that an issue only an issue on Windows with other versions of Visual Studio.

This means that mixed CRTs break the three PyErr_SetFromErrno* functions as they always access the errno of the core's CRT. The patch adds a Py_errno macro that must be used in extensions before a PyErr_SetFromErrno() function is used.

Example:
fd = open(filename, O_RDONLY);
if (fd == -1) {
    Py_errno = errno;
    return PyErr_SetFromErrnoWithFilename(PyExc_OSError, filename);
}

The issue was discovered by me a about two weeks ago and further analyzed by Martin. http://mail.python.org/pipermail/python-dev/2012-August/121460.html
History
Date User Action Args
2012-09-08 13:35:03christian.heimessetrecipients: + christian.heimes, loewis, georg.brandl, pitrou
2012-09-08 13:35:02christian.heimessetmessageid: <1347111302.92.0.306708953598.issue15883@psf.upfronthosting.co.za>
2012-09-08 13:35:01christian.heimeslinkissue15883 messages
2012-09-08 13:35:01christian.heimescreate