#5 Update to 2.7.14
Merged 6 years ago by cstratak. Opened 6 years ago by ishcherb.
rpms/ ishcherb/python2 master  into  master

Add patches for failing tests
Iryna Shcherbina • 6 years ago  
Update to 2.7.14
Iryna Shcherbina • 6 years ago  
file modified
+3 -3
@@ -87,9 +87,9 @@ 

  @@ -1251,7 +1264,7 @@ Python/thread.o: @THREADHEADERS@

   .PHONY: frameworkinstall frameworkinstallframework frameworkinstallstructure

   .PHONY: frameworkinstallmaclib frameworkinstallapps frameworkinstallunixtools

-  .PHONY: frameworkaltinstallunixtools recheck autoconf clean clobber distclean

- -.PHONY: smelly funny patchcheck touch altmaninstall commoninstall

- +.PHONY: smelly funny patchcheck touch altmaninstall commoninstall buildinclude

+  .PHONY: frameworkaltinstallunixtools recheck clean clobber distclean

+ -.PHONY: smelly funny patchcheck altmaninstall commoninstall

+ +.PHONY: smelly funny patchcheck altmaninstall commoninstall buildinclude

   .PHONY: gdbhooks

   

   # IF YOU PUT ANYTHING HERE IT WILL GO AWAY

@@ -118,8 +118,8 @@ 

  +PYTHON=		python$(DEBUG_SUFFIX)$(EXE)

  +BUILDPYTHON=	python$(DEBUG_SUFFIX)$(BUILDEXE)

   

+  PYTHON_FOR_REGEN=@PYTHON_FOR_REGEN@

   PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@

-  _PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@

  @@ -547,7 +553,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o

   		_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \

   		$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
@@ -194,8 +194,8 @@ 

   # pkgconfig directory

   LIBPC=		$(LIBDIR)/pkgconfig

   

- -libainstall:	all python-config

- +libainstall:	all python$(DEBUG_SUFFIX)-config

+ -libainstall:	@DEF_MAKE_RULE@ python-config

+ +libainstall:	@DEF_MAKE_RULE@ python$(DEBUG_SUFFIX)-config

   	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \

   	do \

   		if test ! -d $(DESTDIR)$$i; then \

@@ -1,20 +0,0 @@ 

- diff -up Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS Python-2.7/Python/pythonrun.c

- --- Python-2.7/Python/pythonrun.c.less-verbose-COUNT_ALLOCS	2010-08-17 14:49:33.321913909 -0400

- +++ Python-2.7/Python/pythonrun.c	2010-08-17 14:54:48.750910403 -0400

- @@ -470,7 +470,15 @@ 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

-  

-      PRINT_TOTAL_REFS();

@@ -1,16 +0,0 @@ 

- diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py

- index 0dd4258..d9b3267 100644

- --- a/Lib/test/test_sys.py

- +++ b/Lib/test/test_sys.py

- @@ -769,6 +769,11 @@ class SizeofTest(unittest.TestCase):

-                    '10P'                 # PySequenceMethods

-                    '6P'                  # PyBufferProcs

-                    '2P')

- +

- +        # COUNT_ALLOCS adds further fields to the end of a PyTypeObject:

- +        if hasattr(sys, 'getcounts'):

- +            s += size('P')

- +

-          class newstyleclass(object):

-              pass

-          check(newstyleclass, s)

@@ -1,18 +0,0 @@ 

- diff -up Python-2.7.2/Lib/test/test_weakref.py.skip-test-within-test_weakref-in-debug-build Python-2.7.2/Lib/test/test_weakref.py

- --- Python-2.7.2/Lib/test/test_weakref.py.skip-test-within-test_weakref-in-debug-build	2011-09-08 17:55:09.675392260 -0400

- +++ Python-2.7.2/Lib/test/test_weakref.py	2011-09-08 17:59:08.857375903 -0400

- @@ -550,6 +550,14 @@ class ReferencesTestCase(TestBase):

-          del c1, c2, C, D

-          gc.collect()

-  

- +    # In a debug build, this fails with:

- +    #   AssertionError: Lists differ: [] != ['C went away']

- +    #   Second list contains 1 additional elements.

- +    #   First extra element 0:

- +    #   C went away

- +    #   - []

- +    #   + ['C went away']

- +    @unittest.skipIf(hasattr(sys, 'getobjects'), 'debug build')

-      def test_callback_in_cycle_resurrection(self):

-          import gc

-  

@@ -1,24 +0,0 @@ 

- diff -up Python-2.7.2/Lib/test/test_gc.py.fix-test_gc_with_COUNT_ALLOCS Python-2.7.2/Lib/test/test_gc.py

- --- Python-2.7.2/Lib/test/test_gc.py.fix-test_gc_with_COUNT_ALLOCS	2011-09-08 19:49:13.045924309 -0400

- +++ Python-2.7.2/Lib/test/test_gc.py	2011-09-08 19:50:07.035920617 -0400

- @@ -102,11 +102,17 @@ class GCTests(unittest.TestCase):

-          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)

- -        self.assertEqual(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):

-          # Tricky: self.__init__ is a bound method, it references the instance.

@@ -1,13 +1,13 @@ 

  --- Lib/test/test_gdb.py.old	2012-04-11 21:04:01.367073855 -0400

  +++ Lib/test/test_gdb.py	2012-04-12 08:52:58.320288761 -0400

- @@ -144,6 +153,10 @@

-              'Missing separate debuginfo for ',

-              'Try: zypper install -C ',

+ @@ -211,6 +211,10 @@

+              # ignore all warnings

+              'warning: ',

               )

  +        ignore_patterns += ('warning: Unable to open',

  +                            'Missing separate debuginfo for',

  +                            'Try: yum --disablerepo=',

  +                            'Undefined set print command')

           for line in errlines:

-              if not line.startswith(ignore_patterns):

-                  unexpected_errlines.append(line)

+              if not line:

+                  continue

file removed
-22
@@ -1,22 +0,0 @@ 

- diff --git a/Python/random.c b/Python/random.c

- index 2f83b5d..4cae217 100644

- --- a/Python/random.c

- +++ b/Python/random.c

- @@ -97,8 +97,15 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)

-  }

-  

-  /* Issue #25003: Don't use getentropy() on Solaris (available since

- - * Solaris 11.3), it is blocking whereas os.urandom() should not block. */

- -#elif defined(HAVE_GETENTROPY) && !defined(sun)

- +   Solaris 11.3), it is blocking whereas os.urandom() should not block.

- +

- +   Issue #29188: Don't use getentropy() on Linux since the glibc 2.24

- +   implements it with the getrandom() syscall which can fail with ENOSYS,

- +   and this error is not supported in py_getentropy() and getrandom() is called

- +   with flags=0 which blocks until system urandom is initialized, which is not

- +   the desired behaviour to seed the Python hash secret nor for os.urandom():

- +   see the PEP 524 which was only implemented in Python 3.6. */

- +#elif defined(HAVE_GETENTROPY) && !defined(sun) && !defined(linux)

-  #define PY_GETENTROPY 1

-  

-  /* Fill buffer with size pseudo-random bytes generated by getentropy().

@@ -1,63 +0,0 @@ 

- diff --git a/Makefile.pre.in b/Makefile.pre.in

- index 9e4be0a..a58b59c 100644

- --- a/Makefile.pre.in

- +++ b/Makefile.pre.in

- @@ -863,12 +863,12 @@ $(LIBRARY_OBJS) $(MODOBJS) Modules/python.o: $(PYTHON_HEADERS)

-  TESTOPTS=	-l $(EXTRATESTOPTS)

-  TESTPROG=	$(srcdir)/Lib/test/regrtest.py

-  TESTPYTHON=	$(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt $(TESTPYTHONOPTS)

- -test:		all platform

- +test:		@DEF_MAKE_RULE@ platform

-  		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

-  		-$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)

-  		$(TESTPYTHON) $(TESTPROG) $(TESTOPTS)

-  

- -testall:	all platform

- +testall:	@DEF_MAKE_RULE@ platform

-  		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

-  		$(TESTPYTHON) $(srcdir)/Lib/compileall.py

-  		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

- @@ -877,7 +877,7 @@ testall:	all platform

-  

-  #  Run the unitests for both architectures in a Universal build on OSX

-  #  Must be run on an Intel box.

- -testuniversal:	all platform

- +testuniversal:	@DEF_MAKE_RULE@ platform

-  		if [ `arch` != 'i386' ];then \

-  			echo "This can only be used on OSX/i386" ;\

-  			exit 1 ;\

- @@ -900,14 +900,14 @@ QUICKTESTOPTS=	$(TESTOPTS) -x test_subprocess test_io test_lib2to3 \

-  		test_multibytecodec test_urllib2_localnet test_itertools \

-  		test_multiprocessing test_mailbox test_socket test_poll \

-  		test_select test_zipfile

- -quicktest:	all platform

- +quicktest:	@DEF_MAKE_RULE@ platform

-  		-find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f

-  		-$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)

-  		$(TESTPYTHON) $(TESTPROG) $(QUICKTESTOPTS)

-  

-  MEMTESTOPTS=    $(QUICKTESTOPTS) -x test_dl test___all__ test_fork1 \

-  		test_longexp

- -memtest:	all platform

- +memtest:	@DEF_MAKE_RULE@ platform

-  		-rm -f $(srcdir)/Lib/test/*.py[co]

-  		-$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)

-  		$(TESTPYTHON) $(TESTPROG) $(MEMTESTOPTS)

- @@ -1198,7 +1198,7 @@ LIBPL=		$(LIBP)/config$(DEBUG_SUFFIX)

-  # pkgconfig directory

-  LIBPC=		$(LIBDIR)/pkgconfig

-  

- -libainstall:	all python$(DEBUG_SUFFIX)-config

- +libainstall:	@DEF_MAKE_RULE@ python$(DEBUG_SUFFIX)-config

-  	@for i in $(LIBDIR) $(LIBP) $(LIBPL) $(LIBPC); \

-  	do \

-  		if test ! -d $(DESTDIR)$$i; then \

- @@ -1425,7 +1425,7 @@ distclean: clobber

-  				     -exec rm -f {} ';'

-  

-  # Check for smelly exported symbols (not starting with Py/_Py)

- -smelly: all

- +smelly: @DEF_MAKE_RULE@

-  	nm -p $(LIBRARY) | \

-  		sed -n "/ [TDB] /s/.* //p" | grep -v "^_*Py" | sort -u; \

-  

@@ -1,16 +0,0 @@ 

- diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py

- index d203cdd..c128dae 100644

- --- a/Lib/test/test_ssl.py

- +++ b/Lib/test/test_ssl.py

- @@ -3256,8 +3256,9 @@ if _have_threads:

-                  except ssl.SSLError as e:

-                      stats = e

-  

- -                if expected is None and IS_OPENSSL_1_1:

- -                    # OpenSSL 1.1.0 raises handshake error

- +                if (expected is None and IS_OPENSSL_1_1

- +                        and ssl.OPENSSL_VERSION_INFO < (1, 1, 0, 6)):

- +                    # OpenSSL 1.1.0 to 1.1.0e raises handshake error

-                      self.assertIsInstance(stats, ssl.SSLError)

-                  else:

-                      msg = "failed trying %s (s) and %s (c).\n" \

@@ -0,0 +1,88 @@ 

+ From ab35adc682ec51800aa19a77de9947c6aaa50f41 Mon Sep 17 00:00:00 2001

+ From: Victor Stinner <victor.stinner@gmail.com>

+ Date: Fri, 6 Oct 2017 22:28:59 +0200

+ Subject: [PATCH] bpo-31719: Fix test_regrtest.test_crashed() on s390x

+ 

+ Add a new _testcapi._read_null() function to crash Python in a

+ reliable way on s390x.

+ 

+ On s390x, ctypes.string_at(0) returns an empty string rather than

+ crashing.

+ ---

+  Lib/test/support/__init__.py                            |  4 ++--

+  Lib/test/test_regrtest.py                               |  2 ++

+  .../next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst |  3 +++

+  Modules/_testcapimodule.c                               | 17 +++++++++++++++++

+  4 files changed, 24 insertions(+), 2 deletions(-)

+  create mode 100644 Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst

+ 

+ diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py

+ index ef474e00b68..25df3ed0c41 100644

+ --- a/Lib/test/support/__init__.py

+ +++ b/Lib/test/support/__init__.py

+ @@ -1960,6 +1960,6 @@ def _crash_python():

+      Use SuppressCrashReport() to prevent a crash report from popping up.

+      """

+  

+ -    import ctypes

+ +    import _testcapi

+      with SuppressCrashReport():

+ -        ctypes.string_at(0)

+ +        _testcapi._read_null()

+ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py

+ index 264c74d22ba..aae274384c7 100644

+ --- a/Lib/test/test_regrtest.py

+ +++ b/Lib/test/test_regrtest.py

+ @@ -543,6 +543,8 @@ def test_method2(self):

+                                  testname)

+          self.assertEqual(output.splitlines(), all_methods)

+  

+ +    @unittest.skipIf(sys.platform.startswith('aix'),

+ +                     "support._crash_python() doesn't work on AIX")

+      def test_crashed(self):

+          # Any code which causes a crash

+          code = 'import test.support; test.support._crash_python()'

+ diff --git a/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst b/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst

+ new file mode 100644

+ index 00000000000..a06c5267251

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Tests/2017-10-06-22-37-38.bpo-31719.gHyrV3.rst

+ @@ -0,0 +1,3 @@

+ +Fix test_regrtest.test_crashed() on s390x. Add a new _testcapi._read_null()

+ +function to crash Python in a reliable way on s390x. On s390x,

+ +ctypes.string_at(0) returns an empty string rather than crashing.

+ diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c

+ index 7691b5188ff..5902de07823 100644

+ --- a/Modules/_testcapimodule.c

+ +++ b/Modules/_testcapimodule.c

+ @@ -2566,6 +2566,22 @@ py_w_stopcode(PyObject *self, PyObject *args)

+  #endif

+  

+  

+ +/* Read memory from NULL (address 0) to raise a SIGSEGV or SIGBUS signal

+ +   depending on the platform. This function is used by

+ +   test.support._crash_python() to "crash" Python. */

