[Python-checkins] bpo-40214: Fix ctypes WinDLL test with insecure flags (GH-19652)

Miss Islington (bot) webhook-mailer at python.org
Fri May 22 18:24:50 EDT 2020


https://github.com/python/cpython/commit/0cc7becde0bfe896fd23b5cb14fedfb8f2066fca
commit: 0cc7becde0bfe896fd23b5cb14fedfb8f2066fca
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-05-22T15:24:45-07:00
summary:

bpo-40214: Fix ctypes WinDLL test with insecure flags (GH-19652)

(cherry picked from commit 9b498939009f49b8c772c89e8fc80efbfd8afcb5)

Co-authored-by: Steve Dower <steve.dower at python.org>

files:
M Lib/ctypes/test/test_loading.py

diff --git a/Lib/ctypes/test/test_loading.py b/Lib/ctypes/test/test_loading.py
index a62044e370af6..5c48b0db4c393 100644
--- a/Lib/ctypes/test/test_loading.py
+++ b/Lib/ctypes/test/test_loading.py
@@ -158,11 +158,9 @@ def should_fail(command):
             # Relative path (but not just filename) should succeed
             should_pass("WinDLL('./_sqlite3.dll')")
 
-            # XXX: This test has started failing on Azure Pipelines CI.  See
-            #      bpo-40214 for more information.
-            if 0:
-                # Insecure load flags should succeed
-                should_pass("WinDLL('_sqlite3.dll', winmode=0)")
+            # Insecure load flags should succeed
+            # Clear the DLL directory to avoid safe search settings propagating
+            should_pass("windll.kernel32.SetDllDirectoryW(None); WinDLL('_sqlite3.dll', winmode=0)")
 
             # Full path load without DLL_LOAD_DIR shouldn't find dependency
             should_fail("WinDLL(nt._getfullpathname('_sqlite3.dll'), " +



More information about the Python-checkins mailing list