Control: tags -1 + patch Hi,
here is a patch reverting the change. BTW, when trying to build the package with sbuild I get (with or without the patch): END test shared cp -p /<<PKGBUILDDIR>>/build-static/test_results debian/ cp: cannot stat '/<<PKGBUILDDIR>>/build-static/test_results': No such file or directory debian/rules:522: recipe for target 'stamps/stamp-check' failed Best, Tobias
diff -u python2.7-2.7.13~rc1/debian/changelog python2.7-2.7.13~rc1/debian/changelog --- python2.7-2.7.13~rc1/debian/changelog +++ python2.7-2.7.13~rc1/debian/changelog @@ -1,3 +1,11 @@ +python2.7 (2.7.13~rc1-1.1) unstable; urgency=medium + + * Non-maintainer upload. + * Revert backward incompatible fix for issue #5322 with + revert-issue5322.diff. Closes: #847791. + + -- Tobias Hansen <[email protected]> Sun, 11 Dec 2016 19:00:47 +0000 + python2.7 (2.7.13~rc1-1) unstable; urgency=medium * Python 2.7.13 release candidate 1. diff -u python2.7-2.7.13~rc1/debian/patches/series.in python2.7-2.7.13~rc1/debian/patches/series.in --- python2.7-2.7.13~rc1/debian/patches/series.in +++ python2.7-2.7.13~rc1/debian/patches/series.in @@ -71,0 +72 @@ +revert-issue5322.diff only in patch2: unchanged: --- python2.7-2.7.13~rc1.orig/debian/patches/revert-issue5322.diff +++ python2.7-2.7.13~rc1/debian/patches/revert-issue5322.diff @@ -0,0 +1,165 @@ +Description: Revert change of issue #5322 + This change is not backward compatible + (see the code example in the upstream bug report) + and in particular breaks SageMath. +Author: Tobias Hansen <[email protected]> +Bug: https://bugs.python.org/issue5322#msg282852 +Bug-Debian: http://bugs.debian.org/847791 + +--- a/Lib/test/test_descr.py ++++ b/Lib/test/test_descr.py +@@ -3,7 +3,6 @@ + import sys + import types + import unittest +-import warnings + import weakref + + from copy import deepcopy +@@ -1551,84 +1550,6 @@ + self.assertEqual(b.foo, 3) + self.assertEqual(b.__class__, D) + +- def test_bad_new(self): +- self.assertRaises(TypeError, object.__new__) +- self.assertRaises(TypeError, object.__new__, '') +- self.assertRaises(TypeError, list.__new__, object) +- self.assertRaises(TypeError, object.__new__, list) +- class C(object): +- __new__ = list.__new__ +- self.assertRaises(TypeError, C) +- class C(list): +- __new__ = object.__new__ +- self.assertRaises(TypeError, C) +- +- def test_object_new(self): +- class A(object): +- pass +- object.__new__(A) +- self.assertRaises(TypeError, object.__new__, A, 5) +- object.__init__(A()) +- self.assertRaises(TypeError, object.__init__, A(), 5) +- +- class A(object): +- def __init__(self, foo): +- self.foo = foo +- object.__new__(A) +- object.__new__(A, 5) +- object.__init__(A(3)) +- self.assertRaises(TypeError, object.__init__, A(3), 5) +- +- class A(object): +- def __new__(cls, foo): +- return object.__new__(cls) +- object.__new__(A) +- self.assertRaises(TypeError, object.__new__, A, 5) +- object.__init__(A(3)) +- object.__init__(A(3), 5) +- +- class A(object): +- def __new__(cls, foo): +- return object.__new__(cls) +- def __init__(self, foo): +- self.foo = foo +- object.__new__(A) +- with warnings.catch_warnings(record=True) as w: +- warnings.simplefilter('always', DeprecationWarning) +- a = object.__new__(A, 5) +- self.assertEqual(type(a), A) +- self.assertEqual(len(w), 1) +- object.__init__(A(3)) +- a = A(3) +- with warnings.catch_warnings(record=True) as w: +- warnings.simplefilter('always', DeprecationWarning) +- object.__init__(a, 5) +- self.assertEqual(a.foo, 3) +- self.assertEqual(len(w), 1) +- +- def test_restored_object_new(self): +- class A(object): +- def __new__(cls, *args, **kwargs): +- raise AssertionError +- self.assertRaises(AssertionError, A) +- class B(A): +- __new__ = object.__new__ +- def __init__(self, foo): +- self.foo = foo +- with warnings.catch_warnings(): +- warnings.simplefilter('error', DeprecationWarning) +- b = B(3) +- self.assertEqual(b.foo, 3) +- self.assertEqual(b.__class__, B) +- del B.__new__ +- self.assertRaises(AssertionError, B) +- del A.__new__ +- with warnings.catch_warnings(): +- warnings.simplefilter('error', DeprecationWarning) +- b = B(3) +- self.assertEqual(b.foo, 3) +- self.assertEqual(b.__class__, B) +- + def test_altmro(self): + # Testing mro() and overriding it... + class A(object): +@@ -3835,24 +3756,6 @@ + self.assertEqual(isinstance(d, D), True) + self.assertEqual(d.foo, 1) + +- class C(object): +- @staticmethod +- def __new__(*args): +- return args +- self.assertEqual(C(1, 2), (C, 1, 2)) +- class D(C): +- pass +- self.assertEqual(D(1, 2), (D, 1, 2)) +- +- class C(object): +- @classmethod +- def __new__(*args): +- return args +- self.assertEqual(C(1, 2), (C, C, 1, 2)) +- class D(C): +- pass +- self.assertEqual(D(1, 2), (D, D, 1, 2)) +- + def test_imul_bug(self): + # Testing for __imul__ problems... + # SF bug 544647 +--- a/Objects/typeobject.c ++++ b/Objects/typeobject.c +@@ -6304,33 +6304,7 @@ + sanity checks and constructing a new argument + list. Cut all that nonsense short -- this speeds + up instance creation tremendously. */ +- PyObject *self = PyCFunction_GET_SELF(descr); +- if (!self || !PyType_Check(self)) { +- /* This should never happen because +- tp_new_wrapper expects a type for self. +- Use slot_tp_new which will call +- tp_new_wrapper which will raise an +- exception. */ +- specific = (void *)slot_tp_new; +- } +- else { +- PyTypeObject *staticbase = type->tp_base; +- specific = ((PyTypeObject *)self)->tp_new; +- /* Check that the user does not do anything +- silly and unsafe like object.__new__(dict). +- To do this, we check that the most derived +- base that's not a heap type is this type. */ +- while (staticbase && +- (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) +- staticbase = staticbase->tp_base; +- if (staticbase && +- staticbase->tp_new != specific) +- /* Seems to be unsafe, better use +- slot_tp_new which will call +- tp_new_wrapper which will raise an +- exception if it is unsafe. */ +- specific = (void *)slot_tp_new; +- } ++ specific = (void *)type->tp_new; + /* XXX I'm not 100% sure that there isn't a hole + in this reasoning that requires additional + sanity checks. I'll buy the first person to
Description: Revert change of issue #5322 This change is not backward compatible (see the code example in the upstream bug report) and in particular breaks SageMath. Author: Tobias Hansen <[email protected]> Bug: https://bugs.python.org/issue5322#msg282852 Bug-Debian: http://bugs.debian.org/847791 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -3,7 +3,6 @@ import sys import types import unittest -import warnings import weakref from copy import deepcopy @@ -1551,84 +1550,6 @@ self.assertEqual(b.foo, 3) self.assertEqual(b.__class__, D) - def test_bad_new(self): - self.assertRaises(TypeError, object.__new__) - self.assertRaises(TypeError, object.__new__, '') - self.assertRaises(TypeError, list.__new__, object) - self.assertRaises(TypeError, object.__new__, list) - class C(object): - __new__ = list.__new__ - self.assertRaises(TypeError, C) - class C(list): - __new__ = object.__new__ - self.assertRaises(TypeError, C) - - def test_object_new(self): - class A(object): - pass - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A()) - self.assertRaises(TypeError, object.__init__, A(), 5) - - class A(object): - def __init__(self, foo): - self.foo = foo - object.__new__(A) - object.__new__(A, 5) - object.__init__(A(3)) - self.assertRaises(TypeError, object.__init__, A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - object.__new__(A) - self.assertRaises(TypeError, object.__new__, A, 5) - object.__init__(A(3)) - object.__init__(A(3), 5) - - class A(object): - def __new__(cls, foo): - return object.__new__(cls) - def __init__(self, foo): - self.foo = foo - object.__new__(A) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - a = object.__new__(A, 5) - self.assertEqual(type(a), A) - self.assertEqual(len(w), 1) - object.__init__(A(3)) - a = A(3) - with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always', DeprecationWarning) - object.__init__(a, 5) - self.assertEqual(a.foo, 3) - self.assertEqual(len(w), 1) - - def test_restored_object_new(self): - class A(object): - def __new__(cls, *args, **kwargs): - raise AssertionError - self.assertRaises(AssertionError, A) - class B(A): - __new__ = object.__new__ - def __init__(self, foo): - self.foo = foo - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - del B.__new__ - self.assertRaises(AssertionError, B) - del A.__new__ - with warnings.catch_warnings(): - warnings.simplefilter('error', DeprecationWarning) - b = B(3) - self.assertEqual(b.foo, 3) - self.assertEqual(b.__class__, B) - def test_altmro(self): # Testing mro() and overriding it... class A(object): @@ -3835,24 +3756,6 @@ self.assertEqual(isinstance(d, D), True) self.assertEqual(d.foo, 1) - class C(object): - @staticmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, 1, 2)) - - class C(object): - @classmethod - def __new__(*args): - return args - self.assertEqual(C(1, 2), (C, C, 1, 2)) - class D(C): - pass - self.assertEqual(D(1, 2), (D, D, 1, 2)) - def test_imul_bug(self): # Testing for __imul__ problems... # SF bug 544647 --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -6304,33 +6304,7 @@ sanity checks and constructing a new argument list. Cut all that nonsense short -- this speeds up instance creation tremendously. */ - PyObject *self = PyCFunction_GET_SELF(descr); - if (!self || !PyType_Check(self)) { - /* This should never happen because - tp_new_wrapper expects a type for self. - Use slot_tp_new which will call - tp_new_wrapper which will raise an - exception. */ - specific = (void *)slot_tp_new; - } - else { - PyTypeObject *staticbase = type->tp_base; - specific = ((PyTypeObject *)self)->tp_new; - /* Check that the user does not do anything - silly and unsafe like object.__new__(dict). - To do this, we check that the most derived - base that's not a heap type is this type. */ - while (staticbase && - (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - if (staticbase && - staticbase->tp_new != specific) - /* Seems to be unsafe, better use - slot_tp_new which will call - tp_new_wrapper which will raise an - exception if it is unsafe. */ - specific = (void *)slot_tp_new; - } + specific = (void *)type->tp_new; /* XXX I'm not 100% sure that there isn't a hole in this reasoning that requires additional sanity checks. I'll buy the first person to

