Issue 10296: ctypes catches BreakPoint error on windows 32 (original) (raw)

Created on 2010-11-03 08:20 by kristjan.jonsson, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ctypes.diff kristjan.jonsson,2013-03-18 21:47
Messages (6)
msg120312 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2010-11-03 08:20
import ctypes ctypes.windll.kernel32.DebugBreak() This used to be a handy way to attach a debugger to a running program, by way of JIT debugging. Now ctypes catches and handles this exception so a debugger is never invoked. Bummer.
msg124683 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2010-12-26 23:00
With a release build of python, I have a similar behavior on both 2.5 and 2.7; the messages are different though: 2.5: WindowsError: [Error -2147483645] One or more arguments are invalid. 2.7: WindowsError: exception: breakpoint encountered And with both versions, a debug build (python_d.exe) triggers the JIT debugger. What do you get exactly?
msg124700 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2010-12-27 02:42
I _think_ that in our old 2.5 python (which had a backported ctypes from 2.6 to support 64 bits) we always got the JIT debugger i.e. with _ctypes.pyd and _ctypes_d.pyd. This api, "DebugBreak" always invokes the JIT debugger, however the program was compiled (_NDEBUG, DEBUG, or not). This is done by raising the breakpoint exception and apparently _ctypes.pyd is catching that exception and handling it, but only in release mode, while I think it shouldn't do.
msg155450 - (view) Author: Pat Byrne (pjlbyrne) Date: 2012-03-12 13:38
This affects me too.
msg184533 - (view) Author: Kristján Valur Jónsson (kristjan.jonsson) * (Python committer) Date: 2013-03-18 21:47
Here is a suggested patch. SEH will now not catch BREAKPOINT exceptions.
msg184700 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-03-19 23:00
New changeset b2e8392a8f77 by Kristján Valur Jónsson in branch '2.7': Issue #10296 : Don't handle BreakPoint exceptions using http://hg.python.org/cpython/rev/b2e8392a8f77 New changeset bc5778b488c1 by Kristján Valur Jónsson in branch '3.2': Issue #10296 : Don't handle BreakPoint exceptions using http://hg.python.org/cpython/rev/bc5778b488c1 New changeset 4c7eb717ea88 by Kristján Valur Jónsson in branch '3.3': #10296: Merge to 3.3 http://hg.python.org/cpython/rev/4c7eb717ea88 New changeset 4f3fbdb4d748 by Kristján Valur Jónsson in branch 'default': Issue #10296: Merge to default http://hg.python.org/cpython/rev/4f3fbdb4d748
History
Date User Action Args
2022-04-11 14:57:08 admin set github: 54505
2013-03-20 03:05:05 kristjan.jonsson set status: open -> closedresolution: fixed
2013-03-19 23:00:52 python-dev set nosy: + python-devmessages: +
2013-03-18 21:47:41 kristjan.jonsson set files: + ctypes.diffkeywords: + patchmessages: +
2012-07-26 14:51:58 pitrou set nosy: + meador.inge
2012-07-26 14:26:13 ishimoto set nosy: + ishimoto
2012-03-12 13:38:30 pjlbyrne set nosy: + pjlbyrnemessages: +
2011-12-22 12:02:37 Sacha.Brants-Menard set nosy: + Sacha.Brants-Menard
2010-12-27 02:42:37 kristjan.jonsson set nosy:theller, amaury.forgeotdarc, kristjan.jonssonmessages: +
2010-12-26 23:00:59 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2010-12-22 22:06:59 terry.reedy set nosy: + theller
2010-11-03 08:20:30 kristjan.jonsson create