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
ba7c2260
Kaydet (Commit)
ba7c2260
authored
Eki 07, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Make platform.libc_ver() less slow
üst
978b9d2a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
+15
-10
platform.py
Lib/platform.py
+15
-10
No files found.
Lib/platform.py
Dosyayı görüntüle @
ba7c2260
...
...
@@ -130,15 +130,15 @@ except AttributeError:
### Platform specific APIs
_libc_search
=
re
.
compile
(
r
'(__libc_init)'
'|'
'(GLIBC_([0-9.]+))'
'|'
'(libc(_
\
w+)?
\
.so(?:
\
.(
\
d[0-9.]*))?)'
,
re
.
ASCII
)
_libc_search
=
re
.
compile
(
b
'(__libc_init)'
b
'|'
b
'(GLIBC_([0-9.]+))'
b
'|'
br
'(libc(_
\
w+)?
\
.so(?:
\
.(
\
d[0-9.]*))?)'
,
re
.
ASCII
)
def
libc_ver
(
executable
=
sys
.
executable
,
lib
=
''
,
version
=
''
,
chunksize
=
2048
):
chunksize
=
16384
):
""" Tries to determine the libc version that the file executable
(which defaults to the Python interpreter) is linked against.
...
...
@@ -159,17 +159,22 @@ def libc_ver(executable=sys.executable,lib='',version='',
# able to open symlinks for reading
executable
=
os
.
path
.
realpath
(
executable
)
f
=
open
(
executable
,
'rb'
)
binary
=
f
.
read
(
chunksize
)
.
decode
(
'latin-1'
)
binary
=
f
.
read
(
chunksize
)
pos
=
0
while
1
:
m
=
_libc_search
.
search
(
binary
,
pos
)
if
b
'libc'
in
binary
or
b
'GLIBC'
in
binary
:
m
=
_libc_search
.
search
(
binary
,
pos
)
else
:
m
=
None
if
not
m
:
binary
=
f
.
read
(
chunksize
)
.
decode
(
'latin-1'
)
binary
=
f
.
read
(
chunksize
)
if
not
binary
:
break
pos
=
0
continue
libcinit
,
glibc
,
glibcversion
,
so
,
threads
,
soversion
=
m
.
groups
()
libcinit
,
glibc
,
glibcversion
,
so
,
threads
,
soversion
=
[
s
.
decode
(
'latin1'
)
if
s
is
not
None
else
s
for
s
in
m
.
groups
()]
if
libcinit
and
not
lib
:
lib
=
'libc'
elif
glibc
:
...
...
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