You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Patch-adding __init__ in a class takes no effect when called from a subinterpreter #90192
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2021-12-10.12:29:40.628>created_at=<Date2021-12-10.12:01:00.299>labels= ['expert-subinterpreters', 'type-bug', '3.10', '3.11']
title='Patch-adding __init__ in a class takes no effect when called from a subinterpreter'updated_at=<Date2021-12-10.12:29:40.628>user='https://github.com/hroncok'
I have isolated the following reproducer that shows a regression in Python 3.10+. It happens at least with 3.10.0, 3.10.1 and 3.11.0a2. It works as expected in Python 3.9.
The following code is valid and works on 3.9, 3.10, 3.11:
I mark this issue as a duplicate of bpo-46006. It's not exactly the same issue, but the root cause is the same: in some functions, Python use fast pointer comparisons when two strings are interned, but this now fails if two interned strings belong to two different interpreters.
Activity
hroncok commentedon Dec 10, 2021
Hello,
based on some bug reports reported in:
I have isolated the following reproducer that shows a regression in Python 3.10+. It happens at least with 3.10.0, 3.10.1 and 3.11.0a2. It works as expected in Python 3.9.
The following code is valid and works on 3.9, 3.10, 3.11:
=========================================
=========================================
But if we run it via a subinterpreter, it breaks on 3.10+:
=========================================
Greeting("Miro")"""
=========================================
My observation also shows that if the Greeting class already had (any) __init__:
=========================================
=========================================
It works as expected on 3.9, 3.10, 3.11.
In reality, this is most likely to affect classes with decorators, like:
=========================================
=========================================
This works standalone, but fails in a subinterpreter:
hroncok commentedon Dec 10, 2021
git bisect gives:
ea25180
vstinner commentedon Dec 10, 2021
I mark this issue as a duplicate of bpo-46006. It's not exactly the same issue, but the root cause is the same: in some functions, Python use fast pointer comparisons when two strings are interned, but this now fails if two interned strings belong to two different interpreters.