Skip to content

gh-105751: Remove obsolete object base class in some ctypes tests #107460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -192,7 +192,7 @@ class S8I(Structure):
(9*2, 8*3, 7*4, 6*5, 5*6, 4*7, 3*8, 2*9))

def test_recursive_as_param(self):
class A(object):
class A:
pass

a = A()
Expand All @@ -201,15 +201,15 @@ class A(object):
c_int.from_param(a)


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

class AsParamWrapperTestCase(BasicWrapTestCase):
wrap = AsParamWrapper


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 @@ -120,7 +120,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 @@ -86,7 +86,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 @@ -97,15 +97,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 @@ -157,15 +157,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 @@ -174,7 +174,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