← 返回首页
gh-94808: add tests covering `PyFunction_GetKwDefaults` and `PyFunction_SetKwDefaults` by sobolevn · Pull Request #98809 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-94808: add tests covering PyFunction_GetKwDefaults and PyFunction_SetKwDefaults#98809

Merged
iritkatriel merged 3 commits into
python:mainfrom
sobolevn:cover-pyfunction-get-set-kw-defaults
Nov 5, 2022
Merged

gh-94808: add tests covering PyFunction_GetKwDefaults and PyFunction_SetKwDefaults#98809
iritkatriel merged 3 commits into
python:mainfrom
sobolevn:cover-pyfunction-get-set-kw-defaults

Conversation

sobolevn commented Oct 28, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Member

There are also several changes to PyFunction_[G|S]etDefaults tests:

  • I've added all types of arguments to function: including pos-only args
  • I've fixed one copy-paste error
  • I've added more corner cases to the test

Refs: #98449

sobolevn force-pushed the cover-pyfunction-get-set-kw-defaults branch from c85132f to a200c39 Compare October 28, 2022 12:31
sobolevn added tests Tests in the Lib/test dir skip news labels Oct 28, 2022
sobolevn requested a review from iritkatriel November 5, 2022 12:22
iritkatriel self-assigned this Nov 5, 2022
Comment thread Lib/test/test_capi.py
@@ -963,6 +977,8 @@ def some(pos_only='p', zero=0, optional=None):

with self.assertRaises(SystemError):
_testcapi.function_set_defaults(some, 1) # not tuple or None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

It would be good to check here that a failed set in fact did not change the defaults.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Ah I see this is checked after the next failed set. But better to check every time.

iritkatriel added needs backport to 3.10 only security fixes needs backport to 3.11 only security fixes labels Nov 5, 2022
iritkatriel changed the title gh-94808: Cover PyFunction_GetKwDefaults and PyFunction_SetKwDefaults gh-94808: add tests covering PyFunction_GetKwDefaults and PyFunction_SetKwDefaults Nov 5, 2022
iritkatriel removed the needs backport to 3.10 only security fixes label Nov 5, 2022
iritkatriel merged commit 317acb8 into python:main Nov 5, 2022

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Sorry, @sobolevn and @iritkatriel, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker 317acb80387674db8c94f48bb9823ae516d05f5c 3.11

ZeroIntensity removed the needs backport to 3.11 only security fixes label Feb 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Footer

© 2026 GitHub, Inc.