summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* | Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. CallingSerhiy Storchaka2016-06-121-1/+1
|\ \ | |/ | | | | | | function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior.
| * Issue #27286: Fixed compiling BUILD_MAP_UNPACK_WITH_CALL opcode. CallingSerhiy Storchaka2016-06-121-1/+1
| | | | | | | | | | function with generalized unpacking (PEP 448) and conflicting keyword names could cause undefined behavior.
* | Issue #27140: Added BUILD_CONST_KEY_MAP opcode.Serhiy Storchaka2016-06-111-29/+156
| |
* | Issue #26647: Python interpreter now uses 16-bit wordcode instead of bytecode.Serhiy Storchaka2016-05-241-54/+27
| | | | | | | | Patch by Demur Rumed.
* | Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
|\ \ | |/
| * Issue #22570: Renamed Py_SETREF to Py_XSETREF.Serhiy Storchaka2016-04-061-1/+1
| |
| * code_richcompare() now uses the constants typesVictor Stinner2016-01-221-48/+10
| | | | | | | | | | | | | | | | | | Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now correctly compiled to two different functions: f1() returns 1 (int) and f2() returns 1.0 (int), even if 1 and 1.0 are equal. Add a new _PyCode_ConstantKey() private function.
* | compiler.c: fix compiler warnings on WindowsVictor Stinner2016-03-231-7/+9
| |
* | Update assertion in compiler_addop_i()Victor Stinner2016-03-011-4/+8
| | | | | | | | | | | | | | In practice, bytecode instruction arguments are unsigned. Update the assertion to make it more explicit that argument must be greater or equal than 0. Rewrite also the comment.
* | compile.c: inline compiler_use_new_block()Victor Stinner2016-02-271-26/+9
| | | | | | | | | | | | * Inline compiler_use_new_block() function into its only callee, compiler_enter_scope() * Remove unused NEW_BLOCK() macro
* | compiler: don't emit SyntaxWarning on const stmtVictor Stinner2016-02-081-22/+2
| | | | | | | | | | Issue #26204: the compiler doesn't emit SyntaxWarning warnings anymore when constant statements are ignored.
* | compiler now ignores constant statementsVictor Stinner2016-02-081-11/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The compile ignores constant statements and emit a SyntaxWarning warning. Don't emit the warning for string statement because triple quoted string is a common syntax for multiline comments. Don't emit the warning on ellipis neither: 'def f(): ...' is a legit syntax for abstract functions. Changes: * test_ast: ignore SyntaxWarning when compiling test statements. Modify test_load_const() to use assignment expressions rather than constant expression. * test_code: add more kinds of constant statements, ignore SyntaxWarning when testing that the compiler removes constant statements. * test_grammar: ignore SyntaxWarning on the statement "1"
* | Add ast.ConstantVictor Stinner2016-01-251-13/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | code_richcompare() now uses the constants typesVictor Stinner2016-01-221-48/+10
| | | | | | | | | | | | | | | | | | Issue #25843: When compiling code, don't merge constants if they are equal but have a different types. For example, "f1, f2 = lambda: 1, lambda: 1.0" is now correctly compiled to two different functions: f1() returns 1 (int) and f2() returns 1.0 (int), even if 1 and 1.0 are equal. Add a new _PyCode_ConstantKey() private function.
* | co_lnotab supports negative line number deltaVictor Stinner2016-01-201-7/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue #26107: The format of the co_lnotab attribute of code objects changes to support negative line number delta. Changes: * assemble_lnotab(): if line number delta is less than -128 or greater than 127, emit multiple (offset_delta, lineno_delta) in co_lnotab * update functions decoding co_lnotab to use signed 8-bit integers - dis.findlinestarts() - PyCode_Addr2Line() - _PyCode_CheckLineNumber() - frame_setlineno() * update lnotab_notes.txt * increase importlib MAGIC_NUMBER to 3361 * document the change in What's New in Python 3.6 * cleanup also PyCode_Optimize() to use better variable names
* | Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
|\ \ | |/ | | | | macro Py_SETREF.
| * Issue #20440: Massive replacing unsafe attribute setting code with specialSerhiy Storchaka2015-12-241-2/+1
| | | | | | | | macro Py_SETREF.
* | Issue 25483: Add an opcode to make f-string formatting more robust.Eric V. Smith2015-11-031-65/+33
| |
* | Issue #25523: Merge a-to-an corrections from 3.5Martin Panter2015-11-021-1/+1
|\ \ | |/
| * Issue #25523: Merge "a" to "an" fixes from 3.4 into 3.5Martin Panter2015-11-021-1/+1
| |\
| | * Issue #25523: Correct "a" article to "an" articleMartin Panter2015-11-021-1/+1
| | | | | | | | | | | | | | | | | | This changes the main documentation, doc strings, source code comments, and a couple error messages in the test suite. In some cases the word was removed or edited some other way to fix the grammar.
* | | Issue #24965: Implement PEP 498 "Literal String Interpolation". ↵Eric V. Smith2015-09-191-1/+116
| | | | | | | | | | | | Documentation is still needed, I'll open an issue for that.
* | | merge 3.5 (#25060)Benjamin Peterson2015-09-111-1/+1
|\ \ \ | |/ /
| * | compute stack effect of BUILD_MAP correctly (closes #25060)Benjamin Peterson2015-09-111-1/+1
| | |
* | | Fix refleak.Stefan Krah2015-07-271-1/+3
|\ \ \ | |/ /
| * | Fix refleak.Stefan Krah2015-07-271-1/+3
| | |
* | | Merge 3.5 (Issue #24687)Yury Selivanov2015-07-231-14/+13
|\ \ \ | |/ /
| * | Issue #24687: Plug refleak on SyntaxError in function parameters annotations.Yury Selivanov2015-07-231-14/+13
| | |
* | | Merge 3.5 (Issue #24619)Yury Selivanov2015-07-221-3/+2
|\ \ \ | |/ /
| * | Issue #24619: More tests; fix nits in compiler.cYury Selivanov2015-07-221-3/+2
| | |
* | | Merge 3.5 (Issue #24528)Yury Selivanov2015-06-301-1/+4
|\ \ \ | |/ /
| * | Issue #24528: Improve error message for awaits in comprehensionsYury Selivanov2015-06-301-1/+4
| | |
* | | Issue #24400: Merge 3.5Yury Selivanov2015-06-221-6/+4
|\ \ \ | |/ /