summaryrefslogtreecommitdiffstats
path: root/Python/symtable.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-111789: Use PyDict_GetItemRef() in Python/symtable.c (gh-112084)Serhiy Storchaka2023-11-271-8/+4
|
* gh-111123: symtable should visit exception handlers before the else block ↵Irit Katriel2023-10-211-2/+2
| | | | (#111142)
* gh-109390: add dump_symtable utility under #if 0 (#109391)Carl Meyer2023-09-201-1/+110
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-109219: propagate free vars through type param scopes (#109377)Carl Meyer2023-09-141-3/+2
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-109118: Disallow nested scopes within PEP 695 scopes within classes (#109196)Jelle Zijlstra2023-09-121-0/+23
| | | | | Fixes #109118. Fixes #109194. Co-authored-by: Carl Meyer <carl@oddbird.net>
* gh-109207: Fix SystemError when printing symtable entry object. (GH-109225)云line2023-09-101-3/+2
|
* Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146)Serhiy Storchaka2023-09-081-15/+57
|
* GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT (#108507)Victor Stinner2023-09-081-2/+2
| | | | | | | Symbols of the C API should be prefixed by "Py_" to avoid conflict with existing names in 3rd party C extensions on "#include <Python.h>". test.pythoninfo now logs Py_C_RECURSION_LIMIT constant and other _testcapi and _testinternalcapi constants.
* gh-108765: Cleanup #include in Python/*.c files (#108977)Victor Stinner2023-09-061-1/+1
| | | Mention one symbol imported by each #include.
* GH-107263: Increase C stack limit for most functions, except ↵Mark Shannon2023-08-041-9/+2
| | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
* gh-106869: Use new PyMemberDef constant names (#106871)Victor Stinner2023-07-251-9/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Remove '#include "structmember.h"'. * If needed, add <stddef.h> to get offsetof() function. * Update Parser/asdl_c.py to regenerate Python/Python-ast.c. * Replace: * T_SHORT => Py_T_SHORT * T_INT => Py_T_INT * T_LONG => Py_T_LONG * T_FLOAT => Py_T_FLOAT * T_DOUBLE => Py_T_DOUBLE * T_STRING => Py_T_STRING * T_OBJECT => _Py_T_OBJECT * T_CHAR => Py_T_CHAR * T_BYTE => Py_T_BYTE * T_UBYTE => Py_T_UBYTE * T_USHORT => Py_T_USHORT * T_UINT => Py_T_UINT * T_ULONG => Py_T_ULONG * T_STRING_INPLACE => Py_T_STRING_INPLACE * T_BOOL => Py_T_BOOL * T_OBJECT_EX => Py_T_OBJECT_EX * T_LONGLONG => Py_T_LONGLONG * T_ULONGLONG => Py_T_ULONGLONG * T_PYSSIZET => Py_T_PYSSIZET * T_NONE => _Py_T_NONE * READONLY => Py_READONLY * PY_AUDIT_READ => Py_AUDIT_READ * READ_RESTRICTED => Py_AUDIT_READ * PY_WRITE_RESTRICTED => _Py_WRITE_RESTRICTED * RESTRICTED => (READ_RESTRICTED | _Py_WRITE_RESTRICTED)
* gh-107211: Rename PySymtable_Lookup() to _PySymtable_Lookup() (#107212)Victor Stinner2023-07-251-1/+1
| | | | Rename the internal PySymtable_Lookup() function to _PySymtable_Lookup() and no longer export it.
* gh-104656: Rename typeparams AST node to type_params (#104657)Jelle Zijlstra2023-05-221-43/+43
|
* gh-104640: Disallow walrus in comprehension within type scopes (#104641)Jelle Zijlstra2023-05-191-4/+31
|
* gh-104602: ensure all cellvars are known up front (#104603)Carl Meyer2023-05-191-19/+20
| | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* gh-104374: Remove access to class scopes for inlined comprehensions (#104528)Jelle Zijlstra2023-05-181-2/+3
| | | Co-authored-by: Carl Meyer <carl@oddbird.net>
* gh-104572: Improve error messages for invalid constructs in PEP 695 contexts ↵Jelle Zijlstra2023-05-171-4/+4
| | | | (#104573)
* gh-103763: Implement PEP 695 (#103764)Jelle Zijlstra2023-05-161-26/+329
| | | | | | | | | | | | | | This implements PEP 695, Type Parameter Syntax. It adds support for: - Generic functions (def func[T](): ...) - Generic classes (class X[T](): ...) - Type aliases (type X = ...) - New scoping when the new syntax is used within a class body - Compiler and interpreter changes to support the new syntax and scoping rules Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Co-authored-by: Eric Traut <eric@traut.com> Co-authored-by: Larry Hastings <larry@hastings.org> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104404: fix crasher with nested comprehensions plus lambdas (#104442)Carl Meyer2023-05-131-7/+14
|
* gh-104357: fix inlined comprehensions that close over iteration var (#104368)Carl Meyer2023-05-111-6/+13
|
* gh-97933: (PEP 709) inline list/dict/set comprehensions (#101441)Carl Meyer2023-05-091-27/+109
| | | | Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* gh-102371: move _Py_Mangle from compile.c to symtable.c (#102372)Irit Katriel2023-03-021-1/+66
|
* gh-87447: Fix walrus comprehension rebind checking (#100581)Nikita Sobolev2023-01-081-1/+2
| | | | Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
* gh-100577: Replace `assert(0)` with `Py_UNREACHABLE` in `symtable.c` (#100579)Nikita Sobolev2022-12-281-1/+1
|
* gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530)Victor Stinner2022-11-161-3/+3
| | | | Replace Py_INCREF() and Py_XINCREF() using a cast with Py_NewRef() and Py_XNewRef().
* gh-99300: Use Py_NewRef() in Python/ directory (#99302)Victor Stinner2022-11-101-6/+3
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in C files of the Python/ directory.
* gh-87092: do not allocate PyFutureFeatures dynamically (GH-98913)Irit Katriel2022-11-021-5/+4
|
* GH-91079: Decouple C stack overflow checks from Python recursion checks. ↵Mark Shannon2022-10-051-6/+3
| | | | (GH-96510)
* bpo-46765: Replace Locally Cached Strings with Statically Initialized ↵Eric Snow2022-02-231-39/+11
| | | | | Objects (gh-31366) https://bugs.python.org/issue46765
* bpo-46417: Clear symtable identifiers at exit (GH-30809)Victor Stinner2022-01-221-2/+15
| | | | | | Add _PySymtable_Fini() function, called by finalize_interp_clear(). Update test_cmd_line.test_showrefcount() to tolerate negative reference count.
* bpo-45292: [PEP-654] add except* (GH-29581)Irit Katriel2021-12-141-0/+6
|
* bpo-46042: Improve SyntaxError locations in the symbol table (GH-30059)Pablo Galindo Salgado2021-12-111-60/+83
|
* bpo-45753: Make recursion checks more efficient. (GH-29524)Mark Shannon2021-11-161-2/+3
| | | | * Uses recursion remaining, instead of recursion depth to speed up check against recursion limit.
* bpo-33346: Allow async comprehensions inside implicit async comprehensions ↵Serhiy Storchaka2021-07-131-1/+8
| | | | | (GH-6766) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-44313: generate LOAD_ATTR/CALL_FUNCTION for top-level imported objects ↵Batuhan Taskaya2021-06-301-1/+1
| | | | (GH-26677)
* bpo-42725: Render annotations effectless on symbol table with PEP 563 (GH-25583)Batuhan Taskaya2021-05-031-10/+91
|
* bpo-43892: Make match patterns explicit in the AST (GH-25585)Nick Coghlan2021-04-291-16/+48
| | | Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* bpo-43914: Highlight invalid ranges in SyntaxErrors (#25525)Pablo Galindo2021-04-231-51/+90
| | | | | | | | | | | | | | | | | To improve the user experience understanding what part of the error messages associated with SyntaxErrors is wrong, we can highlight the whole error range and not only place the caret at the first character. In this way: >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^ SyntaxError: Generator expression must be parenthesized becomes >>> foo(x, z for z in range(10), t, w) File "<stdin>", line 1 foo(x, z for z in range(10), t, w) ^^^^^^^^^^^^^^^^^^^^ SyntaxError: Generator expression must be parenthesized
* bpo-43244: Remove Yield macro from pycore_ast.h (GH-25243)Victor Stinner2021-04-071-1/+0
| | | | | | | | * pycore_ast.h no longer defines the Yield macro. * Fix a compiler warning on Windows: "warning C4005: 'Yield': macro redefinition". * Python-ast.c now defines directly functions with their real _Py_xxx() name, rather than xxx(). * Remove "#undef Yield" in C files including pycore_ast.h.
* bpo-43244: Remove the pyarena.h header (GH-25007)Victor Stinner2021-03-241-3/+3
| | | | | | | | | | | | | | | | | | Remove the pyarena.h header file with functions: * PyArena_New() * PyArena_Free() * PyArena_Malloc() * PyArena_AddPyObject() These functions were undocumented, excluded from the limited C API, and were only used internally by the compiler. Add pycore_pyarena.h header. Rename functions: * PyArena_New() => _PyArena_New() * PyArena_Free() => _PyArena_Free() * PyArena_Malloc() => _PyArena_Malloc() * PyArena_AddPyObject() => _PyArena_AddPyObject()
* bpo-43244: Remove parser_interface.h header file (GH-25001)Victor Stinner2021-03-241-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Remove parser functions using the "struct _mod" type, because the AST C API was removed: * PyParser_ASTFromFile() * PyParser_ASTFromFileObject() * PyParser_ASTFromFilename() * PyParser_ASTFromString() * PyParser_ASTFromStringObject() These functions were undocumented and excluded from the limited C API. Add pycore_parser.h internal header file. Rename functions: * PyParser_ASTFromFileObject() => _PyParser_ASTFromFile() * PyParser_ASTFromStringObject() => _PyParser_ASTFromString() These functions are no longer exported (replace PyAPI_FUNC() with extern). Remove also _PyPegen_run_parser_from_file() function. Update test_peg_generator to use _PyPegen_run_parser_from_file_pointer() instead.
* bpo-43244: Add pycore_compile.h header file (GH-25000)Victor Stinner2021-03-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the compiler functions using "struct _mod" type, because the public AST C API was removed: * PyAST_Compile() * PyAST_CompileEx() * PyAST_CompileObject() * PyFuture_FromAST() * PyFuture_FromASTObject() These functions were undocumented and excluded from the limited C API. Rename functions: * PyAST_CompileObject() => _PyAST_Compile() * PyFuture_FromASTObject() => _PyFuture_FromAST() Moreover, _PyFuture_FromAST() is no longer exported (replace PyAPI_FUNC() with extern). _PyAST_Compile() remains exported for test_peg_generator. Remove also compatibility functions: * PyAST_Compile() * PyAST_CompileEx() * PyFuture_FromAST()
* bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933)Victor Stinner2021-03-231-0/+1
| | | | | | | | | | | | | | | | These functions were undocumented and excluded from the limited C API. Most names defined by these header files were not prefixed by "Py" and so could create names conflicts. For example, Python-ast.h defined a "Yield" macro which was conflict with the "Yield" name used by the Windows <winbase.h> header. Use the Python ast module instead. * Move Include/asdl.h to Include/internal/pycore_asdl.h. * Move Include/Python-ast.h to Include/internal/pycore_ast.h. * Remove ast.h header file. * pycore_symtable.h no longer includes Python-ast.h.
* bpo-43244: Remove symtable.h header file (GH-24910)Victor Stinner2021-03-191-25/+36
| | | | | | | | | | | | | | | | | | Rename Include/symtable.h to to Include/internal/pycore_symtable.h, don't export symbols anymore (replace PyAPI_FUNC and PyAPI_DATA with extern) and rename functions: * PyST_GetScope() to _PyST_GetScope() * PySymtable_BuildObject() to _PySymtable_Build() * PySymtable_Free() to _PySymtable_Free() Remove PySymtable_Build(), Py_SymtableString() and Py_SymtableStringObject() functions. The Py_SymtableString() function was part the stable ABI by mistake but it could not be used, since the symtable.h header file was excluded from the limited C API. The Python symtable module remains available and is unchanged.
* bpo-42128: Structural Pattern Matching (PEP 634) (GH-22917)Brandt Bucher2021-02-261-0/+34
| | | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Talin <viridia@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* bpo-42519: Replace PyObject_MALLOC() with PyObject_Malloc() (GH-23587)Victor Stinner2020-12-011-1/+1
| | | | | | | | | No longer use deprecated aliases to functions: * Replace PyObject_MALLOC() with PyObject_Malloc() * Replace PyObject_REALLOC() with PyObject_Realloc() * Replace PyObject_FREE() with PyObject_Free() * Replace PyObject_Del() with PyObject_Free() * Replace PyObject_DEL() with PyObject_Free()
* bpo-42006: Stop using PyDict_GetItem, PyDict_GetItemString and ↵Serhiy Storchaka2020-10-261-3/+6
| | | | | | | | | | | _PyDict_GetItemId. (GH-22648) These functions are considered not safe because they suppress all internal errors and can return wrong result. PyDict_GetItemString and _PyDict_GetItemId can also silence current exception in rare cases. Remove no longer used _PyDict_GetItemId. Add _PyDict_ContainsId and rename _PyDict_Contains into _PyDict_Contains_KnownHash.
* bpo-41746: Add type information to asdl_seq objects (GH-22223)Pablo Galindo2020-09-161-11/+11
| | | | | | | | | | | | | * Add new capability to the PEG parser to type variable assignments. For instance: ``` | a[asdl_stmt_seq*]=';'.small_stmt+ [';'] NEWLINE { a } ``` * Add new sequence types from the asdl definition (automatically generated) * Make `asdl_seq` type a generic aliasing pointer type. * Create a new `asdl_generic_seq` for the generic case using `void*`. * The old `asdl_seq_GET`/`ast_seq_SET` macros now are typed. * New `asdl_seq_GET_UNTYPED`/`ast_seq_SET_UNTYPED` macros for dealing with generic sequences. * Changes all possible `asdl_seq` types to use specific versions everywhere.
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-1/+1
|