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

gh-144991: Use runtime JIT threshold in _testinternalcapi#145496

Open
corona10 wants to merge 4 commits intopython:mainfrom
corona10:gh-144991
Open

gh-144991: Use runtime JIT threshold in _testinternalcapi#145496
corona10 wants to merge 4 commits intopython:mainfrom
corona10:gh-144991

Conversation

@corona10
Copy link
Member

@corona10corona10 commentedMar 4, 2026
edited by bedevere-appbot
Loading

@corona10
Copy link
MemberAuthor

@markshannon@Fidget-Spinner

TIER2_THRESHOLD was hardcoded using theJUMP_BACKWARD_INITIAL_VALUE,
which doesn't reflect runtime overrides.
This fix intends to read the actual value frominterp->opt_config at module init instead.

if (PyModule_Add(module,"TIER2_THRESHOLD",
// + 1 more due to one loop spent on tracing.
PyLong_FromLong(JUMP_BACKWARD_INITIAL_VALUE+2))<0) {
PyLong_FromLong(interp->opt_config.jump_backward_initial_value+2))<0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You may use PyLong_FromUnsignedLong() since the member is unsigned (uint16_t). Suggestion to use shorter lines:

PyInterpreterState*interp=PyInterpreterState_Get();// + 1 more due to one loop spent on tracing.unsigned longthreshold=interp->opt_config.jump_backward_initial_value+2;if (PyModule_Add(module,"TIER2_THRESHOLD",PyLong_FromUnsignedLong(threshold))<0) {return1;    }

@vstinner
Copy link
Member

"aarch64-pc-windows-msvc/msvc (Debug)" failed with:

Assertion failed: index < _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES, file C:\a\cpython\cpython\Objects\typeobject.c, line 323

The recent change commite6c3c04 added a new static type tostatic_types array. I suppose that#define _Py_MAX_MANAGED_STATIC_BUILTIN_TYPES 201 should be updated.

@corona10corona10 requested a review fromvstinnerMarch 4, 2026 14:26
Co-authored-by: Victor Stinner <vstinner@python.org>
Copy link
Member

@vstinnervstinner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

/* For now we hard-code this to a value for which we are confident
all the static builtin types will fit (for all builds). */
#define_Py_MAX_MANAGED_STATIC_BUILTIN_TYPES201
#define_Py_MAX_MANAGED_STATIC_BUILTIN_TYPES202

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Why was this changed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Because a new static type was added recently, and JIT tests crash or fail with an assertion error without this change:#145496 (comment)

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@vstinnervstinnervstinner approved these changes

@Fidget-SpinnerFidget-SpinnerFidget-Spinner left review comments

@markshannonmarkshannonAwaiting requested review from markshannon

Assignees

No one assigned

Labels

awaiting mergeskip newstestsTests in the Lib/test dirtopic-JIT

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@corona10@vstinner@Fidget-Spinner

[8]ページ先頭

©2009-2026 Movatter.jp