Commit graph

12 commits

Author SHA1 Message Date
Victor Stinner f2c1aa1661 Add ast.Constant
Issue #26146: Add a new kind of AST node: ast.Constant. It can be used by
external AST optimizers, but the compiler does not emit directly such node.

An optimizer can replace the following AST nodes with ast.Constant:

* ast.NameConstant: None, False, True
* ast.Num: int, float, complex
* ast.Str: str
* ast.Bytes: bytes
* ast.Tuple if items are constants too: tuple
* frozenset

Update code to accept ast.Constant instead of ast.Num and/or ast.Str:

* compiler
* docstrings
* ast.literal_eval()
* Tools/parser/unparse.py
2016-01-26 00:40:57 +01:00
Victor Stinner 042cb465f6 Fix compiler warning on Windows 64-bit: asdl_seq_SET() stores the index parameter
into a Py_ssize_t, instead of an int
2013-11-16 00:16:58 +01:00
Antoine Pitrou d01d396e7f Issue #4555: All exported C symbols are now prefixed with either "Py" or "_Py".
("make smelly" now clean)
2013-10-12 22:52:43 +02:00
Benjamin Peterson 442f20996d create NameConstant AST class for None, True, and False literals (closes #16619) 2012-12-06 17:41:04 -05:00
Martin v. Löwis cc10a37ef0 Widen ASDL sequences to Py_ssize_t lengths to better match PEP 353. 2012-05-15 14:45:03 +02:00
Benjamin Peterson e249841903 add a asdl bytes type, so Bytes.s be properly typechecked 2011-08-09 16:08:39 -05:00
Neal Norwitz 6baa4c4cc6 Whoops, fix build breakage. There were still a few uses of the bool type.
Remove the last few uses of bool/true/false.
2007-02-26 19:14:12 +00:00
Thomas Wouters 49fd7fa443 Merge p3yk branch with the trunk up to revision 45595. This breaks a fair
number of tests, all because of the codecs/_multibytecodecs issue described
here (it's not a Py3K issue, just something Py3K discovers):
http://mail.python.org/pipermail/python-dev/2006-April/064051.html

Hye-Shik Chang promised to look for a fix, so no need to fix it here. The
tests that are expected to break are:

test_codecencodings_cn
test_codecencodings_hk
test_codecencodings_jp
test_codecencodings_kr
test_codecencodings_tw
test_codecs
test_multibytecodec

This merge fixes an actual test failure (test_weakref) in this branch,
though, so I believe merging is the right thing to do anyway.
2006-04-21 10:40:58 +00:00
Jeremy Hylton a829313d7b Remove asdl_seq_APPEND() and simplify asdl seq implementation.
Clarify intended use of set_context() and check errors at all call sites.
2006-02-28 17:58:27 +00:00
Neal Norwitz adb69fcdff Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,
simplifies a lot of error handling code, and fixes many memory leaks.
2005-12-17 20:54:49 +00:00
Neal Norwitz 7b5a604d24 Whoops, checkin consistent versions of *all* files to stop polluting
a bunch of names
2005-11-13 19:14:20 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00