From 19aade22cbfa57dc500f5fa82229b4b9ed0b4c30 Mon Sep 17 00:00:00 2001 From: Robert Kuska Date: Dec 14 2015 14:57:16 +0000 Subject: [cleanup] Remove COUNT_ALLOCS patches, see rhbz#1291325 --- diff --git a/00113-more-configuration-flags.patch b/00113-more-configuration-flags.patch deleted file mode 100644 index 1067af1..0000000 --- a/00113-more-configuration-flags.patch +++ /dev/null @@ -1,50 +0,0 @@ -diff -up Python-3.3.0b1/configure.ac.more-configuration-flags Python-3.3.0b1/configure.ac ---- Python-3.3.0b1/configure.ac.more-configuration-flags 2012-07-20 13:25:33.232864839 -0400 -+++ Python-3.3.0b1/configure.ac 2012-07-20 13:25:33.314863815 -0400 -@@ -2585,6 +2585,30 @@ else AC_MSG_RESULT(no) - fi], - [AC_MSG_RESULT(no)]) - -+AC_MSG_CHECKING(for --with-count-allocs) -+AC_ARG_WITH(count-allocs, -+[ --with(out)count-allocs enable/disable per-type instance accounting], [ -+if test "$withval" != no -+then -+ AC_DEFINE(COUNT_ALLOCS, 1, -+ [Define to keep records of the number of instances of each type]) -+ AC_MSG_RESULT(yes) -+else AC_MSG_RESULT(no) -+fi], -+[AC_MSG_RESULT(no)]) -+ -+AC_MSG_CHECKING(for --with-call-profile) -+AC_ARG_WITH(call-profile, -+[ --with(out)-call-profile enable/disable statistics on function call invocation], [ -+if test "$withval" != no -+then -+ AC_DEFINE(CALL_PROFILE, 1, -+ [Define to keep records on function call invocation]) -+ AC_MSG_RESULT(yes) -+else AC_MSG_RESULT(no) -+fi], -+[AC_MSG_RESULT(no)]) -+ - # Check for Python-specific malloc support - AC_MSG_CHECKING(for --with-pymalloc) - AC_ARG_WITH(pymalloc, -diff -up Python-3.3.0b1/pyconfig.h.in.more-configuration-flags Python-3.3.0b1/pyconfig.h.in ---- Python-3.3.0b1/pyconfig.h.in.more-configuration-flags 2012-07-20 13:25:33.000000000 -0400 -+++ Python-3.3.0b1/pyconfig.h.in 2012-07-20 13:26:02.826494869 -0400 -@@ -12,6 +12,12 @@ - support for AIX C++ shared extension modules. */ - #undef AIX_GENUINE_CPLUSPLUS - -+/* Define to keep records on function call invocation */ -+#undef CALL_PROFILE -+ -+/* Define to keep records of the number of instances of each type */ -+#undef COUNT_ALLOCS -+ - /* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM - mixed-endian order (byte order 45670123) */ - #undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 diff --git a/00125-less-verbose-COUNT_ALLOCS.patch b/00125-less-verbose-COUNT_ALLOCS.patch deleted file mode 100644 index fea9a4e..0000000 --- a/00125-less-verbose-COUNT_ALLOCS.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up Python-3.5.0b3/Python/pylifecycle.c.ms Python-3.5.0b3/Python/pylifecycle.c ---- Python-3.5.0b3/Python/pylifecycle.c.ms 2015-07-08 10:12:40.470623896 +0200 -+++ Python-3.5.0b3/Python/pylifecycle.c 2015-07-08 10:13:50.141169162 +0200 -@@ -612,7 +612,16 @@ Py_Finalize(void) - - /* Debugging stuff */ - #ifdef COUNT_ALLOCS -- dump_counts(stdout); -+ /* This is a downstream Fedora modification. -+ The upstream default with COUNT_ALLOCS is to always dump the counts to -+ stdout on exit. For our debug builds its useful to have the info from -+ COUNT_ALLOCS available, but the stdout info here gets in the way, so -+ we make it optional, wrapping it in an environment variable (modelled -+ on the other PYTHONDUMP* env variables): -+ */ -+ if (Py_GETENV("PYTHONDUMPCOUNTS")) -+ dump_counts(stdout); -+ - #endif - /* dump hash stats */ - _PyHash_Fini(); diff --git a/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch b/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch deleted file mode 100644 index 5fa9bd4..0000000 --- a/00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -up Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys Python-3.3.0b2/Lib/test/test_sys.py ---- Python-3.3.0b2/Lib/test/test_sys.py.fix-COUNT_ALLOCS-failure-in-test_sys 2012-08-11 02:54:16.000000000 -0400 -+++ Python-3.3.0b2/Lib/test/test_sys.py 2012-08-13 14:50:15.253720597 -0400 -@@ -835,12 +835,17 @@ class SizeofTest(unittest.TestCase): - # type - # static type: PyTypeObject - s = vsize('P2n15Pl4Pn9Pn11PIP') -+ # COUNT_ALLOCS adds a further 3 Py_ssize_t and 2 pointers: -+ if hasattr(sys, 'getcounts'): -+ s += struct.calcsize('3P2P') - check(int, s) - # (PyTypeObject + PyAsyncMethods + PyNumberMethods + PyMappingMethods + - # PySequenceMethods + PyBufferProcs + 4P) - s = vsize('P2n17Pl4Pn9Pn11PIP') + struct.calcsize('34P 3P 3P 10P 2P 4P') - # Separate block for PyDictKeysObject with 4 entries - s += struct.calcsize("2nPn") + 4*struct.calcsize("n2P") -+ if hasattr(sys, 'getcounts'): -+ s += struct.calcsize('3P2P') - # class - class newstyleclass(object): pass - check(newstyleclass, s) diff --git a/00135-fix-test-within-test_weakref-in-debug-build.patch b/00135-fix-test-within-test_weakref-in-debug-build.patch deleted file mode 100644 index 6ed7801..0000000 --- a/00135-fix-test-within-test_weakref-in-debug-build.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff -up Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix Python-3.2b2/Lib/test/test_weakref.py ---- Python-3.2b2/Lib/test/test_weakref.py.test-weakref-COUNT_ALLOCS_fix 2010-12-28 20:33:46.963364990 -0500 -+++ Python-3.2b2/Lib/test/test_weakref.py 2010-12-28 20:35:44.115935248 -0500 -@@ -583,9 +583,10 @@ class ReferencesTestCase(TestBase): - # been cleared without their callbacks executing. OTOH, the weakref - # to C is bound to a function local (wr), and wasn't trash, so that - # callback should have been invoked when C went away. -- self.assertEqual(alist, ["C went away"]) -- # The remaining weakref should be dead now (its callback ran). -- self.assertEqual(wr(), None) -+ if not hasattr(sys, 'getcounts'): -+ self.assertEqual(alist, ["C went away"]) -+ # The remaining weakref should be dead now (its callback ran). -+ self.assertEqual(wr(), None) - - del alist[:] - gc.collect() diff --git a/00141-fix-tests_with_COUNT_ALLOCS.patch b/00141-fix-tests_with_COUNT_ALLOCS.patch deleted file mode 100644 index 96a2fbf..0000000 --- a/00141-fix-tests_with_COUNT_ALLOCS.patch +++ /dev/null @@ -1,113 +0,0 @@ -diff -r e245b0d7209b Lib/test/test_gc.py ---- a/Lib/test/test_gc.py Sun Oct 20 02:01:29 2013 -0700 -+++ b/Lib/test/test_gc.py Fri Nov 08 13:25:29 2013 +0100 -@@ -127,10 +127,16 @@ - del a - self.assertNotEqual(gc.collect(), 0) - del B, C -- self.assertNotEqual(gc.collect(), 0) -+ if hasattr(sys, 'getcounts'): -+ self.assertEqual(gc.collect(), 0) -+ else: -+ self.assertNotEqual(gc.collect(), 0) - A.a = A() - del A -- self.assertNotEqual(gc.collect(), 0) -+ if hasattr(sys, 'getcounts'): -+ self.assertEqual(gc.collect(), 0) -+ else: -+ self.assertNotEqual(gc.collect(), 0) - self.assertEqual(gc.collect(), 0) - - def test_method(self): -@@ -618,6 +624,8 @@ - stderr = run_command(code % "gc.DEBUG_SAVEALL") - self.assertNotIn(b"uncollectable objects at shutdown", stderr) - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_gc_main_module_at_shutdown(self): - # Create a reference cycle through the __main__ module and check - # it gets collected at interpreter shutdown. -@@ -632,6 +640,8 @@ - rc, out, err = assert_python_ok('-c', code) - self.assertEqual(out.strip(), b'__del__ called') - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_gc_ordinary_module_at_shutdown(self): - # Same as above, but with a non-__main__ module. - with temp_dir() as script_dir: -diff -r e245b0d7209b Lib/test/test_module.py ---- a/Lib/test/test_module.py Sun Oct 20 02:01:29 2013 -0700 -+++ b/Lib/test/test_module.py Fri Nov 08 13:25:29 2013 +0100 -@@ -81,6 +81,8 @@ - gc_collect() - self.assertEqual(f().__dict__["bar"], 4) - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_clear_dict_in_ref_cycle(self): - destroyed = [] - m = ModuleType("foo") -@@ -96,6 +98,8 @@ - gc_collect() - self.assertEqual(destroyed, [1]) - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_weakref(self): - m = ModuleType("foo") - wr = weakref.ref(m) -@@ -190,6 +194,8 @@ - self.assertEqual(r[-len(ends_with):], ends_with, - '{!r} does not end with {!r}'.format(r, ends_with)) - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'skipping since COUNT_ALLOCS was used, see issue19527') - 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") ---- a/Lib/test/test_io.py.orig 2014-01-09 14:43:44.000000000 +0100 -+++ b/Lib/test/test_io.py 2014-01-09 14:50:30.839597351 +0100 -@@ -2611,6 +2611,8 @@ - """.format(iomod=iomod, kwargs=kwargs) - return assert_python_ok("-c", code) - -+ @unittest.skipIf(hasattr(sys, 'getrefcount'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_create_at_shutdown_without_encoding(self): - rc, out, err = self._check_create_at_shutdown() - if err: -@@ -2621,6 +2623,8 @@ - else: - self.assertEqual("ok", out.decode().strip()) - -+ @unittest.skipIf(hasattr(sys, 'getrefcount'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_create_at_shutdown_with_encoding(self): - rc, out, err = self._check_create_at_shutdown(encoding='utf-8', - errors='strict') ---- a/Lib/test/test_logging.py.orig 2014-01-09 14:53:07.016388198 +0100 -+++ b/Lib/test/test_logging.py 2014-01-09 14:54:25.654282973 +0100 -@@ -3398,6 +3398,8 @@ - logging.setLoggerClass(logging.Logger) - self.assertEqual(logging.getLoggerClass(), logging.Logger) - -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_logging_at_shutdown(self): - # Issue #20037 - code = """if 1: - ---- a/Lib/test/test_warnings/__init__.py.orig 2014-01-09 15:10:12.454997100 +0100 -+++ b/Lib/test/test_warnings/__init__.py 2014-01-09 15:11:14.028913478 +0100 -@@ -780,6 +780,8 @@ - assert_python_ok('-c', 'pass', '-W', 'always', PYTHONPATH=cwd) - - class FinalizationTest(unittest.TestCase): -+ @unittest.skipIf(hasattr(sys, 'getcounts'), -+ 'types are immortal if COUNT_ALLOCS is used') - def test_finalization(self): - # Issue #19421: warnings.warn() should not crash - # during Python finalization diff --git a/python3.spec b/python3.spec index 91b2633..437a516 100644 --- a/python3.spec +++ b/python3.spec @@ -267,22 +267,6 @@ Patch104: 00104-lib64-fix-for-test_install.patch # Downstream only: not appropriate for upstream Patch111: 00111-no-static-lib.patch -# 00113 # -# Add configure-time support for the COUNT_ALLOCS and CALL_PROFILE options -# described at http://svn.python.org/projects/python/trunk/Misc/SpecialBuilds.txt -# so that if they are enabled, they will be in that build's pyconfig.h, so that -# extension modules will reliably use them -# Not yet sent upstream -Patch113: 00113-more-configuration-flags.patch - -# 00125 # -# COUNT_ALLOCS is useful for debugging, but the upstream behaviour of always -# emitting debug info to stdout on exit is too verbose and makes it harder to -# use the debug build. Add a "PYTHONDUMPCOUNTS" environment variable which -# must be set to enable the output on exit -# Not yet sent upstream -Patch125: 00125-less-verbose-COUNT_ALLOCS.patch - # 00131 # # The four tests in test_io built on top of check_interrupted_write_retry # fail when built in Koji, for ppc and ppc64; for some reason, the SIGALRM @@ -308,18 +292,6 @@ Patch132: 00132-add-rpmbuild-hooks-to-unittest.patch # 00133-skip-test_dl.patch is not relevant for python3: the "dl" module no # longer exists -# 00134 # -# Fix a failure in test_sys.py when configured with COUNT_ALLOCS enabled -# Not yet sent upstream -Patch134: 00134-fix-COUNT_ALLOCS-failure-in-test_sys.patch - -# 00135 # -# test_weakref's test_callback_in_cycle_resurrection doesn't work with -# COUNT_ALLOCS, as the metrics keep "C" alive. Work around this for our -# debug build: -# Not yet sent upstream -Patch135: 00135-fix-test-within-test_weakref-in-debug-build.patch - # 00137 # # Some tests within distutils fail when run in an rpmbuild: Patch137: 00137-skip-distutils-tests-that-fail-in-rpmbuild.patch @@ -332,13 +304,6 @@ Patch139: 00139-skip-test_float-known-failure-on-arm.patch # ideally short lived patch disabling a test thats fragile on different arches Patch140: python3-arm-skip-failing-fragile-test.patch -# 00141 # -# Fix tests for case when tests for case when configured with -# COUNT_ALLOCS (debug build): http://bugs.python.org/issue19527 -# Applies to: test_gc, test_module, test_io, test_logging, test_warnings, -# test_threading -Patch141: 00141-fix-tests_with_COUNT_ALLOCS.patch - # 00143 # # Fix the --with-tsc option on ppc64, and rework it on 32-bit ppc to avoid # aliasing violations (rhbz#698726) @@ -740,26 +705,16 @@ sed -r -i s/'_PIP_VERSION = "[0-9.]+"'/'_PIP_VERSION = "%{pip_version}"'/ Lib/en %patch102 -p1 %patch104 -p1 %endif - - %patch111 -p1 -%patch113 -p1 - -%patch125 -p1 -b .less-verbose-COUNT_ALLOCS - %ifarch ppc %{power64} %patch131 -p1 %endif - %patch132 -p1 -%patch134 -p1 -%patch135 -p1 %patch137 -p1 %ifarch %{arm} %patch139 -p1 %patch140 -p1 %endif -%patch141 -p1 %patch143 -p1 -b .tsc-on-ppc %patch146 -p1 %ifarch ppc %{power64}