GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-139393: fix `_CALL_LEN` JIT tests for tuples by picnixz · Pull Request #139394 · python/cpython

Conversation

@picnixz

@picnixz picnixz commented Sep 28, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This fixes a regression introduced in 7ce25ed when _PY_NSMALLPOSINTS was changed from 257 to 1025.

  • Issue: test_capi.test_opt.test_call_len_known_length fails on JIT+debug builds #139393

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ashm-dev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@picnixz
fix _CALL_LEN JIT tests for tuples
3162b3e
@bedevere-app bedevere-app Bot added awaiting core review tests Tests in the Lib/test dir labels Sep 28, 2025
@picnixz picnixz added skip news and removed tests Tests in the Lib/test dir awaiting core review labels Sep 28, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Sep 28, 2025
test_capi.test_opt.test_call_len_known_length fails on JIT+debug builds #139393
Closed
@picnixz picnixz added tests Tests in the Lib/test dir awaiting core review labels Sep 28, 2025
@picnixz
picnixz requested review from brandtbucher and tomasr8 September 28, 2025 12:40
ashm-dev
ashm-dev approved these changes Sep 28, 2025
View reviewed changes

@ashm-dev ashm-dev left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Everything is ok, I tested the fixes on clang and gcc works without problems!)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
ZeroIntensity
ZeroIntensity reviewed Sep 28, 2025
View reviewed changes
Comment thread Modules/_testinternalcapi.c Outdated
Comment on lines +2584 to +2586
if (PyModule_AddIntMacro(module, _PY_NSMALLNEGINTS) < 0) {
return 1;
}

@ZeroIntensity ZeroIntensity Sep 28, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This isn't used anywhere, is it?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Sep 28, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Mmh, yes, this one isn't used anymore. I wondered whether I needed one but I don't need to. I'll amend this one.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Sep 28, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Side comment: this function should return -1 instead of 1 as it's the case for other Py_mod_exec functions (I got surprised by the "return 1"). It doesn't really matter per se, but I think we should generally document what kind of values we expect for Py_mod_* handlers and tp_* ones (it's not clear what tp_clear should return and when).

Currently, errors in Py_mod_exec functions are indicated by a non-zero return value, but it's not documented. I would advise that we document this.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@picnixz
remove unused export
ea1f0e9
picnixz
picnixz commented Sep 28, 2025
View reviewed changes
Comment thread Lib/test/test_capi/test_opt.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@picnixz
Update Lib/test/test_capi/test_opt.py
be5e820
@picnixz
picnixz requested a review from ZeroIntensity September 28, 2025 15:07
ZeroIntensity
ZeroIntensity reviewed Sep 28, 2025
View reviewed changes
Comment thread Lib/test/test_capi/test_opt.py
def testfunc(n):
class C:
t = tuple(range(300))
t = tuple(range(2048))

@ZeroIntensity ZeroIntensity Sep 28, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Instead of using a hardcoded magic number, it would be nice if we used _PY_NSMALLPOSINTS * 2 or something like that to make sure this test always works, even if we increase _PY_NSMALLPOSINTS in the future.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Sep 28, 2025 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I am actually unsure whether we need hardcoding here actually because of the JIT. I'll check if changing it to a compile-time known value is necessary or not.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Sep 28, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah that's what I feared. While the test still passes, the uops will be different. I don't remember when we have some inlined computations x * y that are then transformed in a single LOAD_CONST.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@picnixz picnixz Sep 28, 2025

Copy link
Copy Markdown
Member Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Also, I think we should make such change at other places as well. If you want to, let's open a separate issue.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Fidget-Spinner
Fidget-Spinner approved these changes Sep 28, 2025
View reviewed changes

@Fidget-Spinner Fidget-Spinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

ashm-dev reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels Sep 28, 2025
@picnixz
picnixz merged commit 3779f2b into python:main Sep 28, 2025
4 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label Sep 28, 2025
@picnixz
picnixz deleted the fix/jit/small-code-points-139393 branch September 28, 2025 17:30
ashm-dev
ashm-dev approved these changes Sep 28, 2025
View reviewed changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ZeroIntensity ZeroIntensity ZeroIntensity left review comments
@Fidget-Spinner Fidget-Spinner Fidget-Spinner approved these changes
@brandtbucher brandtbucher Awaiting requested review from brandtbucher
@tomasr8 tomasr8 Awaiting requested review from tomasr8
+1 more reviewer
@ashm-dev ashm-dev ashm-dev approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@picnixz @Fidget-Spinner @ZeroIntensity @ashm-dev
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.