bpo-24960: use pkgutil.get_data in lib2to3 to read pickled grammar files by benjaminp · Pull Request #4977 · python/cpython (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation6 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
This is more complicated than it should be because we need to preserve the
useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar
has. We only look for the pickled grammar file with pkgutil.get_data and only if
the source file does not exist.
https://bugs.python.org/issue24960
This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist.
Should this ultimately use importlib.resources
(landing soon, right @brettcannon @warsaw?) in 3.7?
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is I believe this is correct. Don't let the importlib.resources question hold you back, as this is the form the change will need backporting to 3.6 and 2.7 in anyways.
Thanks @benjaminp for the PR 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6.
🐍🍒⛏🤖
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request
…les (pythonGH-4977)
This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist. (cherry picked from commit 8a58771)
Sorry, @benjaminp, I could not cleanly backport this to 2.7
due to a conflict.
Please backport using cherry_picker on command line.cherry_picker 8a5877165e993afb2633cd48da5222326d3f6e0e 2.7
benjaminp added a commit that referenced this pull request
…mar files (GH-4977)
This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist.. (cherry picked from commit 8a58771)
benjaminp pushed a commit that referenced this pull request
This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist. (cherry picked from commit 8a58771)
benjaminp added a commit that referenced this pull request
This is more complicated than it should be because we need to preserve the useful mtime-based regeneration feature that lib2to3.pgen2.driver.load_grammar has. We only look for the pickled grammar file with pkgutil.get_data and only if the source file does not exist.. (cherry picked from commit 8a58771)