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

Commit877067c

Browse files
mdickinsoncorona10
authored andcommitted
Add note to longintrepr.h to clarify that ob_digit[0] is always safe to access.
1 parent61adba0 commit877067c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎Include/cpython/longintrepr.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ typedef long stwodigits; /* signed variant of twodigits */
7171
0 <= ob_digit[i] <= MASK.
7272
The allocation function takes care of allocating extra memory
7373
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
74+
We always allocate memory for at least one digit, so accessing ob_digit[0]
75+
is always safe. However, in the case ob_size == 0, the contents of
76+
ob_digit[0] may be undefined.
7477
7578
CAUTION: Generic code manipulating subtypes of PyVarObject has to
7679
aware that ints abuse ob_size's sign bit.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp