8000 Remove blib2to3 grammar cache logging (#3193) · IBMZ-Linux-OSS-Python/black@d85cf00 · GitHub
[go: up one dir, main page]

Skip to content

Commit d85cf00

Browse files
authored
Remove blib2to3 grammar cache logging (psf#3193)
As error logs are emitted often (they happen when Black's cache directory is created after blib2to3 tries to write its cache) and cause issues to be filed by users who think Black isn't working correctly. The 8000 se errors are expected for now and aren't a cause for concern so let's remove them to stop worrying users (and new issues from being opened). We can improve the blib2to3 caching mechanism to write its cache at the end of a successful command line invocation later.
1 parent 4f1772e commit d85cf00

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454

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

5860
### Packaging
5961

src/blib2to3/pgen2/driver.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,13 @@ def load_grammar(
263263
logger = logging.getLogger(__name__)
264264
gp = _generate_pickle_name(gt) if gp is None else gp
265265
if force or not _newer(gp, gt):
266-
logger.info("Generating grammar tables from %s", gt)
267266
g: grammar.Grammar = pgen.generate_grammar(gt)
268267
if save:
269-
logger.info("Writing grammar tables to %s", gp)
270268
try:
271269
g.dump(gp)
272-
except OSError as e:
273-
logger.info("Writing failed: %s", e)
270+
except OSError:
271+
# Ignore error, caching is not vital.
272+
pass
274273
else:
275274
g = grammar.Grammar()
276275
g.load(gp)

0 commit comments

Comments
 (0)
0