Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

long_subtype_new underallocates for zero #101037

Closed
Labels
3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error
@mdickinson

Description

@mdickinson

When creatingint instances, wealways allocate space for and initialise at least one digit, since themedium_value function that's used for fast pathsassumes the existence of that digit. This change was introduced for Python 3.11 in PR#27832.

However, the corresponding change inlong_subtype_new was missed; this results in us asking for zero digits in the case of creating an instance of a subclass ofint with value zero - e.g.,

classMyInt(int):passmyint=MyInt()# problem

That's then a problem ifmyint is used in a context wheremedium_value might be called on it, for example as inint(myint).

We've got away with this so far because of a compensatingoverallocation issue: see#81381; this bug blocked an attempt to address#81381 in#100855. But I believe this should still be fixed.

I'll make a PR shortly.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixestype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp