Skip to content

gh-152132: Test all PyRun functions in test_capi.test_run#153352

Merged
vstinner merged 3 commits into
python:mainfrom
vstinner:test_pyrun_capi
Jul 9, 2026
Merged

gh-152132: Test all PyRun functions in test_capi.test_run#153352
vstinner merged 3 commits into
python:mainfrom
vstinner:test_pyrun_capi

Conversation

@vstinner

@vstinner vstinner commented Jul 8, 2026

Copy link
Copy Markdown
Member

PyRun_InteractiveOneObjectEx() now raises TypeError if the second parameter type is not str.

PyRun_InteractiveOneObjectEx() now raises TypeError if the second
parameter type is not str.
@vstinner vstinner added tests Tests in the Lib/test dir topic-C-API needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 8, 2026
These functions can fail with MemoryError
@vstinner vstinner merged commit cd9994e into python:main Jul 9, 2026
51 checks passed
@vstinner vstinner deleted the test_pyrun_capi branch July 9, 2026 10:50
@miss-islington-app

Copy link
Copy Markdown

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

GH-153411 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 9, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker cd9994e2831ea743e5423c1db56ca2ca42154e0a 3.13

@bedevere-app

bedevere-app Bot commented Jul 9, 2026

Copy link
Copy Markdown

GH-153412 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 9, 2026
@vstinner

vstinner commented Jul 9, 2026

Copy link
Copy Markdown
Member Author

While writing new tests, I got two bugs/crashes:

TODO: The tests don't cover all code paths:

  • PyRun_AnyFile*() family calls _PyRun_InteractiveLoopObject() if _Py_FdIsInteractive(fp, filename) is true. I tried but failed so far to write tests using pty.openpty() to have a TTY which can be fully controlled.
  • Compiler flags are not tested.
  • PyRun_SimpleFile*() family: the .pyc code path is not tested.

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

Labels

needs backport to 3.13 bugs and security fixes skip news tests Tests in the Lib/test dir topic-C-API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant