[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-05-26 Thread Brian Curtin

Brian Curtin  added the comment:

Committed to py3k in r81547 and release31-maint in r81546.

Thanks for the patch!

--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-05-26 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

I wrote a short C program to test a few different variations.  It looks to me 
like a bug in the operating system's implementation of HKEY_PERFORMANCE_DATA 
(which is a virtual registry key).  If I pass NULL as the second parameter to a 
more conventional key that has a default value, everything works fine.

I suggest changing the test to pass "" instead of None.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-05-26 Thread Brian Curtin

Brian Curtin  added the comment:

test_dynamic_key fails on py3k, but not because of these changes.

RegQueryValueExW doesn't appear to work with NULL for the second parameter 
(valueName), although it is documented to and the ANSI version on 2.x works 
fine. The empty string is also documented as an acceptable parameter, so while 
testing it out, I hardcoded "" in PyQueryValueEx and the calls worked. With 
NULL, it raises "WindowsError: [Error 87] The parameter is incorrect".

Thoughts? The current py3k patch is attached.

--
Added file: http://bugs.python.org/file17467/issue2810_py3k.diff

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-05-26 Thread Brian Curtin

Brian Curtin  added the comment:

Committed to trunk in r81517 and release26-maint in r81540.

I'll cover the 3.x stuff today and then close it out.

--
assignee: stutzbach -> brian.curtin
resolution:  -> fixed
stage: patch review -> committed/rejected

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-29 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

In the updated patch I uploaded yesterday, I increased the loop count from 100 
to 1000 and it still runs virtually instantly.  I also added a comment stating 
that the test is trying to trigger a race condition.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-29 Thread R. David Murray

R. David Murray  added the comment:

How much would increasing the loop count slow down the test?  Since if the bug 
isn't present the loop will run to the end every time, if it is non-trivial it 
would probably be better to keep it shorter, since Brian said it failed one way 
or another 9 out of 10 times.  Either way, a note in the test that it may 
occasionally pass even if the bug is present, but should fail most of the time, 
would be a good idea.

--
nosy: +r.david.murray

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-28 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


Removed file: http://bugs.python.org/file16802/winreg_test.pach

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-28 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Attached is a new test-case patch.

--
Added file: http://bugs.python.org/file17122/winreg_test.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-27 Thread Daniel Stutzbach

Daniel Stutzbach  added the comment:

Thank for the feedback.  I'll revise the patch tomorrow based on your 
code-cleanup suggestions.

To answer your question about the thread and explain why the test sometimes 
passes:

The goal of test_changing_value is to try to trigger a race condition that 
exists inside many of these function.  So, yes, the thread is necessary. :) 
Thankfully the functions call Py_BEGIN_ALLOW_THREADS; otherwise, I'd have to 
launch another process to try to trigger it.

Sometimes we never manage to hit the race condition and the test passes even 
though the bug is present.  I can increase the number of attempts to trigger it 
(currently "for _ in range(100)") to make it more likely to occur every time 
the test is run.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-27 Thread Brian Curtin

Brian Curtin  added the comment:

After a quick glance, the _winreg.c changes look ok. I'll try to fit in a 
review shortly.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-27 Thread Brian Curtin

Brian Curtin  added the comment:

test_changing_value is giving inconsistent results when the _winreg.c patch is 
not applied. It mostly fails on QueryValue, sometimes on EnumValue, and about 
1/10 times the test does not fail at all. Ideally the tests should not use 
threads -- can the same thing be tested without a thread? It seems like the 
issue isn't related to concurrency, but maybe I missed something.

With _winreg.c patched, the tests seem to pass, but I haven't run that as much 
as I have the unpatched version.

winreg_test.pach
- test_changing_value (assuming we need do this as a thread)
-- I'd just use HKEY_CURRENT_USER directly instead of storing it locally
-- done doesn't need to be a list, it could just be the True/False
-- the if/else could be shortened to `s = "x" if short else "x"*2000`

- test_long_key
-- After SetValue I'd just call EnumKey(key, 0) since you can only ever have 
that value to use. The loop isn't really used.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-27 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


--
assignee:  -> stutzbach
keywords: +needs review
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2810] _winreg.EnumValue sometimes raises WindowsError ("More data is available")

2010-04-27 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


--
title: _winreg.EnumValue fails when the registry data includes multibyte 
unicode characters -> _winreg.EnumValue sometimes raises WindowsError ("More 
data is available")

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com