[PyQt] sipdistutils.py - broken exceptions flags in VC++

Matteo Italia matteo at mitalia.net
Mon Oct 27 22:27:47 GMT 2014


Hello,

when building a Python 2.7 extension on Windows (with VC++ 2008) through
sipdistutils.py, I spotted several warning about wrong exception flags.

The issue seems to be that distutils only bothers to provide a compiler
with build options adequate for C extensions
(http://bugs.python.org/issue1222585), while we need C++ settings. For
this reason, no /EH flag is provided, and we end up building extensions
with broken exception semantic (in particular, RAII seems to be
completely broken when no /EH is provided, and catch(...) catches also
SEH exceptions, which is _extremely_ bad).

To fix this issue, I patched sipdistutils.py to add the adequate
exception specification option (/EHsc) if not present (and complain if
some /EH which is not /EHsc is already present); attached you can find
the diff against the sipdistutils.py in the current repository (since it
already goes on checking command line arguments, there's also a check to
remove -Wstrict-prototypes on Unix, which just generates noise in the
build).

Could someone check if it looks ok and if it can be eventually merged
back in SIP? I already had several bizarre crashes that could be traced
back to this problem, so I think that this may be useful to others.

Regards,
Matteo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sipdistutils-winexceptions.patch
Type: text/x-patch
Size: 1975 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20141027/6bf3849b/attachment.bin>


More information about the PyQt mailing list