Martin v. Löwis wrote:
In building a package with several platforms, I
ran across the warning message below from Visual
Studio 2008.  Should we add the /EHsc option to the
compile_options in distutils for MSVC?  Or is it more
complex than that...

Who is "we"? If you have a module that uses C++ exceptions,
you should certainly enable compiler support for exceptions,
for that module.

In my original email, I referred to the patch for distutils at:
 http://tinyurl.com/63bqo2

Based on that patch, I made the attached patch in distutils to
msvc9compiler.py and that made the complaints disappear
(and presumably made the exceptions work?).

Is there any downside to doing this by default?
Or should I parameterize my build_ext for that platform
to include that option?

Some of the web pages on the topic suggest that this is
due to a change in the compiler behavior with VS2008.
So this may bite other people as 2.6 rolls out.

I am not an expert in structured exception handling
and all the nuances so welcome any advice.

Thanks - Jim



--- msvc9compiler.py.orig       2008-05-16 16:08:01.619640200 -0700
+++ msvc9compiler.py    2008-05-15 16:45:47.493969600 -0700
@@ -375,15 +375,15 @@
 
         self.preprocess_options = None
         if self.__arch == "x86":
-            self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3',
+            self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/EHsc',
                                      '/DNDEBUG']
-            self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3',
+            self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', 
'/EHsc',
                                           '/Z7', '/D_DEBUG']
         else:
             # Win64
-            self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' ,
+            self.compile_options = [ '/nologo', '/Ox', '/MD', '/W3', '/GS-' , 
'/EHsc',
                                      '/DNDEBUG']
-            self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', 
'/GS-',
+            self.compile_options_debug = ['/nologo', '/Od', '/MDd', '/W3', 
'/GS-', '/EHsc',
                                           '/Z7', '/D_DEBUG']
 
         self.ldflags_shared = ['/DLL', '/nologo', '/INCREMENTAL:NO']
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to