Upgrade to Python 2.7.12
slel opened this issue · 22 comments
Tarball: https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
Since Python 2.7.13 has issues with __new__, I postpone that to #22037.
CC: @dimpase @kiwifb @nexttime @vbraun @wluebbe
Component: packages: standard
Author: François Bissey
Branch/Commit: 85e931b
Reviewer: Volker Braun
Issue created by migration from https://trac.sagemath.org/ticket/19735
Breaks timeit because of https://bugs.python.org/issue5633 more precisely this commit https://hg.python.org/cpython/rev/14d1018940cb.
That's the kind of problems
sage: from sage.misc.sage_timeit import sage_timeit
sage: sage_timeit('3^100000', globals(), preparse=True, number=50)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-2-e93b8105f8e1> in <module>()
----> 1 sage_timeit('3^100000', globals(), preparse=True, number=Integer(50))
/home/frb15/gentoo/usr/lib/python2.7/site-packages/sage/misc/sage_timeit.pyc in sage_timeit(stmt, globals_dict, preparse, number, repeat, precision, seconds)
218 # to the shell namespace?
219
--> 220 src = timeit_.template % {'stmt': timeit_.reindent(stmt, 8), 'setup': "pass"}
221 code = compile(src, "<magic-timeit>", "exec")
222 ns = {}
KeyError: ‘init’
Every single doctest relying on timeit breaks. From what I can see from the commit adding 'init': '' to the timeit_.template call may be enough. I haven't tested this yet.
Description changed:
---
+++
@@ -1,3 +1,6 @@
-Python 2.7.11 was released on 2015-12-05.
+Upgrade to Python 2.7.12 (original ticket: upgrade to Python 2.7.11)
-https://www.python.org/downloads/release/python-2711/
+Python 2.7.12 was released on 2016-06-25.
+
+https://www.python.org/downloads/release/python-2712/
+what is the plan? this ticket seems to be important for Sage support on OSX 10.12 (aka Sierra), see #21567
Haven't tested yet, I have a feeling we'll have to fix the timeit template as I mentioned 9 months ago. I wouldn't think that problem would go away.
Gentoo has stabilized 2.7.12 so now I have a few doctests failures because of it.
--- src.orig/sage/misc/sage_timeit.py 2016-11-30 14:54:28.076049582 +1300
+++ src/sage/misc/sage_timeit.py 2016-11-30 15:01:53.256127012 +1300
@@ -218,7 +218,7 @@
# to the shell namespace?
src = timeit_.template % {'stmt': timeit_.reindent(stmt, 8),
- 'setup': "pass"}
+ 'setup': "pass", 'init' : ''}
code = compile(src, "<magic-timeit>", "exec")
ns = {}
if not globals_dict:
fixed most of them, but I still have
sage -t --long /usr/lib64/python2.7/site-packages/sage/combinat/words/word.py
**********************************************************************
File "/usr/lib64/python2.7/site-packages/sage/combinat/words/word.py", line 511, in sage.combinat.words.word.InfiniteWord_iter_with_caching
Failed example:
dumps(w)
Expected:
Traceback (most recent call last):
...
PicklingError: Can't pickle <type 'generator'>: attribute lookup __builtin__.generator failed
Got:
<BLANKLINE>
Traceback (most recent call last):
File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 501, in _run
self.compile_and_execute(example, compiler, test.globs)
File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 864, in compile_and_execute
exec(compiled, globs)
File "<doctest sage.combinat.words.word.InfiniteWord_iter_with_caching[9]>", line 1, in <module>
dumps(w)
File "sage/structure/sage_object.pyx", line 1116, in sage.structure.sage_object.dumps (/scratch2/portage/sci-mathematics/sage-9999/work/sage-9999/src-python2_7/build/cythonized/sage/structure/sage_object.c:13886)
return comp.compress(cPickle.dumps(obj, protocol=2))
TypeError: can't pickle generator objects
in quadruple. At least, one doctest is currently in the don't know the cause of failure basket.
Description changed:
---
+++
@@ -1,6 +1,3 @@
-Upgrade to Python 2.7.12 (original ticket: upgrade to Python 2.7.11)
+**Tarball**: https://www.python.org/ftp/python/2.7.12/Python-2.7.12.tgz
-Python 2.7.12 was released on 2016-06-25.
-
-https://www.python.org/downloads/release/python-2712/
-
+Since Python 2.7.13 has issues with `__new__`, I postpone that to #22037.It looks like just the error message of the expected error changed. So it's just a matter of updating the doctest, no?
Yes just the error message of the doctest but don't forget to adjust sage_timeit.py. We have also been discussing inclusion of https://bugs.python.org/issue1222585 in another ticket. Do you also use it in debian? We do in Gentoo.
I am putting a branch together now.
At least one of the patches has actually been upstreamed, removing...
I didn't find a reference to #1222585 in the python Debian package.
Replying to @tobihan:
I didn't find a reference to #1222585 in the python Debian package.
I guess one of the person pushing was a Gentoo dev. It is useful and the correct thing to do but the impact is probably invisible on a full GNU system.
The tinfo.patch which looks like is cygwin stuff needs work or possibly removal.
xcode stuff added, will be trivial to regenerate the patch.
Author: François Bissey
OK, I think the new tinfo.patch is correct as the migration was trivial. I also had to fix uuid-issue_11063.patch and it is a bit less trivial there, so whoever thought we need that should look at it. I didn't include the distutils_c++ patch as it should really be done to python2 and python3 and we probably want to limit the changes done in this ticket.
New commits:
c35ea3c | Upgrade python2 to 2.7.12 and update tinfo and uuid patches |
85e931b | fix sage_timeit and word.py for python 2.7.12 |
Branch: u/fbissey/python2.7.12
Reviewer: Volker Braun
Changed branch from u/fbissey/python2.7.12 to 85e931b