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
a5bbf200
Kaydet (Commit)
a5bbf200
authored
Ara 12, 2008
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
revert r67713. it causes build problems
üst
d9472672
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
linecache.py
Lib/linecache.py
+20
-4
No files found.
Lib/linecache.py
Dosyayı görüntüle @
a5bbf200
...
@@ -7,7 +7,7 @@ that name.
...
@@ -7,7 +7,7 @@ that name.
import
sys
import
sys
import
os
import
os
import
tokeniz
e
import
r
e
__all__
=
[
"getline"
,
"clearcache"
,
"checkcache"
]
__all__
=
[
"getline"
,
"clearcache"
,
"checkcache"
]
...
@@ -121,11 +121,27 @@ def updatecache(filename, module_globals=None):
...
@@ -121,11 +121,27 @@ def updatecache(filename, module_globals=None):
pass
pass
else
:
else
:
# No luck
# No luck
## print '*** Cannot stat', filename, ':', msg
return
[]
return
[]
with
open
(
fullname
,
'rb'
)
as
fp
:
## print("Refreshing cache for %s..." % fullname)
coding
,
line
=
tokenize
.
detect_encoding
(
fp
.
readline
)
try
:
with
open
(
fullname
,
'r'
,
encoding
=
coding
)
as
fp
:
fp
=
open
(
fullname
,
'rU'
)
lines
=
fp
.
readlines
()
lines
=
fp
.
readlines
()
fp
.
close
()
except
Exception
as
msg
:
## print '*** Cannot open', fullname, ':', msg
return
[]
coding
=
"utf-8"
for
line
in
lines
[:
2
]:
m
=
re
.
search
(
r"coding[:=]\s*([-\w.]+)"
,
line
)
if
m
:
coding
=
m
.
group
(
1
)
break
try
:
lines
=
[
line
if
isinstance
(
line
,
str
)
else
str
(
line
,
coding
)
for
line
in
lines
]
except
:
pass
# Hope for the best
size
,
mtime
=
stat
.
st_size
,
stat
.
st_mtime
size
,
mtime
=
stat
.
st_size
,
stat
.
st_mtime
cache
[
filename
]
=
size
,
mtime
,
lines
,
fullname
cache
[
filename
]
=
size
,
mtime
,
lines
,
fullname
return
lines
return
lines
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