Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 09c530d

Browse files
committed
Revert r88639 (the optimization changes behaviour and breaks buildbots)
1 parent ffa1a77 commit 09c530d

4 files changed

Lines changed: 7 additions & 22 deletions

File tree

Lib/ctypes/test/test_loading.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,12 +102,5 @@ def test_1703286_B(self):
102102
# This is the real test: call the function via 'call_function'
103103
self.assertEqual(0, call_function(proc, (None,)))
104104

105-
if os.name != "nt":
106-
def test_libc_exists(self):
107-
# A basic test that the libc is found by find_library()
108-
# XXX Can this fail on some non-Windows systems?
109-
self.assertTrue(libc_name)
110-
self.assertTrue(os.path.exists(libc_name))
111-
112105
if __name__ == "__main__":
113106
unittest.main()

Lib/ctypes/util.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,14 @@ def _findSoname_ldconfig(name):
203203
abi_type = mach_map.get(machine, 'libc6')
204204

205205
# XXX assuming GLIBC's ldconfig (with option -p)
206-
name = 'lib%s' % name
207-
pat = re.compile('\s*(/[^\(\)\s]*%s\.[^\(\)\s]*)' % re.escape(name))
206+
expr = r'(\S+)\s+\((%s(?:, OS ABI:[^\)]*)?)\)[^/]*(/[^\(\)\s]*lib%s\.[^\(\)\s]*)' \
207+
% (abi_type, re.escape(name))
208208
with contextlib.closing(os.popen('LC_ALL=C LANG=C /sbin/ldconfig -p 2>/dev/null')) as f:
209-
for line in f:
210-
if not '=>' in line:
211-
continue
212-
path = line.rsplit('=>', 1)[1]
213-
if not name+'.' in path:
214-
continue
215-
res = pat.search(path)
216-
if res:
217-
return res.group(1)
209+
data = f.read()
210+
res = re.search(expr, data)
211+
if not res:
212+
return None
213+
return res.group(1)
218214

219215
def find_library(name):
220216
return _findSoname_ldconfig(name) or _get_soname(_findLib_gcc(name))

Misc/ACKS

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ Dag Gruneau
329329
Michael Guravage
330330
Lars Gustäbel
331331
Thomas Güttler
332-
Jonas H.
333332
Barry Haddow
334333
Paul ten Hagen
335334
Rasmus Hahn

Misc/NEWS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ Core and Builtins
3535
Library
3636
-------
3737

38-
- Issue #11258: Speed up ctypes.util.find_library() under Linux a lot. Patch
39-
by Jonas H.
40-
4138
- Issue #11297: Add collections.ChainMap().
4239

4340
- Issue #10755: Add the posix.fdlistdir() function. Patch by Ross Lagerwall.

0 commit comments

Comments
 (0)