Skip to content

Commit

Permalink
[3.12] gh-105751: Remove obsolete object base class in some ctypes …
Browse files Browse the repository at this point in the history
…tests (GH-107460) (#107501)

(cherry picked from commit 520efec)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
  • Loading branch information
ambv and tomasr8 committed Jul 31, 2023
1 parent 99518bb commit 831fd19
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions Lib/test/test_ctypes/test_as_parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ class S8I(Structure):
def test_recursive_as_param(self):
from ctypes import c_int

class A(object):
class A:
pass

a = A()
Expand All @@ -205,7 +205,7 @@ class A(object):

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class AsParamWrapper(object):
class AsParamWrapper:
def __init__(self, param):
self._as_parameter_ = param

Expand All @@ -214,7 +214,7 @@ class AsParamWrapperTestCase(BasicWrapTestCase):

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

class AsParamPropertyWrapper(object):
class AsParamPropertyWrapper:
def __init__(self, param):
self._param = param

Expand Down
2 changes: 1 addition & 1 deletion Lib/test/test_ctypes/test_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_unsupported_restype_2(self):
def test_issue_7959(self):
proto = self.functype.__func__(None)

class X(object):
class X:
def func(self): pass
def __init__(self):
self.v = proto(self.func)
Expand Down
8 changes: 4 additions & 4 deletions Lib/test/test_ctypes/test_numbers.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def test_byref(self):
def test_floats(self):
# c_float and c_double can be created from
# Python int and float
class FloatLike(object):
class FloatLike:
def __float__(self):
return 2.0
f = FloatLike()
Expand All @@ -109,15 +109,15 @@ def __float__(self):
self.assertEqual(t(f).value, 2.0)

def test_integers(self):
class FloatLike(object):
class FloatLike:
def __float__(self):
return 2.0
f = FloatLike()
class IntLike(object):
class IntLike:
def __int__(self):
return 2
d = IntLike()
class IndexLike(object):
class IndexLike:
def __index__(self):
return 2
i = IndexLike()
Expand Down
6 changes: 3 additions & 3 deletions Lib/test/test_ctypes/test_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ def test_noctypes_argtype(self):
# TypeError: has no from_param method
self.assertRaises(TypeError, setattr, func, "argtypes", (object,))

class Adapter(object):
class Adapter:
def from_param(cls, obj):
return None

func.argtypes = (Adapter(),)
self.assertEqual(func(None), None)
self.assertEqual(func(object()), None)

class Adapter(object):
class Adapter:
def from_param(cls, obj):
return obj

Expand All @@ -184,7 +184,7 @@ def from_param(cls, obj):
self.assertRaises(ArgumentError, func, object())
self.assertEqual(func(c_void_p(42)), 42)

class Adapter(object):
class Adapter:
def from_param(cls, obj):
raise ValueError(obj)

Expand Down

0 comments on commit 831fd19

Please sign in to comment.