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

Setters of members with unsigned integer type and __index__() #115011

Closed
Assignees
serhiy-storchaka
@serhiy-storchaka

Description

@serhiy-storchaka

Yet one strange thing about member setters with unsigned integer type is that they support different ranges forint and int-like objects (objects with the__index__() method).

For Py_T_ULONG the range forint isLONG_MIN-ULONG_MAX, but for indexes it is smaller:LONG_MIN-LONG_MAX.

The same is for Py_T_UINT, except that the maximal hard limit for indexLONG_MAX can be larger than the maximal safe limitUINT_MAX, depending on platform, so on some platforms it may be lesser issue.

Py_T_ULLONG is even more limited. The range forint is 0-ULLONG_MAX (negatives not allowed!), and the range for indexes isLONG_MIN-LONG_MAX, which includes negatives, bat has much lesser upper limit. It is a remnant of dark old times, when Python had two not yet completely compatible integer types.

Py_T_PYSSIZET does not support__index__() at all. It is becausePyLong_AsSsize_t() does not support them.

Linked PRs

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp