mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 10:44:36 +08:00
Revert python-based sys.displayhook implementation
This reverts commit c0b11de36f.
This commit is contained in:
1 parent
edbc7a94e4
commit
a855dfe5ed
1 file changed
-28
Vendored
-28
@@ -444,33 +444,6 @@ def enablerlcompleter():
|
||||
|
||||
sys.__interactivehook__ = register_readline
|
||||
|
||||
|
||||
def enabledisplayhook():
|
||||
"""
|
||||
Enable default value exibition on interactive prompts, by
|
||||
registering a sys.__displayhook__.
|
||||
"""
|
||||
def displayhook(value):
|
||||
if value is None:
|
||||
return
|
||||
# Set '_' to None to avoid recursion
|
||||
builtins._ = None
|
||||
text = repr(value)
|
||||
try:
|
||||
sys.stdout.write(text)
|
||||
except UnicodeEncodeError:
|
||||
bytes = text.encode(sys.stdout.encoding, 'backslashreplace')
|
||||
if hasattr(sys.stdout, 'buffer'):
|
||||
sys.stdout.buffer.write(bytes)
|
||||
else:
|
||||
text = bytes.decode(sys.stdout.encoding, 'strict')
|
||||
sys.stdout.write(text)
|
||||
sys.stdout.write("\n")
|
||||
builtins._ = value
|
||||
|
||||
sys.__displayhook__ = displayhook
|
||||
|
||||
|
||||
def venv(known_paths):
|
||||
global PREFIXES, ENABLE_USER_SITE
|
||||
|
||||
@@ -588,7 +561,6 @@ def main():
|
||||
sethelper()
|
||||
if not sys.flags.isolated:
|
||||
enablerlcompleter()
|
||||
enabledisplayhook()
|
||||
execsitecustomize()
|
||||
if ENABLE_USER_SITE:
|
||||
execusercustomize()
|
||||
|
||||
Reference in new issue
Block a user