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

Commitb359f66

Browse files
authored
pythongh-120593: Make _PyLong_CompactValue() parameter const again (python#122367)
Change _PyLong_IsCompact() and _PyLong_CompactValue() parameter typefrom 'PyObject*' to 'const PyObject*'. Avoid the Py_TYPE() macrowhich does not support const parameter.
1 parentaa449cf commitb359f66

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎Include/cpython/longintrepr.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,18 +119,18 @@ PyAPI_FUNC(PyLongObject*) _PyLong_FromDigits(
119119

120120

121121
staticinlineint
122-
_PyLong_IsCompact(PyLongObject*op) {
123-
assert(PyType_HasFeature(Py_TYPE(op),Py_TPFLAGS_LONG_SUBCLASS));
122+
_PyLong_IsCompact(constPyLongObject*op) {
123+
assert(PyType_HasFeature(op->ob_base.ob_type,Py_TPFLAGS_LONG_SUBCLASS));
124124
returnop->long_value.lv_tag< (2 <<_PyLong_NON_SIZE_BITS);
125125
}
126126

127127
#definePyUnstable_Long_IsCompact _PyLong_IsCompact
128128

129129
staticinlinePy_ssize_t
130-
_PyLong_CompactValue(PyLongObject*op)
130+
_PyLong_CompactValue(constPyLongObject*op)
131131
{
132132
Py_ssize_tsign;
133-
assert(PyType_HasFeature(Py_TYPE(op),Py_TPFLAGS_LONG_SUBCLASS));
133+
assert(PyType_HasFeature(op->ob_base.ob_type,Py_TPFLAGS_LONG_SUBCLASS));
134134
assert(PyUnstable_Long_IsCompact(op));
135135
sign=1- (op->long_value.lv_tag&_PyLong_SIGN_MASK);
136136
returnsign* (Py_ssize_t)op->long_value.ob_digit[0];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp