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
e2b5624e
Kaydet (Commit)
e2b5624e
authored
Tem 25, 2012
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #15318: Prevent writing to sys.stdin.
Patch by Roger Serwy and myself.
üst
7009845c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
7 deletions
+38
-7
NEWS.txt
Lib/idlelib/NEWS.txt
+2
-0
PyShell.py
Lib/idlelib/PyShell.py
+15
-1
run.py
Lib/idlelib/run.py
+21
-6
No files found.
Lib/idlelib/NEWS.txt
Dosyayı görüntüle @
e2b5624e
What's New in IDLE 2.7.4?
What's New in IDLE 2.7.4?
=========================
=========================
- Issue #15318: Prevent writing to sys.stdin.
- Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
- Issue #13532, #15319: Check that arguments to sys.stdout.write are strings.
- Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.
- Issue # 12510: Attempt to get certain tool tips no longer crashes IDLE.
...
...
Lib/idlelib/PyShell.py
Dosyayı görüntüle @
e2b5624e
...
@@ -11,6 +11,7 @@ import time
...
@@ -11,6 +11,7 @@ import time
import
threading
import
threading
import
traceback
import
traceback
import
types
import
types
import
io
import
linecache
import
linecache
from
code
import
InteractiveInterpreter
from
code
import
InteractiveInterpreter
...
@@ -422,6 +423,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
...
@@ -422,6 +423,9 @@ class ModifiedInterpreter(InteractiveInterpreter):
except
socket
.
timeout
,
err
:
except
socket
.
timeout
,
err
:
self
.
display_no_subprocess_error
()
self
.
display_no_subprocess_error
()
return
None
return
None
# Can't regiter self.tkconsole.stdin, since run.py wants to
# call non-TextIO methods on it (such as getvar)
# XXX should be renamed to "console"
self
.
rpcclt
.
register
(
"stdin"
,
self
.
tkconsole
)
self
.
rpcclt
.
register
(
"stdin"
,
self
.
tkconsole
)
self
.
rpcclt
.
register
(
"stdout"
,
self
.
tkconsole
.
stdout
)
self
.
rpcclt
.
register
(
"stdout"
,
self
.
tkconsole
.
stdout
)
self
.
rpcclt
.
register
(
"stderr"
,
self
.
tkconsole
.
stderr
)
self
.
rpcclt
.
register
(
"stderr"
,
self
.
tkconsole
.
stderr
)
...
@@ -875,13 +879,14 @@ class PyShell(OutputWindow):
...
@@ -875,13 +879,14 @@ class PyShell(OutputWindow):
self
.
save_stderr
=
sys
.
stderr
self
.
save_stderr
=
sys
.
stderr
self
.
save_stdin
=
sys
.
stdin
self
.
save_stdin
=
sys
.
stdin
from
idlelib
import
IOBinding
from
idlelib
import
IOBinding
self
.
stdin
=
PseudoInputFile
(
self
)
self
.
stdout
=
PseudoFile
(
self
,
"stdout"
,
IOBinding
.
encoding
)
self
.
stdout
=
PseudoFile
(
self
,
"stdout"
,
IOBinding
.
encoding
)
self
.
stderr
=
PseudoFile
(
self
,
"stderr"
,
IOBinding
.
encoding
)
self
.
stderr
=
PseudoFile
(
self
,
"stderr"
,
IOBinding
.
encoding
)
self
.
console
=
PseudoFile
(
self
,
"console"
,
IOBinding
.
encoding
)
self
.
console
=
PseudoFile
(
self
,
"console"
,
IOBinding
.
encoding
)
if
not
use_subprocess
:
if
not
use_subprocess
:
sys
.
stdout
=
self
.
stdout
sys
.
stdout
=
self
.
stdout
sys
.
stderr
=
self
.
stderr
sys
.
stderr
=
self
.
stderr
sys
.
stdin
=
self
sys
.
stdin
=
self
.
stdin
#
#
self
.
history
=
self
.
History
(
self
.
text
)
self
.
history
=
self
.
History
(
self
.
text
)
#
#
...
@@ -1279,6 +1284,15 @@ class PseudoFile(object):
...
@@ -1279,6 +1284,15 @@ class PseudoFile(object):
def
isatty
(
self
):
def
isatty
(
self
):
return
True
return
True
class
PseudoInputFile
(
object
):
def
__init__
(
self
,
shell
):
self
.
readline
=
shell
.
readline
self
.
isatty
=
shell
.
isatty
def
write
(
self
,
s
):
raise
io
.
UnsupportedOperation
(
"not writable"
)
writelines
=
write
usage_msg
=
"""
\
usage_msg
=
"""
\
...
...
Lib/idlelib/run.py
Dosyayı görüntüle @
e2b5624e
...
@@ -260,7 +260,7 @@ class _RPCFile(io.TextIOBase):
...
@@ -260,7 +260,7 @@ class _RPCFile(io.TextIOBase):
def
__getattribute__
(
self
,
name
):
def
__getattribute__
(
self
,
name
):
# When accessing the 'rpc' attribute, or 'write', use ours
# When accessing the 'rpc' attribute, or 'write', use ours
if
name
in
(
'rpc'
,
'write'
):
if
name
in
(
'rpc'
,
'write'
,
'writelines'
):
return
io
.
TextIOBase
.
__getattribute__
(
self
,
name
)
return
io
.
TextIOBase
.
__getattribute__
(
self
,
name
)
# Else only look into the remote object only
# Else only look into the remote object only
return
getattr
(
self
.
rpc
,
name
)
return
getattr
(
self
.
rpc
,
name
)
...
@@ -268,20 +268,35 @@ class _RPCFile(io.TextIOBase):
...
@@ -268,20 +268,35 @@ class _RPCFile(io.TextIOBase):
def
__setattr__
(
self
,
name
,
value
):
def
__setattr__
(
self
,
name
,
value
):
return
setattr
(
self
.
rpc
,
name
,
value
)
return
setattr
(
self
.
rpc
,
name
,
value
)
@staticmethod
def
_ensure_string
(
func
):
def
f
(
self
,
s
):
if
not
isinstance
(
s
,
basestring
):
raise
TypeError
(
'must be str, not '
+
type
(
s
)
.
__name__
)
return
func
(
self
,
s
)
return
f
class
_RPCOutputFile
(
_RPCFile
):
@_RPCFile._ensure_string
def
write
(
self
,
s
):
def
write
(
self
,
s
):
if
not
isinstance
(
s
,
(
basestring
,
bytearray
)):
raise
TypeError
(
'must be string, not '
+
type
(
s
)
.
__name__
)
return
self
.
rpc
.
write
(
s
)
return
self
.
rpc
.
write
(
s
)
class
_RPCInputFile
(
_RPCFile
):
@_RPCFile._ensure_string
def
write
(
self
,
s
):
raise
io
.
UnsupportedOperation
(
"not writable"
)
writelines
=
write
class
MyHandler
(
rpc
.
RPCHandler
):
class
MyHandler
(
rpc
.
RPCHandler
):
def
handle
(
self
):
def
handle
(
self
):
"""Override base method"""
"""Override base method"""
executive
=
Executive
(
self
)
executive
=
Executive
(
self
)
self
.
register
(
"exec"
,
executive
)
self
.
register
(
"exec"
,
executive
)
sys
.
stdin
=
self
.
console
=
self
.
get_remote_proxy
(
"stdin"
)
self
.
console
=
self
.
get_remote_proxy
(
"stdin"
)
sys
.
stdout
=
_RPCFile
(
self
.
get_remote_proxy
(
"stdout"
))
sys
.
stdin
=
_RPCInputFile
(
self
.
console
)
sys
.
stderr
=
_RPCFile
(
self
.
get_remote_proxy
(
"stderr"
))
sys
.
stdout
=
_RPCOutputFile
(
self
.
get_remote_proxy
(
"stdout"
))
sys
.
stderr
=
_RPCOutputFile
(
self
.
get_remote_proxy
(
"stderr"
))
from
idlelib
import
IOBinding
from
idlelib
import
IOBinding
sys
.
stdin
.
encoding
=
sys
.
stdout
.
encoding
=
\
sys
.
stdin
.
encoding
=
sys
.
stdout
.
encoding
=
\
sys
.
stderr
.
encoding
=
IOBinding
.
encoding
sys
.
stderr
.
encoding
=
IOBinding
.
encoding
...
...
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