summaryrefslogtreecommitdiff
path: root/pycparser/_build_tables.py
Commit message (Collapse)AuthorAgeFilesLines
* _build_tables: Invalidate cache before importing generated modules (#494)Michał Górny2023-02-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure to invalidate finder caches before trying to import generated modules. This is necessary according to the Python documentation: https://docs.python.org/3/library/importlib.html#importlib.invalidate_caches This fixes a hard-to-reproduce bug that Python would be unable to find just-generated `lextab.py` if mtime of the current directory did not change from the moment the script was started. This could e.g. be the case if one has second-precision timestamps and removes the generated file just before starting the build, e.g.: $ rm pycparser/lextab.py; python -m build -nw It could also be reproduced easier by doing something like: $ cd pycparser $ touch .; python -B _build_tables.py Traceback (most recent call last): File "/var/tmp/pycparser/pycparser/_build_tables.py", line 38, in <module> import lextab ModuleNotFoundError: No module named 'lextab' This is because the first command (`rm` or `touch`) updates the mtime of the directory to the current time. If the script is run fast enough, it manages to scan the directory and then write the new `lextab.py` within the same second. As a result, mtime of the directory after writing the new file is the same as when the script was started, finder does not invalidate the cache and assumes that `lextab.py` does not exist since it did not exist when the directory was scanned earlier. This potentially fixes #493. It was originally reported on https://bugs.gentoo.org/701878. Thanks to Gary E. Miller for patience in reproducing the problem and proxy-debugging it for me, as well as testing the final patch before submission.
* Insert '.' and '..' to sys.path before import statements (#321)Thomas Krennwallner2019-04-131-2/+6
| | | | Restricted environments like embeddable python do not include the current working directory on startup.
* Use https:// for all project links where available (#267)Jon Dufresne2018-06-261-1/+1
|
* Remove Copyright from every source fileEli Bendersky2017-02-021-1/+1
| | | | Replace it by website link; copyright appears in the LICENSE file already, which is sufficient
* Various cosmetic updates to documentationEli Bendersky2015-05-101-1/+1
|
* Prepare for release 2.11release_v2.11Eli Bendersky2015-04-211-1/+0
|
* Fix sys.path inclusion order in _build_tables.py (GH issue #12),Eli Bendersky2013-07-241-1/+1
| | | | and some comment fixes.
* Updated CHANGES and some cosmetic cleanupsEli Bendersky2013-06-121-3/+3
|
* typo & cosmetic changesEli Bendersky2012-02-031-1/+1
|
* * Added EmptyStatement node to represent an empty statement (sole ';'), with ↵eli.bendersky2011-10-161-1/+3
| | | | | | tests and c-to-c support * Added sys.path update in _build_tables.py to enable it to run correctly from the pycparser folder
* changed license notices to BSD in all fileseli.bendersky2011-04-291-2/+2
|
* releasing version 2.01 - removed yaml dependency, fix installation problemseli.bendersky2010-12-041-2/+3
|
* Fixes for correct setup of the packageeli.bendersky2010-12-031-1/+1
|
* initial implementation of C99 named initializers and compound literals. The ↵eli.bendersky2010-10-301-1/+1
| | | | latter still doesn't work because of a shift/reduce conflict
* initial import from SVNEli Bendersky2010-05-211-0/+31