Commit Graph

241 Commits

Author SHA1 Message Date
Benjamin Peterson 2f8bfef158 replace PY_SIZE_MAX with SIZE_MAX 2016-09-07 09:26:18 -07:00
Eric V. Smith 6a4efce7a5 Closes issue 27921: Disallow backslashes anywhere in f-strings. This is a temporary restriction. In 3.6 beta 2, the plan is to again allow backslashes in the string parts of f-strings, but disallow them in the expression parts. 2016-09-03 09:18:34 -04:00
Martin Panter 02b75abf73 Merge spelling and grammar fixes from 3.5 2016-08-05 01:51:39 +00:00
Martin Panter 69332c1a64 Fix spelling and grammar in documentation and code comments 2016-08-04 13:07:31 +00:00
Serhiy Storchaka fbd1523525 Issue #27352: Correct the validation of the ImportFrom AST node and simplify
the implementation of the IMPORT_NAME opcode.
2016-06-27 21:39:12 +03:00
Berker Peksag 094c9c921c Issue #23275: Allow () = iterable assignment syntax
Documentation updates by Martin Panter.
2016-05-18 08:44:29 +03:00
Benjamin Peterson 9d66d4af06 remove unused c_encoding struct member 2016-02-25 23:25:14 -08:00
Benjamin Peterson 768921cf33 rewrite parsestr() so it's comprehensible; remove dead code 2016-02-25 23:13:53 -08:00
Benjamin Peterson 202803a0c0 c_encoding can never be NULL, which allows some code simplification 2016-02-25 22:34:45 -08:00
Victor Stinner be59d1489b Issue #26146: enhance ast.Constant error message
Mention the name of the invalid type in error message of AST validation for
constants.