+ +static PyObject *

+ +read_null(PyObject *self, PyObject *args)

+ +{

+ +    volatile int *x;

+ +    volatile int y;

+ +

+ +    x = NULL;

+ +    y = *x;

+ +    return PyLong_FromLong(y);

+ +

+ +}

+ +

+ +

+  static PyMethodDef TestMethods[] = {

+      {"raise_exception",         raise_exception,                 METH_VARARGS},

+      {"set_errno",               set_errno,                       METH_VARARGS},

+ @@ -2685,6 +2701,7 @@ static PyMethodDef TestMethods[] = {

+  #ifdef W_STOPCODE

+      {"W_STOPCODE", py_w_stopcode, METH_VARARGS},

+  #endif

+ +    {"_read_null", (PyCFunction)read_null, METH_NOARGS},

+      {NULL, NULL} /* sentinel */

+  };

+  

@@ -0,0 +1,172 @@ 

+ From 7b4ba62e388474e811268322b47f80d464933541 Mon Sep 17 00:00:00 2001

+ From: Victor Stinner <victor.stinner@gmail.com>

+ Date: Tue, 17 Oct 2017 02:25:23 -0700

+ Subject: [PATCH] [2.7] bpo-31692: Add PYTHONSHOWALLOCCOUNT env var (GH-3927)

+ 

+ bpo-31692, bpo-19527:

+ 

+ * Add a new PYTHONSHOWALLOCCOUNT environment variable, similar to

+   the Python 3 "-X showalloccount" option

+ * When Python is compiled with COUNT_ALLOCS, the new

+   PYTHONSHOWALLOCCOUNT environment variable now has to be set to dump

+   allocation counts into stderr on shutdown. Moreover, allocations

+   statistics are now dumped into stderr rather than stdout.

+ * Add @test.support.requires_type_collecting decorator: skip test if

+   COUNT_ALLOCS is defined

+ * Fix tests for COUNT_ALLOCS: decorate some methods with

+   @requires_type_collecting

+ * test_sys.test_objecttypes(): update object type when COUNT_ALLOCS

+   is defined

+ ---

+  Doc/c-api/typeobj.rst                                              | 2 +-

+  Doc/using/cmdline.rst                                              | 7 +++++++

+  Lib/test/support/__init__.py                                       | 3 +++

+  Lib/test/test_abc.py                                               | 1 +

+  Lib/test/test_gc.py                                                | 4 +++-

+  Lib/test/test_regrtest.py                                          | 1 +

+  Lib/test/test_sys.py                                               | 5 ++++-

+  Lib/test/test_weakref.py                                           | 1 +

+  .../Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst     | 4 ++++

+  Python/pythonrun.c                                                 | 4 +++-

+  10 files changed, 28 insertions(+), 4 deletions(-)

+  create mode 100644 Misc/NEWS.d/next/Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst

+ 

+ diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst

+ index 18edcdd7e5a..f0ccf2ea5fe 100644

+ --- a/Doc/c-api/typeobj.rst

+ +++ b/Doc/c-api/typeobj.rst

+ @@ -1101,7 +1101,7 @@ The next fields, up to and including :c:member:`~PyTypeObject.tp_weaklist`, only

+  The remaining fields are only defined if the feature test macro

+  :const:`COUNT_ALLOCS` is defined, and are for internal use only. They are

+  documented here for completeness.  None of these fields are inherited by

+ -subtypes.

+ +subtypes. See the :envvar:`PYTHONSHOWALLOCCOUNT` environment variable.

+  

+  

+  .. c:member:: Py_ssize_t PyTypeObject.tp_allocs

+ diff --git a/Doc/using/cmdline.rst b/Doc/using/cmdline.rst

+ index f00f7f6026a..55bc12893d6 100644

+ --- a/Doc/using/cmdline.rst

+ +++ b/Doc/using/cmdline.rst

+ @@ -663,3 +663,10 @@ if Python was configured with the ``--with-pydebug`` build option.

+  

+     If set, Python will print memory allocation statistics every time a new

+     object arena is created, and on shutdown.

+ +

+ +.. envvar:: PYTHONSHOWALLOCCOUNT

+ +

+ +   If set and Python was compiled with ``COUNT_ALLOCS`` defined, Python will

+ +   dump allocations counts into stderr on shutdown.

+ +

+ +   .. versionadded:: 2.7.15

+ diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py

+ index 25df3ed0c41..d14a6620b5d 100644

+ --- a/Lib/test/support/__init__.py

+ +++ b/Lib/test/support/__init__.py

+ @@ -1795,6 +1795,9 @@ def py3k_bytes(b):

+          except TypeError:

+              return bytes(b)

+  

+ +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."""

+ diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py

+ index 6a8c3a13274..dbba37cdb6f 100644

+ --- a/Lib/test/test_abc.py

+ +++ b/Lib/test/test_abc.py

+ @@ -208,6 +208,7 @@ class C(A, B):

+          C()

+          self.assertEqual(B.counter, 1)

+  

+ +    @test_support.requires_type_collecting

+      def test_cache_leak(self):

+          # See issue #2521.

+          class A(object):

+ diff --git a/Lib/test/test_gc.py b/Lib/test/test_gc.py

+ index ed01c9802fc..7e47b2d3a27 100644

+ --- a/Lib/test/test_gc.py

+ +++ b/Lib/test/test_gc.py

+ @@ -1,5 +1,6 @@

+  import unittest

+ -from test.test_support import verbose, run_unittest, start_threads, import_module

+ +from test.support import (verbose, run_unittest, start_threads, import_module,

+ +                          requires_type_collecting)

+  import sys

+  import sysconfig

+  import time

+ @@ -90,6 +91,7 @@ class A:

+          del a

+          self.assertNotEqual(gc.collect(), 0)

+  

+ +    @requires_type_collecting

+      def test_newinstance(self):

+          class A(object):

+              pass

+ diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py

+ index aae274384c7..988a72c1099 100644

+ --- a/Lib/test/test_regrtest.py

+ +++ b/Lib/test/test_regrtest.py

+ @@ -493,6 +493,7 @@ def check_leak(self, code, what):

+              self.assertIn(line2, reflog)

+  

+      @unittest.skipUnless(Py_DEBUG, 'need a debug build')

+ +    @support.requires_type_collecting

+      def test_huntrleaks(self):

+          # test --huntrleaks

+          code = textwrap.dedent("""

+ diff --git a/Lib/test/test_sys.py b/Lib/test/test_sys.py

+ index 5baaa352c0b..9342716272a 100644

+ --- a/Lib/test/test_sys.py

+ +++ b/Lib/test/test_sys.py

+ @@ -748,7 +748,10 @@ def delx(self): del self.__x

+          # tupleiterator

+          check(iter(()), size('lP'))

+          # type

+ -        s = vsize('P2P15Pl4PP9PP11PI'   # PyTypeObject

+ +        fmt = 'P2P15Pl4PP9PP11PI'

+ +        if hasattr(sys, 'getcounts'):

+ +            fmt += '3P2P'

+ +        s = vsize(fmt +                 # PyTypeObject

+                    '39P'                 # PyNumberMethods

+                    '3P'                  # PyMappingMethods

+                    '10P'                 # PySequenceMethods

+ diff --git a/Lib/test/test_weakref.py b/Lib/test/test_weakref.py

+ index 415d5ebbd72..418481dadd8 100644

+ --- a/Lib/test/test_weakref.py

+ +++ b/Lib/test/test_weakref.py

+ @@ -601,6 +601,7 @@ class D:

+          del c1, c2, C, D

+          gc.collect()

+  

+ +    @test_support.requires_type_collecting

+      def test_callback_in_cycle_resurrection(self):

+          import gc

+  

+ diff --git a/Misc/NEWS.d/next/Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst b/Misc/NEWS.d/next/Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst

+ new file mode 100644

+ index 00000000000..f32548c67bd

+ --- /dev/null

+ +++ b/Misc/NEWS.d/next/Core and Builtins/2017-10-09-11-03-13.bpo-31692.5-bpdk.rst 

+ @@ -0,0 +1,4 @@

+ +Add a new PYTHONSHOWALLOCCOUNT environment variable. When Python is compiled

+ +with COUNT_ALLOCS, PYTHONSHOWALLOCCOUNT now has to be set to dump allocation

+ +counts into stderr on shutdown. Moreover, allocations statistics are now dumped

+ +into stderr rather than stdout.

+ diff --git a/Python/pythonrun.c b/Python/pythonrun.c

+ index 677f6e48111..44fe13d2f7d 100644

+ --- a/Python/pythonrun.c

+ +++ b/Python/pythonrun.c

+ @@ -488,7 +488,9 @@ Py_Finalize(void)

+  

+      /* Debugging stuff */

+  #ifdef COUNT_ALLOCS

+ -    dump_counts(stdout);

+ +    if (Py_GETENV("PYTHONSHOWALLOCCOUNT")) {

+ +        dump_counts(stderr);

+ +    }

+  #endif

+  

+      PRINT_TOTAL_REFS();

file modified
+17 -50
@@ -111,8 +111,8 @@ 

  Summary: An interpreted, interactive, object-oriented programming language

  Name: %{python}

  # Remember to also rebase python-docs when changing this:

- Version: 2.7.13

- Release: 18%{?dist}

+ Version: 2.7.14

+ Release: 1%{?dist}

  License: Python

  Group: Development/Languages

  Requires: %{python}-libs%{?_isa} = %{version}-%{release}
@@ -473,14 +473,6 @@ 

  # This patch adds the build Modules directory to build path.

  Patch121: 00121-add-Modules-to-build-path.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

- 

  # 2.7.1 (in r84230) added a test to test_abc which fails if python is

  # configured with COUNT_ALLOCS, which is the case for our debug build

  # (the COUNT_ALLOCS instrumentation keeps "C" alive).
@@ -529,16 +521,6 @@ 

  # "dl" is deprecated, and test_dl doesn't work on 64-bit builds:

  Patch133: 00133-skip-test_dl.patch

  

- # 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 #

- # Skip "test_callback_in_cycle_resurrection" in a debug build, where it fails:

- # Not yet sent upstream

- Patch135: 00135-skip-test-within-test_weakref-in-debug-build.patch

- 

  # 00136 #

  # Some tests try to seek on sys.stdin, but don't work as expected when run

  # within Koji/mock; skip them within the rpm build:
@@ -563,11 +545,6 @@ 

  # which appears to be a libffi bug

  Patch140: 00140-skip-test_ctypes-known-failure-on-sparc.patch

  

- # 00141 #

- # Fix test_gc's test_newinstance case when configured with COUNT_ALLOCS:

- # Not yet sent upstream

- Patch141: 00141-fix-test_gc_with_COUNT_ALLOCS.patch

- 

  # 00142 #

  # Some pty tests fail when run in mock (rhbz#714627):

  Patch142: 00142-skip-failing-pty-tests-in-rpmbuild.patch
@@ -746,24 +723,16 @@ 

  # 00198 #

  Patch198: 00198-add-rewheel-module.patch

  

- # 00250 #

- # After  glibc-2.24.90, Python failed to start on EL7 kernel

- # rhbz#1410175: https://bugzilla.redhat.com/show_bug.cgi?id=1410175

- # http://bugs.python.org/issue29157

- # Fixed upstream: https://hg.python.org/cpython/rev/13a39142c047

- Patch250: 00250-getentropy.patch

- 

- # 00269 #

- # Fix python's recompilation with common build commands when using

- # profile guided optimizations.

- # Fixed upstream: http://bugs.python.org/issue29243

- Patch269: 00269-fix-multiple-compilations-issue-with-pgo-builds.patch

- 

- # 00270 #

- # Fix test_alpn_protocols from test_ssl as openssl > 1.1.0f

- # changed the behaviour of the ALPN hook.

- # Fixed upstream: http://bugs.python.org/issue30714

- Patch270: 00270-fix-ssl-alpn-hook-test.patch

+ # 00280 #

+ # The test `test_regrtest.test_crashed` fails on s390x architecture.

+ # https://bugs.python.org/issue31719

+ Patch280: 00280-Fix-test_regrtest-test_crashed-on-s390x.patch

+ 

+ # 00283 #

+ # Fix tests on debug build configured with COUNT_ALLOCS,

+ # and add a new environment variable PYTHONSHOWALLOCCOUNT:

+ # https://bugs.python.org/issue31692

+ Patch283: 00283-fix-tests_with_COUNT_ALLOCS.patch

  

  # (New patches go here ^^^)

  #
@@ -1024,7 +993,6 @@ 

  

  

  %patch121 -p1

- %patch125 -p1 -b .less-verbose-COUNT_ALLOCS

  %patch128 -p1

  

  %patch130 -p1
@@ -1035,8 +1003,6 @@ 

  

  %patch132 -p1

  %patch133 -p1

- %patch134 -p1

- %patch135 -p1

  %patch136 -p1 -b .stdin-test

  %patch137 -p1

  %patch138 -p1
@@ -1046,7 +1012,6 @@ 

  %ifarch %{sparc}

  %patch140 -p1

  %endif

- %patch141 -p1

  %patch142 -p1 -b .tty-fail

  %patch143 -p1 -b .tsc-on-ppc

  %if !%{with_gdbm}
@@ -1075,10 +1040,9 @@ 

  %if %{with rewheel}

  %patch198 -p1

  %endif

+ %patch283 -p1

+ %patch280 -p1

  

- %patch250 -p1

- %patch269 -p1

- %patch270 -p1

  

  %if 0%{?_module_build}

  %patch4000 -p1
@@ -1958,6 +1922,9 @@ 

  # ======================================================

  

  %changelog

+ * Mon Oct 09 2017 Iryna Shcherbina <ishcherb@redhat.com> - 2.7.14-1

+ - Update to version 2.7.14

+ 

  * Thu Aug 31 2017 Tomas Orsava <torsava@redhat.com> - 2.7.13-18

  - Switch some macros into bconds to facilitate modularity

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (Python-2.7.13.tar.xz) = f37c9a28ce129d01e63c84d7db627a06402854578f62d17927334ea21ede318e04bbf66e890e3f47c85333e6b19f6e5581fb3f3e27efd24be27017d1b6529c4b

+ SHA512 (Python-2.7.14.tar.xz) = 78310b0be6388ffa15f29a80afb9ab3c03a572cb094e9da00cfe391afadb51696e41f592eb658d6a31a2f422fdac8a55214a382cbb8cfb43d4a127d5b35ea7f9

Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=22339475

Just a minor nitpick here. Would it be possible to just keep this line here and move the rest to the commit message? The changelog messages are mostly relevant to the users and patch addition/refactoring/removal information is more relevant to developers, so it makes more sense to add it to the commit message.

Numbering of the patch should be changed to 280. (Apologies, already reserved the number 279 and pushed some changes for python3 before I take a look at this PR). https://fedoraproject.org/wiki/SIGs/Python/PythonPatches#The_Patches

rebased onto 9db4c32

6 years ago

Would it be possible to just keep this line here and move the rest to the commit message?

Done!

Numbering of the patch should be changed to 280.

Fixed, and reserved in the doc linked.

I have also updated 141 patch to use the new one introduced upstream just today (https://bugs.python.org/issue31692).
Scratch build with the updated patch 141 here: https://koji.fedoraproject.org/koji/taskinfo?taskID=22348391

Scratch build for commit changes and patch renaming running here: https://koji.fedoraproject.org/koji/taskinfo?taskID=22350388

A minor issue. Commit message still references the s390x as patch279:

"Add a patch to skip a failing test on s390x: 279"

I'd also wait until the upstream PR [0] is merged, before this PR is merged since it introduces a new environment variable.

[0] https://github.com/python/cpython/pull/3927

2 new commits added

  • Add patches for failing tests
  • Update to 2.7.14
6 years ago

A minor issue. Commit message still references the s390x as patch279:

Ooops, nice catch!

I'd also wait until the upstream PR [0] is merged, before this PR is merged since it introduces a new environment variable.

We used to have this env variable in a downstream patch, it was just named PYTHONDUMPCOUNTS. It was renamed to PYTHONSHOWALLOCCOUNT to be consistent with Python 3 "-X showalloccount" option. I am not sure if we have to communicate this change in any way? Or I can change the name back in the patch, while it is not merged.

The decision, if this fix is merged is on the RM of Python 2.7.

We used to have this env variable in a downstream patch, it was just named PYTHONDUMPCOUNTS. It was renamed to PYTHONSHOWALLOCCOUNT to be consistent with Python 3 "-X showalloccount" option. I am not sure if we have to communicate this change in any way? Or I can change the name back in the patch, while it is not merged.

I don't believe that it is required to communicate this change yet, at least not when it's still being discussed upstream.

Would it be better to reserve a new patch number for this patch as it introduces a differently named environment variable? (so it's basically not a drop in replacement for the previous one).

I don't think being a drop-in replacement is a good criterion for patch numbers.
If it's essentially a new patch, it should get a new patch number.
If it's a new version of the same, it should stay the same.
But it doesn't really matter either way. If you have a preference (i.e. you consult the patch list often and would find a new number useful), just do it that way.

2 new commits added

  • Add patches for failing tests
  • Update to 2.7.14
6 years ago

The patch replaces all 4 downstream patches (125,134,135,141), so it might not be correct to use the same number. Also the numbers are not registered in our patch list, so I have registered 283 number for it.

I have also updated the patch with the recent changes upstream (see commit).

New Koji scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=22525131

LGTM!

On a side note, we might want to backport also https://github.com/python/cpython/commit/3c082a7fdb472f02bcac7a7f8fe1e3a34a11b70b which removes the output of reference counts while in debug mode unless the PYTHONSHOWREFCOUNT env variable is set.

Pull-Request has been merged by cstratak

6 years ago