| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Cc. @eryksun if you're interested! |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you. LGTM 🚀
Sorry, something went wrong.
|
The reason why __cached__, __file__, __package__, __spec__, and __doc__ are wrong is that PyREPL is also a package now, and it's started after the fact in the same namespace. So it effectively overwrites those attributes from what was previously set: >>> __package__
'_pyrepl'
>>> __name__
'__main__'
>>> __spec__
ModuleSpec(name='_pyrepl.__main__', loader=<_frozen_importlib_external.SourceFileLoader object at 0x103a020c0>, origin='/Volumes/RAMDisk/cpython/Lib/_pyrepl/__main__.py')
>>> __file__
'/Volumes/RAMDisk/cpython/Lib/_pyrepl/__main__.py'We'd need to work around that. |
Sorry, something went wrong.
| reader.can_colorize = False | ||
| return reader | ||
|
|
||
| def test_stdin_is_tty(self): |
There was a problem hiding this comment.
This was helpful to me when debugging weird behavior so I decided to keep it.
Sorry, something went wrong.
| return; | ||
| } | ||
| int run = pymain_run_module(L"_pyrepl", 0); | ||
| int run = pymain_start_pyrepl_no_main(); |
There was a problem hiding this comment.
My first intuition was to simply PyImport_ImportModule("_pyrepl.__main__") but then the entire shell session is a side-effect of an on-going import, which was ugly and caused some funny edge cases (a non-zero exit was technically an ImportError).
So instead we do the full dance of running _pyrepl.main.interactive_console(). While doing that I'm smuggling PYTHONSTARTUP support because:
Sorry, something went wrong.
|
Thanks for picking this up @ambv! |
Sorry, something went wrong.
|
It's team work: I push the shoddy changes, you get the git blame! |
Sorry, something went wrong.
There was a problem hiding this comment.
I can't give an approving review (since this is strictly speaking still "my PR" 😄), but from what I can tell this all LGTM! (With the caveat that I'm far from the world's greatest C programmer, so I could easily have missed something)
Sorry, something went wrong.
|
Thanks @AlexWaygood for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
pythonGH-120904) (cherry picked from commit ac07451) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
GH-121916 is a backport of this pull request to the 3.13 branch. |
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Ubuntu NoGIL 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1225/builds/2684 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/ubuntu/buildarea/3.x.itamaro-ubuntu-aws.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot ARM Raspbian 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/424/builds/7678 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/var/lib/buildbot/workers/3.x.gps-raspbian.nondebug/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot s390x SLES 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/540/builds/9493 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-sles-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot s390x Debian 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/49/builds/9540 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/dje/cpython-buildarea/3.x.edelsohn-debian-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Ubuntu NoGIL 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1422/builds/284 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/ubuntu/buildarea/3.13.itamaro-ubuntu-aws.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot s390x SLES 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1437/builds/356 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/dje/cpython-buildarea/3.13.edelsohn-sles-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot ARM Raspbian 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1435/builds/346 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/var/lib/buildbot/workers/3.13.gps-raspbian.nondebug/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot s390x Debian 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1485/builds/353 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/dje/cpython-buildarea/3.13.edelsohn-debian-z/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot x86-64 MacOS Intel ASAN NoGIL 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1366/builds/1670 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-intel-aws.macos-with-brew.asan.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot x86-64 MacOS Intel NoGIL 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1258/builds/2373 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/Users/ec2-user/buildbot/buildarea/3.x.itamaro-macos-intel-aws.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot ARM64 MacOS M1 NoGIL 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1408/builds/287 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/Users/ec2-user/buildbot/buildarea/3.13.itamaro-macos-arm64-aws.macos-with-brew.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Debian root 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1441/builds/318 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/root/buildarea/3.13.angelico-debian-amd64/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Ubuntu Shared 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/506/builds/8352 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/srv/buildbot/buildarea/3.x.bolen-ubuntu/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot x86-64 MacOS Intel ASAN NoGIL 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1460/builds/322 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/Users/ec2-user/buildbot/buildarea/3.13.itamaro-macos-intel-aws.macos-with-brew.asan.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Debian root 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/345/builds/8507 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/root/buildarea/3.x.angelico-debian-amd64/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot x86-64 MacOS Intel NoGIL 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1449/builds/323 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/Users/ec2-user/buildbot/buildarea/3.13.itamaro-macos-intel-aws.nogil/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/469/builds/8577 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Windows10 3.x has failed when building commit ac07451. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/146/builds/9086 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "D:\buildarea\3.x.bolen-windows10\build\Lib\test\test_pyrepl\test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Ubuntu Shared 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1450/builds/273 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "/srv/buildbot/buildarea/3.13.bolen-ubuntu/build/Lib/test/test_pyrepl/test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️Hi! The buildbot AMD64 Windows10 3.13 has failed when building commit 3d9692d. What do you need to do:
You can take a look at the buildbot page here: https://buildbot.python.org/#builders/1501/builds/301 Failed tests:
Failed subtests:
Summary of the results of the build (if available): == Click to see traceback logsTraceback (most recent call last):
File "D:\buildarea\3.13.bolen-windows10\build\Lib\test\test_pyrepl\test_pyrepl.py", line 500, in test_stdout_is_tty
if os.isatty(sys.stdout.fileno()):
~~~~~~~~~~~~~~~~~^^
io.UnsupportedOperation: fileno
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
In order to fix the regression caused by #119547, this PR goes back to the original fix that was proposed in the early commits of #119547.
The REPL must use the globals from sys.modules["__main__"] in case a different module has been run as __main__ using -i; in order to prevent globals from _pyrepl.__main__ from leaking into the global namespace, we move the vast majority of the globals out of __main__.py instead of running the REPL with an entirely fresh set of globals.
Some small filtering of globals is additionally done in Lib/_pyrepl/simple_interact.py, so that we're able to import functions and classes in _pyrepl.__main__ without these globals leaking into the REPL environment. (This filtering only works for things with __module__ attributes, though, so it's still best to keep _pyrepl/__main__.py as minimal as possible.)
This still doesn't exactly match the behaviour of the old REPL for some dunders:
I'm not really sure why that is!