Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
gh-130168: pyrepl can messup and poll is not thread safe#138617
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Misc/NEWS.d/next/Library/2025-09-07-19-47-35.gh-issue-130168.qvtlOZ.rst OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
picnixz commentedSep 7, 2025
Hum, now tests fail but I don't know why. Is there another place where we use the internal state? |
yihong0618 commentedSep 7, 2025
same like#124030 |
picnixz commentedSep 7, 2025
Yeah buthttps://github.com/python/cpython/actions/runs/17528155338/job/49781429653?pr=138617 worked and it was before my suggestions. Ok, remove the |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 commentedSep 7, 2025
Done will check the test |
picnixz commentedSep 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Mmh, so apparently the issue is indeed with the cleanup. Though I don't understand why.... because cleanups are called in LIFO. |
picnixz commentedSep 7, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
When I meant "remove it", I meant remove the addCleanup, but keep |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 commentedSep 7, 2025
sorry for forget that, now move it back |
yihong0618 commentedSep 7, 2025
do we need to open an issue to track this? |
yihong0618 commentedSep 8, 2025
This patch also make#129614 the same behavior as 3.12 |
picnixz commentedSep 8, 2025
Maybe, but I'll need to check with a smaller reproducer. |
yihong0618 commentedSep 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@picnixz after some dig found why here the issue is that we mock the it is fine but in some system like ubuntu arm 24 but this length is 20 you can use this script to check importsysimporttermiossys.path.insert(0,"./Lib")from_pyrepl.fancy_termiosimporttcgetattr,tcsetattrdefmain():try:state=tcgetattr(0)print("Real tcgetattr works, cc length:",len(state.cc))tcsetattr(0,termios.TCSADRAIN,state)print("Real tcsetattr works")exceptExceptionase:print("Error:",e)if__name__=="__main__":main() if we use self.addclean ... it calls the patch and the length is different so I think we add console.restore() in the last is fine |
yihong0618 commentedSep 17, 2025
merge and fix the conflict |
yihong0618 commentedSep 17, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
interesting fail will try to figure out why fixed |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
chris-eibl commentedSep 23, 2025
chris-eibl commentedSep 23, 2025
I understand this is to be in sync what the old REPL showed, but isn't that misleading, because here |
picnixz commentedSep 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It is, through
Mmh, then the fix should be different probably. The OP's output seems to be on darwin which is Unix-based as well. Note that In addition, on Apple terminals, line wrap is disabled so maybe something is different here as well? |
chris-eibl commentedSep 23, 2025
Just FTR, confirming that Windows isn't affected (since as said like on Linux no Legacy console: The prompt is overridden in this case, but this will be solved by#138732. |
yihong0618 commentedSep 23, 2025
chris-eibl commentedSep 23, 2025
Oh, I know :) I was referring to
Why not just fail with "concurrent poll" - why mimic the 3.12 error message here? |
yihong0618 commentedSep 23, 2025
sorry for the confusion next time will try to use LLM or something else to make a better desc. |
yihong0618 commentedSep 25, 2025
yes it is mess up |
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
yihong0618 commentedSep 25, 2025
@chris-eibl now fixed the mess up can you help to check? |
chris-eibl commentedSep 25, 2025
Works now for me on native Ubuntu 24.04.3 LTS. |
yihong0618 commentedSep 25, 2025
thank you for confirm the reason is that merge conflict~ |
chris-eibl commentedSep 25, 2025
Still unsure about the IMHO the PR would be simpler without trying to mimic it, but that's the the pyrepl maintainers decision, anyway. |
yihong0618 commentedSep 25, 2025
the reason I choose that is make the runtime error message as basic repl |
| # Forbid re-entrant calls and use the old REPL error message. | ||
| raise RuntimeError("can't re-enter readline") |
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, maybe we can change the message. I don't have a suggestion now but I'd like REPL maintainers to first check this PR.



Uh oh!
There was an error while loading.Please reload this page.
This fix issue 130168
but for this one it contains two issues:
the first one is for poll here is not thread safe
more can check. ##53111
and the second one is for the prepare and restore the error message will mess up.
and for the default pyrepl >= 3.13 the input is wrote in python different from the old one
this patch make the error same which is
can't re-enter readlinelike python3.12before this patch:
after this patch:

which not mess up anything
cc@gaogaotiantian can you help to check?
Thank you very much.