Message80883
| Author |
jaraco |
| Recipients |
jaraco, theller |
| Date |
2009年01月31日.20:53:34 |
| SpamBayes Score |
7.946577e-08 |
| Marked as misclassified |
No |
| Message-id |
<1233435219.37.0.934884464449.issue5119@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|