mirror of https://github.com/python/cpython
8f59ee01be
* Add tokenization of :=
- Add token to Include/token.h. Add token to documentation in Doc/library/token.rst.
- Run `./python Lib/token.py` to regenerate Lib/token.py.
- Update Parser/tokenizer.c: add case to handle `:=`.
* Add initial usage of := in grammar.
* Update Python.asdl to match the grammar updates. Regenerated Include/Python-ast.h and Python/Python-ast.c
* Update AST and compiler files in Python/ast.c and Python/compile.c. Basic functionality, this isn't scoped properly
* Regenerate Lib/symbol.py using `./python Lib/symbol.py`
* Tests - Fix failing tests in test_parser.py due to changes in token numbers for internal representation
* Tests - Add simple test for := token
* Tests - Add simple tests for named expressions using expr and suite
* Tests - Update number of levels for nested expressions to prevent stack overflow
* Update symbol table to handle NamedExpr
* Update Grammar to allow assignment expressions in if statements.
Regenerate Python/graminit.c accordingly using `make regen-grammar`
* Tests - Add additional tests for named expressions in RoundtripLegalSyntaxTestCase, based on examples and information directly from PEP 572
Note: failing tests are currently commented out (4 out of 24 tests currently fail)
* Tests - Add temporary syntax test failure tests in test_parser.py
Note: There is an outstanding TODO for this -- syntax tests need to be
moved to a different file (presumably test_syntax.py), but this is
covering what needs to be tested at the moment, and it's more convenient
to run a single test for the time being
* Add support for allowing assignment expressions as function argument annotations. Uncomment tests for these cases because they all pass now!
* Tests - Move existing syntax tests out of test_parser.py and into test_named_expressions.py. Refactor syntax tests to use unittest
* Add TargetScopeError exception to extend SyntaxError
Note: This simply creates the TargetScopeError exception, it is not yet
used anywhere
* Tests - Update tests per PEP 572
Continue refactoring test suite:
The named expression test suite now checks for any invalid cases that
throw exceptions (no longer limited to SyntaxErrors), assignment tests
to ensure that variables are properly assigned, and scope tests to
ensure that variable availability and values are correct
Note:
- There are still tests that are marked to skip, as they are not yet
implemented
- There are approximately 300 lines of the PEP that have not yet been
addressed, though these may be deferred
* Documentation - Small updates to XXX/todo comments
- Remove XXX from child description in ast.c
- Add comment with number of previously supported nested expressions for
3.7.X in test_parser.py
* Fix assert in seq_for_testlist()
* Cleanup - Denote "Not implemented -- No keyword args" on failing test case. Fix PEP8 error for blank lines at beginning of test classes in test_parser.py
* Tests - Wrap all file opens in `with...as` to ensure files are closed
* WIP: handle f(a := 1)
* Tests and Cleanup - No longer skips keyword arg test. Keyword arg test now uses a simpler test case and does not rely on an external file. Remove print statements from ast.c
* Tests - Refactor last remaining test case that relied on on external file to use a simpler test case without the dependency
* Tests - Add better description of remaning skipped tests. Add test checking scope when using assignment expression in a function argument
* Tests - Add test for nested comprehension, testing value and scope. Fix variable name in skipped comprehension scope test
* Handle restriction of LHS for named expressions - can only assign to LHS of type NAME. Specifically, restrict assignment to tuples
This adds an alternative set_context specifically for named expressions,
set_namedexpr_context. Thus, context is now set differently for standard
assignment versus assignment for named expressions in order to handle
restrictions.
* Tests - Update negative test case for assigning to lambda to match new error message. Add negative test case for assigning to tuple
* Tests - Reorder test cases to group invalid syntax cases and named assignment target errors
* Tests - Update test case for named expression in function argument - check that result and variable are set correctly
* Todo - Add todo for TargetScopeError based on Guido's comment (
|
||
---|---|---|
.. | ||
cpython | ||
internal | ||
Python-ast.h | ||
Python.h | ||
abstract.h | ||
asdl.h | ||
ast.h | ||
bitset.h | ||
bltinmodule.h | ||
boolobject.h | ||
bytearrayobject.h | ||
bytes_methods.h | ||
bytesobject.h | ||
cellobject.h | ||
ceval.h | ||
classobject.h | ||
code.h | ||
codecs.h | ||
compile.h | ||
complexobject.h | ||
context.h | ||
coreconfig.h | ||
datetime.h | ||
descrobject.h | ||
dictobject.h | ||
dtoa.h | ||
dynamic_annotations.h | ||
enumobject.h | ||
errcode.h | ||
eval.h | ||
fileobject.h | ||
fileutils.h | ||
floatobject.h | ||
frameobject.h | ||
funcobject.h | ||
genobject.h | ||
graminit.h | ||
grammar.h | ||
import.h | ||
intrcheck.h | ||
iterobject.h | ||
listobject.h | ||
longintrepr.h | ||
longobject.h | ||
marshal.h | ||
memoryobject.h | ||
metagrammar.h | ||
methodobject.h | ||
modsupport.h | ||
moduleobject.h | ||
namespaceobject.h | ||
node.h | ||
object.h | ||
objimpl.h | ||
odictobject.h | ||
opcode.h | ||
osdefs.h | ||
osmodule.h | ||
parsetok.h | ||
patchlevel.h | ||
pgen.h | ||
pgenheaders.h | ||
py_curses.h | ||
pyarena.h | ||
pycapsule.h | ||
pyctype.h | ||
pydebug.h | ||
pydtrace.d | ||
pydtrace.h | ||
pyerrors.h | ||
pyexpat.h | ||
pyfpe.h | ||
pyhash.h | ||
pylifecycle.h | ||
pymacconfig.h | ||
pymacro.h | ||
pymath.h | ||
pymem.h | ||
pyport.h | ||
pystate.h | ||
pystrcmp.h | ||
pystrhex.h | ||
pystrtod.h | ||
pythonrun.h | ||
pythread.h | ||
pytime.h | ||
rangeobject.h | ||
setobject.h | ||
sliceobject.h | ||
structmember.h | ||
structseq.h | ||
symtable.h | ||
sysmodule.h | ||
token.h | ||
traceback.h | ||
tracemalloc.h | ||
tupleobject.h | ||
typeslots.h | ||
ucnhash.h | ||
unicodeobject.h | ||
warnings.h | ||
weakrefobject.h |