New submission from Jason R. Coombs <jar...@jaraco.com>: 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 = 'usern...@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. ---------- assignee: theller components: ctypes messages: 80883 nosy: jaraco, theller severity: normal status: open title: inconsistent wide character parameter handling in 64-bit python type: behavior versions: Python 2.5, Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5119> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com