diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-05-30 05:24:49 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-05-30 05:24:49 +0000 |
commit | f9d43d9729626b6c61d33bdc75b8586eb781c669 (patch) | |
tree | 84a4ce03195ba55d24fbf53284e39f57d1c85ff8 /Lib/ctypes | |
parent | 3397d7292b66cf5bd87167aad7bbce170c1e5a28 (diff) | |
parent | cdc1b858847731a56f1823aedfe153573a6f8e8b (diff) | |
download | cpython-f9d43d9729626b6c61d33bdc75b8586eb781c669.tar.gz |
Issue #27125: Merge typo fixes from 3.5
Diffstat (limited to 'Lib/ctypes')
-rw-r--r-- | Lib/ctypes/test/test_bitfields.py | 1 | ||||
-rw-r--r-- | Lib/ctypes/test/test_objects.py | 2 | ||||
-rw-r--r-- | Lib/ctypes/test/test_parameters.py | 8 | ||||
-rw-r--r-- | Lib/ctypes/test/test_pep3118.py | 2 | ||||
-rw-r--r-- | Lib/ctypes/test/test_returnfuncptrs.py | 1 | ||||
-rw-r--r-- | Lib/ctypes/test/test_sizes.py | 1 | ||||
-rw-r--r-- | Lib/ctypes/test/test_structures.py | 7 | ||||
-rw-r--r-- | Lib/ctypes/test/test_values.py | 6 | ||||
-rw-r--r-- | Lib/ctypes/util.py | 4 |
9 files changed, 13 insertions, 19 deletions
diff --git a/Lib/ctypes/test/test_bitfields.py b/Lib/ctypes/test/test_bitfields.py index b39d82cc0b..0eb09fb4bf 100644 --- a/Lib/ctypes/test/test_bitfields.py +++ b/Lib/ctypes/test/test_bitfields.py @@ -3,7 +3,6 @@ from ctypes.test import need_symbol import unittest import os -import ctypes import _ctypes_test class BITS(Structure): diff --git a/Lib/ctypes/test/test_objects.py b/Lib/ctypes/test/test_objects.py index ef7b20b000..19e3dc1f2d 100644 --- a/Lib/ctypes/test/test_objects.py +++ b/Lib/ctypes/test/test_objects.py @@ -54,7 +54,7 @@ of 'x' ('_b_base_' is either None, or the root object owning the memory block): ''' -import unittest, doctest, sys +import unittest, doctest import ctypes.test.test_objects diff --git a/Lib/ctypes/test/test_parameters.py b/Lib/ctypes/test/test_parameters.py index e56bccf999..363f58612d 100644 --- a/Lib/ctypes/test/test_parameters.py +++ b/Lib/ctypes/test/test_parameters.py @@ -1,4 +1,4 @@ -import unittest, sys +import unittest from ctypes.test import need_symbol class SimpleTypesTestCase(unittest.TestCase): @@ -49,7 +49,7 @@ class SimpleTypesTestCase(unittest.TestCase): # XXX Replace by c_char_p tests def test_cstrings(self): - from ctypes import c_char_p, byref + from ctypes import c_char_p # c_char_p.from_param on a Python String packs the string # into a cparam object @@ -68,7 +68,7 @@ class SimpleTypesTestCase(unittest.TestCase): @need_symbol('c_wchar_p') def test_cw_strings(self): - from ctypes import byref, c_wchar_p + from ctypes import c_wchar_p c_wchar_p.from_param("123") @@ -98,7 +98,7 @@ class SimpleTypesTestCase(unittest.TestCase): def test_byref_pointer(self): # The from_param class method of POINTER(typ) classes accepts what is # returned by byref(obj), it type(obj) == typ - from ctypes import c_short, c_uint, c_int, c_long, pointer, POINTER, byref + from ctypes import c_short, c_uint, c_int, c_long, POINTER, byref LPINT = POINTER(c_int) LPINT.from_param(byref(c_int(42))) diff --git a/Lib/ctypes/test/test_pep3118.py b/Lib/ctypes/test/test_pep3118.py index 32f802c861..d68397ea80 100644 --- a/Lib/ctypes/test/test_pep3118.py +++ b/Lib/ctypes/test/test_pep3118.py @@ -1,6 +1,6 @@ import unittest from ctypes import * -import re, struct, sys +import re, sys if sys.byteorder == "little": THIS_ENDIAN = "<" diff --git a/Lib/ctypes/test/test_returnfuncptrs.py b/Lib/ctypes/test/test_returnfuncptrs.py index 93eba6bb76..1974f40df6 100644 --- a/Lib/ctypes/test/test_returnfuncptrs.py +++ b/Lib/ctypes/test/test_returnfuncptrs.py @@ -1,6 +1,5 @@ import unittest from ctypes import * -import os import _ctypes_test diff --git a/Lib/ctypes/test/test_sizes.py b/Lib/ctypes/test/test_sizes.py index f9b5e97260..4ceacbc290 100644 --- a/Lib/ctypes/test/test_sizes.py +++ b/Lib/ctypes/test/test_sizes.py @@ -2,7 +2,6 @@ from ctypes import * -import sys import unittest diff --git a/Lib/ctypes/test/test_structures.py b/Lib/ctypes/test/test_structures.py index 84d456c3cc..e00bb046b4 100644 --- a/Lib/ctypes/test/test_structures.py +++ b/Lib/ctypes/test/test_structures.py @@ -326,11 +326,8 @@ class StructureTestCase(unittest.TestCase): cls, msg = self.get_except(Person, b"Someone", (b"a", b"b", b"c")) self.assertEqual(cls, RuntimeError) - if issubclass(Exception, object): - self.assertEqual(msg, - "(Phone) <class 'TypeError'>: too many initializers") - else: - self.assertEqual(msg, "(Phone) TypeError: too many initializers") + self.assertEqual(msg, + "(Phone) <class 'TypeError'>: too many initializers") def test_huge_field_name(self): # issue12881: segfault with large structure field names diff --git a/Lib/ctypes/test/test_values.py b/Lib/ctypes/test/test_values.py index 5a3a47f968..e71b48020f 100644 --- a/Lib/ctypes/test/test_values.py +++ b/Lib/ctypes/test/test_values.py @@ -79,9 +79,9 @@ class PythonValuesTestCase(unittest.TestCase): continue items.append((entry.name.decode("ascii"), entry.size)) - expected = [("__hello__", 161), - ("__phello__", -161), - ("__phello__.spam", 161), + expected = [("__hello__", 139), + ("__phello__", -139), + ("__phello__.spam", 139), ] self.assertEqual(items, expected, "PyImport_FrozenModules example " "in Doc/library/ctypes.rst may be out of date") diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py index 8ff4aff0ca..b89c315726 100644 --- a/Lib/ctypes/util.py +++ b/Lib/ctypes/util.py @@ -222,8 +222,8 @@ elif os.name == "posix": abi_type = mach_map.get(machine, 'libc6') # XXX assuming GLIBC's ldconfig (with option -p) - regex = os.fsencode( - '\s+(lib%s\.[^\s]+)\s+\(%s' % (re.escape(name), abi_type)) + regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' + regex = os.fsencode(regex % (re.escape(name), abi_type)) try: with subprocess.Popen(['/sbin/ldconfig', '-p'], stdin=subprocess.DEVNULL, |