diff options
author | Victor Stinner <vstinner@python.org> | 2020-02-03 14:17:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 14:17:15 (GMT) |
commit | c6e5c1123bac6cbb4c85265155af5349dcea522e (patch) | |
tree | c9bc04bdd74fbf9d8f86dd1999d8acc0f4655fc3 /Lib | |
parent | 869c0c99b94ff9527acc1ca060164ab3d1bdcc53 (diff) | |
download | cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.zip cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.gz cpython-c6e5c1123bac6cbb4c85265155af5349dcea522e.tar.bz2 |
bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)
Remove:
* COUNT_ALLOCS macro
* sys.getcounts() function
* SHOW_ALLOC_COUNT code in listobject.c
* SHOW_TRACK_COUNT code in tupleobject.c
* PyConfig.show_alloc_count field
* -X showalloccount command line option
* @test.support.requires_type_collecting decorator
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/subprocess.py | 2 | ||||
-rw-r--r-- | Lib/test/support/__init__.py | 3 | ||||
-rw-r--r-- | Lib/test/test_embed.py | 2 | ||||
-rw-r--r-- | Lib/test/test_gc.py | 6 | ||||
-rw-r--r-- | Lib/test/test_io.py | 2 | ||||
-rw-r--r-- | Lib/test/test_logging.py | 1 | ||||
-rw-r--r-- | Lib/test/test_module.py | 4 | ||||
-rw-r--r-- | Lib/test/test_support.py | 1 | ||||
-rw-r--r-- | Lib/test/test_sys.py | 4 | ||||
-rw-r--r-- | Lib/test/test_threading.py | 5 | ||||
-rw-r--r-- | Lib/test/test_traceback.py | 1 | ||||
-rw-r--r-- | Lib/test/test_warnings/__init__.py | 1 | ||||
-rw-r--r-- | Lib/test/test_weakref.py | 1 |
13 files changed, 4 insertions, 29 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 26a1e69..c8db387 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -325,7 +325,7 @@ def _args_from_interpreter_flags(): if dev_mode: args.extend(('-X', 'dev')) for opt in ('faulthandler', 'tracemalloc', 'importtime', - 'showalloccount', 'showrefcount', 'utf8'): + 'showrefcount', 'utf8'): if opt in xoptions: value = xoptions[opt] if value is True: diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index 215bab8..259c706 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -2512,9 +2512,6 @@ def swap_item(obj, item, new_val): if item in obj: del obj[item] -requires_type_collecting = unittest.skipIf(hasattr(sys, 'getcounts'), - 'types are immortal if COUNT_ALLOCS is defined') - def args_from_interpreter_flags(): """Return a list of command-line arguments reproducing the current settings in sys.flags and sys.warnoptions.""" diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py index 73ef962..87842b9 100644 --- a/Lib/test/test_embed.py +++ b/Lib/test/test_embed.py @@ -356,7 +356,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'tracemalloc': 0, 'import_time': 0, 'show_ref_count': 0, - 'show_alloc_count': 0, 'dump_refs': 0, 'malloc_stats': 0, @@ -729,7 +728,6 @@ class InitConfigTests(EmbeddingTestsMixin, unittest.TestCase): 'tracemalloc': 2, 'import_time': 1, 'show_ref_count': 1, - 'show_alloc_count': 1, 'malloc_stats': 1, 'stdio_encoding': 'iso8859-1', diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py index 18f8d10..acb6391 100644 --- a/Lib/test/test_gc.py +++ b/Lib/test/test_gc.py @@ -2,7 +2,7 @@ import unittest import unittest.mock from test.support import (verbose, refcount_test, run_unittest, cpython_only, start_threads, - temp_dir, requires_type_collecting, TESTFN, unlink, + temp_dir, TESTFN, unlink, import_module) from test.support.script_helper import assert_python_ok, make_script @@ -131,7 +131,6 @@ class GCTests(unittest.TestCase): del a self.assertNotEqual(gc.collect(), 0) - @requires_type_collecting def test_newinstance(self): class A(object): pass @@ -709,7 +708,6 @@ class GCTests(unittest.TestCase): stderr = run_command(code % "gc.DEBUG_SAVEALL") self.assertNotIn(b"uncollectable objects at shutdown", stderr) - @requires_type_collecting def test_gc_main_module_at_shutdown(self): # Create a reference cycle through the __main__ module and check # it gets collected at interpreter shutdown. @@ -723,7 +721,6 @@ class GCTests(unittest.TestCase): rc, out, err = assert_python_ok('-c', code) self.assertEqual(out.strip(), b'__del__ called') - @requires_type_collecting def test_gc_ordinary_module_at_shutdown(self): # Same as above, but with a non-__main__ module. with temp_dir() as script_dir: @@ -743,7 +740,6 @@ class GCTests(unittest.TestCase): rc, out, err = assert_python_ok('-c', code) self.assertEqual(out.strip(), b'__del__ called') - @requires_type_collecting def test_global_del_SystemExit(self): code = """if 1: class ClassWithDel: diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 501e931..8a123fa 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -3492,7 +3492,6 @@ class TextIOWrapperTest(unittest.TestCase): """.format(iomod=iomod, kwargs=kwargs) return assert_python_ok("-c", code) - @support.requires_type_collecting def test_create_at_shutdown_without_encoding(self): rc, out, err = self._check_create_at_shutdown() if err: @@ -3502,7 +3501,6 @@ class TextIOWrapperTest(unittest.TestCase): else: self.assertEqual("ok", out.decode().strip()) - @support.requires_type_collecting def test_create_at_shutdown_with_encoding(self): rc, out, err = self._check_create_at_shutdown(encoding='utf-8', errors='strict') diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py index c38fdae..e223522 100644 --- a/Lib/test/test_logging.py +++ b/Lib/test/test_logging.py @@ -4252,7 +4252,6 @@ class ModuleLevelMiscTest(BaseTest): h.close() logging.setLoggerClass(logging.Logger) - @support.requires_type_collecting def test_logging_at_shutdown(self): # Issue #20037 code = """if 1: diff --git a/Lib/test/test_module.py b/Lib/test/test_module.py index efe9a8e..1d44563 100644 --- a/Lib/test/test_module.py +++ b/Lib/test/test_module.py @@ -1,7 +1,7 @@ # Test the module type import unittest import weakref -from test.support import gc_collect, requires_type_collecting +from test.support import gc_collect from test.support.script_helper import assert_python_ok import sys @@ -101,7 +101,6 @@ class ModuleTests(unittest.TestCase): gc_collect() self.assertEqual(f().__dict__["bar"], 4) - @requires_type_collecting def test_clear_dict_in_ref_cycle(self): destroyed = [] m = ModuleType("foo") @@ -266,7 +265,6 @@ a = A(destroyed)""" self.assertEqual(r[-len(ends_with):], ends_with, '{!r} does not end with {!r}'.format(r, ends_with)) - @requires_type_collecting def test_module_finalization_at_shutdown(self): # Module globals and builtins should still be available during shutdown rc, out, err = assert_python_ok("-c", "from test import final_a") diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py index 2f347bd..175f7c8 100644 --- a/Lib/test/test_support.py +++ b/Lib/test/test_support.py @@ -493,7 +493,6 @@ class TestSupport(unittest.TestCase): ['-Wignore', '-X', 'dev'], ['-X', 'faulthandler'], ['-X', 'importtime'], - ['-X', 'showalloccount'], ['-X', 'showrefcount'], ['-X', 'tracemalloc'], ['-X', 'tracemalloc=3'], diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py index 947c935..58701a1 100644 --- a/Lib/test/test_sys.py +++ b/Lib/test/test_sys.py @@ -819,7 +819,6 @@ class SysModuleTest(unittest.TestCase): c = sys.getallocatedblocks() self.assertIn(c, range(b - 50, b + 50)) - @test.support.requires_type_collecting def test_is_finalizing(self): self.assertIs(sys.is_finalizing(), False) # Don't use the atexit module because _Py_Finalizing is only set @@ -841,7 +840,6 @@ class SysModuleTest(unittest.TestCase): rc, stdout, stderr = assert_python_ok('-c', code) self.assertEqual(stdout.rstrip(), b'True') - @test.support.requires_type_collecting def test_issue20602(self): # sys.flags and sys.float_info were wiped during shutdown. code = """if 1: @@ -1295,8 +1293,6 @@ class SizeofTest(unittest.TestCase): # type # static type: PyTypeObject fmt = 'P2nPI13Pl4Pn9Pn11PIPP' - if hasattr(sys, 'getcounts'): - fmt += '3n2P' s = vsize(fmt) check(int, s) # class diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py index 62f2d54..a9d31af 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -3,8 +3,7 @@ Tests for the threading module. """ import test.support -from test.support import (verbose, import_module, cpython_only, - requires_type_collecting) +from test.support import verbose, import_module, cpython_only from test.support.script_helper import assert_python_ok, assert_python_failure import random @@ -552,7 +551,6 @@ class ThreadTests(BaseTestCase): self.assertEqual(err, b"") self.assertEqual(data, "Thread-1\nTrue\nTrue\n") - @requires_type_collecting def test_main_thread_during_shutdown(self): # bpo-31516: current_thread() should still point to the main thread # at shutdown @@ -1113,7 +1111,6 @@ class ThreadingExceptionTests(BaseTestCase): self.assertIn("ZeroDivisionError", err) self.assertNotIn("Unhandled exception", err) - @requires_type_collecting def test_print_exception_stderr_is_none_1(self): script = r"""if True: import sys diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py index 7135d99..60e0b58 100644 --- a/Lib/test/test_traceback.py +++ b/Lib/test/test_traceback.py @@ -174,7 +174,6 @@ class TracebackCases(unittest.TestCase): # Issue #18960: coding spec should have no effect do_test("x=0\n# coding: GBK\n", "h\xe9 ho", 'utf-8', 5) - @support.requires_type_collecting def test_print_traceback_at_exit(self): # Issue #22599: Ensure that it is possible to use the traceback module # to display an exception at Python exit diff --git a/Lib/test/test_warnings/__init__.py b/Lib/test/test_warnings/__init__.py index c6fb097..268ecb0 100644 --- a/Lib/test/test_warnings/__init__.py +++ b/Lib/test/test_warnings/__init__.py @@ -1227,7 +1227,6 @@ class BootstrapTest(unittest.TestCase): class FinalizationTest(unittest.TestCase): - @support.requires_type_collecting def test_finalization(self): # Issue #19421: warnings.warn() should not crash # during Python finalization diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py index 228bc17..63c7255 100644 --- a/Lib/test/test_weakref.py +++ b/Lib/test/test_weakref.py @@ -649,7 +649,6 @@ class ReferencesTestCase(TestBase): del c1, c2, C, D gc.collect() - @support.requires_type_collecting def test_callback_in_cycle_resurrection(self): import gc |