-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
unable to read from stdin when using cpython 3.13 #13170
Comments
Are you using an uv-installed Python as well? If so, can you try with a vanilla upstream Python 3.13? I suspect this is the same underlying issue as #12888. |
You are right. I compiled v3.13.1 myself and the example worked. |
I actually can't reproduce with this example even with an uv-managed Python 3.13.0 ( From what I could gather this should only be happening if something does |
I removed all existing venvs and created a new one
|
Hmm, so
Maybe |
This is the last part of the imports
|
and Yes, the workaround solves the issue. |
Would you recommend to use pytest-workaround-12888 · PyPI as a dependency to fix this problem in production? |
Thanks for all the infos! It looks like this is indeed another way the issue in #12888 manifests, I missed that it got triggered by pdb doing I only happened to notice that package in the references when scrolling through that issue, but I trust both the company behind it (Sentry) as well as its author (Anthony Sottile who is a former pytest core maintainer). I'm assuming the package is mostly on PyPI for easy usage for Sentry projects, but if you're okay with that (and it e.g. potentially vanishing once they don't need it anymore), I'd say go for it (and thanks @asottile-sentry!). |
We had a very similar workaround before for pyreadline, which had a similar issue: - Introduced in pytest-dev#1281 - Removed in pytest-dev#8848 for pytest-dev#8733 and pytest-dev#8847 This technically will regress the issues above, but those issues just mean that `import readline` is broken in general, so the user should fix it instead (by e.g. uninstalling pyreadline). Fixes pytest-dev#12888 Fixes pytest-dev#13170
Pushed a PR with a workaround: |
yeah that package should work well as a workaround -- all it does is insert an import during process startup via a unfortunately we're currently stuck on an old version of pytest (due to rerunfailures) so it was necessary for us |
I fixed it by adding this to my # this fixes #186
import readline # noqa I didn't want to add an additional dependency to my project (which would probably have to be packaged by the distributions) Thank you very much for your help. |
* Add readline workaround for libedit We had a very similar workaround before for pyreadline, which had a similar issue: - Introduced in #1281 - Removed in #8848 for #8733 and #8847 This technically will regress the issues above, but those issues just mean that `import readline` is broken in general, so the user should fix it instead (by e.g. uninstalling pyreadline). Fixes #12888 Fixes #13170 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Handle no readline on Windows --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Add readline workaround for libedit We had a very similar workaround before for pyreadline, which had a similar issue: - Introduced in #1281 - Removed in #8848 for #8733 and #8847 This technically will regress the issues above, but those issues just mean that `import readline` is broken in general, so the user should fix it instead (by e.g. uninstalling pyreadline). Fixes #12888 Fixes #13170 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Handle no readline on Windows --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit b4009b3)
pip list
from the virtual environment you are usingI ask the user in inline-snapshot for approval if he wants to fix the snapshot values, but this does not work for cpython 3.13.
I can only reproduce this problem with pytest.
The problem can be reproduced like this:
conftest.py
test_example.py
Running pytest asks for "hi" but value will always be an empty string no matter what you type.
But it work when you use
pytest -s
and type "hi" orecho hi | pytest
.I can only reproduce this problem using cpython 3.13, it worked for older versions.
uv pip list:
os: linux/debian
The text was updated successfully, but these errors were encountered: