Skip to content

Fix the error message for disallowed __weakref__ slots #87980

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maggyero mannequin opened this issue Apr 12, 2021 · 1 comment
Closed

Fix the error message for disallowed __weakref__ slots #87980

maggyero mannequin opened this issue Apr 12, 2021 · 1 comment
Labels
3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@maggyero
Copy link
Mannequin

maggyero mannequin commented Apr 12, 2021

BPO 43814
Nosy @maggyero
PRs
  • gh-87980: Fix the error message for disallowed __weakref__ slots #25362
  • 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 = None
    closed_at = None
    created_at = <Date 2021-04-12.13:55:17.866>
    labels = ['interpreter-core', 'type-feature', '3.11']
    title = 'Fix the error message for disallowed __weakref__ slots'
    updated_at = <Date 2022-01-15.19:22:04.426>
    user = 'https://github.com/maggyero'

    bugs.python.org fields:

    activity = <Date 2022-01-15.19:22:04.426>
    actor = 'iritkatriel'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Interpreter Core']
    creation = <Date 2021-04-12.13:55:17.866>
    creator = 'maggyero'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43814
    keywords = ['patch']
    message_count = 1.0
    messages = ['390851']
    nosy_count = 1.0
    nosy_names = ['maggyero']
    pr_nums = ['25362']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43814'
    versions = ['Python 3.11']

    @maggyero
    Copy link
    Mannequin Author

    maggyero mannequin commented Apr 12, 2021

    When

    TypeError: __weakref__ slot disallowed: either we already got one, or __itemsize__ != 0
    

    is raised, the second condition base->tp_itemsize != 0 (i.e. the base is a variable-length type, like int, tuple and bytes) in the error message is impossible since using a non-empty __slots__ (e.g. __slots__ = ('__weakref__',)) for a subtype of a variable-length type raises a

    TypeError: nonempty __slots__ not supported for subtype of '…'
    

    earlier in the type.__new__ implementation.

    @maggyero maggyero mannequin added 3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels Apr 12, 2021
    @iritkatriel iritkatriel added 3.11 only security fixes and removed 3.7 (EOL) end of life 3.8 (EOL) end of life 3.9 only security fixes 3.10 only security fixes labels Jan 15, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    kumaraditya303 pushed a commit that referenced this issue Jan 1, 2023
    )
    
    Fix the error message for disallowed `__weakref__` slots.
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    Development

    No branches or pull requests

    2 participants