mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-109219: propagate free vars through type param scopes (#109377)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
parent
4a54074a0f
commit
909adb5092
3 changed files with 17 additions and 3 deletions
|
@ -836,8 +836,7 @@ update_symbols(PyObject *symbols, PyObject *scopes,
|
|||
the class that has the same name as a local
|
||||
or global in the class scope.
|
||||
*/
|
||||
if (classflag &&
|
||||
PyLong_AS_LONG(v) & (DEF_BOUND | DEF_GLOBAL)) {
|
||||
if (classflag) {
|
||||
long flags = PyLong_AS_LONG(v) | DEF_FREE_CLASS;
|
||||
v_new = PyLong_FromLong(flags);
|
||||
if (!v_new) {
|
||||
|
@ -1078,7 +1077,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
|
|||
goto error;
|
||||
/* Records the results of the analysis in the symbol table entry */
|
||||
if (!update_symbols(ste->ste_symbols, scopes, bound, newfree, inlined_cells,
|
||||
ste->ste_type == ClassBlock))
|
||||
(ste->ste_type == ClassBlock) || ste->ste_can_see_class_scope))
|
||||
goto error;
|
||||
|
||||
temp = PyNumber_InPlaceOr(free, newfree);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue