Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-101072: support default and kw default in PyEval_EvalCodeEx for 3.11+ #101127

Merged

Conversation

MatthieuDartiailh
Copy link
Contributor

@MatthieuDartiailh MatthieuDartiailh commented Jan 18, 2023

Fixes the regression observed in PyEval_EvalCodeEx on 3.11+ and add a test to avoid future regressions.

This should be backported to 3.11 I believe.

kumaraditya303
kumaraditya303 previously requested changes Feb 5, 2023
Copy link
Contributor

@kumaraditya303 kumaraditya303 left a comment

Choose a reason for hiding this comment

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

Please format the C code as per https://peps.python.org/pep-0007/

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@MatthieuDartiailh
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-bot
Copy link

Thanks for making the requested changes!

@kumaraditya303: please review the changes made to this pull request.

Copy link
Contributor

@ambv ambv left a comment

Choose a reason for hiding this comment

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

👍🏻 Fix works.
👍🏻 New tests fail without the fix applied.
👎🏻 There's a refleak in the new test.

Before (main at 7a25310):

0:00:00 load avg: 3.77 [1/1] test_capi
beginning 9 repetitions
123456789
.........
test_capi passed in 49.2 sec

== Tests result: SUCCESS ==

After (this PR rebased on top of 7a25310):

0:00:00 load avg: 3.72 [1/1] test_capi
beginning 9 repetitions
123456789
.........
test_capi leaked [1, 1, 1, 1] references, sum=4
test_capi failed (reference leak) in 49.6 sec

== Tests result: FAILURE ==

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

for (int i = 0; i < kwcount; i++) {
PyTuple_SET_ITEM(kwnames, i, Py_NewRef(kws[2*i]));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This code is duplicated in the block right above, leading to double new refs.

@MatthieuDartiailh
Copy link
Contributor Author

Thanks for the edits @ambv !

ambv
ambv approved these changes Feb 7, 2023
@ambv ambv dismissed kumaraditya303’s stale review February 7, 2023 08:48

I applied the formatting Kumar wanted

@ambv ambv merged commit ae62bdd into python:main Feb 7, 2023
17 checks passed
@miss-islington
Copy link
Contributor

Thanks @MatthieuDartiailh for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒🤖

@miss-islington
Copy link
Contributor

Sorry, @MatthieuDartiailh and @ambv, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ae62bddaf81176a7e55f95f18d55621c9c46c23d 3.11

@MatthieuDartiailh MatthieuDartiailh deleted the pyeval_evalcodeex_default_support branch February 7, 2023 09:35
ambv pushed a commit to ambv/cpython that referenced this pull request Feb 7, 2023
…CodeEx for 3.11+ (pythonGH-101127)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit ae62bdd)

Co-authored-by: Matthieu Dartiailh <m.dartiailh@gmail.com>
@bedevere-bot
Copy link

GH-101636 is a backport of this pull request to the 3.11 branch.

ambv added a commit to ambv/cpython that referenced this pull request Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants