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

bpo-40334: PEP 617: New PEG parser for CPython #19503

Merged
merged 78 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
57f78dd
Run CI in pegen branch as well (#3)
pablogsal Feb 26, 2020
5c0c31f
Merge steps 1-3 and 6 into 'pegen' branch (#8)
gvanrossum Mar 20, 2020
eab06f3
Fall back to a set for done in collect_todo (#9)
lysnikolaou Mar 20, 2020
91427a4
Add Github Actions for pegen tests in Tools/peg_generator (#12)
lysnikolaou Mar 23, 2020
cccfd3d
Allow expressions in yield_expression rule and rename it to annotated…
lysnikolaou Mar 23, 2020
51611b4
Copy .clang-format from pegen project, to guide 'make format-c'
gvanrossum Mar 23, 2020
0c7a382
Expose a C API and a Python-level module for pegen (#11)
lysnikolaou Mar 23, 2020
0cffa81
Run clang-format over peg_parser/pegen.c
gvanrossum Mar 23, 2020
e960c15
Run clang-format over Parser/pegen/pegen.c
gvanrossum Mar 23, 2020
89c2385
Run clang-format over Modules/peg_parser.c
gvanrossum Mar 23, 2020
1d2b107
Ifdef-out token_name() to silence compiler output noise warning
gvanrossum Mar 23, 2020
12f6175
Merge branch 'master' into pegen
gvanrossum Mar 23, 2020
59abf20
Make Ubuntu tests pass; disable Win and Mac tests (#19)
lysnikolaou Mar 23, 2020
14ae717
Rewrite run_parser* functions to always return a mod_ty (#17)
lysnikolaou Mar 24, 2020
bfa7445
Rewrite exported function (#21)
lysnikolaou Mar 24, 2020
4c4917b
Merge remote-tracking branch 'upstream/master' into pegen
lysnikolaou Mar 24, 2020
479bd95
Remove all unnecessary code from Tools/peg_generator; only keep the g…
lysnikolaou Mar 27, 2020
4410737
Support for PEP 614 (#24)
pablogsal Mar 27, 2020
b984cad
Re-enable MacOS test on Github Actions (#26)
lysnikolaou Mar 27, 2020
919a669
Add memoization control (#28)
gvanrossum Mar 27, 2020
55101cb
Fold long lines in metagrammar
gvanrossum Mar 30, 2020
ca3eeca
Update Parser/pegen/parse.c after addition of memoization flag (#28)
lysnikolaou Apr 1, 2020
33b77af
Add a command-line flag and an environment variable to enable pegen (…
lysnikolaou Apr 3, 2020
3aa1dd4
Add missing possible start rules in python.gram (#32)
lysnikolaou Apr 3, 2020
b8ce9a1
Merge remote-tracking branch 'upstream/master' into pegen
pablogsal Apr 3, 2020
f3d8888
Update grammar to account for _Py_keyword changes (#40)
pablogsal Apr 3, 2020
242114a
Merge remote-tracking branch 'upstream/master' into pegen
pablogsal Apr 3, 2020
35bedc2
Add new C API functions PyPegen_*FromFileObject and use them in inter…
lysnikolaou Apr 4, 2020
74736fe
Memoize some rules to avoid exponential time in deep nesting (#39)
pablogsal Apr 4, 2020
4bc4e7c
Run tests with pegen enabled on CI (#41)
lysnikolaou Apr 5, 2020
6ba7869
Improve SyntaxError message when an ERRORTOKEN is returned by the tok…
lysnikolaou Apr 6, 2020
ee7b2cf
Use FILE pointer instead of filename string to pass file to parser (#52)
lysnikolaou Apr 6, 2020
c12c227
Add start_mark variable in loop rules (#51)
lysnikolaou Apr 6, 2020
18743bc
Simplify grammar rules around ASYNC (#53)
gvanrossum Apr 7, 2020
3359dab
Throw SyntaxError when parsing a STRING throws an exception (#54)
lysnikolaou Apr 7, 2020
071df9c
Add use_peg field to sys.flags (#55)
lysnikolaou Apr 7, 2020
b1f0bd8
Improve error reporting and disallow f(**kwargs, *args) (#46)
pablogsal Apr 7, 2020
0627990
Propagate errors from the tokenizer (#57)
pablogsal Apr 8, 2020
f233194
Output more descriptive error messages for named expressions (#56)
lysnikolaou Apr 8, 2020
1dcdc4b
Output more descriptive error messages for invalid assignments (#59)
lysnikolaou Apr 9, 2020
8da51f1
Avoid memory leak in Parser_New (#62)
lysnikolaou Apr 9, 2020
494114e
Fix SEGFAULT in test_fstring (#61)
lysnikolaou Apr 9, 2020
99a8e2f
Provide location info on SyntaxError due to EOLS or EOFS errors (#60)
lysnikolaou Apr 9, 2020
502dfb7
Merge remote-tracking branch 'upstream/master' into pegen
lysnikolaou Apr 10, 2020
e43370e
Ignore encoding cookie when that's necessary (#68)
lysnikolaou Apr 12, 2020
a7f962d
Silence compiler warnings about unused variables on Linux (#70)
lysnikolaou Apr 12, 2020
9c36a0f
Merge remote-tracking branch 'upstream/master' into pegen
lysnikolaou Apr 12, 2020
9952d03
Refactor illegal syntax rules to avoid invalid error messages (#72)
lysnikolaou Apr 13, 2020
b684233
Create a new rule for STRING+ and memoize it (#67)
lysnikolaou Apr 14, 2020
45d6bf7
Fix type of strings rule (#73)
lysnikolaou Apr 14, 2020
a54e89e
Skip one test_traceback test, where pegen is better (#74)
lysnikolaou Apr 15, 2020
d386c70
Skip non-critical test_string_literals test that fails (#75)
lysnikolaou Apr 15, 2020
1169db2
Add script that reproduces all the PEP benchmarks (#71)
lysnikolaou Apr 15, 2020
e764fb2
Merge remote-tracking branch 'upstream/master' into pegen
lysnikolaou Apr 15, 2020
dad5249
Fix calls to _PyInterpreterState_GET after merge
lysnikolaou Apr 15, 2020
6f6354f
Generate specialized error message for invalid string prefixes (#77)
lysnikolaou Apr 15, 2020
b623006
Compress data/xxl.py and decompress on demand (#79)
pablogsal Apr 17, 2020
1a03e3e
Use the new parser by default (#81)
pablogsal Apr 17, 2020
3af6081
Rename pegen functions to start with the _PyPegen_ prefix (#80)
lysnikolaou Apr 17, 2020
e3c95c9
Compile pegen in windows (#82)
pablogsal Apr 17, 2020
d7e4b5c
Remove whitespace to make patchcheck happy (#87)
pablogsal Apr 17, 2020
ffee25f
Rename the peg_parser module to _peg_parser (#86)
pablogsal Apr 17, 2020
b625797
Fix travis errors (#88)
pablogsal Apr 17, 2020
85f7400
Remove the -p command line option and add a new -X oldparser option i…
lysnikolaou Apr 18, 2020
a4c58b5
Disallow trailing comma in from-imports (#97)
lysnikolaou Apr 20, 2020
04062ed
Add blurb
gvanrossum Apr 20, 2020
f1afe08
Use pegen in the symtable and fix symtable test errors (#102)
pablogsal Apr 20, 2020
b8899ec
Merge branch 'master' into pegen
gvanrossum Apr 20, 2020
975baa4
Only optimize __debug__ when ctx==Load (#106)
gvanrossum Apr 21, 2020
298650c
Reproduce current parser's error messages for indentation errors (#107)
lysnikolaou Apr 21, 2020
de6edfb
Add more tokenize errors (#105)
pablogsal Apr 21, 2020
ef0f6fa
Normalize unicode identifiers (#108)
pablogsal Apr 21, 2020
a9d309c
Raise IndentationError on indentation-related errors (#111)
lysnikolaou Apr 21, 2020
871cecb
Copy most fixes from #96 except for the part that uses pegen for comp…
gvanrossum Apr 21, 2020
ecef99b
Temporarily suppress two failures in test_eof.py (one even with old p…
gvanrossum Apr 21, 2020
443afb1
Use col_offset when raising an E_DEDENT error (#116)
lysnikolaou Apr 21, 2020
87460d2
Use pegen in compile and other functions in pythonrun.c (#96)
lysnikolaou Apr 22, 2020
14ab84b
Don't use longjmp and check for the error indicator on every rule (#119)
pablogsal Apr 22, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- '**/*.rst'
pull_request:
branches:
- pegen
Copy link
Member

Choose a reason for hiding this comment

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

This change should be reverted, no?

- master
- 3.8
- 3.7
Expand Down Expand Up @@ -50,6 +51,22 @@ jobs:
build_macos:
name: 'macOS'
runs-on: macos-latest
env:
PYTHONOLDPARSER: old
steps:
- uses: actions/checkout@v1
- name: Configure CPython
run: ./configure --with-pydebug --with-openssl=/usr/local/opt/openssl --prefix=/opt/python-dev
- name: Build CPython
run: make -j4
- name: Display build info
run: make pythoninfo
- name: Tests
run: make buildbottest TESTOPTS="-j4 -uall,-cpu"
Copy link
Member

Choose a reason for hiding this comment

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

Is it really worth it to slow down the pre-commit to test the old parser on different platforms? A single pre-commit job would be enough, no? (Pick your favorite platform.) Or maybe only post-commit buildbots would be enough.


build_macos_pegen:
name: 'macOS - Pegen'
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Configure CPython
Expand All @@ -64,6 +81,34 @@ jobs:
build_ubuntu:
name: 'Ubuntu'
runs-on: ubuntu-latest
env:
OPENSSL_VER: 1.1.1f
PYTHONOLDPARSER: old
steps:
- uses: actions/checkout@v1
- name: Install Dependencies
run: sudo ./.github/workflows/posix-deps-apt.sh
- name: 'Restore OpenSSL build'
id: cache-openssl
uses: actions/cache@v1
with:
path: ./multissl/openssl/${{ env.OPENSSL_VER }}
key: ${{ runner.os }}-multissl-openssl-${{ env.OPENSSL_VER }}
- name: Install OpenSSL
if: steps.cache-openssl.outputs.cache-hit != 'true'
run: python3 Tools/ssl/multissltests.py --steps=library --base-directory $PWD/multissl --openssl $OPENSSL_VER --system Linux
- name: Configure CPython
run: ./configure --with-pydebug --with-openssl=$PWD/multissl/openssl/$OPENSSL_VER
- name: Build CPython
run: make -j4
- name: Display build info
run: make pythoninfo
- name: Tests
run: xvfb-run make buildbottest TESTOPTS="-j4 -uall,-cpu"

build_ubuntu_pegen:
name: 'Ubuntu - Pegen'
runs-on: ubuntu-latest
env:
OPENSSL_VER: 1.1.1f
steps:
Expand Down
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: c
dist: xenial
dist: bionic
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to change the Travis CI base image in a separated PR.


# To cache doc-building dependencies and C compiler output.
cache:
Expand All @@ -22,6 +22,7 @@ env:
branches:
only:
- master
- pegen
- /^\d\.\d+$/
- buildbot-custom

Expand Down Expand Up @@ -157,7 +158,9 @@ install:
before_script:
# -Og is much faster than -O0
- CFLAGS="${CFLAGS} -Og" ./configure --with-pydebug
- make -j4 regen-all
- eval "$(pyenv init -)"
- pyenv global 3.8
- PYTHON_FOR_REGEN=python3.8 make -j4 regen-all
- changes=`git status --porcelain`
- |
# Check for changes in regenerated files
Expand Down
8 changes: 8 additions & 0 deletions Doc/using/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ Miscellaneous options
defines the following possible values:

* ``-X faulthandler`` to enable :mod:`faulthandler`;
* ``-X oldparser``: enable the traditional LL(1) parser. See also
:envvar:`PYTHONOLDPARSER`.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe the PEP 617 should be mentioned here. I suggest to directly deprecate this option and announces its removal in 3.10 using a .. deprecated markup.

Moreover, the new option should be documented in the ".. versionchanged:: 3.9" below.

Same remark for PYTHONOLDPARSER.

* ``-X showrefcount`` to output the total reference count and number of used
memory blocks when the program finishes or after each statement in the
interactive interpreter. This only works on debug builds.
Expand Down Expand Up @@ -574,6 +576,12 @@ conflict.
:option:`-d` multiple times.


.. envvar:: PYTHONOLDPARSER

If this is set it is equivalent to specifying the :option:`-X`
``oldparser`` option.


.. envvar:: PYTHONINSPECT

If this is set to a non-empty string it is equivalent to specifying the
Expand Down
Loading