Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 061b14a

Browse files
Reverted r84315 and r84316, with Benjamin's blessing. The tests were
fine. They were failing due to a problem exposed in r84307 and fixed in r84317. See Issue 8781 for details.
1 parent f5a3d69 commit 061b14a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

Lib/ctypes/test/test_parameters.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,19 @@ def test_cstrings(self):
6767
self.assertTrue(c_char_p.from_param(a) is a)
6868

6969
def test_cw_strings(self):
70-
from ctypes import byref, sizeof
70+
from ctypes import byref
7171
try:
72-
from ctypes import c_wchar, c_wchar_p
72+
from ctypes import c_wchar_p
7373
except ImportError:
7474
## print "(No c_wchar_p)"
7575
return
7676
s = "123"
7777
if sys.platform == "win32":
78-
unisize = 8 if sys.maxunicode == 1114111 else 4
79-
if unisize == sizeof(c_wchar):
80-
self.assertIs(c_wchar_p.from_param(s)._obj, s)
81-
# new in 0.9.1: convert (decode) ascii to unicode
82-
self.assertEqual(c_wchar_p.from_param("123")._obj, "123")
78+
self.assertTrue(c_wchar_p.from_param(s)._obj is s)
8379
self.assertRaises(TypeError, c_wchar_p.from_param, 42)
80+
81+
# new in 0.9.1: convert (decode) ascii to unicode
82+
self.assertEqual(c_wchar_p.from_param("123")._obj, "123")
8483
self.assertRaises(TypeError, c_wchar_p.from_param, b"123\377")
8584

8685
pa = c_wchar_p.from_param(c_wchar_p("123"))

0 commit comments

Comments
 (0)