diff options
| -rwxr-xr-x | setup.py | 18 | ||||
| -rw-r--r-- | src/greenlet/greenlet.cpp | 4 |
2 files changed, 16 insertions, 6 deletions
@@ -1,5 +1,5 @@ #! /usr/bin/env python - +from __future__ import print_function import sys import os import glob @@ -48,9 +48,19 @@ elif sys.platform == 'win32': # around try blocks are less aggressive. # /EHsc is suggested, as /EHa isn't supposed to be linked to other things not built # with it. - print("Enabling /EHsc") - cpp_compile_args.append("/EHsc") - + # See https://docs.microsoft.com/en-us/cpp/build/reference/eh-exception-handling-model?view=msvc-160 + handler = "/EHsc" + if '64 bit' not in sys.version: + # Our 32-bit switch_x64_msvc.h file + # reads and writes to fs:[0] and [seh]; the writes to fs:[0] + # generate "warning C4733: + # Inline asm assigning to 'FS:0': handler not registered as safe handler" + # We might need to pass /SAFESEH:NO to the linker somehow, or register + # the slp_switch function with the .SAFESEH assembler directive. Here, + # we're trying to enable generic SEH handling for everything. + handler = "/EHa" + print("Exception handling with", handler) + cpp_compile_args.append(handler) def readfile(filename): with open(filename, 'r') as f: # pylint:disable=unspecified-encoding diff --git a/src/greenlet/greenlet.cpp b/src/greenlet/greenlet.cpp index 456330e..931c4ce 100644 --- a/src/greenlet/greenlet.cpp +++ b/src/greenlet/greenlet.cpp @@ -1053,7 +1053,7 @@ public: try { err = target->switching_state->g_initialstub(&dummymarker); } - catch (const PyErrOccurred& e) { + catch (const PyErrOccurred&) { this->release_args(); throw; } @@ -1345,7 +1345,7 @@ protected: try { result = parent->switching_state->g_switch(); } - catch (const PyErrOccurred& e) { + catch (const PyErrOccurred&) { // Ignore. } |
