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
Change ast.__version__ calculation to provide consistent ordering #56482
Comments
Benjamin's AST modification checkins switched directly from the SVN revision number (as a string) to the hg revision hash. While that preserves uniqueness, it makes ordering difficult to determine. The last AST version in 3.2 was '82163' (and it was '82160' in 2.7). I would like to change the version number calculation to something like: '9.x.y.zzzzzzz' where 9 is a prefix to get 3.3+ ast.__version__ values to sort higher than earlier versions This would require changes to ast.py (to add the 9.x.y prefix) and to release.py (to check that the 'x.y' prefix is correct in the current release) |
I'd drop the 9. part. People doing comparison on these numbers possibly OTOH, most people probably don't do ordering comparisons at all, but
I'd synthesize x.y from patchlevel.h, in which case it would be fully |
I propose we leave ast.__version__ alone. Using ast.__version__ at all should be a very advanced usecase. Generally, you should just be able to look at sys.version_info. We could document this rather than duplicating sys.version_info in ast.__version__. I think ast.__version__ is mostly useful for things like: print("Running with Python {} and AST {}".format(sys.mercurial[2], ast.__version__) |
I think you should just kill ast.__version__ in that case. There was a discussion on python-dev and packaging about __version__ and PEP-396 was the result. If you want the VCS info put it somewhere else (like __vcs_version__?). |
sys.version_info and sys._mercurial provide all the info needed for someone (like me for mnfy) to know if their code will work against the AST nodes used by the running interpreter. I say drop __version__. |
New changeset b23ad0a6cf87 by Benjamin Peterson in branch 'default': |
Can you please elaborate? How do you know from looking at |
On Sat, Jul 16, 2011 at 8:24 PM, Martin v. Löwis <report@bugs.python.org> wrote:
For anyone not following CPython tip, the real version indicator is Life is more difficult for anyone following CPython tip, but in that |
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: