lark-parser / lark

Lark is a parsing toolkit for Python, built with a focus on ergonomics, performance and modularity.
MIT License
4.88k stars 414 forks source link

Add user to cache filename; better handle cache load/save failures #1179

Closed klauer closed 2 years ago

klauer commented 2 years ago

Context

Closes #1178

Description

This is my attempt at fixing the issue I reported (#1178) regarding cache files generated by different users on the same system.

Consider this a proposal - I'd be happy to adjust it to your preference.

Three main changes were made:

erezsh commented 2 years ago

Thanks, I agree with the changes.

Moved the try/except block to include cache load

The one thing that bugs me is that now it will always say "Loading grammar from cache ...", even when the cache file doesn't exist. At least, we should change it to "checking for cache for grammar", or something of the sort.

@MegaIng Mind also taking a look?

klauer commented 2 years ago

Anything else I can do to help move this along?

erezsh commented 2 years ago

@klauer Sorry, I've been a little busy. I'll try to look into it this weekend.

erezsh commented 2 years ago

Thanks for the PR!