1818if not support .has_subprocess_support :
1919 raise unittest .SkipTest ("test module requires subprocess" )
2020
21- # Debug build?
22- Py_DEBUG = hasattr (sys , "gettotalrefcount" )
23-
2421
2522# XXX (ncoghlan): Move to script_helper and make consistent with run_python
2623def _kill_python_and_exit_code (p ):
@@ -144,7 +141,7 @@ def run_python(*args):
144141 # "-X showrefcount" shows the refcount, but only in debug builds
145142 rc , out , err = run_python ('-I' , '-X' , 'showrefcount' , '-c' , code )
146143 self .assertEqual (out .rstrip (), b"{'showrefcount': True}" )
147- if Py_DEBUG :
144+ if support . Py_DEBUG :
148145 # bpo-46417: Tolerate negative reference count which can occur
149146 # because of bugs in C extensions. This test is only about checking
150147 # the showrefcount feature.
@@ -753,7 +750,7 @@ def test_xdev(self):
753750 code = ("import warnings; "
754751 "print(' '.join('%s::%s' % (f[0], f[2].__name__) "
755752 "for f in warnings.filters))" )
756- if Py_DEBUG :
753+ if support . Py_DEBUG :
757754 expected_filters = "default::Warning"
758755 else :
759756 expected_filters = ("default::Warning "
@@ -827,7 +824,7 @@ def test_warnings_filter_precedence(self):
827824 expected_filters = ("error::BytesWarning "
828825 "once::UserWarning "
829826 "always::UserWarning" )
830- if not Py_DEBUG :
827+ if not support . Py_DEBUG :
831828 expected_filters += (" "
832829 "default::DeprecationWarning "
833830 "ignore::DeprecationWarning "
@@ -867,10 +864,10 @@ def test_pythonmalloc(self):
867864 # Test the PYTHONMALLOC environment variable
868865 pymalloc = support .with_pymalloc ()
869866 if pymalloc :
870- default_name = 'pymalloc_debug' if Py_DEBUG else 'pymalloc'
867+ default_name = 'pymalloc_debug' if support . Py_DEBUG else 'pymalloc'
871868 default_name_debug = 'pymalloc_debug'
872869 else :
873- default_name = 'malloc_debug' if Py_DEBUG else 'malloc'
870+ default_name = 'malloc_debug' if support . Py_DEBUG else 'malloc'
874871 default_name_debug = 'malloc_debug'
875872
876873 tests = [
@@ -933,6 +930,8 @@ def test_parsing_error(self):
933930 self .assertTrue (proc .stderr .startswith (err_msg ), proc .stderr )
934931 self .assertNotEqual (proc .returncode , 0 )
935932
933+ # TODO: RUSTPYTHON
934+ @unittest .expectedFailure
936935 def test_int_max_str_digits (self ):
937936 code = "import sys; print(sys.flags.int_max_str_digits, sys.get_int_max_str_digits())"
938937
@@ -950,7 +949,8 @@ def res2int(res):
950949 return tuple (int (i ) for i in out .split ())
951950
952951 res = assert_python_ok ('-c' , code )
953- self .assertEqual (res2int (res ), (- 1 , sys .get_int_max_str_digits ()))
952+ current_max = sys .get_int_max_str_digits ()
953+ self .assertEqual (res2int (res ), (current_max , current_max ))
954954 res = assert_python_ok ('-X' , 'int_max_str_digits=0' , '-c' , code )
955955 self .assertEqual (res2int (res ), (0 , 0 ))
956956 res = assert_python_ok ('-X' , 'int_max_str_digits=4000' , '-c' , code )
0 commit comments