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
b2fda239
Kaydet (Commit)
b2fda239
authored
Eki 30, 2010
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
close files correctly
üst
bbb0412a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
trace.py
Lib/trace.py
+12
-11
No files found.
Lib/trace.py
Dosyayı görüntüle @
b2fda239
...
@@ -404,16 +404,16 @@ def find_strings(filename, encoding=None):
...
@@ -404,16 +404,16 @@ def find_strings(filename, encoding=None):
# If the first token is a string, then it's the module docstring.
# If the first token is a string, then it's the module docstring.
# Add this special case so that the test in the loop passes.
# Add this special case so that the test in the loop passes.
prev_ttype
=
token
.
INDENT
prev_ttype
=
token
.
INDENT
f
=
open
(
filename
,
encoding
=
encoding
)
with
open
(
filename
,
encoding
=
encoding
)
as
f
:
for
ttype
,
tstr
,
start
,
end
,
line
in
tokenize
.
generate_tokens
(
f
.
readline
):
tok
=
tokenize
.
generate_tokens
(
f
.
readline
)
if
ttype
==
token
.
STRING
:
for
ttype
,
tstr
,
start
,
end
,
line
in
tok
:
if
prev_ttype
==
token
.
INDENT
:
if
ttype
==
token
.
STRING
:
sline
,
scol
=
start
if
prev_ttype
==
token
.
INDENT
:
eline
,
ecol
=
end
sline
,
scol
=
start
for
i
in
range
(
sline
,
eline
+
1
):
eline
,
ecol
=
end
d
[
i
]
=
1
for
i
in
range
(
sline
,
eline
+
1
):
prev_ttype
=
ttype
d
[
i
]
=
1
f
.
close
()
prev_ttype
=
ttype
return
d
return
d
def
find_executable_linenos
(
filename
):
def
find_executable_linenos
(
filename
):
...
@@ -421,7 +421,8 @@ def find_executable_linenos(filename):
...
@@ -421,7 +421,8 @@ def find_executable_linenos(filename):
try
:
try
:
with
io
.
FileIO
(
filename
,
'r'
)
as
file
:
with
io
.
FileIO
(
filename
,
'r'
)
as
file
:
encoding
,
lines
=
tokenize
.
detect_encoding
(
file
.
readline
)
encoding
,
lines
=
tokenize
.
detect_encoding
(
file
.
readline
)
prog
=
open
(
filename
,
"r"
,
encoding
=
encoding
)
.
read
()
with
open
(
filename
,
"r"
,
encoding
=
encoding
)
as
f
:
prog
=
f
.
read
()
except
IOError
as
err
:
except
IOError
as
err
:
print
((
"Not printing coverage data for
%
r:
%
s"
print
((
"Not printing coverage data for
%
r:
%
s"
%
(
filename
,
err
)),
file
=
sys
.
stderr
)
%
(
filename
,
err
)),
file
=
sys
.
stderr
)
...
...
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