cpython: 4ce22d69e134 (original) (raw)
Mercurial > cpython
changeset 106105:4ce22d69e134 2.7
Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows. Original patch by Chi Hsuan Yen. [#29082]
Serhiy Storchaka storchaka@gmail.com | |
---|---|
date | Thu, 12 Jan 2017 17:00:32 +0200 |
parents | 3a01ade11123 |
children | 8578757cc3a6 d9539a5c2315 |
files | Lib/ctypes/test/test_loading.py Misc/NEWS Modules/_ctypes/callproc.c |
diffstat | 3 files changed, 11 insertions(+), 1 deletions(-)[+] [-] Lib/ctypes/test/test_loading.py 7 Misc/NEWS 3 Modules/_ctypes/callproc.c 2 |
line wrap: on
line diff
--- a/Lib/ctypes/test/test_loading.py +++ b/Lib/ctypes/test/test_loading.py @@ -3,6 +3,7 @@ import sys, unittest import os from ctypes.util import find_library from ctypes.test import is_resource_enabled +import test.test_support as support libc_name = None if os.name == "nt": @@ -27,6 +28,12 @@ class LoaderTest(unittest.TestCase): CDLL(os.path.basename(libc_name)) self.assertRaises(OSError, CDLL, self.unknowndll)
- @support.requires_unicode
- @unittest.skipUnless(libc_name is not None, 'could not find libc')
- def test_load_unicode(self):
CDLL(unicode(libc_name))[](#l1.18)
self.assertRaises(OSError, CDLL, unicode(self.unknowndll))[](#l1.19)
+ @unittest.skipUnless(libc_name is not None, 'could not find libc') @unittest.skipUnless(libc_name is not None and os.path.basename(libc_name) == "libc.so.6",
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -23,6 +23,9 @@ Extension Modules Library ------- +- Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
- Issue #29006: Revert change from issue #10513 for making sqlite more liable to emit "database table is locked" errors.
--- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -1281,7 +1281,7 @@ static PyObject *load_library(PyObject * PyObject *nameobj; PyObject *ignored; HMODULE hMod;
#ifdef _UNICODE name = alloca((PyString_Size(nameobj) + 1) * sizeof(WCHAR));