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
85c6772a
Kaydet (Commit)
85c6772a
authored
Eyl 01, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
IDLE: fix some RessourceWarning, reuse tokenize.open()
üst
0af03063
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
31 deletions
+28
-31
PyShell.py
Lib/idlelib/PyShell.py
+14
-12
ScriptBinding.py
Lib/idlelib/ScriptBinding.py
+14
-19
No files found.
Lib/idlelib/PyShell.py
Dosyayı görüntüle @
85c6772a
...
...
@@ -201,18 +201,18 @@ class PyShellEditorWindow(EditorWindow):
breaks
=
self
.
breakpoints
filename
=
self
.
io
.
filename
try
:
lines
=
open
(
self
.
breakpointPath
,
"r"
)
.
readlines
()
with
open
(
self
.
breakpointPath
,
"r"
)
as
fp
:
lines
=
fp
.
readlines
()
except
IOError
:
lines
=
[]
new_file
=
open
(
self
.
breakpointPath
,
"w"
)
for
line
in
lines
:
if
not
line
.
startswith
(
filename
+
'='
):
new_file
.
write
(
line
)
self
.
update_breakpoints
()
breaks
=
self
.
breakpoints
if
breaks
:
new_file
.
write
(
filename
+
'='
+
str
(
breaks
)
+
'
\n
'
)
new_file
.
close
()
with
open
(
self
.
breakpointPath
,
"w"
)
as
new_file
:
for
line
in
lines
:
if
not
line
.
startswith
(
filename
+
'='
):
new_file
.
write
(
line
)
self
.
update_breakpoints
()
breaks
=
self
.
breakpoints
if
breaks
:
new_file
.
write
(
filename
+
'='
+
str
(
breaks
)
+
'
\n
'
)
def
restore_file_breaks
(
self
):
self
.
text
.
update
()
# this enables setting "BREAK" tags to be visible
...
...
@@ -220,7 +220,8 @@ class PyShellEditorWindow(EditorWindow):
if
filename
is
None
:
return
if
os
.
path
.
isfile
(
self
.
breakpointPath
):
lines
=
open
(
self
.
breakpointPath
,
"r"
)
.
readlines
()
with
open
(
self
.
breakpointPath
,
"r"
)
as
fp
:
lines
=
fp
.
readlines
()
for
line
in
lines
:
if
line
.
startswith
(
filename
+
'='
):
breakpoint_linenumbers
=
eval
(
line
[
len
(
filename
)
+
1
:])
...
...
@@ -571,7 +572,8 @@ class ModifiedInterpreter(InteractiveInterpreter):
def
execfile
(
self
,
filename
,
source
=
None
):
"Execute an existing file"
if
source
is
None
:
source
=
open
(
filename
,
"r"
)
.
read
()
with
open
(
filename
,
"r"
)
as
fp
:
source
=
fp
.
read
()
try
:
code
=
compile
(
source
,
filename
,
"exec"
)
except
(
OverflowError
,
SyntaxError
):
...
...
Lib/idlelib/ScriptBinding.py
Dosyayı görüntüle @
85c6772a
...
...
@@ -67,25 +67,20 @@ class ScriptBinding:
def
tabnanny
(
self
,
filename
):
# XXX: tabnanny should work on binary files as well
with
open
(
filename
,
'r'
,
encoding
=
'iso-8859-1'
)
as
f
:
two_lines
=
f
.
readline
()
+
f
.
readline
()
encoding
=
IOBinding
.
coding_spec
(
two_lines
)
if
not
encoding
:
encoding
=
'utf-8'
f
=
open
(
filename
,
'r'
,
encoding
=
encoding
)
try
:
tabnanny
.
process_tokens
(
tokenize
.
generate_tokens
(
f
.
readline
))
except
tokenize
.
TokenError
as
msg
:
msgtxt
,
(
lineno
,
start
)
=
msg
self
.
editwin
.
gotoline
(
lineno
)
self
.
errorbox
(
"Tabnanny Tokenizing Error"
,
"Token Error:
%
s"
%
msgtxt
)
return
False
except
tabnanny
.
NannyNag
as
nag
:
# The error messages from tabnanny are too confusing...
self
.
editwin
.
gotoline
(
nag
.
get_lineno
())
self
.
errorbox
(
"Tab/space error"
,
indent_message
)
return
False
with
tokenize
.
open
(
filename
)
as
f
:
try
:
tabnanny
.
process_tokens
(
tokenize
.
generate_tokens
(
f
.
readline
))
except
tokenize
.
TokenError
as
msg
:
msgtxt
,
(
lineno
,
start
)
=
msg
self
.
editwin
.
gotoline
(
lineno
)
self
.
errorbox
(
"Tabnanny Tokenizing Error"
,
"Token Error:
%
s"
%
msgtxt
)
return
False
except
tabnanny
.
NannyNag
as
nag
:
# The error messages from tabnanny are too confusing...
self
.
editwin
.
gotoline
(
nag
.
get_lineno
())
self
.
errorbox
(
"Tab/space error"
,
indent_message
)
return
False
return
True
def
checksyntax
(
self
,
filename
):
...
...
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