Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cd49d532
Kaydet (Commit)
cd49d532
authored
Mar 25, 2012
tarafından
Andrew Svetlov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #14200 — now displayhook for IDLE works in non-subprocess mode as well as subprecess.
üst
1a7742eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
21 deletions
+22
-21
PyShell.py
Lib/idlelib/PyShell.py
+2
-0
rpc.py
Lib/idlelib/rpc.py
+19
-0
run.py
Lib/idlelib/run.py
+1
-21
No files found.
Lib/idlelib/PyShell.py
Dosyayı görüntüle @
cd49d532
...
...
@@ -999,6 +999,8 @@ class PyShell(OutputWindow):
return
False
else
:
nosub
=
"==== No Subprocess ===="
sys
.
displayhook
=
rpc
.
displayhook
self
.
write
(
"Python
%
s on
%
s
\n
%
s
\n
%
s"
%
(
sys
.
version
,
sys
.
platform
,
self
.
COPYRIGHT
,
nosub
))
self
.
showprompt
()
...
...
Lib/idlelib/rpc.py
Dosyayı görüntüle @
cd49d532
...
...
@@ -40,6 +40,7 @@ import traceback
import
copyreg
import
types
import
marshal
import
builtins
def
unpickle_code
(
ms
):
...
...
@@ -603,3 +604,21 @@ class MethodProxy(object):
# XXX KBK 09Sep03 We need a proper unit test for this module. Previously
# existing test code was removed at Rev 1.27 (r34098).
def
displayhook
(
value
):
"""Override standard display hook to use non-locale encoding"""
if
value
is
None
:
return
# Set '_' to None to avoid recursion
builtins
.
_
=
None
text
=
repr
(
value
)
try
:
sys
.
stdout
.
write
(
text
)
except
UnicodeEncodeError
:
# let's use ascii while utf8-bmp codec doesn't present
encoding
=
'ascii'
bytes
=
text
.
encode
(
encoding
,
'backslashreplace'
)
text
=
bytes
.
decode
(
encoding
,
'strict'
)
sys
.
stdout
.
write
(
text
)
sys
.
stdout
.
write
(
"
\n
"
)
builtins
.
_
=
value
Lib/idlelib/run.py
Dosyayı görüntüle @
cd49d532
...
...
@@ -6,7 +6,6 @@ import traceback
import
_thread
as
thread
import
threading
import
queue
import
builtins
from
idlelib
import
CallTips
from
idlelib
import
AutoComplete
...
...
@@ -262,25 +261,6 @@ class MyRPCServer(rpc.RPCServer):
thread
.
interrupt_main
()
def
displayhook
(
value
):
"""Override standard display hook to use non-locale encoding"""
if
value
is
None
:
return
# Set '_' to None to avoid recursion
builtins
.
_
=
None
text
=
repr
(
value
)
try
:
sys
.
stdout
.
write
(
text
)
except
UnicodeEncodeError
:
# let's use ascii while utf8-bmp codec doesn't present
encoding
=
'ascii'
bytes
=
text
.
encode
(
encoding
,
'backslashreplace'
)
text
=
bytes
.
decode
(
encoding
,
'strict'
)
sys
.
stdout
.
write
(
text
)
sys
.
stdout
.
write
(
"
\n
"
)
builtins
.
_
=
value
class
MyHandler
(
rpc
.
RPCHandler
):
def
handle
(
self
):
...
...
@@ -290,7 +270,7 @@ class MyHandler(rpc.RPCHandler):
sys
.
stdin
=
self
.
console
=
self
.
get_remote_proxy
(
"stdin"
)
sys
.
stdout
=
self
.
get_remote_proxy
(
"stdout"
)
sys
.
stderr
=
self
.
get_remote_proxy
(
"stderr"
)
sys
.
displayhook
=
displayhook
sys
.
displayhook
=
rpc
.
displayhook
# page help() text to shell.
import
pydoc
# import must be done here to capture i/o binding
pydoc
.
pager
=
pydoc
.
plainpager
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment