[issue7766] sys.getwindowsversion as PyStructSequence

2010-07-08 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: The previously mentioned comments about backwards incompatibility with the number of items in the sequence are now a problem, since structseq now inherits from tuple. It seems that n_in_sequence gets ignored and we have a 9 item tuple. --

[issue7766] sys.getwindowsversion as PyStructSequence

2010-07-08 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Brian Curtin wrote: Brian Curtin cur...@acm.org added the comment: The previously mentioned comments about backwards incompatibility with the number of items in the sequence are now a problem, since structseq now inherits from

[issue7766] sys.getwindowsversion as PyStructSequence

2010-07-08 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: Yep, setting this back to closed. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7766 ___

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: The more I think about this, the more concerned I am about changing the number of elements in the tuple. That's the change that broke platform.py. Maybe we should add a parameter named something like level, defaulting to 0. 0 = existing

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Eric Smith wrote: Eric Smith e...@trueblade.com added the comment: The more I think about this, the more concerned I am about changing the number of elements in the tuple. That's the change that broke platform.py. Maybe we should

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Great idea, Marc-Andre. I agree that's the better approach. It looks like PyStructSequence supports this, by setting n_in_sequence to a value smaller then the number of PyStructSequence_Fields. A quick look doesn't show any uses of this in the

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Marc-Andre Lemburg
Marc-Andre Lemburg m...@egenix.com added the comment: Eric Smith wrote: Eric Smith e...@trueblade.com added the comment: Great idea, Marc-Andre. I agree that's the better approach. It looks like PyStructSequence supports this, by setting n_in_sequence to a value smaller then the

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Here's a patch that implement's Marc-Andre's suggestion. The docstring and documentation need work. I still need to verify that this isn't a misuse of PyStructSequence, but the tests pass on Windows. I need to verify a few other platforms to

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: Thanks a lot for taking a look at this, Eric and Marc-Andre. Apologies for the few mistakes in there, I jumped the gun and submitted that last patch before having run the full test suite again. Good catch on the missing #ifdef. I will also run

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I can confirm the most recent patch (ex2) doesn't break anything on MacOS or Linux. It's clear that structseq.c is designed to be used this way, with more named members than unnamed members (and vice-versa, actually). See n_members vs.

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Here's the final version of the patch. After some testing on various platforms I'll commit it. -- Added file: http://bugs.python.org/file16020/winver_as_structseq_ex4.diff ___ Python tracker

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-26 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Committed in trunk r77763, in py3k r77765. -- assignee: - eric.smith resolution: - accepted stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-25 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: Here's an updated patch. I fixed some docstrings, modified it to work with the most recent assertIsInstance changes, and added #ifdef for Windows. There are a number of test failures still, I think all of them relating to errors in platform.py

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-23 Thread Brian Curtin
New submission from Brian Curtin cur...@acm.org: I always find myself wishing sys.getwindowsversion() utilized the named tuple concept, so here it is against trunk. sys.version_info was also changed in this manner for 2.7. Because it is a PyStructSeq/named tuple, it is still accessible like a

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-23 Thread Eric Smith
Eric Smith e...@trueblade.com added the comment: I like this. I've visually reviewed the patch, but haven't tested it yet. I'm willing to commit this. Could you add to the tests to assert that .major is equal to [0], etc.? Also, the documentation says that element [4] is text, but you've

[issue7766] sys.getwindowsversion as PyStructSequence

2010-01-23 Thread Brian Curtin
Brian Curtin cur...@acm.org added the comment: Good point about OSVERSIONINFOEX. I've actually wanted some of that info as well, and according to MSDN the minimum supported client to get that structure is Windows 2000 - same as OSVERSIONINFO. Attached is a patch updated with your comments