You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
<snip>
File "C:\Projects\python-trunk\lib\test\test_winreg.py", line 86, in
ReadTestData
with OpenKey(key, "sub_key") as sub_key:
AttributeError: __exit__
_winreg.OpenKey() returns a PyHKEY. This type can no longer be used in
a "with" statement after r72912 introduced the SETUP_WITH opcode. The
old way used PyObject_GetAttr() to get __enter__ and __exit__ which
works fine with PyHKEY since it has a tp_getattr function. The new way
uses _PyObject_LookupSpecial() which uses the MRO and the dict of the
object.
I guess the right fix here is to update PyHKEY so it uses the modern
APIs but I don't know how to do this without breaking the special casing
for the "handle" member. Using T_INT isn't quite correct since it is a
pointer not an int.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: