[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Committed with changed test. Thank you for your patch Chi Hsuan Yen.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4ce22d69e134 by Serhiy Storchaka in branch '2.7':
Issue #29082: Fixed loading libraries in ctypes by unicode names on Windows.
https://hg.python.org/cpython/rev/4ce22d69e134

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-12 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Here's a new patch using fake library names.

And thanks for those related issues about asdl_c.py!

--
Added file: http://bugs.python.org/file46273/issue29082_3.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2017-01-07 Thread Martin Panter

Martin Panter added the comment:

Other tests are skipped if libc_name is None, so your assertion is inconsistent.

FTR there are reports open about problems with bootstrap files like asdl_c.py, 
e.g. Issue 28143 proposing to port that file to Python 3, and Issue 23404 about 
the future of “make touch”.

--
stage: needs patch -> patch review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-31 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Oops, Parser/asdl_c.py shouldn't be included. Here's the correct patch

--
Added file: http://bugs.python.org/file46103/issue29082.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-31 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

I finally get Windows builds working. Here's the patch.

--
Added file: http://bugs.python.org/file46102/issue29082.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-31 Thread Chi Hsuan Yen

Changes by Chi Hsuan Yen :


Removed file: 
http://bugs.python.org/file46055/LoadLibrary_revert_arg_parsing.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-27 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

Sorry, but I'm afraid of being unable to test it. I tried to setup a Windows 
build environment for 2.x but failed. (I've once successfully built 3.x on 
Windows for issue25939, but things seems different now :(

--
keywords: +patch
Added file: 
http://bugs.python.org/file46055/LoadLibrary_revert_arg_parsing.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good catch Chi Hsuan Yen! This is my mistake, I though PyString_Size() works 
only with str (as many similar *_Size() functions). Agreed, this change should 
be reverted. Do you want provide the patch with tests?

--
keywords: +easy (C)
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29082] In 2.7.13, _ctypes.LoadLibrary no longer accepts Unicode objects

2016-12-27 Thread Chi Hsuan Yen

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com