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

Remove blib2to3 grammar cache logging #3193

Merged
merged 1 commit into from Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Expand Up @@ -52,6 +52,8 @@

- Change from deprecated `asyncio.get_event_loop()` to create our event loop which
removes DeprecationWarning (#3164)
- Remove logging from internal `blib2to3` library since it regularily emits error logs
about failed caching that can and should be ignored (#3193)

### Packaging

Expand Down
7 changes: 3 additions & 4 deletions src/blib2to3/pgen2/driver.py
Expand Up @@ -263,14 +263,13 @@ def load_grammar(
logger = logging.getLogger(__name__)
gp = _generate_pickle_name(gt) if gp is None else gp
if force or not _newer(gp, gt):
logger.info("Generating grammar tables from %s", gt)
g: grammar.Grammar = pgen.generate_grammar(gt)
if save:
logger.info("Writing grammar tables to %s", gp)
try:
g.dump(gp)
except OSError as e:
logger.info("Writing failed: %s", e)
except OSError:
# Ignore error, caching is not vital.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make it debug? Could be handy to debug a caching issue one day? Should we also log the OSError type / messing in said debug message?

Suggested change
# Ignore error, caching is not vital.
# Ignore error, as caching is not vital.

pass
else:
g = grammar.Grammar()
g.load(gp)
Expand Down