Bugs item #728896, was opened at 2003-04-28 22:49
Message generated for change (Comment added) made by mhammond
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=728896&group_id=78018
Category: win32
Group: None
>Status: Closed
>Resolution: Fixed
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'
----------------------------------------------------------------------
>Comment By: Mark Hammond (mhammond)
Date: 2003-07-29 16:59
Message:
Logged In: YES
user_id=14198
This has been fixed - my test_win32api module no longer
shows a stale exception.
Thanks!
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=551954&aid=728896&group_id=78018
|