Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
99ba17f5
Commit
99ba17f5
authored
Jan 12, 2017
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
Original patch by Chi Hsuan Yen.
parent
c8a752ea
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
Lib/ctypes/test/test_loading.py
Lib/ctypes/test/test_loading.py
+7
-0
Misc/NEWS
Misc/NEWS
+3
-0
Modules/_ctypes/callproc.c
Modules/_ctypes/callproc.c
+1
-1
No files found.
Lib/ctypes/test/test_loading.py
View file @
99ba17f5
...
...
@@ -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
))
self
.
assertRaises
(
OSError
,
CDLL
,
unicode
(
self
.
unknowndll
))
@
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"
,
...
...
Misc/NEWS
View file @
99ba17f5
...
...
@@ -23,6 +23,9 @@ Extension Modules
Library
-------
- Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
Original patch by Chi Hsuan Yen.
- Issue #29006: Revert change from issue #10513 for making sqlite more liable to
emit "database table is locked" errors.
...
...
Modules/_ctypes/callproc.c
View file @
99ba17f5
...
...
@@ -1281,7 +1281,7 @@ static PyObject *load_library(PyObject *self, PyObject *args)
PyObject
*
nameobj
;
PyObject
*
ignored
;
HMODULE
hMod
;
if
(
!
PyArg_ParseTuple
(
args
,
"
S
|O:LoadLibrary"
,
&
nameobj
,
&
ignored
))
if
(
!
PyArg_ParseTuple
(
args
,
"
O
|O:LoadLibrary"
,
&
nameobj
,
&
ignored
))
return
NULL
;
#ifdef _UNICODE
name
=
alloca
((
PyString_Size
(
nameobj
)
+
1
)
*
sizeof
(
WCHAR
));
...
...
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