Suggestion made by Joseph Jevnik on a review.
2016-01-27 00:39:12 +01:00
Victor Stinner 726f6902ce Fix a refleak in validate_constant()
Issue #26146.
2016-01-27 00:11:47 +01:00
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
Georg Brandl 5c60ea3fa1 Fix two instances of wrong indentation. 2016-01-18 07:53:59 +01:00
Serhiy Storchaka 726fc139a5 Issue #20440: More use of Py_SETREF.
This patch is manually crafted and contains changes that couldn't be handled
automatically.
2015-12-27 15:44:33 +02:00
Serhiy Storchaka 2d06e84455 Issue #25923: Added the const qualifier to static constant arrays. 2015-12-25 19:53:18 +02:00
Victor Stinner f9827ea618 Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node when
compiling AST from Python objects.
2015-11-06 17:01:48 +01:00
Victor Stinner c106c68aeb Issue #25555: Fix parser and AST: fill lineno and col_offset of "arg" node when
compiling AST from Python objects.
2015-11-06 17:01:48 +01:00
Martin Panter c2432f6edb One more typo in a comment 2015-10-07 11:15:15 +00:00
Benjamin Peterson 00d4442979 merge 3.5 (#25131) 2015-09-25 22:44:55 -07:00
Benjamin Peterson 58b53953f8 make opening brace of container literals and comprehensions correspond to the line number and col offset of the AST node (closes #25131) 2015-09-25 22:44:43 -07:00
Eric V. Smith 1e5fcc3dea Fixed error creation if the problem is an empty expression in an f-string: use ast_error instead of PyErr_SetString. 2015-09-24 08:52:04 -04:00
Eric V. Smith 1d44c41b0c Move f-string compilation of the expression earlier, before the conversion character and format_spec are checked. This allows for error messages that more closely match what a user would expect. 2015-09-23 07:49:00 -04:00
Eric V. Smith 5567f89c6f Issue #24779: Remove unused rawmode parameter to unicode_decode. 2015-09-21 13:36:09 -04:00
Eric V. Smith 235a6f0984 Issue #24965: Implement PEP 498 "Literal String Interpolation". Documentation is still needed, I'll open an issue for that. 2015-09-19 14:51:32 -04:00
Victor Stinner 00723e0353 Fix ast_for_atom()
Clear PyObject_Str() exception if it failed, ast_error() should not be called
with an exception set.
2015-09-03 12:57:11 +02:00
Yury Selivanov 1fa3652e59 Merge 3.5 (issue #24975) 2015-09-02 15:50:04 -04:00
Yury Selivanov b3d531348c Issue #24975: Fix AST compilation for PEP 448 syntax. 2015-09-01 16:10:49 -04:00
Eric V. Smith 163b5c668d Fix a trivial typo. 2015-08-21 09:40:38 -04:00
Robert Collins df395991f6 Issue #9232: Support trailing commas in function declarations.
For example, "def f(*, a = 3,): pass" is now legal.

Patch from Mark Dickinson.
2015-08-12 08:00:06 +12:00
Yury Selivanov 14acf5f41d Issue #24791: Fix grammar regression for call syntax: 'g(*a or b)'. 2015-08-05 17:54:10 -04:00
Yury Selivanov 7544508f02 PEP 0492 -- Coroutines with async and await syntax. Issue #24017. 2015-05-11 22:57:16 -04:00
Benjamin Peterson 025e9ebd0a PEP 448: additional unpacking generalizations (closes #2292)
Patch by Neil Girdhar.
2015-05-05 20:16:41 -04:00
Victor Stinner 0c39b1b970 Initialize variables to prevent GCC warnings 2015-03-18 15:02:06 +01:00
Benjamin Peterson f86d1fdab7 merge 3.4 (#21295) 2015-02-02 10:52:56 -05:00
Benjamin Peterson 7a66fc22ad revert lineno and col_offset changes from #16795 (closes #21295) 2015-02-02 10:51:20 -05:00
Benjamin Peterson d51374ed78 PEP 465: a dedicated infix operator for matrix multiplication (closes #21176) 2014-04-09 23:55:56 -04:00
Benjamin Peterson 0714b8b6ab set line and column numbers for keyword-only arg nodes (closes #20619) 2014-02-13 19:22:14 -05:00
Benjamin Peterson e84fde981d set line and column numbers for keyword-only arg nodes (closes #20619) 2014-02-13 19:22:14 -05:00
Serhiy Storchaka c679227e31 Issue #1772673: The type of `char*` arguments now changed to `const char*`. 2013-10-19 21:03:34 +03: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
Victor Stinner 14e461d5b9 Close #11619: The parser and the import machinery do not encode Unicode
filenames anymore on Windows.
2013-08-26 22:28:21 +02:00
Christian Heimes 6f08d30afe Fix potential NULL pointer dereferencing in ast module
CID 719690
2013-07-24 21:02:50 +02:00
Christian Heimes 72f562f719 Fix potential NULL pointer dereferencing in ast module
CID 719690
2013-07-24 21:02:17 +02:00
Victor Stinner 0fae8f9083 Issue #18408: Fix ast_for_atom(), PyErr_Fetch(&type, &value, &tback) can set value to NULL 2013-07-17 21:51:42 +02:00
Victor Stinner 43d8195a70 Issue #18408: Handle PyArena_AddPyObject() failure in ast.c
PyList_Append() (called by PyArena_AddPyObject()) can fail because of a
MemoryError for example.
2013-07-17 00:57:58 +02:00
Benjamin Peterson aad1d87339 move declaration to top of block 2013-03-18 10:59:41 -07:00
Benjamin Peterson cda75be02a unify some ast.argument's attrs; change Attribute column offset (closes #16795)
Patch from Sven Brauch.
2013-03-18 10:48:58 -07:00
Serhiy Storchaka b8cbba5877 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:43:25 +02:00
Serhiy Storchaka 801d955f04 Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:42:01 +02:00
Serhiy Storchaka 5e61f14c6d Issue #12983: Bytes literals with invalid \x escape now raise a SyntaxError
and a full traceback including line number.
2013-02-10 17:36:00 +02:00