Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_winreg fails #50450

Closed
abbeyj mannequin opened this issue Jun 5, 2009 · 2 comments
Closed

test_winreg fails #50450

abbeyj mannequin opened this issue Jun 5, 2009 · 2 comments
Labels
OS-windows tests Tests in the Lib/test dir

Comments

@abbeyj
Copy link
Mannequin

abbeyj mannequin commented Jun 5, 2009

BPO 6201
Nosy @amauryfa, @benjaminp

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:

assignee = None
closed_at = <Date 2009-06-09.23:10:28.888>
created_at = <Date 2009-06-05.06:45:41.071>
labels = ['tests', 'OS-windows']
title = 'test_winreg fails'
updated_at = <Date 2009-06-09.23:10:28.838>
user = 'https://bugs.python.org/abbeyj'

bugs.python.org fields:

activity = <Date 2009-06-09.23:10:28.838>
actor = 'amaury.forgeotdarc'
assignee = 'none'
closed = True
closed_date = <Date 2009-06-09.23:10:28.888>
closer = 'amaury.forgeotdarc'
components = ['Tests', 'Windows']
creation = <Date 2009-06-05.06:45:41.071>
creator = 'abbeyj'
dependencies = []
files = []
hgrepos = []
issue_num = 6201
keywords = []
message_count = 2.0
messages = ['88926', '89173']
nosy_count = 3.0
nosy_names = ['amaury.forgeotdarc', 'benjamin.peterson', 'abbeyj']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue6201'
versions = ['Python 2.7']

@abbeyj
Copy link
Mannequin Author

abbeyj mannequin commented Jun 5, 2009

test_winreg fails with:
======================================================================
ERROR: testLocalMachineRegistryWorks (test.test_winreg.WinregTests)
----------------------------------------------------------------------

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.

@abbeyj abbeyj mannequin added tests Tests in the Lib/test dir OS-windows labels Jun 5, 2009
@amauryfa
Copy link
Member

amauryfa commented Jun 9, 2009

Fixed with r73325.
2.7 really introduces an incompatibility here; I added an entry in the
whatsnew file.

@amauryfa amauryfa closed this as completed Jun 9, 2009
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OS-windows tests Tests in the Lib/test dir
Projects
None yet
Development

No branches or pull requests

1 participant