[New-bugs-announce] [issue8394] ctypes.dlopen() doesn't support surrogates

STINNER Victor report at bugs.python.org
Wed Apr 14 03:16:20 CEST 2010

New submission from STINNER Victor <victor.stinner at haypocalc.com>:

The PEP 383 introduces filename using surrogates. ctypes.dlopen() support them. ctypes.cdll.LoadLibrary('libc\uDCff.so.6') fails with:

   UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' 
   in position 4: surrogates not allowed

Attached patch fixes this issue.

TODO: Remove the assert(PyBytes_Check(name2)). I don't know if PyUnicode_FSConverter() does always return a PyBytes object or not.

components: Library (Lib), Unicode
files: ctypes_dlopen_surrogates.patch
keywords: patch
messages: 103108
nosy: haypo
severity: normal
status: open
title: ctypes.dlopen() doesn't support surrogates
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16921/ctypes_dlopen_surrogates.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list