[issue25562] Python 2 & 3 don't allow the user to disable ctypes SEH in windows

2015-11-05 Thread R. David Murray

R. David Murray added the comment:

This would be a new feature and so would not be acceptable for python2.7.

I wonder if cffi has such a switch.

--
nosy: +r.david.murray
type: behavior -> enhancement
versions:  -Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25562] Python 2 & 3 don't allow the user to disable ctypes SEH in windows

2015-11-05 Thread tzickel

New submission from tzickel:

In Windows, there is a mechanizm called SEH that allows C/C++ programs to catch 
OS Exceptions (such as divide by zero, page faults, etc..).

Python's ctypes module for some reason forces the user to wrap all ctypes FFI 
calls with a special SEH wrapper that converts those exceptions to Python 
exceptions.

For the UNIX people think about it that python installs a signal handler 
without you asking (or being able to remove it) when calling FFI functions.

The main issue with this, is that when you want to debug why a DLL behaves 
badly and you want a process dump (or catch the stack trace in the DLL) you 
can't without attaching a debugger and catching first-chance exceptions 
(because the ctypes SEH handling masks the issue).

My proposal is to have both in python 2 and in python 3 an option to call an 
FFI function with selectively using or not SEH.

Here is the SEH wrap (as you can see it's not optional in runtime):
https://github.com/python/cpython/blob/master/Modules/_ctypes/callproc.c#L806

--
components: ctypes
messages: 254143
nosy: amaury.forgeotdarc, belopolsky, meador.inge, tzickel
priority: normal
severity: normal
status: open
title: Python 2 & 3 don't allow the user to disable ctypes SEH in windows
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com