summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-17611. Move unwinding of stack for "pseudo exceptions" from interpreter ↵Serhiy Storchaka2018-02-221-165/+244
| | | | | | | | | to compiler. (GH-5006) Co-authored-by: Mark Shannon <mark@hotpy.org> Co-authored-by: Antoine Pitrou <antoine@python.org>
* bpo-32550. Remove the STORE_ANNOTATION bytecode. (GH-5181)Mark Shannon2018-01-301-6/+10
|
* String annotations [PEP 563] (#4390)Guido van Rossum2018-01-261-2/+24
| | | | | | | | * Document `from __future__ import annotations` * Provide plumbing and tests for `from __future__ import annotations` * Implement unparsing the AST back to string form This is required for PEP 563 and as such only implements a part of the unparsing process that covers expressions.
* bpo-31113: Get rid of recursion in the compiler for normal control flow. (#3015)Serhiy Storchaka2018-01-111-78/+104
|
* bpo-24340: Fix estimation of the code stack size. (#5076)Serhiy Storchaka2018-01-091-37/+90
|
* bpo-32439: Clean up the code for compiling comparison expressions. (#5029)Serhiy Storchaka2017-12-301-23/+20
|
* bpo-32372: Move __debug__ optimization to the AST level. (#4925)Serhiy Storchaka2017-12-251-18/+8
|
* bpo-32365: Fix a reference leak when compile __debug__. (#4916)Serhiy Storchaka2017-12-181-4/+4
| | | It was introduced in bpo-27169.
* bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)Serhiy Storchaka2017-12-151-30/+15
| | | This fixes also bpo-22091.
* bpo-29469: Move constant folding to AST optimizer (GH-2858)INADA Naoki2017-12-141-0/+4
|
* bpo-32176: Set CO_NOFREE in the code object constructor (GH-4675)Nick Coghlan2017-12-031-5/+0
| | | | | | | | Previously, CO_NOFREE was set in the compiler, which meant it could end up being set incorrectly when code objects were created directly. Setting it in the constructor based on freevars and cellvars ensures it is always accurate, regardless of how the code object is defined.
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-111-1/+1
| | | | (#4370)
* bpo-31708: Allow async generator expressions in synchronous functions (#3905)Yury Selivanov2017-10-061-1/+1
|
* bpo-31709: Drop support for asynchronous __aiter__. (#3903)Yury Selivanov2017-10-061-6/+0
|
* bpo-31338 (#3374)Barry Warsaw2017-09-151-2/+1
| | | | | | | * Add Py_UNREACHABLE() as an alias to abort(). * Use Py_UNREACHABLE() instead of assert(0) * Convert more unreachable code to use Py_UNREACHABLE() * Document Py_UNREACHABLE() and a few other macros.
* bpo-31286, bpo-30024: Fixed stack usage in absolute imports with (#3217)Serhiy Storchaka2017-08-291-10/+16
| | | binding a submodule to a name.
* bpo-30923: Silence fall-through warnings included in -Wextra since gcc-7.0. ↵Stefan Krah2017-08-211-2/+3
| | | | (#3157)
* bpo-30501: Make the compiler producing optimized code for condition ↵Serhiy Storchaka2017-06-111-41/+137
| | | | expressions. (#1851)
* bpo-30024: Circular imports involving absolute imports with binding (#1264)Serhiy Storchaka2017-05-091-2/+2
| | | a submodule to a name are now supported.
* bpo-29878: Add global instances of int for 0 and 1. (#852)Serhiy Storchaka2017-03-301-16/+3
|
* bpo-29463: Add docstring field to some AST nodes. (#46)INADA Naoki2017-02-221-48/+16
| | | | | | | | | | | * bpo-29463: Add docstring field to some AST nodes. ClassDef, ModuleDef, FunctionDef, and AsyncFunctionDef has docstring field for now. It was first statement of there body. * fix document. thanks travis! * doc fixes
* bpo-29607: Fix stack_effect computation for CALL_FUNCTION_EX (#202)Matthieu Dartiailh2017-02-211-1/+1
|
* Issue #28959: Added private macro PyDict_GET_SIZE for retrieving the size of ↵Serhiy Storchaka2016-12-161-17/+9
| | | | dict.
* Issue #26110: Add LOAD_METHOD/CALL_METHOD opcodes.Yury Selivanov2016-12-141-0/+37
| | | | | | | Special thanks to INADA Naoki for pushing the patch through the last mile, Serhiy Storchaka for reviewing the code, and to Victor Stinner for suggesting the idea (originally implemented in the PyPy project).
* Issue #28739: f-string expressions no longer accepted as docstrings andSerhiy Storchaka2016-12-111-1/+2
|\ | | | | | | by ast.literal_eval() even if they do not include subexpressions.
| * Issue #28739: f-string expressions no longer accepted as docstrings andSerhiy Storchaka2016-12-111-1/+2
| | | | | | | | by ast.literal_eval() even if they do not include subexpressions.
* | Merge #23722 from 3.6Nick Coghlan2016-12-051-2/+6
|\ \ | |/
| * Issue #23722: improve __classcell__ compatibilityNick Coghlan2016-12-051-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Handling zero-argument super() in __init_subclass__ and __set_name__ involved moving __class__ initialisation to type.__new__. This requires cooperation from custom metaclasses to ensure that the new __classcell__ entry is passed along appropriately. The initial implementation of that change resulted in abruptly broken zero-argument super() support in metaclasses that didn't adhere to the new requirements (such as Django's metaclass for Model definitions). The updated approach adopted here instead emits a deprecation warning for those cases, and makes them work the same way they did in Python 3.5. This patch also improves the related class machinery documentation to cover these details and to include more reader-friendly cross-references and index entries.
* | Issue #28823: Simplified compiling with opcode BUILD_MAP_UNPACK.Serhiy Storchaka2016-11-281-5/+2
| |
* | Added the const qualifier to char* variables that refer to readonly internalSerhiy Storchaka2016-11-201-1/+1
|/ | | | UTF-8 represenatation of Unicode objects.
* Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-5/+5
|\ | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
| * Issue #28701: Replace PyUnicode_CompareWithASCIIString with ↵Serhiy Storchaka2016-11-161-5/+5
| | | | | | | | | | | | _PyUnicode_EqualToASCIIString. The latter function is more readable, faster and doesn't raise exceptions.
* | Issue #28257: Improved error message when pass a non-iterable asSerhiy Storchaka2016-10-021-2/+2
| | | | | | | | a var-positional argument. Added opcode BUILD_TUPLE_UNPACK_WITH_CALL.
* | Issue #27213: Fixed different issues with reworked CALL_FUNCTION* opcodes.Serhiy Storchaka2016-09-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | * BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with single tuple or dict. * Restored more informative error messages for incorrect var-positional and var-keyword arguments. * Removed code duplications in _PyEval_EvalCodeWithName(). * Removed redundant runtime checks and parameters in _PyStack_AsDict(). * Added a workaround and enabled previously disabled test in test_traceback. * Removed dead code from the dis module.
* | Issue #28076: Variable annotations should be mangled for private names.Guido van Rossum2016-09-111-1/+7
| | | | | | | | By Ivan Levkivskyi.
* | Issue #27129: Replaced wordcode related magic constants with macros.Serhiy Storchaka2016-09-111-6/+7
| |
* | Issue #23722: Initialize __class__ from type.__new__()Nick Coghlan2016-09-111-5/+10
| | | | | | | | | | | | | | | | | | The __class__ cell used by zero-argument super() is now initialized from type.__new__ rather than __build_class__, so class methods relying on that will now work correctly when called from metaclass methods during class creation. Patch by Martin Teichmann.
* | Rework CALL_FUNCTION* opcodesVictor Stinner2016-09-091-89/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more efficient bytecode: * CALL_FUNCTION now only accepts position arguments * CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys of keyword arguments are packed into a constant tuple. * CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for positional and keyword arguments. CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed. 2 tests of test_traceback are currently broken: skip test, the issue #28050 was created to track the issue. Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka and Victor Stinner.
* | Issue #28008: Implement PEP 530 -- asynchronous comprehensions.Yury Selivanov2016-09-091-16/+202
| |
* | Issue #28003: Implement PEP 525 -- Asynchronous Generators.Yury Selivanov2016-09-091-5/+8
| |
* | Issue #27985: Implement PEP 526 -- Syntax for Variable Annotations.Yury Selivanov2016-09-091-1/+214
| | | | | | | | Patch by Ivan Levkivskyi.
* | replace PY_SIZE_MAX with SIZE_MAXBenjamin Peterson2016-09-071-2/+2
| |
* | replace Py_(u)intptr_t with the c99 standard typesBenjamin Peterson2016-09-061-3/+3
| |
* | Issue #27078: Added BUILD_STRING opcode. Optimized f-strings evaluation.Serhiy Storchaka2016-09-061-24/+2
| |
* | Issue #27594: Prevent assertion error when running test_ast with coverageNed Deily2016-08-171-1/+1
| | | | | | | | | | enabled: ensure code object has a valid first line number. Patch suggested by Ivan Levkivskyi.
* | merge 3.5 (#27514)Benjamin Peterson2016-07-151-1/+1
|\ \ | |/
| * make too many nested blocks be a SyntaxError instead of a SystemError ↵Benjamin Peterson2016-07-151-1/+1
| | | | | | | | | | | | (closes #27514) Patch by Ammar Askar.
* | Issue #27301: Fixed incorrect return codes for errors in compile.c.Serhiy Storchaka2016-06-151-24/+38
|\ \ | |/
| * Issue #27301: Fixed incorrect return codes for errors in compile.c.Serhiy Storchaka2016-06-151-16/+20
| |
* | Issue #27095: Simplified MAKE_FUNCTION and removed MAKE_CLOSURE opcodes.Serhiy Storchaka2016-06-121-111/+136
| | | | | | | | Patch by Demur Rumed.