Suppress DeprecatedWarning in python_overload_simple_cast_runme testcase

I think these are due to problems inside the Python interpreter sorted out in 3.10.
From 3.10 release notes:

Builtin and extension functions that take integer arguments no longer accept Decimals,
Fractions and other objects that can be converted to integers only with a loss (e.g.
that have the __int__() method but do not have the __index__() method).
This commit is contained in:
William S Fulton 2025-05-12 19:08:57 +01:00
parent d966fd3ba1
commit ff7ab351a3
1 changed files with 7 additions and 1 deletions

View File

@ -2,6 +2,12 @@ from python_overload_simple_cast import *
import sys
# For handling in these 2 versions of Python:
# DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using __int__ is deprecated, and may be removed in a future version of Python.
if sys.version_info[0:2] == (3, 8) or sys.version_info[0:2] == (3, 9):
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
class Ai:
def __init__(self, x):
@ -29,7 +35,7 @@ add = Ad(5.5)
try:
fint(add)
good = 0
except:
except TypeError:
good = 1
if not good: