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

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions 6 Include/cpython/longintrepr.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,6 @@ _PyLong_IsCompact(const PyLongObject* op) {
return op->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS);
}

static inline int
PyLong_CheckCompact(PyObject *op)
{
return PyLong_CheckExact(op) && _PyLong_IsCompact((const PyLongObject *)op);
}

#define PyUnstable_Long_IsCompact _PyLong_IsCompact

static inline Py_ssize_t
Expand Down
6 changes: 6 additions & 0 deletions 6 Include/internal/pycore_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ _PyLong_FlipSign(PyLongObject *op) {
#define _PyLong_FALSE_TAG TAG_FROM_SIGN_AND_SIZE(0, 0)
#define _PyLong_TRUE_TAG TAG_FROM_SIGN_AND_SIZE(1, 1)

static inline int
_PyLong_CheckExactAndCompact(PyObject *op)
{
return PyLong_CheckExact(op) && _PyLong_IsCompact((const PyLongObject *)op);
}

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions 4 Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,12 @@ dummy_func(

op(_GUARD_NOS_INT, (left, unused -- left, unused)) {
PyObject *left_o = PyStackRef_AsPyObjectBorrow(left);
EXIT_IF(!PyLong_CheckCompact(left_o));
EXIT_IF(!_PyLong_CheckExactAndCompact(left_o));
}

op(_GUARD_TOS_INT, (value -- value)) {
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
EXIT_IF(!PyLong_CheckCompact(value_o));
EXIT_IF(!_PyLong_CheckExactAndCompact(value_o));
}

op(_GUARD_NOS_OVERFLOWED, (left, unused -- left, unused)) {
Expand Down
4 changes: 2 additions & 2 deletions 4 Python/executor_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions 24 Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions 6 Python/optimizer_symbols.c
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ _Py_uop_sym_set_const(JitOptContext *ctx, JitOptRef ref, PyObject *const_val)
make_const(sym, const_val);
return;
case JIT_SYM_COMPACT_INT:
if (PyLong_CheckCompact(const_val)) {
if (_PyLong_CheckExactAndCompact(const_val)) {
make_const(sym, const_val);
}
else {
Expand Down Expand Up @@ -679,7 +679,7 @@ _Py_uop_sym_is_compact_int(JitOptRef ref)
{
JitOptSymbol *sym = PyJitRef_Unwrap(ref);
if (sym->tag == JIT_SYM_KNOWN_VALUE_TAG) {
return (bool)PyLong_CheckCompact(sym->value.value);
return (bool)_PyLong_CheckExactAndCompact(sym->value.value);
}
return sym->tag == JIT_SYM_COMPACT_INT;
}
Expand Down Expand Up @@ -716,7 +716,7 @@ _Py_uop_sym_set_compact_int(JitOptContext *ctx, JitOptRef ref)
}
return;
case JIT_SYM_KNOWN_VALUE_TAG:
if (!PyLong_CheckCompact(sym->value.value)) {
if (!_PyLong_CheckExactAndCompact(sym->value.value)) {
Py_CLEAR(sym->value.value);
sym_set_bottom(ctx, sym);
}
Expand Down
2 changes: 1 addition & 1 deletion 2 Tools/cases_generator/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def has_error_without_pop(op: parser.CodeDef) -> bool:
"PyStackRef_IsValid",
"PyStackRef_Wrap",
"PyStackRef_Unwrap",
"PyLong_CheckCompact",
"_PyLong_CheckExactAndCompact",
)


Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.