Message80883
Using Python 2.5.4 and Python 2.6.1 on 32-bit python, when passing a
regular string to a function expecting pointer to a wide string
(wintypes.LPCWSTR), the function executes without problems.
When calling the same using Python 2.6.1 on 64-bit windows, the called
function appears not to recognize the parameter unless it is first
converted to unicode.
I discovered this when calling the WNetAddConnection2 function.
Assuming a properly-initialized NETRESOURCE, resource.
password = None
username = 'username@domain.com'
flags = 0
val = ctypes.windll.mpr.WNetAddConnection2W(
ctypes.byref(resource),
password,
username,
flags)
This method works fine on 32-bit python but fails on 64-bit python
unless username=unicode(username). The error returned is "The specified
password is incorrect", indicating that the username is in fact
incorrect because the correct username does not require a password.
I wish I had a better test case; I'll try to track down one that doesn't
require such a complex underlying API.
I'm not sure what the correct fix is for this, but regardless, I would
expect the behavior to be consistent for the same Python version
independent of word size. |
|
Date |
User |
Action |
Args |
2009-01-31 20:53:39 | jaraco | set | recipients:
+ jaraco, theller |
2009-01-31 20:53:39 | jaraco | set | messageid: <1233435219.37.0.934884464449.issue5119@psf.upfronthosting.co.za> |
2009-01-31 20:53:36 | jaraco | link | issue5119 messages |
2009-01-31 20:53:34 | jaraco | create | |
|