[pywin32-bugs] [ pywin32-Bugs-728896 ] Strange exception handling in win32api registry fns
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2003-04-28 12:49:39
|
Bugs item #728896, was opened at 2003-04-28 22:49 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=728896&group_id=78018 Category: win32 Group: None Status: Open Resolution: None Priority: 5 Submitted By: Mark Hammond (mhammond) Assigned to: Mark Hammond (mhammond) Summary: Strange exception handling in win32api registry fns Initial Comment: Hi, The registry handling methods in win32api seem to have problems with the Python exception handling. It took me some time, but I have managed to isolate the problem to a simple program. But the problem is more severe in more complicated situations, and there it seems to happen with most (or all) registry methods (win32api.Reg...()). The methods of _winreg module do not exhibit this problem. For now, I am using _winreg. However, it would be nice if the problem could be tracked down inside the win32api's source code and be fixed. regards, Hung Jung Lu #---------------------------------------------------------------------- # OS used: Windows XP # # Python 2.1 # program works correctly: correct exception message displayed # # Python 2.2.2 (win32all build 152) # (a) In Pythonwin intractive window, you get # SystemError: error return without exception set # (b) When running with python.exe, it crashes # # Python 2.3b1 (win32all build 153) # (a) In Pythonwin intractive window, you get # SystemError: error return without exception set # (b) When running with python.exe, program exits silently, # which is not the correct behavior # # Comments: # (a) equivalent _winreg module methods do not have problem. # (b) problem seems to happen with most, or all, win32api.Reg...() # methods, not in this particular example, but in more # complicated programs (involving classes) # import win32con import win32api def reg_operation(): hkey = win32api.RegCreateKey(win32con.HKEY_CURRENT_USER, r'Software\Spam') x = 3/0 # or a statement like: raise 'error' try: reg_operation() except: x = 5/0 # or a statement like: raise 'error' ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=728896&group_id=78018 |