[issue4804] Python on Windows disables all C runtime library assertions

Martin v. Löwis report at bugs.python.org
Mon Jan 19 17:30:46 CET 2009


Martin v. Löwis <martin at v.loewis.de> added the comment:

Kristjan, please understanding that setting the CRT error handling is
not thread-safe, and trying to do it in a fine-grained way can cause all
kinds of crazy races. With your patch, the following sequencce of events
is possible if two threads T1 and T2 simultaneously try to access the CRT:

1. T1 saves the old mode (O), installs its own mode (N1)
2. T1 releases the GIL, invokes CRT operation
3. T2 starts running, saves the old mode (N1), installs its own mode (N2)
4. T1 completes, restores the old mode (O)
5. T2 completes, restores the old mode (N1)

As a net result, the original error handling is *not* restored.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4804>
_______________________________________


More information about the Python-bugs-list mailing list