[New-bugs-announce] [issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects
Chi Hsuan Yen
report at bugs.python.org
Tue Dec 27 05:09:01 EST 2016
New submission from Chi Hsuan Yen:
In issue27330, there's one more change besides fixing possible memory leaks. In LoadLibrary function of _ctypes: [1]
- if (!PyArg_ParseTuple(args, "O|O:LoadLibrary", &nameobj, &ignored))
+ if (!PyArg_ParseTuple(args, "S|O:LoadLibrary", &nameobj, &ignored))
Before this change, both bytes and unicode objects are accepted in _ctypes.LoadLibrary() (Unicode objects are implicitly converted to bytes), and after this change only bytes objects are valid.
There are two options:
* Revert the relevant PyArg_ParseTuple.
It's better to have fewer surprises on 2.7 branch :)
* Document the change.
I prefer the first option as in our project ```from __future__ import unicode_literals``` is used everywhere, and in Python 3 only Unicode objects are acceptable in _ctypes.LoadLibrary().
Downstream report: https://github.com/rg3/youtube-dl/issues/11540
Added the author and the reviewer in issue27330.
[1] e04c054beb53
----------
components: ctypes
messages: 284081
nosy: Chi Hsuan Yen, martin.panter, serhiy.storchaka
priority: normal
severity: normal
status: open
title: In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29082>
_______________________________________
More information about the New-bugs-announce
mailing list