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

regression in 3.13.4Random.getrandbits when anint like object is passed #135326

Closed
Assignees
gpshead
Labels
3.13bugs and security fixesrelease-blockertype-bugAn unexpected behavior, bug, or error
@gpshead

Description

@gpshead

Bug report

Bug description:

via#133489 (comment)@tornaria reports:

There is an (unintended?) api break. In python 3.13.3,getrandbits() accepts an "integer-like" object as in:

Python 3.13.3 (main, Apr 11 2025, 13:41:26) [GCC 13.2.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import random ; r = random.Random()>>> from numpy import int64>>> r.getrandbits(int64(20))582096

but in python 3.13.4,getrandbits() fails as in:

Python 3.13.4 (main, Jun  8 2025, 19:43:01) [GCC 14.2.1 20250405] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import random ; r = random.Random()>>> from numpy import int64>>> r.getrandbits(int64(20))Traceback (most recent call last):  File "<python-input-2>", line 1, in <module>    r.getrandbits(int64(20))    ~~~~~~~~~~~~~^^^^^^^^^^^TypeError: an integer is required

This causes trouble for sagemath, where integers are by default a special typeZZ.

CPython versions tested on:

3.13

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

Labels

3.13bugs and security fixesrelease-blockertype-bugAn unexpected behavior, bug, or error

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2026 Movatter.jp