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
8c52027e
Kaydet (Commit)
8c52027e
authored
Nis 23, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #11258: Speed up ctypes.util.find_library() under Linux by a factor
of 5 to 10. Initial patch by Jonas H.
üst
877509ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
8 deletions
+18
-8
util.py
Lib/ctypes/util.py
+14
-8
ACKS
Misc/ACKS
+1
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/ctypes/util.py
Dosyayı görüntüle @
8c52027e
import
sys
,
os
import
sys
,
os
import
contextlib
import
contextlib
import
subprocess
# find_library(name) returns the pathname of a library, or None.
# find_library(name) returns the pathname of a library, or None.
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
...
@@ -203,14 +204,19 @@ elif os.name == "posix":
...
@@ -203,14 +204,19 @@ elif os.name == "posix":
abi_type
=
mach_map
.
get
(
machine
,
'libc6'
)
abi_type
=
mach_map
.
get
(
machine
,
'libc6'
)
# XXX assuming GLIBC's ldconfig (with option -p)
# XXX assuming GLIBC's ldconfig (with option -p)
expr
=
r'(\S+)\s+\((
%
s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib
%
s\.[^\(\)\s]*)'
\
regex
=
os
.
fsencode
(
%
(
abi_type
,
re
.
escape
(
name
))
'
\
s+(lib
%
s
\
.[^
\
s]+)
\
s+
\
(
%
s'
%
(
re
.
escape
(
name
),
abi_type
))
with
contextlib
.
closing
(
os
.
popen
(
'LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null'
))
as
f
:
try
:
data
=
f
.
read
()
with
subprocess
.
Popen
([
'/sbin/ldconfig'
,
'-p'
],
res
=
re
.
search
(
expr
,
data
)
stdin
=
subprocess
.
DEVNULL
,
if
not
res
:
stderr
=
subprocess
.
DEVNULL
,
return
None
stdout
=
subprocess
.
PIPE
,
return
res
.
group
(
1
)
env
=
{
'LC_ALL'
:
'C'
,
'LANG'
:
'C'
})
as
p
:
res
=
re
.
search
(
regex
,
p
.
stdout
.
read
())
if
res
:
return
os
.
fsdecode
(
res
.
group
(
1
))
except
OSError
:
pass
def
find_library
(
name
):
def
find_library
(
name
):
return
_findSoname_ldconfig
(
name
)
or
_get_soname
(
_findLib_gcc
(
name
))
return
_findSoname_ldconfig
(
name
)
or
_get_soname
(
_findLib_gcc
(
name
))
...
...
Misc/ACKS
Dosyayı görüntüle @
8c52027e
...
@@ -338,6 +338,7 @@ Filip Gruszczyński
...
@@ -338,6 +338,7 @@ Filip Gruszczyński
Michael Guravage
Michael Guravage
Lars Gustäbel
Lars Gustäbel
Thomas Güttler
Thomas Güttler
Jonas H.
Barry Haddow
Barry Haddow
Paul ten Hagen
Paul ten Hagen
Rasmus Hahn
Rasmus Hahn
...
...
Misc/NEWS
Dosyayı görüntüle @
8c52027e
...
@@ -113,6 +113,9 @@ Core and Builtins
...
@@ -113,6 +113,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
11258
:
Speed
up
ctypes
.
util
.
find_library
()
under
Linux
by
a
factor
of
5
to
10.
Initial
patch
by
Jonas
H
.
-
Issue
#
11382
:
Trivial
system
calls
,
such
as
dup
()
or
pipe
(),
needn
't
-
Issue
#
11382
:
Trivial
system
calls
,
such
as
dup
()
or
pipe
(),
needn
't
release the GIL. Patch by Charles-François Natali.
release the GIL. Patch by Charles-François Natali.
...
...
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