Xuanteng Huang
6ec886531f
gh-126072: Set docstring attribute for module and class ( #126231 )
2024-11-08 15:13:18 +00:00
Xuanteng Huang
35df4eb959
gh-126072: do not add `None` to `co_consts` if there is no docstring (GH-126101)
2024-10-30 09:01:09 +00:00
Victor Stinner
9bda7750c2
gh-125196: Use PyUnicodeWriter in symtable.c ( #125199 )
2024-10-09 17:54:54 +02:00
Victor Stinner
b9a8ca0a6a
gh-115754: Use Py_GetConstant(Py_CONSTANT_EMPTY_STR) ( #125194 )
...
Replace PyUnicode_New(0, 0), PyUnicode_FromString("")
and PyUnicode_FromStringAndSize("", 0)
with Py_GetConstant(Py_CONSTANT_EMPTY_STR).
2024-10-09 17:15:23 +02:00
Irit Katriel
05fc4d758a
gh-122985: add SYMBOL_TO_SCOPE macro in symtable ( #122986 )
2024-08-14 06:17:04 +01:00
Irit Katriel
833eb106f5
gh-122562: fix dump_symtable for ste_free and ste_child_free removal ( #122825 )
2024-08-08 14:03:45 +01:00
Serhiy Storchaka
e74680b718
gh-122595: Add more error checks in the compiler (GH-122596)
2024-08-06 08:59:44 +03:00
Serhiy Storchaka
efcd65cd84
gh-122313: Clean up deep recursion guarding code in the compiler (GH-122640)
...
Add ENTER_RECURSIVE and LEAVE_RECURSIVE macros in ast.c, ast_opt.c and
symtable.c. Remove VISIT_QUIT macro in symtable.c.
The current recursion depth counter only needs to be updated during
normal execution -- all functions should just return an error code
if an error occurs.
2024-08-03 12:45:45 +03:00
Jelle Zijlstra
8234419c32
gh-122562: Remove ste_free and ste_child_free from symtable ( #122563 )
2024-08-01 16:28:25 -07:00
Jelle Zijlstra
ae192262ad
gh-119180: Add evaluate functions for type params and type aliases ( #122212 )
2024-07-27 17:24:10 +00:00
Irit Katriel
bc94cf7e25
gh-122245: move checks for writes and shadowing of __debug__ to symtable ( #122246 )
2024-07-26 14:39:56 +01:00
Jelle Zijlstra
2762c6cc5e
gh-121637: Syntax error for optimized-away incorrect await ( #121656 )
...
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
2024-07-22 14:12:43 -07:00
Irit Katriel
67a05de17c
gh-121272: move async for/with validation from compiler to symtable ( #121361 )
2024-07-04 14:47:21 +01:00
Irit Katriel
19d1e43e43
gh-121352: use _Py_SourceLocation in symtable ( #121353 )
2024-07-04 11:28:44 +01:00
Irit Katriel
93156880ef
gh-121272: set ste_coroutine during symtable construction ( #121297 )
...
compiler no longer modifies the symtable after this.
2024-07-03 10:18:34 +01:00
Irit Katriel
1ac273224a
gh-121272: move __future__ import validation from compiler to symtable ( #121273 )
2024-07-02 16:22:08 +00:00
Steve Dower
e731554337
Fixes loop variables to be the same types as their limit (GH-120958)
2024-06-24 17:11:47 +01:00
Bénédikt Tran
4bf17c381f
gh-119933: Improve ``SyntaxError`` message for invalid type parameters expressions ( #119976 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-17 06:51:03 -07:00
Bénédikt Tran
32d3e05fe6
gh-120029: remove unused macros in ``symtable.c`` ( #120222 )
...
Co-authored-by: Carl Meyer <carl@oddbird.net>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-06-12 09:23:45 -04:00
Kirill Podoprigora
19435d299a
gh-120385: Fix reference leak in symtable ( #120386 )
...
Decref 'new_ste' if symtable_visit_annotations() fails.
2024-06-12 09:37:14 +02:00
Jelle Zijlstra
9b8611eeea
gh-119180: PEP 649 compiler changes ( #119361 )
2024-06-11 13:06:49 +00:00
Carl Meyer
0ae8579b85
gh-119666: fix multiple class-scope comprehensions referencing __class__ ( #120295 )
2024-06-09 22:23:30 -04:00
Bénédikt Tran
153b118b78
gh-119981: Use do while(0) in some symtable.c multi-line macros ( #119982 )
2024-06-03 15:48:02 +00:00
Jelle Zijlstra
a9a74da4a0
gh-119311: Fix name mangling with PEP 695 generic classes ( #119464 )
...
Fixes #119311 . Fixes #119395 .
2024-05-27 19:50:38 -07:00
Jelle Zijlstra
ca269e58c2
gh-116126: Implement PEP 696 ( #116129 )
...
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
2024-05-03 06:17:32 -07:00
Jelle Zijlstra
2326d6c868
gh-109118: Make comprehensions work within annotation scopes, but without inlining ( #118160 )
...
Co-authored-by: Carl Meyer <carl@oddbird.net>
2024-04-28 06:21:28 -07:00
Jelle Zijlstra
85f727c5fb
gh-109118: Allow lambdas in annotation scopes in classes ( #118019 )
2024-04-22 12:50:26 -07:00
Irit Katriel
1d5479b236
gh-117411: move PyFutureFeatures to pycore_symtable.h and make it private ( #117412 )
2024-04-02 10:34:49 +00:00
wookie184
664965a1c1
gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561)
2024-02-17 12:06:31 +00:00
Carl Meyer
fedbf77191
gh-114828: Fix __class__ in class-scope inlined comprehensions ( #115139 )
2024-02-07 16:56:16 +00:00
Mark Shannon
17b73ab99e
GH-113655: Lower the C recursion limit on various platforms (GH-113944)
2024-01-16 09:32:01 +00:00
Yan Yanchii
fda901a1ff
gh-113842: Add missing error check for PyIter_Next() in Python/symtable.c (GH-113843)
2024-01-09 12:43:58 +02:00
Serhiy Storchaka
befbad3663
gh-111789: Use PyDict_GetItemRef() in Python/symtable.c (gh-112084)
2023-11-27 18:55:30 +01:00
Irit Katriel
b578e51f02
gh-111123: symtable should visit exception handlers before the else block ( #111142 )
2023-10-21 13:38:29 +01:00
Carl Meyer
32ffe58c12
gh-109390: add dump_symtable utility under #if 0 ( #109391 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-20 10:55:56 -06:00
Carl Meyer
909adb5092
gh-109219: propagate free vars through type param scopes ( #109377 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-09-14 10:20:32 -06:00
Jelle Zijlstra
b88d9e75f6
gh-109118: Disallow nested scopes within PEP 695 scopes within classes ( #109196 )
...
Fixes #109118 . Fixes #109194 .
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-09-11 17:11:06 -07:00
云line
4297499696
gh-109207: Fix SystemError when printing symtable entry object. (GH-109225)
2023-09-10 15:04:24 +03:00
Serhiy Storchaka
87a7faf6b6
Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146)
2023-09-08 19:57:41 +03:00
Victor Stinner
b0edf3b98e
GH-91079: Rename C_RECURSION_LIMIT to Py_C_RECURSION_LIMIT ( #108507 )
...
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.
2023-09-08 09:48:28 +00:00
Victor Stinner
b298b395e8
gh-108765: Cleanup #include in Python/*.c files ( #108977 )
...
Mention one symbol imported by each #include.
2023-09-06 15:56:08 +02:00
Mark Shannon
fa45958450
GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535)
...
* Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2.
2023-08-04 10:10:29 +01:00
Victor Stinner
1a3faba9f1
gh-106869: Use new PyMemberDef constant names ( #106871 )
...
* 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)
2023-07-25 15:28:30 +02:00
Victor Stinner
2e0744955f
gh-107211: Rename PySymtable_Lookup() to _PySymtable_Lookup() ( #107212 )
...
Rename the internal PySymtable_Lookup() function to
_PySymtable_Lookup() and no longer export it.
2023-07-25 00:54:09 +00:00
Jelle Zijlstra
a5f244d627
gh-104656: Rename typeparams AST node to type_params ( #104657 )
2023-05-21 21:25:09 -07:00
Jelle Zijlstra
8a8853af24
gh-104640: Disallow walrus in comprehension within type scopes ( #104641 )
2023-05-19 07:31:09 -07:00
Carl Meyer
86e6f16ccb
gh-104602: ensure all cellvars are known up front ( #104603 )
...
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-05-19 00:07:35 +00:00
Jelle Zijlstra
662aede68b
gh-104374: Remove access to class scopes for inlined comprehensions ( #104528 )
...
Co-authored-by: Carl Meyer <carl@oddbird.net>
2023-05-18 05:22:17 +00:00
Jelle Zijlstra
97db2f3e07
gh-104572: Improve error messages for invalid constructs in PEP 695 contexts ( #104573 )
2023-05-17 06:05:42 -07:00
Jelle Zijlstra
24d8b88420
gh-103763: Implement PEP 695 ( #103764 )
...
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>
2023-05-15 20:36:23 -07:00