[arch-commits] Commit in sagemath/repos/community-staging-x86_64 (28 files)

Antonio Rojas arojas at archlinux.org
Tue Feb 5 17:33:01 UTC 2019


    Date: Tuesday, February 5, 2019 @ 17:33:00
  Author: arojas
Revision: 429642

archrelease: copy trunk to community-staging-x86_64

Added:
  sagemath/repos/community-staging-x86_64/PKGBUILD
    (from rev 429641, sagemath/trunk/PKGBUILD)
  sagemath/repos/community-staging-x86_64/fes02.patch
    (from rev 429641, sagemath/trunk/fes02.patch)
  sagemath/repos/community-staging-x86_64/latte-count.patch
    (from rev 429641, sagemath/trunk/latte-count.patch)
  sagemath/repos/community-staging-x86_64/package.patch
    (from rev 429641, sagemath/trunk/package.patch)
  sagemath/repos/community-staging-x86_64/sagemath-cremona.patch
    (from rev 429641, sagemath/trunk/sagemath-cremona.patch)
  sagemath/repos/community-staging-x86_64/sagemath-cypari2.patch
    (from rev 429641, sagemath/trunk/sagemath-cypari2.patch)
  sagemath/repos/community-staging-x86_64/sagemath-ecl-sigfpe.patch
    (from rev 429641, sagemath/trunk/sagemath-ecl-sigfpe.patch)
  sagemath/repos/community-staging-x86_64/sagemath-env.patch
    (from rev 429641, sagemath/trunk/sagemath-env.patch)
  sagemath/repos/community-staging-x86_64/sagemath-numpy-1.16.patch
    (from rev 429641, sagemath/trunk/sagemath-numpy-1.16.patch)
  sagemath/repos/community-staging-x86_64/sagemath-python3-notebook.patch
    (from rev 429641, sagemath/trunk/sagemath-python3-notebook.patch)
  sagemath/repos/community-staging-x86_64/sagemath-singular-4.1.1.p4.patch
    (from rev 429641, sagemath/trunk/sagemath-singular-4.1.1.p4.patch)
  sagemath/repos/community-staging-x86_64/sagemath-sphinx-1.8.patch
    (from rev 429641, sagemath/trunk/sagemath-sphinx-1.8.patch)
  sagemath/repos/community-staging-x86_64/sagemath-threejs.patch
    (from rev 429641, sagemath/trunk/sagemath-threejs.patch)
  sagemath/repos/community-staging-x86_64/test-optional.patch
    (from rev 429641, sagemath/trunk/test-optional.patch)
Deleted:
  sagemath/repos/community-staging-x86_64/PKGBUILD
  sagemath/repos/community-staging-x86_64/fes02.patch
  sagemath/repos/community-staging-x86_64/latte-count.patch
  sagemath/repos/community-staging-x86_64/package.patch
  sagemath/repos/community-staging-x86_64/sagemath-cremona.patch
  sagemath/repos/community-staging-x86_64/sagemath-cypari2.patch
  sagemath/repos/community-staging-x86_64/sagemath-ecl-sigfpe.patch
  sagemath/repos/community-staging-x86_64/sagemath-env.patch
  sagemath/repos/community-staging-x86_64/sagemath-numpy-1.16.patch
  sagemath/repos/community-staging-x86_64/sagemath-python3-notebook.patch
  sagemath/repos/community-staging-x86_64/sagemath-singular-4.1.1.p4.patch
  sagemath/repos/community-staging-x86_64/sagemath-sphinx-1.8.patch
  sagemath/repos/community-staging-x86_64/sagemath-threejs.patch
  sagemath/repos/community-staging-x86_64/test-optional.patch

----------------------------------+
 PKGBUILD                         |  322 ++++----
 fes02.patch                      |  114 +-
 latte-count.patch                |  178 ++--
 package.patch                    |   78 +-
 sagemath-cremona.patch           |   62 -
 sagemath-cypari2.patch           | 1422 ++++++++++++++++++-------------------
 sagemath-ecl-sigfpe.patch        |  294 +++----
 sagemath-env.patch               |  324 ++++----
 sagemath-numpy-1.16.patch        |  170 ++--
 sagemath-python3-notebook.patch  |   54 -
 sagemath-singular-4.1.1.p4.patch |  156 ++--
 sagemath-sphinx-1.8.patch        |   56 -
 sagemath-threejs.patch           |   22 
 test-optional.patch              |   50 -
 14 files changed, 1651 insertions(+), 1651 deletions(-)

Deleted: PKGBUILD
===================================================================
--- PKGBUILD	2019-02-05 17:30:42 UTC (rev 429641)
+++ PKGBUILD	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,161 +0,0 @@
-# Maintainer: Antonio Rojas <arojas at archlinux.org>
-# Contributor: Evgeniy Alekseev <arcanis.arch at gmail dot com>
-# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
-# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
-# Contributor: Osman Ugus <ugus11 at yahoo dot com>
-# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
-
-pkgbase=sagemath
-pkgname=(sagemath sagemath-jupyter)
-pkgver=8.6
-pkgrel=3
-pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
-arch=(x86_64)
-url="http://www.sagemath.org"
-license=(GPL)
-depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow nauty python2-rpy2 python2-fpylll python2-psutil python2-cypari2
-  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future gap flintqs lcalc lrcalc arb
-  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox m4rie rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon
-  sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials
-  libgiac libhomfly libbraiding three.js openblas)
-optdepends=('cython2: to compile cython code' 'python2-pkgconfig: to compile cython code'
-  'jmol: 3D plots' 'sage-notebook: Flask notebook interface (deprecated)'
-  'sagemath-doc: Documentation and inline help' 'python2-igraph: igraph backend for graph theory'
-  'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs'
-  'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids'
-  'ffmpeg: to export animations to video' 'imagemagick: to show animations'
-  'coxeter: Coxeter groups implementation'
-  'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
-  'libfes: exhaustive search of solutions for boolean equations' 'python2-pynormaliz: Normaliz backend for polyhedral computations'
-  'latte-integrale: integral point count in polyhedra' 'polymake: polymake backend for polyhedral computations'
-  'shared_meataxe: faster matrix arithmetic over finite fields'
-  'sirocco: for computing the fundamental group of the complement of a plane curve' 'primecount: faster prime_pi implementation'
-  'dot2tex: for displaying some diagrams' 'cryptominisat5: SAT solver' 'python2-pycosat: picosat SAT solver'
-  'python2-pip: to install optional packages with sage -pip')
-makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc sirocco
-  mcqd coxeter bliss tdlib python2-pkgconfig shared_meataxe libfes primecount)
-source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
-        sagemath-env.patch
-        package.patch
-        latte-count.patch
-        sagemath-python3-notebook.patch
-        test-optional.patch
-        fes02.patch
-        sagemath-threejs.patch
-        sagemath-cremona.patch
-        sagemath-sphinx-1.8.patch
-        sagemath-cypari2.patch
-        sagemath-singular-4.1.1.p4.patch
-        sagemath-ecl-sigfpe.patch
-        sagemath-numpy-1.16.patch)
-sha256sums=('dea613fc955cada76aaa7ab379bc5a219fe8b496064824f8c798b2b1651442fa'
-            'de6e38462ef1848778fbc23a63529fbee9229dbb245bb653f58a0d834a634c04'
-            '960afe4fcbffe2762b66119b8f14355386ced0d8ee52b535d0dac1dba90d365b'
-            'ef265f88ceb6caf4aac2d86ea74850861d99a63d11c94fc52b2ce88053c26d1e'
-            'bd2744c6564bbf71bd6ea3cd7b9031e2126cc1423bcdc1fcc258d90d750a129d'
-            'f12bd2a53ad51549015093aacc89978f4d796d9ab5bcd3d737aa0d57a5815b54'
-            '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94'
-            'f6b48abf34f64ea3fc092b0f0179e89633f7d3ecc0d62c2acacbfa1217751d63'
-            '4c6df9e4e5a7b29ecf6189eda3e5a79f69b6e1b4d29c1b9559663149b8c0af96'
-            '22f5e44a42c8276025b8512f45cac1c36d576c29c7fd9d36fde8b19ff87867d8'
-            'ca47248d2ed5edfe663ea02e261ddbb26a7cb03bef67928dbec690d9b9a8f129'
-            '482887fe43d89cef3270e89300ab9e2238fa74cd5b7c875688b68fb1b10c4fdf'
-            'a42f3b152b1aedb8abf16bc70971419919d1fe30328574e7fef8305f9d07d938'
-            'd483b1dc78eb83e3cd1620e3d44214ca0704065e1d27d7a257976e56c85f2d5b')
-
-prepare(){
-  cd sage-$pkgver
-
-# Arch-specific patches
-# assume all optional packages are installed
-  patch -p0 -i ../package.patch
-# set env variables
-  patch -p0 -i ../sagemath-env.patch
-# don't list optional packages when running tests
-  patch -p0 -i ../test-optional.patch
-# use correct latte-count binary name
-  patch -p1 -i ../latte-count.patch
-# make 'sage -notebook=jupyter' work with our python3 jupyter-notebook package
-  patch -p1 -i ../sagemath-python3-notebook.patch
-# fix three.js plotting backend
-  patch -p1 -i ../sagemath-threejs.patch
-# fix introspection with sphinx 1.8
-  patch -p1 -i ../sagemath-sphinx-1.8.patch
-
-# Upstream patches  
-# fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
-  patch -p1 -i ../fes02.patch
-# use Features to detect Cremona databases https://trac.sagemath.org/ticket/25825
-  patch -p1 -i ../sagemath-cremona.patch
-# Fix build with cypari 2.0 https://trac.sagemath.org/ticket/26442
-  patch -p1 -i ../sagemath-cypari2.patch
-# Fixes for singular 4.1.1p4 https://trac.sagemath.org/ticket/25993
-  patch -p1 -i ../sagemath-singular-4.1.1.p4.patch
-# Fix SIGFPE crashes with ecl 16.1.3 https://trac.sagemath.org/ticket/22191
-  patch -p1 -i ../sagemath-ecl-sigfpe.patch
-# Fix inline fortran with numpy 1.16 https://trac.sagemath.org/ticket/27061
-  patch -p1 -i ../sagemath-numpy-1.16.patch
-
-# use python2
-  sed -e 's|sage-python23|python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/*
-  sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
-  sed -e 's|exec ipython\b|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage
-  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
-}
-
-
-build() {
-  cd sage-$pkgver/src
-
-  export CC=gcc
-  export SAGE_ROOT="$PWD"
-  export SAGE_SRC="$PWD"
-  python2 setup.py build
-}
-
-package_sagemath() {
-  optdepends+=('sagemath-jupyter: Jupyter kernel')
-
-  cd sage-$pkgver/src
-
-  export SAGE_ROOT="$PWD"
-  export SAGE_LOCAL="/usr"
-  export SAGE_EXTCODE="$PWD"/ext
-  python2 setup.py install --root="$pkgdir" --optimize=1
-
-  mkdir -p "$pkgdir"/usr/bin
-  cp bin/{sage,math-readline} "$pkgdir"/usr/bin
-  for _i in cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipynb2rst \
-    ipython massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run \
-    run-cython runtests startuptime.py sws2rst valgrind version.sh
-  do
-    cp bin/sage-$_i "$pkgdir"/usr/bin
-  done
-  
-  mkdir -p "$pkgdir"/usr/share/sage
-  cp -r ext "$pkgdir"/usr/share/sage
-  
-# Remove sage_setup
-  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
-
-# Split jupyter kernel
-  rm -r "$pkgdir"/usr/share/jupyter
-}
-
-package_sagemath-jupyter() {
-  pkgdesc='Jupyter kernel for SageMath'
-  depends=(sagemath python2-jupyter_client python2-ipywidgets mathjax jsmol)
-  optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter')
-
-  cd sage-$pkgver/src
-
-  export SAGE_ROOT="$PWD"
-  export SAGE_LOCAL="/usr"
-
-  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')"
-# fix symlinks to assets
-  for _i in $(ls ext/notebook-ipython); do
-    rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
-    ln -s /usr/share/sage/ext/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
-  done
-}

Copied: sagemath/repos/community-staging-x86_64/PKGBUILD (from rev 429641, sagemath/trunk/PKGBUILD)
===================================================================
--- PKGBUILD	                        (rev 0)
+++ PKGBUILD	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,161 @@
+# Maintainer: Antonio Rojas <arojas at archlinux.org>
+# Contributor: Evgeniy Alekseev <arcanis.arch at gmail dot com>
+# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
+# Contributor: Thomas Dziedzic <gostrc at gmail dot com>
+# Contributor: Osman Ugus <ugus11 at yahoo dot com>
+# Contributor: Stefan Husmann <stefan-husmann at t-online dot de>
+
+pkgbase=sagemath
+pkgname=(sagemath sagemath-jupyter)
+pkgver=8.6
+pkgrel=3
+pkgdesc="Open Source Mathematics Software, free alternative to Magma, Maple, Mathematica, and Matlab"
+arch=(x86_64)
+url="http://www.sagemath.org"
+license=(GPL)
+depends=(ipython2 ppl palp brial cliquer maxima-ecl gfan sympow nauty python2-rpy2 python2-fpylll python2-psutil python2-cypari2
+  python2-matplotlib python2-scipy python2-sympy python2-networkx python2-pillow python2-future gap flintqs lcalc lrcalc arb
+  eclib gmp-ecm zn_poly gd python2-cvxopt pynac linbox m4rie rubiks pari-galdata pari-seadata-small planarity rankwidth tachyon
+  sage-data-combinatorial_designs sage-data-elliptic_curves sage-data-graphs sage-data-polytopes_db sage-data-conway_polynomials
+  libgiac libhomfly libbraiding three.js openblas)
+optdepends=('cython2: to compile cython code' 'python2-pkgconfig: to compile cython code'
+  'jmol: 3D plots' 'sage-notebook: Flask notebook interface (deprecated)'
+  'sagemath-doc: Documentation and inline help' 'python2-igraph: igraph backend for graph theory'
+  'coin-or-cbc: COIN backend for numerical computations' 'coin-or-csdp: for computing Lovász theta-function of graphs'
+  'buckygen: for generating fullerene graphs' 'plantri: for generating some classes of graphs' 'benzene: for generating fusenes and benzenoids'
+  'ffmpeg: to export animations to video' 'imagemagick: to show animations'
+  'coxeter: Coxeter groups implementation'
+  'lrs: Algorithms for linear reverse search used in game theory and for computing volume of polytopes'
+  'libfes: exhaustive search of solutions for boolean equations' 'python2-pynormaliz: Normaliz backend for polyhedral computations'
+  'latte-integrale: integral point count in polyhedra' 'polymake: polymake backend for polyhedral computations'
+  'shared_meataxe: faster matrix arithmetic over finite fields'
+  'sirocco: for computing the fundamental group of the complement of a plane curve' 'primecount: faster prime_pi implementation'
+  'dot2tex: for displaying some diagrams' 'cryptominisat5: SAT solver' 'python2-pycosat: picosat SAT solver'
+  'python2-pip: to install optional packages with sage -pip')
+makedepends=(cython2 boost ratpoints symmetrica python2-jinja coin-or-cbc sirocco
+  mcqd coxeter bliss tdlib python2-pkgconfig shared_meataxe libfes primecount)
+source=("$pkgname-$pkgver.tar.gz::https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
+        sagemath-env.patch
+        package.patch
+        latte-count.patch
+        sagemath-python3-notebook.patch
+        test-optional.patch
+        fes02.patch
+        sagemath-threejs.patch
+        sagemath-cremona.patch
+        sagemath-sphinx-1.8.patch
+        sagemath-cypari2.patch
+        sagemath-singular-4.1.1.p4.patch
+        sagemath-ecl-sigfpe.patch
+        sagemath-numpy-1.16.patch)
+sha256sums=('dea613fc955cada76aaa7ab379bc5a219fe8b496064824f8c798b2b1651442fa'
+            'de6e38462ef1848778fbc23a63529fbee9229dbb245bb653f58a0d834a634c04'
+            '960afe4fcbffe2762b66119b8f14355386ced0d8ee52b535d0dac1dba90d365b'
+            'ef265f88ceb6caf4aac2d86ea74850861d99a63d11c94fc52b2ce88053c26d1e'
+            'bd2744c6564bbf71bd6ea3cd7b9031e2126cc1423bcdc1fcc258d90d750a129d'
+            'f12bd2a53ad51549015093aacc89978f4d796d9ab5bcd3d737aa0d57a5815b54'
+            '7fcb52e96935dccb0f958d37c2f4e3918392480b9af53e08562f6cba6c68cb94'
+            'f6b48abf34f64ea3fc092b0f0179e89633f7d3ecc0d62c2acacbfa1217751d63'
+            '4c6df9e4e5a7b29ecf6189eda3e5a79f69b6e1b4d29c1b9559663149b8c0af96'
+            '22f5e44a42c8276025b8512f45cac1c36d576c29c7fd9d36fde8b19ff87867d8'
+            'ca47248d2ed5edfe663ea02e261ddbb26a7cb03bef67928dbec690d9b9a8f129'
+            '482887fe43d89cef3270e89300ab9e2238fa74cd5b7c875688b68fb1b10c4fdf'
+            'a42f3b152b1aedb8abf16bc70971419919d1fe30328574e7fef8305f9d07d938'
+            'd483b1dc78eb83e3cd1620e3d44214ca0704065e1d27d7a257976e56c85f2d5b')
+
+prepare(){
+  cd sage-$pkgver
+
+# Arch-specific patches
+# assume all optional packages are installed
+  patch -p0 -i ../package.patch
+# set env variables
+  patch -p0 -i ../sagemath-env.patch
+# don't list optional packages when running tests
+  patch -p0 -i ../test-optional.patch
+# use correct latte-count binary name
+  patch -p1 -i ../latte-count.patch
+# make 'sage -notebook=jupyter' work with our python3 jupyter-notebook package
+  patch -p1 -i ../sagemath-python3-notebook.patch
+# fix three.js plotting backend
+  patch -p1 -i ../sagemath-threejs.patch
+# fix introspection with sphinx 1.8
+  patch -p1 -i ../sagemath-sphinx-1.8.patch
+
+# Upstream patches  
+# fix build against libfes 0.2 http://trac.sagemath.org/ticket/15209
+  patch -p1 -i ../fes02.patch
+# use Features to detect Cremona databases https://trac.sagemath.org/ticket/25825
+  patch -p1 -i ../sagemath-cremona.patch
+# Fix build with cypari 2.0 https://trac.sagemath.org/ticket/26442
+  patch -p1 -i ../sagemath-cypari2.patch
+# Fixes for singular 4.1.1p4 https://trac.sagemath.org/ticket/25993
+  patch -p1 -i ../sagemath-singular-4.1.1.p4.patch
+# Fix SIGFPE crashes with ecl 16.1.3 https://trac.sagemath.org/ticket/22191
+  patch -p1 -i ../sagemath-ecl-sigfpe.patch
+# Fix inline fortran with numpy 1.16 https://trac.sagemath.org/ticket/27061
+  patch -p1 -i ../sagemath-numpy-1.16.patch
+
+# use python2
+  sed -e 's|sage-python23|python2|' -e 's|#!/usr/bin/env python\b|#!/usr/bin/env python2|' -i src/bin/*
+  sed -e 's|cython {OPT}|cython2 {OPT}|' -e 's|python setup.py|python2 setup.py|' -i src/sage/misc/cython.py
+  sed -e 's|exec ipython\b|exec ipython2|' -e 's|cygdb|cygdb2|g' -i src/bin/sage
+  sed -e "s|'cython'|'cython2'|" -i src/bin/sage-cython
+}
+
+
+build() {
+  cd sage-$pkgver/src
+
+  export CC=gcc
+  export SAGE_ROOT="$PWD"
+  export SAGE_SRC="$PWD"
+  python2 setup.py build
+}
+
+package_sagemath() {
+  optdepends+=('sagemath-jupyter: Jupyter kernel')
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+  export SAGE_EXTCODE="$PWD"/ext
+  python2 setup.py install --root="$pkgdir" --optimize=1
+
+  mkdir -p "$pkgdir"/usr/bin
+  cp bin/{sage,math-readline} "$pkgdir"/usr/bin
+  for _i in cachegrind callgrind cleaner coverage coverageall cython env eval grep grepdoc inline-fortran ipynb2rst \
+    ipython massif maxima.lisp native-execute notebook num-threads.py omega open preparse python rst2sws rst2txt run \
+    run-cython runtests startuptime.py sws2rst valgrind version.sh
+  do
+    cp bin/sage-$_i "$pkgdir"/usr/bin
+  done
+  
+  mkdir -p "$pkgdir"/usr/share/sage
+  cp -r ext "$pkgdir"/usr/share/sage
+  
+# Remove sage_setup
+  rm -r "$pkgdir"/usr/lib/python2.7/site-packages/sage_setup
+
+# Split jupyter kernel
+  rm -r "$pkgdir"/usr/share/jupyter
+}
+
+package_sagemath-jupyter() {
+  pkgdesc='Jupyter kernel for SageMath'
+  depends=(sagemath python2-jupyter_client python2-ipywidgets mathjax jsmol)
+  optdepends=('sage-notebook-exporter: convert flask notebooks to Jupyter')
+
+  cd sage-$pkgver/src
+
+  export SAGE_ROOT="$PWD"
+  export SAGE_LOCAL="/usr"
+
+  python2 -c "from sage.repl.ipython_kernel.install import SageKernelSpec; SageKernelSpec.update(prefix='$pkgdir/usr')"
+# fix symlinks to assets
+  for _i in $(ls ext/notebook-ipython); do
+    rm "$pkgdir"/usr/share/jupyter/kernels/sagemath/$_i
+    ln -s /usr/share/sage/ext/notebook-ipython/$_i "$pkgdir"/usr/share/jupyter/kernels/sagemath/
+  done
+}

Deleted: fes02.patch
===================================================================
--- fes02.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ fes02.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,57 +0,0 @@
-From b1f5e3ecc789db674fe17552812f2d0e2ab84be0 Mon Sep 17 00:00:00 2001
-From: Charles Bouillaguet <charles.bouillaguet at lifl.fr>
-Date: Thu, 19 Sep 2013 10:31:11 +0200
-Subject: updating the libFES binding to match a change in the interface
-
----
- src/sage/libs/fes.pyx | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/src/sage/libs/fes.pyx b/src/sage/libs/fes.pyx
-index 40b9c23..d188cf0 100644
---- a/src/sage/libs/fes.pyx
-+++ b/src/sage/libs/fes.pyx
-@@ -1,17 +1,19 @@
- """
--Binding for the FES library.
-+Binding for the libFES library.
- 
- Finding solutions of systems of boolean equations by exhaustive
- search, via the fes library. This is usually (much) faster than
- computing a Groebner basis, except in special cases where the latter
- is particularly easy.
- 
--The FES library is presently only able to deal with polynomials in 64
-+More information is available at [http://www.lifl.fr/~bouillag/fes].
-+
-+The libFES library is presently only able to deal with polynomials in 64
- variables. Performing a full exhaustive search over 64 variables will
- take a **long** time. The number of variables can be artificially
- reduced to 64 by specializing some of them.
- 
--Note that the FES library **requires** at least of the equations to be
-+Note that the libFES library **requires** at least of the equations to be
- non-linear.
- 
- AUTHORS:
-@@ -71,7 +73,7 @@ from libc.stdint cimport uint64_t
- cdef extern from "fes_interface.h":
-     ctypedef int (*solution_callback_t)(void *, uint64_t)
- 
--    void exhaustive_search_wrapper(int n, int n_eqs, int degree, int ***coeffs, solution_callback_t callback, void* callback_state, int verbose)
-+    void exhaustive_search_wrapper(int n, int n_eqs, int degree, int ***coeffs, solution_callback_t callback, void* callback_state, int verbose, int T)
- 
- 
- from sage.rings.integer import Integer
-@@ -217,7 +217,7 @@ def exhaustive_search(eqs,  max_sols=Infinity, verbose=False):
- 
-     # ------- runs the library
-     sig_on()
--    exhaustive_search_wrapper(n, len(eqs), degree, coeffs, report_solution, <void *> internal_state, verbose)
-+    exhaustive_search_wrapper(n, len(eqs), degree, coeffs, report_solution, <void *> internal_state, verbose, 0)
-     sig_off()
- 
-     # ------- frees memory occupied by the dense representation of the equations
--- 
-cgit v1.0-1-gd88e
-

Copied: sagemath/repos/community-staging-x86_64/fes02.patch (from rev 429641, sagemath/trunk/fes02.patch)
===================================================================
--- fes02.patch	                        (rev 0)
+++ fes02.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,57 @@
+From b1f5e3ecc789db674fe17552812f2d0e2ab84be0 Mon Sep 17 00:00:00 2001
+From: Charles Bouillaguet <charles.bouillaguet at lifl.fr>
+Date: Thu, 19 Sep 2013 10:31:11 +0200
+Subject: updating the libFES binding to match a change in the interface
+
+---
+ src/sage/libs/fes.pyx | 12 +++++++-----
+ 1 file changed, 7 insertions(+), 5 deletions(-)
+
+diff --git a/src/sage/libs/fes.pyx b/src/sage/libs/fes.pyx
+index 40b9c23..d188cf0 100644
+--- a/src/sage/libs/fes.pyx
++++ b/src/sage/libs/fes.pyx
+@@ -1,17 +1,19 @@
+ """
+-Binding for the FES library.
++Binding for the libFES library.
+ 
+ Finding solutions of systems of boolean equations by exhaustive
+ search, via the fes library. This is usually (much) faster than
+ computing a Groebner basis, except in special cases where the latter
+ is particularly easy.
+ 
+-The FES library is presently only able to deal with polynomials in 64
++More information is available at [http://www.lifl.fr/~bouillag/fes].
++
++The libFES library is presently only able to deal with polynomials in 64
+ variables. Performing a full exhaustive search over 64 variables will
+ take a **long** time. The number of variables can be artificially
+ reduced to 64 by specializing some of them.
+ 
+-Note that the FES library **requires** at least of the equations to be
++Note that the libFES library **requires** at least of the equations to be
+ non-linear.
+ 
+ AUTHORS:
+@@ -71,7 +73,7 @@ from libc.stdint cimport uint64_t
+ cdef extern from "fes_interface.h":
+     ctypedef int (*solution_callback_t)(void *, uint64_t)
+ 
+-    void exhaustive_search_wrapper(int n, int n_eqs, int degree, int ***coeffs, solution_callback_t callback, void* callback_state, int verbose)
++    void exhaustive_search_wrapper(int n, int n_eqs, int degree, int ***coeffs, solution_callback_t callback, void* callback_state, int verbose, int T)
+ 
+ 
+ from sage.rings.integer import Integer
+@@ -217,7 +217,7 @@ def exhaustive_search(eqs,  max_sols=Infinity, verbose=False):
+ 
+     # ------- runs the library
+     sig_on()
+-    exhaustive_search_wrapper(n, len(eqs), degree, coeffs, report_solution, <void *> internal_state, verbose)
++    exhaustive_search_wrapper(n, len(eqs), degree, coeffs, report_solution, <void *> internal_state, verbose, 0)
+     sig_off()
+ 
+     # ------- frees memory occupied by the dense representation of the equations
+-- 
+cgit v1.0-1-gd88e
+

Deleted: latte-count.patch
===================================================================
--- latte-count.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ latte-count.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,89 +0,0 @@
-diff --git a/src/sage/geometry/polyhedron/base_ZZ.py b/src/sage/geometry/polyhedron/base_ZZ.py
-index 268af9db0d..70d41dfa30 100644
---- a/src/sage/geometry/polyhedron/base_ZZ.py
-+++ b/src/sage/geometry/polyhedron/base_ZZ.py
-@@ -171,7 +171,7 @@ class Polyhedron_ZZ(Polyhedron_base):
-             sage: p = P.ehrhart_polynomial(maxdet=5, verbose=True)  # optional - latte_int
-             This is LattE integrale ...
-             ...
--            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd '--maxdet=5' /dev/stdin
-+            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd '--maxdet=5' /dev/stdin
-             ...
-             sage: p    # optional - latte_int
-             1/2*t^2 + 3/2*t + 1
-@@ -179,7 +179,7 @@ class Polyhedron_ZZ(Polyhedron_base):
-             sage: p = P.ehrhart_polynomial(dual=True, verbose=True)  # optional - latte_int
-             This is LattE integrale ...
-             ...
--            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --dual /dev/stdin
-+            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --dual /dev/stdin
-             ...
-             sage: p   # optional - latte_int
-             1/2*t^2 + 3/2*t + 1
-@@ -187,7 +187,7 @@ class Polyhedron_ZZ(Polyhedron_base):
-             sage: p = P.ehrhart_polynomial(irrational_primal=True, verbose=True)   # optional - latte_int
-             This is LattE integrale ...
-             ...
--            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-primal /dev/stdin
-+            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-primal /dev/stdin
-             ...
-             sage: p   # optional - latte_int
-             1/2*t^2 + 3/2*t + 1
-@@ -195,7 +195,7 @@ class Polyhedron_ZZ(Polyhedron_base):
-             sage: p = P.ehrhart_polynomial(irrational_all_primal=True, verbose=True)  # optional - latte_int
-             This is LattE integrale ...
-             ...
--            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-all-primal /dev/stdin
-+            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-all-primal /dev/stdin
-             ...
-             sage: p   # optional - latte_int
-             1/2*t^2 + 3/2*t + 1
-@@ -207,7 +207,7 @@ class Polyhedron_ZZ(Polyhedron_base):
-             ...
-             RuntimeError: LattE integrale program failed (exit code 1):
-             ...
--            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd '--bim-bam-boum=19' /dev/stdin
-+            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd '--bim-bam-boum=19' /dev/stdin
-             Unknown command/option --bim-bam-boum=19
-         """
-         if self.is_empty():
-diff --git a/src/sage/interfaces/latte.py b/src/sage/interfaces/latte.py
-index 066cedd401..302b39910d 100644
---- a/src/sage/interfaces/latte.py
-+++ b/src/sage/interfaces/latte.py
-@@ -93,7 +93,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
-         sage: n = count(cddin, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
-         This is LattE integrale ...
-         ...
--        Invocation: count '--redundancy-check=none' --cdd /dev/stdin
-+        Invocation: latte-count '--redundancy-check=none' --cdd /dev/stdin
-         ...
-         Total Unimodular Cones: ...
-         Maximum number of simplicial cones in memory at once: ...
-@@ -112,7 +112,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
-     # Check that LattE is present
-     Latte().require()
- 
--    args = ['count']
-+    args = ['latte-count']
-     if ehrhart_polynomial and multivariate_generating_function:
-         raise ValueError
-     if ehrhart_polynomial:
-diff --git a/src/sage/features/latte.py b/src/sage/features/latte.py
-index 63d227fd35..040a5cf1f9 100644
---- a/src/sage/features/latte.py
-+++ b/src/sage/features/latte.py
-@@ -10,10 +10,10 @@ from . import Executable, Feature, FeatureTestResult
- 
- class Latte_count(Executable):
-     r"""
--    Feature for the executable ``count`` from the LattE suite.
-+    Feature for the executable ``latte-count`` from the LattE suite.
-     """
-     def __init__(self):
--        Executable.__init__(self, "count", executable="count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
-+        Executable.__init__(self, "latte-count", executable="latte-count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
- 
- class Latte_integrate(Executable):
-     r"""
-

Copied: sagemath/repos/community-staging-x86_64/latte-count.patch (from rev 429641, sagemath/trunk/latte-count.patch)
===================================================================
--- latte-count.patch	                        (rev 0)
+++ latte-count.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,89 @@
+diff --git a/src/sage/geometry/polyhedron/base_ZZ.py b/src/sage/geometry/polyhedron/base_ZZ.py
+index 268af9db0d..70d41dfa30 100644
+--- a/src/sage/geometry/polyhedron/base_ZZ.py
++++ b/src/sage/geometry/polyhedron/base_ZZ.py
+@@ -171,7 +171,7 @@ class Polyhedron_ZZ(Polyhedron_base):
+             sage: p = P.ehrhart_polynomial(maxdet=5, verbose=True)  # optional - latte_int
+             This is LattE integrale ...
+             ...
+-            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd '--maxdet=5' /dev/stdin
++            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd '--maxdet=5' /dev/stdin
+             ...
+             sage: p    # optional - latte_int
+             1/2*t^2 + 3/2*t + 1
+@@ -179,7 +179,7 @@ class Polyhedron_ZZ(Polyhedron_base):
+             sage: p = P.ehrhart_polynomial(dual=True, verbose=True)  # optional - latte_int
+             This is LattE integrale ...
+             ...
+-            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --dual /dev/stdin
++            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --dual /dev/stdin
+             ...
+             sage: p   # optional - latte_int
+             1/2*t^2 + 3/2*t + 1
+@@ -187,7 +187,7 @@ class Polyhedron_ZZ(Polyhedron_base):
+             sage: p = P.ehrhart_polynomial(irrational_primal=True, verbose=True)   # optional - latte_int
+             This is LattE integrale ...
+             ...
+-            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-primal /dev/stdin
++            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-primal /dev/stdin
+             ...
+             sage: p   # optional - latte_int
+             1/2*t^2 + 3/2*t + 1
+@@ -195,7 +195,7 @@ class Polyhedron_ZZ(Polyhedron_base):
+             sage: p = P.ehrhart_polynomial(irrational_all_primal=True, verbose=True)  # optional - latte_int
+             This is LattE integrale ...
+             ...
+-            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-all-primal /dev/stdin
++            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd --irrational-all-primal /dev/stdin
+             ...
+             sage: p   # optional - latte_int
+             1/2*t^2 + 3/2*t + 1
+@@ -207,7 +207,7 @@ class Polyhedron_ZZ(Polyhedron_base):
+             ...
+             RuntimeError: LattE integrale program failed (exit code 1):
+             ...
+-            Invocation: count --ehrhart-polynomial '--redundancy-check=none' --cdd '--bim-bam-boum=19' /dev/stdin
++            Invocation: latte-count --ehrhart-polynomial '--redundancy-check=none' --cdd '--bim-bam-boum=19' /dev/stdin
+             Unknown command/option --bim-bam-boum=19
+         """
+         if self.is_empty():
+diff --git a/src/sage/interfaces/latte.py b/src/sage/interfaces/latte.py
+index 066cedd401..302b39910d 100644
+--- a/src/sage/interfaces/latte.py
++++ b/src/sage/interfaces/latte.py
+@@ -93,7 +93,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
+         sage: n = count(cddin, cdd=True, verbose=True, raw_output=True)  # optional - latte_int
+         This is LattE integrale ...
+         ...
+-        Invocation: count '--redundancy-check=none' --cdd /dev/stdin
++        Invocation: latte-count '--redundancy-check=none' --cdd /dev/stdin
+         ...
+         Total Unimodular Cones: ...
+         Maximum number of simplicial cones in memory at once: ...
+@@ -112,7 +112,7 @@ def count(arg, ehrhart_polynomial=False, multivariate_generating_function=False,
+     # Check that LattE is present
+     Latte().require()
+ 
+-    args = ['count']
++    args = ['latte-count']
+     if ehrhart_polynomial and multivariate_generating_function:
+         raise ValueError
+     if ehrhart_polynomial:
+diff --git a/src/sage/features/latte.py b/src/sage/features/latte.py
+index 63d227fd35..040a5cf1f9 100644
+--- a/src/sage/features/latte.py
++++ b/src/sage/features/latte.py
+@@ -10,10 +10,10 @@ from . import Executable, Feature, FeatureTestResult
+ 
+ class Latte_count(Executable):
+     r"""
+-    Feature for the executable ``count`` from the LattE suite.
++    Feature for the executable ``latte-count`` from the LattE suite.
+     """
+     def __init__(self):
+-        Executable.__init__(self, "count", executable="count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
++        Executable.__init__(self, "latte-count", executable="latte-count", spkg="latte_int", url="https://www.math.ucdavis.edu/~latte/software.php")
+ 
+ class Latte_integrate(Executable):
+     r"""
+

Deleted: package.patch
===================================================================
--- package.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ package.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,39 +0,0 @@
---- src/sage/misc/package.py.orig	2014-11-23 15:58:13.000000000 +0100
-+++ src/sage/misc/package.py	2015-01-22 20:32:25.651383902 +0100
-@@ -328,7 +328,7 @@
-         Use the framework provided by :mod:`sage.features` to check
-         whether a library is installed and functional.
-     """
--    return any(p.split('-')[0] == package for p in installed_packages(exclude_pip))
-+    return True
- 
- def package_versions(package_type, local=False):
-     r"""
---- src/sage_setup/optional_extension.py.orig  2016-10-19 18:35:10.092577510 +0000
-+++ src/sage_setup/optional_extension.py       2016-10-19 18:38:13.514765366 +0000
-@@ -21,8 +21,6 @@
- from distutils.extension import Extension
- from sage.misc.package import list_packages
- 
--all_packages = list_packages(local=True)
--
- 
- class CythonizeExtension(Extension):
-     """
-@@ -76,15 +74,7 @@
-         condition = kwds.pop("condition")
-     except KeyError:
-         pkg = kwds.pop("package")
--        from sage.misc.package import is_package_installed
--        try:
--            pkginfo = all_packages[pkg]
--        except KeyError:
--            # Might be an installed old-style package
--            condition = is_package_installed(pkg)
--        else:
--            condition = (pkginfo["installed_version"] == pkginfo["remote_version"])
--
-+        condition = True
-     if condition:
-         return Extension(*args, **kwds)
-     else:

Copied: sagemath/repos/community-staging-x86_64/package.patch (from rev 429641, sagemath/trunk/package.patch)
===================================================================
--- package.patch	                        (rev 0)
+++ package.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,39 @@
+--- src/sage/misc/package.py.orig	2014-11-23 15:58:13.000000000 +0100
++++ src/sage/misc/package.py	2015-01-22 20:32:25.651383902 +0100
+@@ -328,7 +328,7 @@
+         Use the framework provided by :mod:`sage.features` to check
+         whether a library is installed and functional.
+     """
+-    return any(p.split('-')[0] == package for p in installed_packages(exclude_pip))
++    return True
+ 
+ def package_versions(package_type, local=False):
+     r"""
+--- src/sage_setup/optional_extension.py.orig  2016-10-19 18:35:10.092577510 +0000
++++ src/sage_setup/optional_extension.py       2016-10-19 18:38:13.514765366 +0000
+@@ -21,8 +21,6 @@
+ from distutils.extension import Extension
+ from sage.misc.package import list_packages
+ 
+-all_packages = list_packages(local=True)
+-
+ 
+ class CythonizeExtension(Extension):
+     """
+@@ -76,15 +74,7 @@
+         condition = kwds.pop("condition")
+     except KeyError:
+         pkg = kwds.pop("package")
+-        from sage.misc.package import is_package_installed
+-        try:
+-            pkginfo = all_packages[pkg]
+-        except KeyError:
+-            # Might be an installed old-style package
+-            condition = is_package_installed(pkg)
+-        else:
+-            condition = (pkginfo["installed_version"] == pkginfo["remote_version"])
+-
++        condition = True
+     if condition:
+         return Extension(*args, **kwds)
+     else:

Deleted: sagemath-cremona.patch
===================================================================
--- sagemath-cremona.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-cremona.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,31 +0,0 @@
-diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py
-index 3f8dd62..ed5726a 100644
---- a/src/sage/databases/cremona.py
-+++ b/src/sage/databases/cremona.py
-@@ -53,7 +53,7 @@ from sage.misc.prandom import randint
- 
- import sage.schemes.elliptic_curves.constructor as elliptic
- from .sql_db import SQLDatabase, verify_column
--from sage.misc.package import is_package_installed
-+from sage.features.databases import DatabaseCremona
- from sage.env import CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR
- from sage.misc.all import walltime
- 
-@@ -835,7 +835,7 @@ class MiniCremonaDatabase(SQLDatabase):
-             if N < self.largest_conductor():
-                 message = "There is no elliptic curve with label " + label \
-                     + " in the database"
--            elif is_package_installed('database_cremona_ellcurve'):
-+            elif DatabaseCremona().is_present():
-                 message = "There is no elliptic curve with label " + label \
-                     + " in the currently available databases"
-             else:
-@@ -1683,7 +1683,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None):
-     if name is None and not set_global:
-         return _db
-     if set_global and name is None:
--        if is_package_installed('database_cremona_ellcurve'):
-+        if DatabaseCremona().is_present():
-             name = 'cremona'
-         else:
-             name = 'cremona mini'

Copied: sagemath/repos/community-staging-x86_64/sagemath-cremona.patch (from rev 429641, sagemath/trunk/sagemath-cremona.patch)
===================================================================
--- sagemath-cremona.patch	                        (rev 0)
+++ sagemath-cremona.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,31 @@
+diff --git a/src/sage/databases/cremona.py b/src/sage/databases/cremona.py
+index 3f8dd62..ed5726a 100644
+--- a/src/sage/databases/cremona.py
++++ b/src/sage/databases/cremona.py
+@@ -53,7 +53,7 @@ from sage.misc.prandom import randint
+ 
+ import sage.schemes.elliptic_curves.constructor as elliptic
+ from .sql_db import SQLDatabase, verify_column
+-from sage.misc.package import is_package_installed
++from sage.features.databases import DatabaseCremona
+ from sage.env import CREMONA_MINI_DATA_DIR, CREMONA_LARGE_DATA_DIR
+ from sage.misc.all import walltime
+ 
+@@ -835,7 +835,7 @@ class MiniCremonaDatabase(SQLDatabase):
+             if N < self.largest_conductor():
+                 message = "There is no elliptic curve with label " + label \
+                     + " in the database"
+-            elif is_package_installed('database_cremona_ellcurve'):
++            elif DatabaseCremona().is_present():
+                 message = "There is no elliptic curve with label " + label \
+                     + " in the currently available databases"
+             else:
+@@ -1683,7 +1683,7 @@ def CremonaDatabase(name=None,mini=None,set_global=None):
+     if name is None and not set_global:
+         return _db
+     if set_global and name is None:
+-        if is_package_installed('database_cremona_ellcurve'):
++        if DatabaseCremona().is_present():
+             name = 'cremona'
+         else:
+             name = 'cremona mini'

Deleted: sagemath-cypari2.patch
===================================================================
--- sagemath-cypari2.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-cypari2.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,711 +0,0 @@
-diff --git a/src/sage/matrix/matrix_integer_dense.pxd b/src/sage/matrix/matrix_integer_dense.pxd
-index bc3af7c..5dd2a8e 100644
---- a/src/sage/matrix/matrix_integer_dense.pxd
-+++ b/src/sage/matrix/matrix_integer_dense.pxd
-@@ -30,6 +30,5 @@ cdef class Matrix_integer_dense(Matrix_dense):
- 
-     cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols)
- 
--    cdef extract_hnf_from_pari_matrix(self, GEN H, int flag, bint include_zero_rows)
- 
- cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=*)
-diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx
-index 4f0b0e6..87e3391 100644
---- a/src/sage/matrix/matrix_integer_dense.pyx
-+++ b/src/sage/matrix/matrix_integer_dense.pyx
-@@ -87,11 +87,11 @@ from .args cimport SparseEntry, MatrixArgs_init
- #########################################################
- # PARI C library
- from cypari2.gen cimport Gen
-+from cypari2.stack cimport clear_stack, new_gen
-+from cypari2.paridecl cimport *
- from sage.libs.pari.convert_gmp cimport INT_to_mpz
- from sage.libs.pari.convert_flint cimport (_new_GEN_from_fmpz_mat_t,
-            _new_GEN_from_fmpz_mat_t_rotate90, integer_matrix)
--from cypari2.stack cimport clear_stack
--from cypari2.paridecl cimport *
- #########################################################
- 
- from sage.arith.multi_modular cimport MultiModularBasis
-@@ -2016,10 +2016,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
-             raise ValueError("transformation matrix only available with p-adic algorithm")
-         elif algorithm in ["pari", "pari0", "pari1", "pari4"]:
-             flag = int(algorithm[-1]) if algorithm != "pari" else 1
--            if self.height().ndigits() > 10000 or n >= 50:
--                H_m = self._hnf_pari_big(flag, include_zero_rows=include_zero_rows)
--            else:
--                H_m = self._hnf_pari(flag, include_zero_rows=include_zero_rows)
-+            H_m = self._hnf_pari(flag, include_zero_rows=include_zero_rows)
-         elif algorithm == 'ntl':
-             if nr != nc:
-                 raise ValueError("ntl only computes HNF for square matrices of full rank.")
-@@ -5664,6 +5661,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
-         matrices.
- 
-         EXAMPLES::
-+
-             sage: matrix(ZZ,3,[1..9])._rank_pari()
-             2
-         """
-@@ -5674,16 +5672,12 @@ cdef class Matrix_integer_dense(Matrix_dense):
- 
-     def _hnf_pari(self, int flag=0, bint include_zero_rows=True):
-         """
--        Hermite form of this matrix, computed using PARI.  The
--        computation is done entirely on the PARI stack, then the PARI
--        stack is cleared.  This function is only useful for small
--        matrices, and can crash on large matrices (e.g., if the PARI
--        stack overflows).
-+        Hermite normal form of this matrix, computed using PARI.
- 
-         INPUT:
- 
-         - ``flag`` -- 0 (default), 1, 3 or 4 (see docstring for
--          gp.mathnf).
-+          ``pari.mathnf``).
- 
-         - ``include_zero_rows`` -- boolean. if False, do not include
-           any of the zero rows at the bottom of the matrix in the
-@@ -5733,98 +5727,13 @@ cdef class Matrix_integer_dense(Matrix_dense):
-             sage: pari('mathnf(Mat([0,1]), 4)')
-             [Mat(1), [1, 0; 0, 1]]
-         """
--        cdef GEN A
-         sig_on()
-         A = _new_GEN_from_fmpz_mat_t_rotate90(self._matrix)
--        cdef GEN H = mathnf0(A, flag)
--        B = self.extract_hnf_from_pari_matrix(H, flag, include_zero_rows)
--        clear_stack()  # This calls sig_off()
--        return B
--
--
--    def _hnf_pari_big(self, int flag=0, bint include_zero_rows=True):
--        """
--        Hermite form of this matrix, computed using PARI.
--
--        INPUT:
--
--        - ``flag`` -- 0 (default), 1, 3 or 4 (see docstring for
--          gp.mathnf).
--
--        - ``include_zero_rows`` -- boolean. if False, do not include
--          any of the zero rows at the bottom of the matrix in the
--          output.
--
--        .. NOTE::
--
--            In no cases is the transformation matrix returned by this
--            function.
--
--        EXAMPLES::
--
--            sage: a = matrix(ZZ,3,3,[1..9])
--            sage: a._hnf_pari_big(flag=0, include_zero_rows=True)
--            [1 2 3]
--            [0 3 6]
--            [0 0 0]
--            sage: a._hnf_pari_big(flag=1, include_zero_rows=True)
--            [1 2 3]
--            [0 3 6]
--            [0 0 0]
--            sage: a._hnf_pari_big(flag=3, include_zero_rows=True)
--            [1 2 3]
--            [0 3 6]
--            [0 0 0]
--            sage: a._hnf_pari_big(flag=4, include_zero_rows=True)
--            [1 2 3]
--            [0 3 6]
--            [0 0 0]
--
--        Check that ``include_zero_rows=False`` works correctly::
--
--            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(0, include_zero_rows=False)
--            [1 2 3]
--            [0 3 6]
--            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(1, include_zero_rows=False)
--            [1 2 3]
--            [0 3 6]
--            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(3, include_zero_rows=False)
--            [1 2 3]
--            [0 3 6]
--            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(4, include_zero_rows=False)
--            [1 2 3]
--            [0 3 6]
--        """
--        cdef Gen H = integer_matrix(self._matrix, 1)
--        H = H.mathnf(flag)
--        sig_on()
--        B = self.extract_hnf_from_pari_matrix(H.g, flag, include_zero_rows)
--        clear_stack()  # This calls sig_off()
--        return B
--
--    cdef extract_hnf_from_pari_matrix(self, GEN H, int flag, bint include_zero_rows):
--        # Throw away the transformation matrix (yes, we should later
--        # code this to keep track of it).
--        cdef mpz_t tmp
--        mpz_init(tmp)
--        if flag > 0:
--            H = gel(H,1)
--
--        # Figure out how many columns we got back.
--        cdef Py_ssize_t H_nc = glength(H)  # number of columns
--        # Now get the resulting Hermite form matrix back to Sage, suitably re-arranged.
--        cdef Matrix_integer_dense B
--        if include_zero_rows:
--            B = self.new_matrix()
--        else:
--            B = self.new_matrix(nrows=H_nc)
--        for i in range(self._ncols):
--            for j in range(H_nc):
--                INT_to_mpz(tmp, gcoeff(H, i+1, H_nc-j))
--                fmpz_set_mpz(fmpz_mat_entry(B._matrix,j,self._ncols-i-1),tmp)
--        mpz_clear(tmp)
--        return B
--
-+        H = mathnf0(A, flag)
-+        if typ(H) == t_VEC:
-+            H = gel(H, 1)
-+        GenH = new_gen(H)
-+        return extract_hnf_from_pari_matrix(self, GenH, include_zero_rows)
- 
-     def p_minimal_polynomials(self, p, s_max=None):
-         r"""
-@@ -5966,7 +5875,27 @@ cdef inline GEN pari_GEN(Matrix_integer_dense B):
-     return A
- 
- 
--    #####################################################################################
-+cdef extract_hnf_from_pari_matrix(Matrix_integer_dense self, Gen H, bint include_zero_rows):
-+    cdef mpz_t tmp
-+    mpz_init(tmp)
-+
-+    # Figure out how many columns we got back.
-+    cdef long H_nc = glength(H.g)  # number of columns
-+    # Now get the resulting Hermite form matrix back to Sage, suitably re-arranged.
-+    cdef Matrix_integer_dense B
-+    if include_zero_rows:
-+        B = self.new_matrix()
-+    else:
-+        B = self.new_matrix(nrows=H_nc)
-+    cdef long i, j
-+    for i in range(self._ncols):
-+        for j in range(H_nc):
-+            sig_check()
-+            INT_to_mpz(tmp, gcoeff(H.g, i+1, H_nc-j))
-+            fmpz_set_mpz(fmpz_mat_entry(B._matrix,j,self._ncols-i-1),tmp)
-+    mpz_clear(tmp)
-+    return B
-+
- 
- cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n):
-     # Clear all columns
-@@ -5990,11 +5919,6 @@ cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n):
-     fmpz_clear(t)
-     sig_off()
- 
--###############################################################
--
--
--
--
- 
- cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=None):
-     """
-diff --git a/src/sage/modular/modform/eis_series_cython.pyx b/src/sage/modular/modform/eis_series_cython.pyx
-index f7e944c..3557c6b 100644
---- a/src/sage/modular/modform/eis_series_cython.pyx
-+++ b/src/sage/modular/modform/eis_series_cython.pyx
-@@ -3,7 +3,7 @@ Eisenstein Series (optimized compiled functions)
- """
- 
- from cysignals.memory cimport check_allocarray, sig_free
--from cysignals.signals cimport sig_on, sig_off
-+from cysignals.signals cimport sig_check
- 
- from sage.rings.rational_field import QQ
- from sage.rings.power_series_ring import PowerSeriesRing
-@@ -161,8 +161,7 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
-     """
-     cdef mpz_t *val = <mpz_t *>check_allocarray(prec, sizeof(mpz_t))
-     cdef mpz_t one, mult, term, last, term_m1, last_m1
--    cdef unsigned long int expt
--    cdef long ind, ppow, int_p
-+    cdef long ind
-     cdef int i
-     cdef Fmpz_poly res = Fmpz_poly.__new__(Fmpz_poly)
- 
-@@ -173,8 +172,6 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
-     if (prec == 0):
-         return Fmpz_poly.__new__(Fmpz_poly)
- 
--    sig_on()
--
-     mpz_init(one)
-     mpz_init(term)
-     mpz_init(last)
-@@ -182,33 +179,33 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
-     mpz_init(term_m1)
-     mpz_init(last_m1)
- 
--    for i from 0 <= i < prec :
--        mpz_init(val[i])
--        mpz_set_si(val[i], 1)
-+    for i in range(prec):
-+        mpz_init_set_si(val[i], 1)
- 
-     mpz_set_si(one, 1)
- 
--    expt = <unsigned long int>(k - 1)
--    a0 = - bernoulli(k) / (2*k)
-+    cdef unsigned long expt = k - 1
-+    a0 = -bernoulli(k) / (2*k)
- 
--    for p in primes(1,prec) :
--        int_p = int(p)
--        ppow = <long int>int_p
-+    cdef long p, ppow
-+    for p in primes(1, prec) :
-+        ppow = p
- 
--        mpz_set_si(mult, int_p)
-+        mpz_set_si(mult, p)
-         mpz_pow_ui(mult, mult, expt)
-         mpz_mul(term, mult, mult)
-         mpz_set(last, mult)
- 
--        while (ppow < prec):
-+        while ppow < prec:
-+            sig_check()
-             ind = ppow
-             mpz_sub(term_m1, term, one)
-             mpz_sub(last_m1, last, one)
--            while (ind < prec):
-+            while ind < prec:
-                 mpz_mul(val[ind], val[ind], term_m1)
-                 mpz_fdiv_q(val[ind], val[ind], last_m1)
-                 ind += ppow
--            ppow *= int_p
-+            ppow *= p
-             mpz_set(last, term)
-             mpz_mul(term, term, mult)
- 
-@@ -228,6 +225,4 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
- 
-     sig_free(val)
- 
--    sig_off()
--
-     return res
-diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
-index 758fb70..f499a3e 100644
---- a/src/sage/plot/complex_plot.pyx
-+++ b/src/sage/plot/complex_plot.pyx
-@@ -19,7 +19,7 @@ Complex Plots
- from __future__ import absolute_import
- 
- # TODO: use NumPy buffers and complex fast_callable (when supported)
--from cysignals.signals cimport sig_on, sig_off
-+from cysignals.signals cimport sig_on, sig_off, sig_check
- 
- cimport numpy as cnumpy
- 
-@@ -381,12 +381,18 @@ def complex_plot(f, xrange, yrange, **options):
-         pass
- 
-     cdef double x, y
--    ignore, ranges = setup_for_eval_on_grid([], [xrange, yrange], options['plot_points'])
--    xrange,yrange=[r[:2] for r in ranges]
--    sig_on()
--    z_values = [[  f(new_CDF_element(x, y)) for x in srange(*ranges[0], include_endpoint=True)]
--                                            for y in srange(*ranges[1], include_endpoint=True)]
--    sig_off()
-+    _, ranges = setup_for_eval_on_grid([], [xrange, yrange], options['plot_points'])
-+    xrange = ranges[0]
-+    yrange = ranges[1]
-+    cdef list z_values = []
-+    cdef list row
-+    for y in srange(*yrange, include_endpoint=True):
-+        row = []
-+        for x in srange(*xrange, include_endpoint=True):
-+            sig_check()
-+            row.append(f(new_CDF_element(x, y)))
-+        z_values.append(row)
-+
-     g = Graphics()
-     g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
-     g.add_primitive(ComplexPlot(complex_to_rgb(z_values), xrange, yrange, options))
-diff --git a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
-index 84fa0e4..18f8e90 100644
---- a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
-+++ b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
-@@ -1095,7 +1095,7 @@ class AsymptoticExpansionGenerators(SageObject):
-             sage: asymptotic_expansions.ImplicitExpansion('Z', phi=lambda u: 1 + 2*u + u^2, tau=2, precision=5)
-             Traceback (most recent call last):
-             ...
--            ZeroDivisionError: Symbolic division by zero
-+            ZeroDivisionError: symbolic division by zero
-             sage: asymptotic_expansions.ImplicitExpansion('Z', phi=lambda u: 1 + 2*u + u^2, tau=3, precision=5)
-             3 - 4*I*sqrt(3)*Z^(-1/2) + 6*I*sqrt(3)*Z^(-3/2) + O(Z^(-2))
- 
-diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx
-index ff73a1f..2fcd3a1 100644
---- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx
-+++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx
-@@ -869,7 +869,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
-             Univariate Polynomial Ring in beta over Finite Field of size 3
-         """
-         sig_on()
--        return self._parent.polynomial_ring(name)(new_gen(FF_to_FpXQ_i(self.val)))
-+        pol = new_gen(FF_to_FpXQ(self.val))
-+        return self._parent.polynomial_ring(name)(pol)
- 
-     def minpoly(self, var='x'):
-         """
-@@ -887,7 +888,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
-             y^2 + 1
-         """
-         sig_on()
--        return self._parent.polynomial_ring(var)(new_gen(FF_minpoly(self.val)))
-+        pol = new_gen(FF_minpoly(self.val))
-+        return self._parent.polynomial_ring(var)(pol)
- 
-     def charpoly(self, var='x'):
-         """
-@@ -905,7 +907,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
-             y^2 + 1
-         """
-         sig_on()
--        return self._parent.polynomial_ring(var)(new_gen(FF_charpoly(self.val)))
-+        pol = new_gen(FF_charpoly(self.val))
-+        return self._parent.polynomial_ring(var)(pol)
- 
-     def is_square(self):
-         """
-diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
-index 17e62f3..9e99bde 100644
---- a/src/sage/rings/integer.pyx
-+++ b/src/sage/rings/integer.pyx
-@@ -6806,6 +6806,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
-             ....:         (2^100).binomial(2^22, algorithm='pari')
-             ....:     except AlarmInterrupt:
-             ....:         pass
-+            doctest:...: RuntimeWarning: cypari2 leaked ... bytes on the PARI stack...
-         """
-         cdef Integer x
-         cdef Integer mm
-diff --git a/src/sage/rings/number_field/maps.py b/src/sage/rings/number_field/maps.py
-index 1727c13..5717227 100644
---- a/src/sage/rings/number_field/maps.py
-+++ b/src/sage/rings/number_field/maps.py
-@@ -358,7 +358,7 @@ class MapRelativeNumberFieldToRelativeVectorSpace(NumberFieldIsomorphism):
-             g = g(beta).lift()
-         # Convert the coefficients to elements of the base field.
-         B, from_B, _ = K.absolute_base_field()
--        return self.codomain()([from_B(B(z.lift(), check=False)) for z in g.Vecrev(-K.relative_degree())])
-+        return self.codomain()([from_B(B(z.lift(), check=False)) for z in g.Vecrev(K.relative_degree())])
- 
- 
- class NameChangeMap(NumberFieldIsomorphism):
-diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
-index a711e94..20895c0 100644
---- a/src/sage/rings/polynomial/polynomial_element.pyx
-+++ b/src/sage/rings/polynomial/polynomial_element.pyx
-@@ -4363,8 +4363,7 @@ cdef class Polynomial(CommutativeAlgebraElement):
-             sage: G.prod() == g
-             True
-         """
--        pols = G[0]
--        exps = G[1]
-+        pols, exps = G
-         R = self._parent
-         F = [(R(f), int(e)) for f, e in zip(pols, exps)]
- 
-diff --git a/src/sage/rings/power_series_pari.pyx b/src/sage/rings/power_series_pari.pyx
-index e37e0a3..2e03ade 100644
---- a/src/sage/rings/power_series_pari.pyx
-+++ b/src/sage/rings/power_series_pari.pyx
-@@ -678,7 +678,8 @@ cdef class PowerSeries_pari(PowerSeries):
-             g = g.truncate()
-         if typ(g.g) == t_POL and varn(g.g) == vn:
-             # t_POL has 2 codewords.  Use new_ref instead of g[i] for speed.
--            return [R(g.new_ref(gel(g.g, i))) for i in range(2, lg(g.g))]
-+            G = g.fixGEN()
-+            return [R(g.new_ref(gel(G, i))) for i in range(2, lg(G))]
-         else:
-             return [R(g)]
- 
-@@ -729,6 +730,7 @@ cdef class PowerSeries_pari(PowerSeries):
-             return []
- 
-         cdef pari_gen g = self.g
-+        g.fixGEN()
-         cdef long l, m
- 
-         R = self.base_ring()
-diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
-index e273190..3b89f4b 100644
---- a/src/sage/rings/real_mpfr.pyx
-+++ b/src/sage/rings/real_mpfr.pyx
-@@ -3212,7 +3212,6 @@ cdef class RealNumber(sage.structure.element.RingElement):
-         # by using internal interfaces of MPFR, which are documented
-         # as subject-to-change.
- 
--        sig_on()
-         if mpfr_nan_p(self.value) or mpfr_inf_p(self.value):
-             raise ValueError('Cannot convert NaN or infinity to Pari float')
- 
-@@ -3234,6 +3233,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
-         cdef mp_exp_t exponent
-         cdef GEN pari_float
- 
-+        sig_on()
-         if mpfr_zero_p(self.value):
-             pari_float = real_0_bit(-rounded_prec)
-         else:
-@@ -3245,7 +3245,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
-             # Create a PARI REAL
-             pari_float = cgetr(2 + rounded_prec / wordsize)
-             pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value))
--            mpz_export(&pari_float[2], NULL, 1, wordsize/8, 0, 0, mantissa)
-+            mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa)
-             mpz_clear(mantissa)
- 
-         return new_gen(pari_float)
-diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
-index 586d4ab..c14b9a6 100644
---- a/src/sage/symbolic/expression.pyx
-+++ b/src/sage/symbolic/expression.pyx
-@@ -1273,12 +1273,7 @@ cdef class Expression(CommutativeRingElement):
-             sage: f._convert({'parent':int})
-             0
-         """
--        cdef GEx res
--        sig_on()
--        try:
--            res = self._gobj.evalf(0, kwds)
--        finally:
--            sig_off()
-+        cdef GEx res = self._gobj.evalf(0, kwds)
-         return new_Expression_from_GEx(self._parent, res)
- 
-     def _mpfr_(self, R):
-@@ -2839,11 +2834,7 @@ cdef class Expression(CommutativeRingElement):
-             # constants are wrappers around Sage objects, compare directly
-             if is_a_constant(self._gobj.lhs()) and is_a_constant(self._gobj.rhs()):
-                 return self.operator()(self.lhs().pyobject(), self.rhs().pyobject())
--            sig_on()
--            try:
--                pynac_result = decide_relational(self._gobj)
--            finally:
--                sig_off()
-+            pynac_result = decide_relational(self._gobj)
-             if pynac_result == relational_undecidable:
-                 raise ValueError('undecidable relation: ' + repr(self))
- 
-@@ -3233,27 +3224,23 @@ cdef class Expression(CommutativeRingElement):
-         cdef GEx x
-         cdef Expression _right = <Expression>right
-         cdef operators op
--        sig_on()
--        try:
--            if is_a_relational(left._gobj):
--                if is_a_relational(_right._gobj):
--                    op = compatible_relation(relational_operator(left._gobj),
--                                             relational_operator(_right._gobj))
--                    x = relational(left._gobj.lhs() + _right._gobj.lhs(),
--                                   left._gobj.rhs() + _right._gobj.rhs(),
--                                   op)
--                else:
--                    x = relational(left._gobj.lhs() + _right._gobj,
--                                   left._gobj.rhs() + _right._gobj,
--                                   relational_operator(left._gobj))
--            elif is_a_relational(_right._gobj):
--                x = relational(left._gobj + _right._gobj.lhs(),
--                               left._gobj + _right._gobj.rhs(),
--                               relational_operator(_right._gobj))
-+        if is_a_relational(left._gobj):
-+            if is_a_relational(_right._gobj):
-+                op = compatible_relation(relational_operator(left._gobj),
-+                                         relational_operator(_right._gobj))
-+                x = relational(left._gobj.lhs() + _right._gobj.lhs(),
-+                               left._gobj.rhs() + _right._gobj.rhs(),
-+                               op)
-             else:
--                x = left._gobj + _right._gobj
--        finally:
--            sig_off()
-+                x = relational(left._gobj.lhs() + _right._gobj,
-+                               left._gobj.rhs() + _right._gobj,
-+                               relational_operator(left._gobj))
-+        elif is_a_relational(_right._gobj):
-+            x = relational(left._gobj + _right._gobj.lhs(),
-+                           left._gobj + _right._gobj.rhs(),
-+                           relational_operator(_right._gobj))
-+        else:
-+            x = left._gobj + _right._gobj
-         return new_Expression_from_GEx(left._parent, x)
- 
-     cpdef _sub_(left, right):
-@@ -3289,27 +3276,23 @@ cdef class Expression(CommutativeRingElement):
-         """
-         cdef GEx x
-         cdef Expression _right = <Expression>right
--        sig_on()
--        try:
--            if is_a_relational(left._gobj):
--                if is_a_relational(_right._gobj):
--                    op = compatible_relation(relational_operator(left._gobj),
--                                             relational_operator(_right._gobj))
--                    x = relational(left._gobj.lhs() - _right._gobj.lhs(),
--                                   left._gobj.rhs() - _right._gobj.rhs(),
--                                   op)
--                else:
--                    x = relational(left._gobj.lhs() - _right._gobj,
--                                   left._gobj.rhs() - _right._gobj,
--                                   relational_operator(left._gobj))
--            elif is_a_relational(_right._gobj):
--                x = relational(left._gobj - _right._gobj.lhs(),
--                               left._gobj - _right._gobj.rhs(),
--                               relational_operator(_right._gobj))
-+        if is_a_relational(left._gobj):
-+            if is_a_relational(_right._gobj):
-+                op = compatible_relation(relational_operator(left._gobj),
-+                                         relational_operator(_right._gobj))
-+                x = relational(left._gobj.lhs() - _right._gobj.lhs(),
-+                               left._gobj.rhs() - _right._gobj.rhs(),
-+                               op)
-             else:
--                x = left._gobj - _right._gobj
--        finally:
--            sig_off()
-+                x = relational(left._gobj.lhs() - _right._gobj,
-+                               left._gobj.rhs() - _right._gobj,
-+                               relational_operator(left._gobj))
-+        elif is_a_relational(_right._gobj):
-+            x = relational(left._gobj - _right._gobj.lhs(),
-+                           left._gobj - _right._gobj.rhs(),
-+                           relational_operator(_right._gobj))
-+        else:
-+            x = left._gobj - _right._gobj
-         return new_Expression_from_GEx(left._parent, x)
- 
-     cpdef _mul_(left, right):
-@@ -3457,29 +3440,25 @@ cdef class Expression(CommutativeRingElement):
-         cdef GEx x
-         cdef Expression _right = <Expression>right
-         cdef operators o
--        sig_on()
--        try:
--            if is_a_relational(left._gobj):
--                if is_a_relational(_right._gobj):
--                    op = compatible_relation(relational_operator(left._gobj),
--                                             relational_operator(_right._gobj))
--                    x = relational(left._gobj.lhs() * _right._gobj.lhs(),
--                                   left._gobj.rhs() * _right._gobj.rhs(),
--                                   op)
--                else:
--                    o = relational_operator(left._gobj)
--                    x = relational(left._gobj.lhs() * _right._gobj,
--                                   left._gobj.rhs() * _right._gobj,
--                                   o)
--            elif is_a_relational(_right._gobj):
--                o = relational_operator(_right._gobj)
--                x = relational(left._gobj * _right._gobj.lhs(),
--                               left._gobj * _right._gobj.rhs(),
--                               o)
-+        if is_a_relational(left._gobj):
-+            if is_a_relational(_right._gobj):
-+                op = compatible_relation(relational_operator(left._gobj),
-+                                         relational_operator(_right._gobj))
-+                x = relational(left._gobj.lhs() * _right._gobj.lhs(),
-+                               left._gobj.rhs() * _right._gobj.rhs(),
-+                               op)
-             else:
--                x = left._gobj * _right._gobj
--        finally:
--            sig_off()
-+                o = relational_operator(left._gobj)
-+                x = relational(left._gobj.lhs() * _right._gobj,
-+                               left._gobj.rhs() * _right._gobj,
-+                               o)
-+        elif is_a_relational(_right._gobj):
-+            o = relational_operator(_right._gobj)
-+            x = relational(left._gobj * _right._gobj.lhs(),
-+                           left._gobj * _right._gobj.rhs(),
-+                           o)
-+        else:
-+            x = left._gobj * _right._gobj
-         return new_Expression_from_GEx(left._parent, x)
- 
-     cpdef _div_(left, right):
-@@ -3553,7 +3532,7 @@ cdef class Expression(CommutativeRingElement):
-             sage: x/0
-             Traceback (most recent call last):
-             ...
--            ZeroDivisionError: Symbolic division by zero
-+            ZeroDivisionError: symbolic division by zero
- 
-         Check if Pynac can compute divisions of Python longs (:trac:`13107`)::
- 
-@@ -3563,7 +3542,6 @@ cdef class Expression(CommutativeRingElement):
-         cdef GEx x
-         cdef Expression _right = <Expression>right
-         cdef operators o
--        sig_on()
-         try:
-             if is_a_relational(left._gobj):
-                 if is_a_relational(_right._gobj):
-@@ -3589,11 +3567,9 @@ cdef class Expression(CommutativeRingElement):
-             # TODO: change this to maybe cleverly do something involving Cython C++ exception handling.
-             # See http://docs.cython.org/docs/wrapping_CPlusPlus.html
-             if 'division by zero' in str(msg):
--                raise ZeroDivisionError("Symbolic division by zero")
-+                raise ZeroDivisionError("symbolic division by zero")
-             else:
-                 raise
--        finally:
--            sig_off()
- 
-     def __invert__(self):
-         """
-@@ -5314,11 +5290,7 @@ cdef class Expression(CommutativeRingElement):
-         for k, v in sdict.iteritems():
-             smap.insert(make_pair((<Expression>self.coerce_in(k))._gobj,
-                                   (<Expression>self.coerce_in(v))._gobj))
--        sig_on()
--        try:
--            res = self._gobj.subs_map(smap, 0)
--        finally:
--            sig_off()
-+        res = self._gobj.subs_map(smap, 0)
-         return new_Expression_from_GEx(self._parent, res)
- 
-     subs = substitute
-@@ -7183,12 +7155,7 @@ cdef class Expression(CommutativeRingElement):
-             x^2 + 2*x + 2
-         """
-         cdef Expression r = self.coerce_in(b)
--        cdef GEx x
--        sig_on()
--        try:
--            x = g_gcd(self._gobj, r._gobj)
--        finally:
--            sig_off()
-+        cdef GEx x = g_gcd(self._gobj, r._gobj)
-         return new_Expression_from_GEx(self._parent, x)
- 
-     def gosper_sum(self, *args):
-@@ -8983,12 +8950,7 @@ cdef class Expression(CommutativeRingElement):
-             sage: t = SR(1).zeta(); t
-             Infinity
-         """
--        cdef GEx x
--        sig_on()
--        try:
--            x = g_hold_wrapper(g_zeta, self._gobj, hold)
--        finally:
--            sig_off()
-+        cdef GEx x = g_hold_wrapper(g_zeta, self._gobj, hold)
-         return new_Expression_from_GEx(self._parent, x)
- 
-     def factorial(self, hold=False):

Copied: sagemath/repos/community-staging-x86_64/sagemath-cypari2.patch (from rev 429641, sagemath/trunk/sagemath-cypari2.patch)
===================================================================
--- sagemath-cypari2.patch	                        (rev 0)
+++ sagemath-cypari2.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,711 @@
+diff --git a/src/sage/matrix/matrix_integer_dense.pxd b/src/sage/matrix/matrix_integer_dense.pxd
+index bc3af7c..5dd2a8e 100644
+--- a/src/sage/matrix/matrix_integer_dense.pxd
++++ b/src/sage/matrix/matrix_integer_dense.pxd
+@@ -30,6 +30,5 @@ cdef class Matrix_integer_dense(Matrix_dense):
+ 
+     cdef Matrix_integer_dense _new(self, Py_ssize_t nrows, Py_ssize_t ncols)
+ 
+-    cdef extract_hnf_from_pari_matrix(self, GEN H, int flag, bint include_zero_rows)
+ 
+ cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=*)
+diff --git a/src/sage/matrix/matrix_integer_dense.pyx b/src/sage/matrix/matrix_integer_dense.pyx
+index 4f0b0e6..87e3391 100644
+--- a/src/sage/matrix/matrix_integer_dense.pyx
++++ b/src/sage/matrix/matrix_integer_dense.pyx
+@@ -87,11 +87,11 @@ from .args cimport SparseEntry, MatrixArgs_init
+ #########################################################
+ # PARI C library
+ from cypari2.gen cimport Gen
++from cypari2.stack cimport clear_stack, new_gen
++from cypari2.paridecl cimport *
+ from sage.libs.pari.convert_gmp cimport INT_to_mpz
+ from sage.libs.pari.convert_flint cimport (_new_GEN_from_fmpz_mat_t,
+            _new_GEN_from_fmpz_mat_t_rotate90, integer_matrix)
+-from cypari2.stack cimport clear_stack
+-from cypari2.paridecl cimport *
+ #########################################################
+ 
+ from sage.arith.multi_modular cimport MultiModularBasis
+@@ -2016,10 +2016,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
+             raise ValueError("transformation matrix only available with p-adic algorithm")
+         elif algorithm in ["pari", "pari0", "pari1", "pari4"]:
+             flag = int(algorithm[-1]) if algorithm != "pari" else 1
+-            if self.height().ndigits() > 10000 or n >= 50:
+-                H_m = self._hnf_pari_big(flag, include_zero_rows=include_zero_rows)
+-            else:
+-                H_m = self._hnf_pari(flag, include_zero_rows=include_zero_rows)
++            H_m = self._hnf_pari(flag, include_zero_rows=include_zero_rows)
+         elif algorithm == 'ntl':
+             if nr != nc:
+                 raise ValueError("ntl only computes HNF for square matrices of full rank.")
+@@ -5664,6 +5661,7 @@ cdef class Matrix_integer_dense(Matrix_dense):
+         matrices.
+ 
+         EXAMPLES::
++
+             sage: matrix(ZZ,3,[1..9])._rank_pari()
+             2
+         """
+@@ -5674,16 +5672,12 @@ cdef class Matrix_integer_dense(Matrix_dense):
+ 
+     def _hnf_pari(self, int flag=0, bint include_zero_rows=True):
+         """
+-        Hermite form of this matrix, computed using PARI.  The
+-        computation is done entirely on the PARI stack, then the PARI
+-        stack is cleared.  This function is only useful for small
+-        matrices, and can crash on large matrices (e.g., if the PARI
+-        stack overflows).
++        Hermite normal form of this matrix, computed using PARI.
+ 
+         INPUT:
+ 
+         - ``flag`` -- 0 (default), 1, 3 or 4 (see docstring for
+-          gp.mathnf).
++          ``pari.mathnf``).
+ 
+         - ``include_zero_rows`` -- boolean. if False, do not include
+           any of the zero rows at the bottom of the matrix in the
+@@ -5733,98 +5727,13 @@ cdef class Matrix_integer_dense(Matrix_dense):
+             sage: pari('mathnf(Mat([0,1]), 4)')
+             [Mat(1), [1, 0; 0, 1]]
+         """
+-        cdef GEN A
+         sig_on()
+         A = _new_GEN_from_fmpz_mat_t_rotate90(self._matrix)
+-        cdef GEN H = mathnf0(A, flag)
+-        B = self.extract_hnf_from_pari_matrix(H, flag, include_zero_rows)
+-        clear_stack()  # This calls sig_off()
+-        return B
+-
+-
+-    def _hnf_pari_big(self, int flag=0, bint include_zero_rows=True):
+-        """
+-        Hermite form of this matrix, computed using PARI.
+-
+-        INPUT:
+-
+-        - ``flag`` -- 0 (default), 1, 3 or 4 (see docstring for
+-          gp.mathnf).
+-
+-        - ``include_zero_rows`` -- boolean. if False, do not include
+-          any of the zero rows at the bottom of the matrix in the
+-          output.
+-
+-        .. NOTE::
+-
+-            In no cases is the transformation matrix returned by this
+-            function.
+-
+-        EXAMPLES::
+-
+-            sage: a = matrix(ZZ,3,3,[1..9])
+-            sage: a._hnf_pari_big(flag=0, include_zero_rows=True)
+-            [1 2 3]
+-            [0 3 6]
+-            [0 0 0]
+-            sage: a._hnf_pari_big(flag=1, include_zero_rows=True)
+-            [1 2 3]
+-            [0 3 6]
+-            [0 0 0]
+-            sage: a._hnf_pari_big(flag=3, include_zero_rows=True)
+-            [1 2 3]
+-            [0 3 6]
+-            [0 0 0]
+-            sage: a._hnf_pari_big(flag=4, include_zero_rows=True)
+-            [1 2 3]
+-            [0 3 6]
+-            [0 0 0]
+-
+-        Check that ``include_zero_rows=False`` works correctly::
+-
+-            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(0, include_zero_rows=False)
+-            [1 2 3]
+-            [0 3 6]
+-            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(1, include_zero_rows=False)
+-            [1 2 3]
+-            [0 3 6]
+-            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(3, include_zero_rows=False)
+-            [1 2 3]
+-            [0 3 6]
+-            sage: matrix(ZZ,3,[1..9])._hnf_pari_big(4, include_zero_rows=False)
+-            [1 2 3]
+-            [0 3 6]
+-        """
+-        cdef Gen H = integer_matrix(self._matrix, 1)
+-        H = H.mathnf(flag)
+-        sig_on()
+-        B = self.extract_hnf_from_pari_matrix(H.g, flag, include_zero_rows)
+-        clear_stack()  # This calls sig_off()
+-        return B
+-
+-    cdef extract_hnf_from_pari_matrix(self, GEN H, int flag, bint include_zero_rows):
+-        # Throw away the transformation matrix (yes, we should later
+-        # code this to keep track of it).
+-        cdef mpz_t tmp
+-        mpz_init(tmp)
+-        if flag > 0:
+-            H = gel(H,1)
+-
+-        # Figure out how many columns we got back.
+-        cdef Py_ssize_t H_nc = glength(H)  # number of columns
+-        # Now get the resulting Hermite form matrix back to Sage, suitably re-arranged.
+-        cdef Matrix_integer_dense B
+-        if include_zero_rows:
+-            B = self.new_matrix()
+-        else:
+-            B = self.new_matrix(nrows=H_nc)
+-        for i in range(self._ncols):
+-            for j in range(H_nc):
+-                INT_to_mpz(tmp, gcoeff(H, i+1, H_nc-j))
+-                fmpz_set_mpz(fmpz_mat_entry(B._matrix,j,self._ncols-i-1),tmp)
+-        mpz_clear(tmp)
+-        return B
+-
++        H = mathnf0(A, flag)
++        if typ(H) == t_VEC:
++            H = gel(H, 1)
++        GenH = new_gen(H)
++        return extract_hnf_from_pari_matrix(self, GenH, include_zero_rows)
+ 
+     def p_minimal_polynomials(self, p, s_max=None):
+         r"""
+@@ -5966,7 +5875,27 @@ cdef inline GEN pari_GEN(Matrix_integer_dense B):
+     return A
+ 
+ 
+-    #####################################################################################
++cdef extract_hnf_from_pari_matrix(Matrix_integer_dense self, Gen H, bint include_zero_rows):
++    cdef mpz_t tmp
++    mpz_init(tmp)
++
++    # Figure out how many columns we got back.
++    cdef long H_nc = glength(H.g)  # number of columns
++    # Now get the resulting Hermite form matrix back to Sage, suitably re-arranged.
++    cdef Matrix_integer_dense B
++    if include_zero_rows:
++        B = self.new_matrix()
++    else:
++        B = self.new_matrix(nrows=H_nc)
++    cdef long i, j
++    for i in range(self._ncols):
++        for j in range(H_nc):
++            sig_check()
++            INT_to_mpz(tmp, gcoeff(H.g, i+1, H_nc-j))
++            fmpz_set_mpz(fmpz_mat_entry(B._matrix,j,self._ncols-i-1),tmp)
++    mpz_clear(tmp)
++    return B
++
+ 
+ cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n):
+     # Clear all columns
+@@ -5990,11 +5919,6 @@ cdef _clear_columns(Matrix_integer_dense A, pivots, Py_ssize_t n):
+     fmpz_clear(t)
+     sig_off()
+ 
+-###############################################################
+-
+-
+-
+-
+ 
+ cpdef _lift_crt(Matrix_integer_dense M, residues, moduli=None):
+     """
+diff --git a/src/sage/modular/modform/eis_series_cython.pyx b/src/sage/modular/modform/eis_series_cython.pyx
+index f7e944c..3557c6b 100644
+--- a/src/sage/modular/modform/eis_series_cython.pyx
++++ b/src/sage/modular/modform/eis_series_cython.pyx
+@@ -3,7 +3,7 @@ Eisenstein Series (optimized compiled functions)
+ """
+ 
+ from cysignals.memory cimport check_allocarray, sig_free
+-from cysignals.signals cimport sig_on, sig_off
++from cysignals.signals cimport sig_check
+ 
+ from sage.rings.rational_field import QQ
+ from sage.rings.power_series_ring import PowerSeriesRing
+@@ -161,8 +161,7 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
+     """
+     cdef mpz_t *val = <mpz_t *>check_allocarray(prec, sizeof(mpz_t))
+     cdef mpz_t one, mult, term, last, term_m1, last_m1
+-    cdef unsigned long int expt
+-    cdef long ind, ppow, int_p
++    cdef long ind
+     cdef int i
+     cdef Fmpz_poly res = Fmpz_poly.__new__(Fmpz_poly)
+ 
+@@ -173,8 +172,6 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
+     if (prec == 0):
+         return Fmpz_poly.__new__(Fmpz_poly)
+ 
+-    sig_on()
+-
+     mpz_init(one)
+     mpz_init(term)
+     mpz_init(last)
+@@ -182,33 +179,33 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
+     mpz_init(term_m1)
+     mpz_init(last_m1)
+ 
+-    for i from 0 <= i < prec :
+-        mpz_init(val[i])
+-        mpz_set_si(val[i], 1)
++    for i in range(prec):
++        mpz_init_set_si(val[i], 1)
+ 
+     mpz_set_si(one, 1)
+ 
+-    expt = <unsigned long int>(k - 1)
+-    a0 = - bernoulli(k) / (2*k)
++    cdef unsigned long expt = k - 1
++    a0 = -bernoulli(k) / (2*k)
+ 
+-    for p in primes(1,prec) :
+-        int_p = int(p)
+-        ppow = <long int>int_p
++    cdef long p, ppow
++    for p in primes(1, prec) :
++        ppow = p
+ 
+-        mpz_set_si(mult, int_p)
++        mpz_set_si(mult, p)
+         mpz_pow_ui(mult, mult, expt)
+         mpz_mul(term, mult, mult)
+         mpz_set(last, mult)
+ 
+-        while (ppow < prec):
++        while ppow < prec:
++            sig_check()
+             ind = ppow
+             mpz_sub(term_m1, term, one)
+             mpz_sub(last_m1, last, one)
+-            while (ind < prec):
++            while ind < prec:
+                 mpz_mul(val[ind], val[ind], term_m1)
+                 mpz_fdiv_q(val[ind], val[ind], last_m1)
+                 ind += ppow
+-            ppow *= int_p
++            ppow *= p
+             mpz_set(last, term)
+             mpz_mul(term, term, mult)
+ 
+@@ -228,6 +225,4 @@ cpdef eisenstein_series_poly(int k, int prec = 10) :
+ 
+     sig_free(val)
+ 
+-    sig_off()
+-
+     return res
+diff --git a/src/sage/plot/complex_plot.pyx b/src/sage/plot/complex_plot.pyx
+index 758fb70..f499a3e 100644
+--- a/src/sage/plot/complex_plot.pyx
++++ b/src/sage/plot/complex_plot.pyx
+@@ -19,7 +19,7 @@ Complex Plots
+ from __future__ import absolute_import
+ 
+ # TODO: use NumPy buffers and complex fast_callable (when supported)
+-from cysignals.signals cimport sig_on, sig_off
++from cysignals.signals cimport sig_on, sig_off, sig_check
+ 
+ cimport numpy as cnumpy
+ 
+@@ -381,12 +381,18 @@ def complex_plot(f, xrange, yrange, **options):
+         pass
+ 
+     cdef double x, y
+-    ignore, ranges = setup_for_eval_on_grid([], [xrange, yrange], options['plot_points'])
+-    xrange,yrange=[r[:2] for r in ranges]
+-    sig_on()
+-    z_values = [[  f(new_CDF_element(x, y)) for x in srange(*ranges[0], include_endpoint=True)]
+-                                            for y in srange(*ranges[1], include_endpoint=True)]
+-    sig_off()
++    _, ranges = setup_for_eval_on_grid([], [xrange, yrange], options['plot_points'])
++    xrange = ranges[0]
++    yrange = ranges[1]
++    cdef list z_values = []
++    cdef list row
++    for y in srange(*yrange, include_endpoint=True):
++        row = []
++        for x in srange(*xrange, include_endpoint=True):
++            sig_check()
++            row.append(f(new_CDF_element(x, y)))
++        z_values.append(row)
++
+     g = Graphics()
+     g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore=['xmin', 'xmax']))
+     g.add_primitive(ComplexPlot(complex_to_rgb(z_values), xrange, yrange, options))
+diff --git a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
+index 84fa0e4..18f8e90 100644
+--- a/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
++++ b/src/sage/rings/asymptotic/asymptotic_expansion_generators.py
+@@ -1095,7 +1095,7 @@ class AsymptoticExpansionGenerators(SageObject):
+             sage: asymptotic_expansions.ImplicitExpansion('Z', phi=lambda u: 1 + 2*u + u^2, tau=2, precision=5)
+             Traceback (most recent call last):
+             ...
+-            ZeroDivisionError: Symbolic division by zero
++            ZeroDivisionError: symbolic division by zero
+             sage: asymptotic_expansions.ImplicitExpansion('Z', phi=lambda u: 1 + 2*u + u^2, tau=3, precision=5)
+             3 - 4*I*sqrt(3)*Z^(-1/2) + 6*I*sqrt(3)*Z^(-3/2) + O(Z^(-2))
+ 
+diff --git a/src/sage/rings/finite_rings/element_pari_ffelt.pyx b/src/sage/rings/finite_rings/element_pari_ffelt.pyx
+index ff73a1f..2fcd3a1 100644
+--- a/src/sage/rings/finite_rings/element_pari_ffelt.pyx
++++ b/src/sage/rings/finite_rings/element_pari_ffelt.pyx
+@@ -869,7 +869,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
+             Univariate Polynomial Ring in beta over Finite Field of size 3
+         """
+         sig_on()
+-        return self._parent.polynomial_ring(name)(new_gen(FF_to_FpXQ_i(self.val)))
++        pol = new_gen(FF_to_FpXQ(self.val))
++        return self._parent.polynomial_ring(name)(pol)
+ 
+     def minpoly(self, var='x'):
+         """
+@@ -887,7 +888,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
+             y^2 + 1
+         """
+         sig_on()
+-        return self._parent.polynomial_ring(var)(new_gen(FF_minpoly(self.val)))
++        pol = new_gen(FF_minpoly(self.val))
++        return self._parent.polynomial_ring(var)(pol)
+ 
+     def charpoly(self, var='x'):
+         """
+@@ -905,7 +907,8 @@ cdef class FiniteFieldElement_pari_ffelt(FinitePolyExtElement):
+             y^2 + 1
+         """
+         sig_on()
+-        return self._parent.polynomial_ring(var)(new_gen(FF_charpoly(self.val)))
++        pol = new_gen(FF_charpoly(self.val))
++        return self._parent.polynomial_ring(var)(pol)
+ 
+     def is_square(self):
+         """
+diff --git a/src/sage/rings/integer.pyx b/src/sage/rings/integer.pyx
+index 17e62f3..9e99bde 100644
+--- a/src/sage/rings/integer.pyx
++++ b/src/sage/rings/integer.pyx
+@@ -6806,6 +6806,7 @@ cdef class Integer(sage.structure.element.EuclideanDomainElement):
+             ....:         (2^100).binomial(2^22, algorithm='pari')
+             ....:     except AlarmInterrupt:
+             ....:         pass
++            doctest:...: RuntimeWarning: cypari2 leaked ... bytes on the PARI stack...
+         """
+         cdef Integer x
+         cdef Integer mm
+diff --git a/src/sage/rings/number_field/maps.py b/src/sage/rings/number_field/maps.py
+index 1727c13..5717227 100644
+--- a/src/sage/rings/number_field/maps.py
++++ b/src/sage/rings/number_field/maps.py
+@@ -358,7 +358,7 @@ class MapRelativeNumberFieldToRelativeVectorSpace(NumberFieldIsomorphism):
+             g = g(beta).lift()
+         # Convert the coefficients to elements of the base field.
+         B, from_B, _ = K.absolute_base_field()
+-        return self.codomain()([from_B(B(z.lift(), check=False)) for z in g.Vecrev(-K.relative_degree())])
++        return self.codomain()([from_B(B(z.lift(), check=False)) for z in g.Vecrev(K.relative_degree())])
+ 
+ 
+ class NameChangeMap(NumberFieldIsomorphism):
+diff --git a/src/sage/rings/polynomial/polynomial_element.pyx b/src/sage/rings/polynomial/polynomial_element.pyx
+index a711e94..20895c0 100644
+--- a/src/sage/rings/polynomial/polynomial_element.pyx
++++ b/src/sage/rings/polynomial/polynomial_element.pyx
+@@ -4363,8 +4363,7 @@ cdef class Polynomial(CommutativeAlgebraElement):
+             sage: G.prod() == g
+             True
+         """
+-        pols = G[0]
+-        exps = G[1]
++        pols, exps = G
+         R = self._parent
+         F = [(R(f), int(e)) for f, e in zip(pols, exps)]
+ 
+diff --git a/src/sage/rings/power_series_pari.pyx b/src/sage/rings/power_series_pari.pyx
+index e37e0a3..2e03ade 100644
+--- a/src/sage/rings/power_series_pari.pyx
++++ b/src/sage/rings/power_series_pari.pyx
+@@ -678,7 +678,8 @@ cdef class PowerSeries_pari(PowerSeries):
+             g = g.truncate()
+         if typ(g.g) == t_POL and varn(g.g) == vn:
+             # t_POL has 2 codewords.  Use new_ref instead of g[i] for speed.
+-            return [R(g.new_ref(gel(g.g, i))) for i in range(2, lg(g.g))]
++            G = g.fixGEN()
++            return [R(g.new_ref(gel(G, i))) for i in range(2, lg(G))]
+         else:
+             return [R(g)]
+ 
+@@ -729,6 +730,7 @@ cdef class PowerSeries_pari(PowerSeries):
+             return []
+ 
+         cdef pari_gen g = self.g
++        g.fixGEN()
+         cdef long l, m
+ 
+         R = self.base_ring()
+diff --git a/src/sage/rings/real_mpfr.pyx b/src/sage/rings/real_mpfr.pyx
+index e273190..3b89f4b 100644
+--- a/src/sage/rings/real_mpfr.pyx
++++ b/src/sage/rings/real_mpfr.pyx
+@@ -3212,7 +3212,6 @@ cdef class RealNumber(sage.structure.element.RingElement):
+         # by using internal interfaces of MPFR, which are documented
+         # as subject-to-change.
+ 
+-        sig_on()
+         if mpfr_nan_p(self.value) or mpfr_inf_p(self.value):
+             raise ValueError('Cannot convert NaN or infinity to Pari float')
+ 
+@@ -3234,6 +3233,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
+         cdef mp_exp_t exponent
+         cdef GEN pari_float
+ 
++        sig_on()
+         if mpfr_zero_p(self.value):
+             pari_float = real_0_bit(-rounded_prec)
+         else:
+@@ -3245,7 +3245,7 @@ cdef class RealNumber(sage.structure.element.RingElement):
+             # Create a PARI REAL
+             pari_float = cgetr(2 + rounded_prec / wordsize)
+             pari_float[1] = evalexpo(exponent + rounded_prec - 1) + evalsigne(mpfr_sgn(self.value))
+-            mpz_export(&pari_float[2], NULL, 1, wordsize/8, 0, 0, mantissa)
++            mpz_export(&pari_float[2], NULL, 1, wordsize // 8, 0, 0, mantissa)
+             mpz_clear(mantissa)
+ 
+         return new_gen(pari_float)
+diff --git a/src/sage/symbolic/expression.pyx b/src/sage/symbolic/expression.pyx
+index 586d4ab..c14b9a6 100644
+--- a/src/sage/symbolic/expression.pyx
++++ b/src/sage/symbolic/expression.pyx
+@@ -1273,12 +1273,7 @@ cdef class Expression(CommutativeRingElement):
+             sage: f._convert({'parent':int})
+             0
+         """
+-        cdef GEx res
+-        sig_on()
+-        try:
+-            res = self._gobj.evalf(0, kwds)
+-        finally:
+-            sig_off()
++        cdef GEx res = self._gobj.evalf(0, kwds)
+         return new_Expression_from_GEx(self._parent, res)
+ 
+     def _mpfr_(self, R):
+@@ -2839,11 +2834,7 @@ cdef class Expression(CommutativeRingElement):
+             # constants are wrappers around Sage objects, compare directly
+             if is_a_constant(self._gobj.lhs()) and is_a_constant(self._gobj.rhs()):
+                 return self.operator()(self.lhs().pyobject(), self.rhs().pyobject())
+-            sig_on()
+-            try:
+-                pynac_result = decide_relational(self._gobj)
+-            finally:
+-                sig_off()
++            pynac_result = decide_relational(self._gobj)
+             if pynac_result == relational_undecidable:
+                 raise ValueError('undecidable relation: ' + repr(self))
+ 
+@@ -3233,27 +3224,23 @@ cdef class Expression(CommutativeRingElement):
+         cdef GEx x
+         cdef Expression _right = <Expression>right
+         cdef operators op
+-        sig_on()
+-        try:
+-            if is_a_relational(left._gobj):
+-                if is_a_relational(_right._gobj):
+-                    op = compatible_relation(relational_operator(left._gobj),
+-                                             relational_operator(_right._gobj))
+-                    x = relational(left._gobj.lhs() + _right._gobj.lhs(),
+-                                   left._gobj.rhs() + _right._gobj.rhs(),
+-                                   op)
+-                else:
+-                    x = relational(left._gobj.lhs() + _right._gobj,
+-                                   left._gobj.rhs() + _right._gobj,
+-                                   relational_operator(left._gobj))
+-            elif is_a_relational(_right._gobj):
+-                x = relational(left._gobj + _right._gobj.lhs(),
+-                               left._gobj + _right._gobj.rhs(),
+-                               relational_operator(_right._gobj))
++        if is_a_relational(left._gobj):
++            if is_a_relational(_right._gobj):
++                op = compatible_relation(relational_operator(left._gobj),
++                                         relational_operator(_right._gobj))
++                x = relational(left._gobj.lhs() + _right._gobj.lhs(),
++                               left._gobj.rhs() + _right._gobj.rhs(),
++                               op)
+             else:
+-                x = left._gobj + _right._gobj
+-        finally:
+-            sig_off()
++                x = relational(left._gobj.lhs() + _right._gobj,
++                               left._gobj.rhs() + _right._gobj,
++                               relational_operator(left._gobj))
++        elif is_a_relational(_right._gobj):
++            x = relational(left._gobj + _right._gobj.lhs(),
++                           left._gobj + _right._gobj.rhs(),
++                           relational_operator(_right._gobj))
++        else:
++            x = left._gobj + _right._gobj
+         return new_Expression_from_GEx(left._parent, x)
+ 
+     cpdef _sub_(left, right):
+@@ -3289,27 +3276,23 @@ cdef class Expression(CommutativeRingElement):
+         """
+         cdef GEx x
+         cdef Expression _right = <Expression>right
+-        sig_on()
+-        try:
+-            if is_a_relational(left._gobj):
+-                if is_a_relational(_right._gobj):
+-                    op = compatible_relation(relational_operator(left._gobj),
+-                                             relational_operator(_right._gobj))
+-                    x = relational(left._gobj.lhs() - _right._gobj.lhs(),
+-                                   left._gobj.rhs() - _right._gobj.rhs(),
+-                                   op)
+-                else:
+-                    x = relational(left._gobj.lhs() - _right._gobj,
+-                                   left._gobj.rhs() - _right._gobj,
+-                                   relational_operator(left._gobj))
+-            elif is_a_relational(_right._gobj):
+-                x = relational(left._gobj - _right._gobj.lhs(),
+-                               left._gobj - _right._gobj.rhs(),
+-                               relational_operator(_right._gobj))
++        if is_a_relational(left._gobj):
++            if is_a_relational(_right._gobj):
++                op = compatible_relation(relational_operator(left._gobj),
++                                         relational_operator(_right._gobj))
++                x = relational(left._gobj.lhs() - _right._gobj.lhs(),
++                               left._gobj.rhs() - _right._gobj.rhs(),
++                               op)
+             else:
+-                x = left._gobj - _right._gobj
+-        finally:
+-            sig_off()
++                x = relational(left._gobj.lhs() - _right._gobj,
++                               left._gobj.rhs() - _right._gobj,
++                               relational_operator(left._gobj))
++        elif is_a_relational(_right._gobj):
++            x = relational(left._gobj - _right._gobj.lhs(),
++                           left._gobj - _right._gobj.rhs(),
++                           relational_operator(_right._gobj))
++        else:
++            x = left._gobj - _right._gobj
+         return new_Expression_from_GEx(left._parent, x)
+ 
+     cpdef _mul_(left, right):
+@@ -3457,29 +3440,25 @@ cdef class Expression(CommutativeRingElement):
+         cdef GEx x
+         cdef Expression _right = <Expression>right
+         cdef operators o
+-        sig_on()
+-        try:
+-            if is_a_relational(left._gobj):
+-                if is_a_relational(_right._gobj):
+-                    op = compatible_relation(relational_operator(left._gobj),
+-                                             relational_operator(_right._gobj))
+-                    x = relational(left._gobj.lhs() * _right._gobj.lhs(),
+-                                   left._gobj.rhs() * _right._gobj.rhs(),
+-                                   op)
+-                else:
+-                    o = relational_operator(left._gobj)
+-                    x = relational(left._gobj.lhs() * _right._gobj,
+-                                   left._gobj.rhs() * _right._gobj,
+-                                   o)
+-            elif is_a_relational(_right._gobj):
+-                o = relational_operator(_right._gobj)
+-                x = relational(left._gobj * _right._gobj.lhs(),
+-                               left._gobj * _right._gobj.rhs(),
+-                               o)
++        if is_a_relational(left._gobj):
++            if is_a_relational(_right._gobj):
++                op = compatible_relation(relational_operator(left._gobj),
++                                         relational_operator(_right._gobj))
++                x = relational(left._gobj.lhs() * _right._gobj.lhs(),
++                               left._gobj.rhs() * _right._gobj.rhs(),
++                               op)
+             else:
+-                x = left._gobj * _right._gobj
+-        finally:
+-            sig_off()
++                o = relational_operator(left._gobj)
++                x = relational(left._gobj.lhs() * _right._gobj,
++                               left._gobj.rhs() * _right._gobj,
++                               o)
++        elif is_a_relational(_right._gobj):
++            o = relational_operator(_right._gobj)
++            x = relational(left._gobj * _right._gobj.lhs(),
++                           left._gobj * _right._gobj.rhs(),
++                           o)
++        else:
++            x = left._gobj * _right._gobj
+         return new_Expression_from_GEx(left._parent, x)
+ 
+     cpdef _div_(left, right):
+@@ -3553,7 +3532,7 @@ cdef class Expression(CommutativeRingElement):
+             sage: x/0
+             Traceback (most recent call last):
+             ...
+-            ZeroDivisionError: Symbolic division by zero
++            ZeroDivisionError: symbolic division by zero
+ 
+         Check if Pynac can compute divisions of Python longs (:trac:`13107`)::
+ 
+@@ -3563,7 +3542,6 @@ cdef class Expression(CommutativeRingElement):
+         cdef GEx x
+         cdef Expression _right = <Expression>right
+         cdef operators o
+-        sig_on()
+         try:
+             if is_a_relational(left._gobj):
+                 if is_a_relational(_right._gobj):
+@@ -3589,11 +3567,9 @@ cdef class Expression(CommutativeRingElement):
+             # TODO: change this to maybe cleverly do something involving Cython C++ exception handling.
+             # See http://docs.cython.org/docs/wrapping_CPlusPlus.html
+             if 'division by zero' in str(msg):
+-                raise ZeroDivisionError("Symbolic division by zero")
++                raise ZeroDivisionError("symbolic division by zero")
+             else:
+                 raise
+-        finally:
+-            sig_off()
+ 
+     def __invert__(self):
+         """
+@@ -5314,11 +5290,7 @@ cdef class Expression(CommutativeRingElement):
+         for k, v in sdict.iteritems():
+             smap.insert(make_pair((<Expression>self.coerce_in(k))._gobj,
+                                   (<Expression>self.coerce_in(v))._gobj))
+-        sig_on()
+-        try:
+-            res = self._gobj.subs_map(smap, 0)
+-        finally:
+-            sig_off()
++        res = self._gobj.subs_map(smap, 0)
+         return new_Expression_from_GEx(self._parent, res)
+ 
+     subs = substitute
+@@ -7183,12 +7155,7 @@ cdef class Expression(CommutativeRingElement):
+             x^2 + 2*x + 2
+         """
+         cdef Expression r = self.coerce_in(b)
+-        cdef GEx x
+-        sig_on()
+-        try:
+-            x = g_gcd(self._gobj, r._gobj)
+-        finally:
+-            sig_off()
++        cdef GEx x = g_gcd(self._gobj, r._gobj)
+         return new_Expression_from_GEx(self._parent, x)
+ 
+     def gosper_sum(self, *args):
+@@ -8983,12 +8950,7 @@ cdef class Expression(CommutativeRingElement):
+             sage: t = SR(1).zeta(); t
+             Infinity
+         """
+-        cdef GEx x
+-        sig_on()
+-        try:
+-            x = g_hold_wrapper(g_zeta, self._gobj, hold)
+-        finally:
+-            sig_off()
++        cdef GEx x = g_hold_wrapper(g_zeta, self._gobj, hold)
+         return new_Expression_from_GEx(self._parent, x)
+ 
+     def factorial(self, hold=False):

Deleted: sagemath-ecl-sigfpe.patch
===================================================================
--- sagemath-ecl-sigfpe.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-ecl-sigfpe.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,147 +0,0 @@
-diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx
-index e408866..fa24ac0 100644
---- a/src/sage/libs/ecl.pyx
-+++ b/src/sage/libs/ecl.pyx
-@@ -16,7 +16,7 @@ from __future__ import print_function, absolute_import
- #adapted to work with pure Python types.
- 
- from libc.stdlib cimport abort
--from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD
-+from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD, SIGFPE
- from libc.signal cimport raise_ as signal_raise
- from posix.signal cimport sigaction, sigaction_t
- cimport cysignals.signals
-@@ -48,9 +48,14 @@ cdef extern from "eclsig.h":
-     void ecl_sig_off()
-     cdef sigaction_t ecl_sigint_handler
-     cdef sigaction_t ecl_sigbus_handler
-+    cdef sigaction_t ecl_sigfpe_handler
-     cdef sigaction_t ecl_sigsegv_handler
-     cdef mpz_t ecl_mpz_from_bignum(cl_object obj)
-     cdef cl_object ecl_bignum_from_mpz(mpz_t num)
-+    cdef int fegetexcept()
-+    cdef int feenableexcept(int)
-+    cdef int fedisableexcept(int)
-+    cdef int ecl_feflags
- 
- cdef cl_object string_to_object(char * s):
-     return ecl_read_from_cstring(s)
-@@ -239,6 +244,7 @@ def init_ecl():
-     global ecl_has_booted
-     cdef char *argv[1]
-     cdef sigaction_t sage_action[32]
-+    cdef int sage_fpes
-     cdef int i
- 
-     if ecl_has_booted:
-@@ -258,6 +264,8 @@ def init_ecl():
-     for i in range(1,32):
-         sigaction(i, NULL, &sage_action[i])
- 
-+    sage_fpes = fegetexcept()
-+
-     #initialize ECL
-     ecl_set_option(ECL_OPT_SIGNAL_HANDLING_THREAD, 0)
-     cl_boot(1, argv)
-@@ -265,8 +273,12 @@ def init_ecl():
-     #save signal handler from ECL
-     sigaction(SIGINT, NULL, &ecl_sigint_handler)
-     sigaction(SIGBUS, NULL, &ecl_sigbus_handler)
-+    sigaction(SIGFPE, NULL, &ecl_sigfpe_handler)
-     sigaction(SIGSEGV, NULL, &ecl_sigsegv_handler)
- 
-+    #save ECL's floating point exception flags
-+    ecl_feflags = fegetexcept()
-+
-     #verify that no SIGCHLD handler was installed
-     cdef sigaction_t sig_test
-     sigaction(SIGCHLD, NULL, &sig_test)
-@@ -277,6 +289,9 @@ def init_ecl():
-     for i in range(1,32):
-         sigaction(i, &sage_action[i], NULL)
- 
-+    fedisableexcept(ecl_feflags)
-+    feenableexcept(sage_fpes)
-+
-     #initialise list of objects and bind to global variable
-     # *SAGE-LIST-OF-OBJECTS* to make it rooted in the reachable tree for the GC
-     list_of_objects=cl_cons(Cnil,cl_cons(Cnil,Cnil))
-@@ -320,7 +335,6 @@ def init_ecl():
-                     (values nil (princ-to-string cnd)))))
-         """))
-     safe_funcall_clobj=cl_eval(string_to_object(b"(symbol-function 'sage-safe-funcall)"))
--
-     ecl_has_booted = 1
- 
- cdef cl_object ecl_safe_eval(cl_object form) except NULL:
-diff --git a/src/sage/libs/eclsig.h b/src/sage/libs/eclsig.h
-index f9f2690..a7e1f40 100644
---- a/src/sage/libs/eclsig.h
-+++ b/src/sage/libs/eclsig.h
-@@ -9,24 +9,66 @@
- 
- 
- #include <signal.h>
-+
-+/* Rummage around to determine how ECL was configured */
-+#define ECL_AVOID_FPE_H  /* Prevent some local includes */
-+#include <ecl/config-internal.h>
-+
-+#ifdef HAVE_FENV_H
-+#include <fenv.h>
-+#ifndef FE_ALL_EXCEPT
-+#define FE_ALL_EXCEPT FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID
-+#endif
-+#else
-+#ifndef FE_ALL_EXCEPT
-+#define FE_ALL_EXCEPT 0
-+#endif
-+#define feclearexcept(flags) do {} while (0)
-+#endif
-+
-+#ifndef HAVE_FEENABLEEXCEPT
-+/* These are GNU extensions */
-+#define fegetexcept() 0
-+#define feenablexcept(flags) do {} while (0)
-+#define fdisableexcept(flags) do {} while (0)
-+#endif
-+
- static struct sigaction ecl_sigint_handler;
- static struct sigaction ecl_sigbus_handler;
-+static struct sigaction ecl_sigfpe_handler;
- static struct sigaction ecl_sigsegv_handler;
- static struct sigaction sage_sigint_handler;
- static struct sigaction sage_sigbus_handler;
-+static struct sigaction sage_sigfpe_handler;
- static struct sigaction sage_sigsegv_handler;
-+static int ecl_feflags;
-+static int sage_feflags;
- 
- static inline void set_ecl_signal_handler(void)
- {
-     sigaction(SIGINT, &ecl_sigint_handler, &sage_sigint_handler);
-     sigaction(SIGBUS, &ecl_sigbus_handler, &sage_sigbus_handler);
-+    sigaction(SIGFPE, &ecl_sigfpe_handler, &sage_sigfpe_handler);
-     sigaction(SIGSEGV, &ecl_sigsegv_handler, &sage_sigsegv_handler);
-+
-+    /* first clear pending floating point exceptions, if any */
-+    feclearexcept(FE_ALL_EXCEPT);
-+
-+    /* sage_feflags should be 0; we don't set them otherwise */
-+    sage_feflags = fedisableexcept(FE_ALL_EXCEPT);
-+    feenableexcept(ecl_feflags);
- }
- 
- static inline void unset_ecl_signal_handler(void)
- {
-+    /* clear pending exceptions and restore previous exception mask */
-+    feclearexcept(FE_ALL_EXCEPT);
-+    ecl_feflags = fedisableexcept(FE_ALL_EXCEPT);
-+    feenableexcept(sage_feflags);
-+
-     sigaction(SIGINT, &sage_sigint_handler, NULL);
-     sigaction(SIGBUS, &sage_sigbus_handler, NULL);
-+    sigaction(SIGFPE, &sage_sigfpe_handler, NULL);
-     sigaction(SIGSEGV, &sage_sigsegv_handler, NULL);
- }
- 

Copied: sagemath/repos/community-staging-x86_64/sagemath-ecl-sigfpe.patch (from rev 429641, sagemath/trunk/sagemath-ecl-sigfpe.patch)
===================================================================
--- sagemath-ecl-sigfpe.patch	                        (rev 0)
+++ sagemath-ecl-sigfpe.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,147 @@
+diff --git a/src/sage/libs/ecl.pyx b/src/sage/libs/ecl.pyx
+index e408866..fa24ac0 100644
+--- a/src/sage/libs/ecl.pyx
++++ b/src/sage/libs/ecl.pyx
+@@ -16,7 +16,7 @@ from __future__ import print_function, absolute_import
+ #adapted to work with pure Python types.
+ 
+ from libc.stdlib cimport abort
+-from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD
++from libc.signal cimport SIGINT, SIGBUS, SIGSEGV, SIGCHLD, SIGFPE
+ from libc.signal cimport raise_ as signal_raise
+ from posix.signal cimport sigaction, sigaction_t
+ cimport cysignals.signals
+@@ -48,9 +48,14 @@ cdef extern from "eclsig.h":
+     void ecl_sig_off()
+     cdef sigaction_t ecl_sigint_handler
+     cdef sigaction_t ecl_sigbus_handler
++    cdef sigaction_t ecl_sigfpe_handler
+     cdef sigaction_t ecl_sigsegv_handler
+     cdef mpz_t ecl_mpz_from_bignum(cl_object obj)
+     cdef cl_object ecl_bignum_from_mpz(mpz_t num)
++    cdef int fegetexcept()
++    cdef int feenableexcept(int)
++    cdef int fedisableexcept(int)
++    cdef int ecl_feflags
+ 
+ cdef cl_object string_to_object(char * s):
+     return ecl_read_from_cstring(s)
+@@ -239,6 +244,7 @@ def init_ecl():
+     global ecl_has_booted
+     cdef char *argv[1]
+     cdef sigaction_t sage_action[32]
++    cdef int sage_fpes
+     cdef int i
+ 
+     if ecl_has_booted:
+@@ -258,6 +264,8 @@ def init_ecl():
+     for i in range(1,32):
+         sigaction(i, NULL, &sage_action[i])
+ 
++    sage_fpes = fegetexcept()
++
+     #initialize ECL
+     ecl_set_option(ECL_OPT_SIGNAL_HANDLING_THREAD, 0)
+     cl_boot(1, argv)
+@@ -265,8 +273,12 @@ def init_ecl():
+     #save signal handler from ECL
+     sigaction(SIGINT, NULL, &ecl_sigint_handler)
+     sigaction(SIGBUS, NULL, &ecl_sigbus_handler)
++    sigaction(SIGFPE, NULL, &ecl_sigfpe_handler)
+     sigaction(SIGSEGV, NULL, &ecl_sigsegv_handler)
+ 
++    #save ECL's floating point exception flags
++    ecl_feflags = fegetexcept()
++
+     #verify that no SIGCHLD handler was installed
+     cdef sigaction_t sig_test
+     sigaction(SIGCHLD, NULL, &sig_test)
+@@ -277,6 +289,9 @@ def init_ecl():
+     for i in range(1,32):
+         sigaction(i, &sage_action[i], NULL)
+ 
++    fedisableexcept(ecl_feflags)
++    feenableexcept(sage_fpes)
++
+     #initialise list of objects and bind to global variable
+     # *SAGE-LIST-OF-OBJECTS* to make it rooted in the reachable tree for the GC
+     list_of_objects=cl_cons(Cnil,cl_cons(Cnil,Cnil))
+@@ -320,7 +335,6 @@ def init_ecl():
+                     (values nil (princ-to-string cnd)))))
+         """))
+     safe_funcall_clobj=cl_eval(string_to_object(b"(symbol-function 'sage-safe-funcall)"))
+-
+     ecl_has_booted = 1
+ 
+ cdef cl_object ecl_safe_eval(cl_object form) except NULL:
+diff --git a/src/sage/libs/eclsig.h b/src/sage/libs/eclsig.h
+index f9f2690..a7e1f40 100644
+--- a/src/sage/libs/eclsig.h
++++ b/src/sage/libs/eclsig.h
+@@ -9,24 +9,66 @@
+ 
+ 
+ #include <signal.h>
++
++/* Rummage around to determine how ECL was configured */
++#define ECL_AVOID_FPE_H  /* Prevent some local includes */
++#include <ecl/config-internal.h>
++
++#ifdef HAVE_FENV_H
++#include <fenv.h>
++#ifndef FE_ALL_EXCEPT
++#define FE_ALL_EXCEPT FE_DIVBYZERO | FE_OVERFLOW | FE_UNDERFLOW | FE_INVALID
++#endif
++#else
++#ifndef FE_ALL_EXCEPT
++#define FE_ALL_EXCEPT 0
++#endif
++#define feclearexcept(flags) do {} while (0)
++#endif
++
++#ifndef HAVE_FEENABLEEXCEPT
++/* These are GNU extensions */
++#define fegetexcept() 0
++#define feenablexcept(flags) do {} while (0)
++#define fdisableexcept(flags) do {} while (0)
++#endif
++
+ static struct sigaction ecl_sigint_handler;
+ static struct sigaction ecl_sigbus_handler;
++static struct sigaction ecl_sigfpe_handler;
+ static struct sigaction ecl_sigsegv_handler;
+ static struct sigaction sage_sigint_handler;
+ static struct sigaction sage_sigbus_handler;
++static struct sigaction sage_sigfpe_handler;
+ static struct sigaction sage_sigsegv_handler;
++static int ecl_feflags;
++static int sage_feflags;
+ 
+ static inline void set_ecl_signal_handler(void)
+ {
+     sigaction(SIGINT, &ecl_sigint_handler, &sage_sigint_handler);
+     sigaction(SIGBUS, &ecl_sigbus_handler, &sage_sigbus_handler);
++    sigaction(SIGFPE, &ecl_sigfpe_handler, &sage_sigfpe_handler);
+     sigaction(SIGSEGV, &ecl_sigsegv_handler, &sage_sigsegv_handler);
++
++    /* first clear pending floating point exceptions, if any */
++    feclearexcept(FE_ALL_EXCEPT);
++
++    /* sage_feflags should be 0; we don't set them otherwise */
++    sage_feflags = fedisableexcept(FE_ALL_EXCEPT);
++    feenableexcept(ecl_feflags);
+ }
+ 
+ static inline void unset_ecl_signal_handler(void)
+ {
++    /* clear pending exceptions and restore previous exception mask */
++    feclearexcept(FE_ALL_EXCEPT);
++    ecl_feflags = fedisableexcept(FE_ALL_EXCEPT);
++    feenableexcept(sage_feflags);
++
+     sigaction(SIGINT, &sage_sigint_handler, NULL);
+     sigaction(SIGBUS, &sage_sigbus_handler, NULL);
++    sigaction(SIGFPE, &sage_sigfpe_handler, NULL);
+     sigaction(SIGSEGV, &sage_sigsegv_handler, NULL);
+ }
+ 

Deleted: sagemath-env.patch
===================================================================
--- sagemath-env.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-env.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,162 +0,0 @@
---- src/bin/sage-env.orig	2015-01-06 10:46:04.469687605 +0100
-+++ src/bin/sage-env	2015-01-06 10:49:59.547762019 +0100
-@@ -111,41 +111,7 @@
- }
- 
- 
--# New value for SAGE_ROOT: either SAGE_ROOT (if given)
--# or a guessed value based on pwd.
--if [ -n "$SAGE_ROOT" ]; then
--    NEW_SAGE_ROOT="$SAGE_ROOT"
--elif [ -f sage -a -d build ]; then
--    NEW_SAGE_ROOT="."
--elif [ -f ../../sage -a -d ../../build ]; then
--    NEW_SAGE_ROOT="../.."
--else
--    # No idea what SAGE_ROOT should be...
--    echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
--    echo >&2 "script from the SAGE_ROOT or SAGE_ROOT/local/bin/ directory."
--    return 1
--fi
--
--# Make NEW_SAGE_ROOT absolute
--NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
--
--# Sanity check NEW_SAGE_ROOT
--if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
--    :
--else
--    echo >&2 "Error: SAGE_ROOT is set to a bad value:"
--    echo >&2 "SAGE_ROOT=$SAGE_ROOT"
--    echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
--    echo >&2 "or SAGE_ROOT/local/bin/ directory."
--    return 1
--fi
--
--# Warn if NEW_SAGE_ROOT does not equal the old SAGE_ROOT
--if [ "$SAGE_ROOT" != "$NEW_SAGE_ROOT" -a -n "$SAGE_ROOT" ]; then
--    echo >&2 "Warning: overwriting SAGE_ROOT environment variable:"
--    echo >&2 "Old SAGE_ROOT=$SAGE_ROOT"
--    echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
--fi
-+NEW_SAGE_ROOT="/usr"
- 
- 
- # Don't execute the commands more than once for the same version of
-@@ -174,33 +174,9 @@
- export SAGE_ENV_SOURCED=$SAGE_ENV_VERSION
- 
- export SAGE_ROOT="$NEW_SAGE_ROOT"
-+export SAGE_LOCAL='/usr'
-+export SAGE_SCRIPTS_DIR='/usr/bin'
- 
--
--# sage-env must know where the Sage's script files are.
--# Note that SAGE_SCRIPTS_DIR is only used here, so it does not need to
--# be exported.
--if [ -z "$SAGE_SCRIPTS_DIR" ]; then
--    if [ -n "$SAGE_LOCAL" ] && [ -f "$SAGE_LOCAL/bin/sage-env-config" ]; then
--        SAGE_SCRIPTS_DIR="$SAGE_LOCAL/bin"
--    elif [ -f "$SAGE_ROOT/src/bin/sage-env-config" ]; then
--        SAGE_SCRIPTS_DIR="$SAGE_ROOT/src/bin"
--    else
--        echo >&2 "Error: You must set either the SAGE_LOCAL or SAGE_SCRIPTS_DIR environment variable to run this"
--        return 1
--    fi
--elif [ ! -f "$SAGE_SCRIPTS_DIR/sage-env-config" ]; then
--    echo >&2 "Error: SAGE_SCRIPTS_DIR is set to a bad value:"
--    echo >&2 "SAGE_SCRIPTS_DIR=$SAGE_SCRIPTS_DIR"
--    echo >&2 "You must correct it or erase it and rerun this script"
--    return 1
--fi
--
--# Set environment variables (like SAGE_LOCAL) depending on ./configure
--. "$SAGE_SCRIPTS_DIR/sage-env-config"
--if [ $? -ne 0 ]; then
--    echo >&2 "Error: failed to source $SAGE_SCRIPTS_DIR/sage-env-config"
--    return 1
--fi
- 
- # The compilers are set in order of priority by
- # 1) environment variables
-@@ -296,8 +296,8 @@
- export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
- export SAGE_SPKG_SCRIPTS="$SAGE_LOCAL/var/lib/sage/scripts"
- export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
--export SAGE_SRC="$SAGE_ROOT/src"
--export SAGE_DOC_SRC="$SAGE_SRC/doc"
-+export SAGE_SRC="$SAGE_LOCAL/lib/python2.7/site-packages"
-+export SAGE_DOC_SRC="$SAGE_SHARE/doc/sage"
- export SAGE_DOC="$SAGE_SHARE/doc/sage"
- 
- if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
-@@ -409,29 +409,8 @@
-     export SAGE_STARTUP_FILE
- fi
- 
-+export LIBMTX="$DOT_SAGE/meataxe"
-+[[ -d $LIBMTX ]] || mkdir -p $LIBMTX # Create meataxe data dir
--if [ "$PYTHON_EGG_CACHE" = "" ]; then
--    PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
--    export PYTHON_EGG_CACHE
--fi
--
--# Set PYTHONUSERBASE to avoid picking up non-Sage versions of
--# Matplotlib, numpy, etc. See http://trac.sagemath.org/ticket/19612.
--#
--# For more history (it used to be PYTHONNOUSERSITE=yes which killed
--# the ability to do "sage -pip install PACKAGE --user"), see
--# http://trac.sagemath.org/ticket/14243 and
--# http://trac.sagemath.org/ticket/18955.
--
--if [ "$PYTHONUSERBASE" = "" ]; then
--    PYTHONUSERBASE="$DOT_SAGE/local"
--    export PYTHONUSERBASE
--fi
--
--if [ -n "$PYTHONHOME" ]; then
--    >&2 echo "Warning: PYTHONHOME must not be set when running Sage, clearing env..."
--    unset PYTHONHOME
--fi
--
- LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
- export LDFLAGS
- 
-@@ -495,8 +495,6 @@
-     fi
- fi
-
--export MAXIMA_PREFIX="$SAGE_LOCAL"
--export MAXIMA_USERDIR="$DOT_SAGE/maxima"
- 
- PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
- 
-@@ -607,9 +607,6 @@
-     LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
- fi
- 
--# See trac 7186 -- this is needed if ecl is moved
--ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
--
- # Handle parallel building/testing/...
- # See Trac Ticket #12016
- # First, figure out the right values for SAGE_NUM_THREADS (default
---- src/sage/env.py.orig       2017-12-07 19:51:25.554281539 +0000
-+++ src/sage/env.py    2017-12-07 19:51:42.787654650 +0000
-@@ -117,13 +117,13 @@
- _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid())
- 
- # bunch of sage directories and files
--_add_variable_or_fallback('SAGE_ROOT',       None)
--_add_variable_or_fallback('SAGE_LOCAL',      None)
-+_add_variable_or_fallback('SAGE_ROOT',       '')
-+_add_variable_or_fallback('SAGE_LOCAL',      '/usr')
- _add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
- _add_variable_or_fallback('SAGE_INC',        opj('$SAGE_LOCAL', 'include'))
- _add_variable_or_fallback('SAGE_SHARE',      opj('$SAGE_LOCAL', 'share'))
- 
--_add_variable_or_fallback('SAGE_SRC',        opj('$SAGE_ROOT', 'src'))
-+_add_variable_or_fallback('SAGE_SRC',        opj('$SAGE_LOCAL', 'lib', 'python2.7', 'site-packages'))
- 
- try:
-     sitepackages_dirs = site.getsitepackages()

Copied: sagemath/repos/community-staging-x86_64/sagemath-env.patch (from rev 429641, sagemath/trunk/sagemath-env.patch)
===================================================================
--- sagemath-env.patch	                        (rev 0)
+++ sagemath-env.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,162 @@
+--- src/bin/sage-env.orig	2015-01-06 10:46:04.469687605 +0100
++++ src/bin/sage-env	2015-01-06 10:49:59.547762019 +0100
+@@ -111,41 +111,7 @@
+ }
+ 
+ 
+-# New value for SAGE_ROOT: either SAGE_ROOT (if given)
+-# or a guessed value based on pwd.
+-if [ -n "$SAGE_ROOT" ]; then
+-    NEW_SAGE_ROOT="$SAGE_ROOT"
+-elif [ -f sage -a -d build ]; then
+-    NEW_SAGE_ROOT="."
+-elif [ -f ../../sage -a -d ../../build ]; then
+-    NEW_SAGE_ROOT="../.."
+-else
+-    # No idea what SAGE_ROOT should be...
+-    echo >&2 "Error: You must set the SAGE_ROOT environment variable or run this"
+-    echo >&2 "script from the SAGE_ROOT or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# Make NEW_SAGE_ROOT absolute
+-NEW_SAGE_ROOT=`cd "$NEW_SAGE_ROOT" && pwd -P`
+-
+-# Sanity check NEW_SAGE_ROOT
+-if [ -f "$NEW_SAGE_ROOT/sage" -a -d "$NEW_SAGE_ROOT/build" ]; then
+-    :
+-else
+-    echo >&2 "Error: SAGE_ROOT is set to a bad value:"
+-    echo >&2 "SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "You must correct it or erase it and run this script from the SAGE_ROOT"
+-    echo >&2 "or SAGE_ROOT/local/bin/ directory."
+-    return 1
+-fi
+-
+-# Warn if NEW_SAGE_ROOT does not equal the old SAGE_ROOT
+-if [ "$SAGE_ROOT" != "$NEW_SAGE_ROOT" -a -n "$SAGE_ROOT" ]; then
+-    echo >&2 "Warning: overwriting SAGE_ROOT environment variable:"
+-    echo >&2 "Old SAGE_ROOT=$SAGE_ROOT"
+-    echo >&2 "New SAGE_ROOT=$NEW_SAGE_ROOT"
+-fi
++NEW_SAGE_ROOT="/usr"
+ 
+ 
+ # Don't execute the commands more than once for the same version of
+@@ -174,33 +174,9 @@
+ export SAGE_ENV_SOURCED=$SAGE_ENV_VERSION
+ 
+ export SAGE_ROOT="$NEW_SAGE_ROOT"
++export SAGE_LOCAL='/usr'
++export SAGE_SCRIPTS_DIR='/usr/bin'
+ 
+-
+-# sage-env must know where the Sage's script files are.
+-# Note that SAGE_SCRIPTS_DIR is only used here, so it does not need to
+-# be exported.
+-if [ -z "$SAGE_SCRIPTS_DIR" ]; then
+-    if [ -n "$SAGE_LOCAL" ] && [ -f "$SAGE_LOCAL/bin/sage-env-config" ]; then
+-        SAGE_SCRIPTS_DIR="$SAGE_LOCAL/bin"
+-    elif [ -f "$SAGE_ROOT/src/bin/sage-env-config" ]; then
+-        SAGE_SCRIPTS_DIR="$SAGE_ROOT/src/bin"
+-    else
+-        echo >&2 "Error: You must set either the SAGE_LOCAL or SAGE_SCRIPTS_DIR environment variable to run this"
+-        return 1
+-    fi
+-elif [ ! -f "$SAGE_SCRIPTS_DIR/sage-env-config" ]; then
+-    echo >&2 "Error: SAGE_SCRIPTS_DIR is set to a bad value:"
+-    echo >&2 "SAGE_SCRIPTS_DIR=$SAGE_SCRIPTS_DIR"
+-    echo >&2 "You must correct it or erase it and rerun this script"
+-    return 1
+-fi
+-
+-# Set environment variables (like SAGE_LOCAL) depending on ./configure
+-. "$SAGE_SCRIPTS_DIR/sage-env-config"
+-if [ $? -ne 0 ]; then
+-    echo >&2 "Error: failed to source $SAGE_SCRIPTS_DIR/sage-env-config"
+-    return 1
+-fi
+ 
+ # The compilers are set in order of priority by
+ # 1) environment variables
+@@ -296,8 +296,8 @@
+ export SAGE_SPKG_INST="$SAGE_LOCAL/var/lib/sage/installed"
+ export SAGE_SPKG_SCRIPTS="$SAGE_LOCAL/var/lib/sage/scripts"
+ export SAGE_LOGS="$SAGE_ROOT/logs/pkgs"
+-export SAGE_SRC="$SAGE_ROOT/src"
+-export SAGE_DOC_SRC="$SAGE_SRC/doc"
++export SAGE_SRC="$SAGE_LOCAL/lib/python2.7/site-packages"
++export SAGE_DOC_SRC="$SAGE_SHARE/doc/sage"
+ export SAGE_DOC="$SAGE_SHARE/doc/sage"
+ 
+ if [ -z "${SAGE_ORIG_PATH_SET}" ]; then
+@@ -409,29 +409,8 @@
+     export SAGE_STARTUP_FILE
+ fi
+ 
++export LIBMTX="$DOT_SAGE/meataxe"
++[[ -d $LIBMTX ]] || mkdir -p $LIBMTX # Create meataxe data dir
+-if [ "$PYTHON_EGG_CACHE" = "" ]; then
+-    PYTHON_EGG_CACHE="$DOT_SAGE/.python-eggs"
+-    export PYTHON_EGG_CACHE
+-fi
+-
+-# Set PYTHONUSERBASE to avoid picking up non-Sage versions of
+-# Matplotlib, numpy, etc. See http://trac.sagemath.org/ticket/19612.
+-#
+-# For more history (it used to be PYTHONNOUSERSITE=yes which killed
+-# the ability to do "sage -pip install PACKAGE --user"), see
+-# http://trac.sagemath.org/ticket/14243 and
+-# http://trac.sagemath.org/ticket/18955.
+-
+-if [ "$PYTHONUSERBASE" = "" ]; then
+-    PYTHONUSERBASE="$DOT_SAGE/local"
+-    export PYTHONUSERBASE
+-fi
+-
+-if [ -n "$PYTHONHOME" ]; then
+-    >&2 echo "Warning: PYTHONHOME must not be set when running Sage, clearing env..."
+-    unset PYTHONHOME
+-fi
+-
+ LDFLAGS="-L$SAGE_LOCAL/lib -Wl,-rpath,$SAGE_LOCAL/lib $LDFLAGS"
+ export LDFLAGS
+ 
+@@ -495,8 +495,6 @@
+     fi
+ fi
+
+-export MAXIMA_PREFIX="$SAGE_LOCAL"
+-export MAXIMA_USERDIR="$DOT_SAGE/maxima"
+ 
+ PERL5LIB="$SAGE_LOCAL/lib/perl5:$PERL5LIB" && export PERL5LIB
+ 
+@@ -607,9 +607,6 @@
+     LD_LIBRARY_PATH="$SAGE_LOCAL/bin:$LD_LIBRARY_PATH" && export LD_LIBRARY_PATH
+ fi
+ 
+-# See trac 7186 -- this is needed if ecl is moved
+-ECLDIR="$SAGE_LOCAL/lib/ecl/" && export ECLDIR
+-
+ # Handle parallel building/testing/...
+ # See Trac Ticket #12016
+ # First, figure out the right values for SAGE_NUM_THREADS (default
+--- src/sage/env.py.orig       2017-12-07 19:51:25.554281539 +0000
++++ src/sage/env.py    2017-12-07 19:51:42.787654650 +0000
+@@ -117,13 +117,13 @@
+ _add_variable_or_fallback('LOCAL_IDENTIFIER','$HOSTNAME.%s'%os.getpid())
+ 
+ # bunch of sage directories and files
+-_add_variable_or_fallback('SAGE_ROOT',       None)
+-_add_variable_or_fallback('SAGE_LOCAL',      None)
++_add_variable_or_fallback('SAGE_ROOT',       '')
++_add_variable_or_fallback('SAGE_LOCAL',      '/usr')
+ _add_variable_or_fallback('SAGE_ETC',        opj('$SAGE_LOCAL', 'etc'))
+ _add_variable_or_fallback('SAGE_INC',        opj('$SAGE_LOCAL', 'include'))
+ _add_variable_or_fallback('SAGE_SHARE',      opj('$SAGE_LOCAL', 'share'))
+ 
+-_add_variable_or_fallback('SAGE_SRC',        opj('$SAGE_ROOT', 'src'))
++_add_variable_or_fallback('SAGE_SRC',        opj('$SAGE_LOCAL', 'lib', 'python2.7', 'site-packages'))
+ 
+ try:
+     sitepackages_dirs = site.getsitepackages()

Deleted: sagemath-numpy-1.16.patch
===================================================================
--- sagemath-numpy-1.16.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-numpy-1.16.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,85 +0,0 @@
-diff --git a/src/sage/misc/inline_fortran.py b/src/sage/misc/inline_fortran.py
-index e44724b..2bb4852 100644
---- a/src/sage/misc/inline_fortran.py
-+++ b/src/sage/misc/inline_fortran.py
-@@ -5,6 +5,7 @@ from __future__ import absolute_import
- 
- import os
- import shutil
-+import subprocess
- import sys
- 
- import six
-@@ -154,8 +155,6 @@ class InlineFortran:
-                 from sage.repl.user_globals import get_globals
-                 globals = get_globals()
- 
--        from numpy import f2py
--
-         # Create everything in a temporary directory
-         mytmpdir = tmp_dir()
- 
-@@ -171,36 +170,44 @@ class InlineFortran:
-             else:
-                 fortran_file = name + '.f'
- 
--            s_lib_path = ""
--            s_lib = ""
--            for s in self.library_paths:
--                s_lib_path = s_lib_path + "-L%s "
-+            s_lib_path = ['-L' + p for p in self.library_paths]
-+            s_lib = ['-l' + l for l in self.libraries]
- 
--            for s in self.libraries:
--                s_lib = s_lib + "-l%s "%s
-+            with open(fortran_file, 'w') as fobj:
-+                fobj.write(x)
- 
--            log = name + ".log"
--            extra_args = ('--quiet --f77exec=sage-inline-fortran '
--                          '--f90exec=sage-inline-fortran {lib_path} {lib} '
--                          '> {log} 2>&1'.format(lib_path=s_lib_path,
--                                                lib=s_lib, log=log))
-+            # This is basically the same as what f2py.compile() does, but we
-+            # do it manually here in order to customize running the subprocess
-+            # a bit more (in particular to capture stderr)
-+            cmd = [sys.executable, '-c', 'import numpy.f2py; numpy.f2py.main()']
- 
--            f2py.compile(x, name, extra_args=extra_args,
--                         source_fn=fortran_file)
-+            # What follows are the arguments to f2py itself (appended later
-+            # just for logical separation)
-+            cmd += ['-c', '-m', name, fortran_file, '--quiet',
-+                    '--f77exec=sage-inline-fortran',
-+                    '--f90exec=sage-inline-fortran'] + s_lib_path + s_lib
- 
--            with open(log) as fobj:
--                log_string = fobj.read()
-+            try:
-+                out = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
-+            except subprocess.CalledProcessError as exc:
-+                raise RuntimeError(
-+                    "failed to compile Fortran code:\n{}".format(exc.output))
- 
-             # Note that f2py() doesn't raise an exception if it fails.
-             # In that case, the import below will fail.
-             try:
-                 mod = _import_module_from_path(name, [mytmpdir])
--            except ImportError:
--                raise RuntimeError("failed to compile Fortran code:\n" +
--                                   log_string)
-+            except ImportError as exc:
-+                # Failed to import the module; include any output from building
-+                # the module (even though it was ostensibly successful) in case
-+                # it might help
-+                msg = "failed to load compiled Fortran code: {}".format(exc)
-+                if out:
-+                    msg += '\n' + out
-+                raise RuntimeError(msg)
- 
-             if self.verbose:
--                print(log_string)
-+                print(out)
-         finally:
-             os.chdir(old_cwd)
- 

Copied: sagemath/repos/community-staging-x86_64/sagemath-numpy-1.16.patch (from rev 429641, sagemath/trunk/sagemath-numpy-1.16.patch)
===================================================================
--- sagemath-numpy-1.16.patch	                        (rev 0)
+++ sagemath-numpy-1.16.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,85 @@
+diff --git a/src/sage/misc/inline_fortran.py b/src/sage/misc/inline_fortran.py
+index e44724b..2bb4852 100644
+--- a/src/sage/misc/inline_fortran.py
++++ b/src/sage/misc/inline_fortran.py
+@@ -5,6 +5,7 @@ from __future__ import absolute_import
+ 
+ import os
+ import shutil
++import subprocess
+ import sys
+ 
+ import six
+@@ -154,8 +155,6 @@ class InlineFortran:
+                 from sage.repl.user_globals import get_globals
+                 globals = get_globals()
+ 
+-        from numpy import f2py
+-
+         # Create everything in a temporary directory
+         mytmpdir = tmp_dir()
+ 
+@@ -171,36 +170,44 @@ class InlineFortran:
+             else:
+                 fortran_file = name + '.f'
+ 
+-            s_lib_path = ""
+-            s_lib = ""
+-            for s in self.library_paths:
+-                s_lib_path = s_lib_path + "-L%s "
++            s_lib_path = ['-L' + p for p in self.library_paths]
++            s_lib = ['-l' + l for l in self.libraries]
+ 
+-            for s in self.libraries:
+-                s_lib = s_lib + "-l%s "%s
++            with open(fortran_file, 'w') as fobj:
++                fobj.write(x)
+ 
+-            log = name + ".log"
+-            extra_args = ('--quiet --f77exec=sage-inline-fortran '
+-                          '--f90exec=sage-inline-fortran {lib_path} {lib} '
+-                          '> {log} 2>&1'.format(lib_path=s_lib_path,
+-                                                lib=s_lib, log=log))
++            # This is basically the same as what f2py.compile() does, but we
++            # do it manually here in order to customize running the subprocess
++            # a bit more (in particular to capture stderr)
++            cmd = [sys.executable, '-c', 'import numpy.f2py; numpy.f2py.main()']
+ 
+-            f2py.compile(x, name, extra_args=extra_args,
+-                         source_fn=fortran_file)
++            # What follows are the arguments to f2py itself (appended later
++            # just for logical separation)
++            cmd += ['-c', '-m', name, fortran_file, '--quiet',
++                    '--f77exec=sage-inline-fortran',
++                    '--f90exec=sage-inline-fortran'] + s_lib_path + s_lib
+ 
+-            with open(log) as fobj:
+-                log_string = fobj.read()
++            try:
++                out = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
++            except subprocess.CalledProcessError as exc:
++                raise RuntimeError(
++                    "failed to compile Fortran code:\n{}".format(exc.output))
+ 
+             # Note that f2py() doesn't raise an exception if it fails.
+             # In that case, the import below will fail.
+             try:
+                 mod = _import_module_from_path(name, [mytmpdir])
+-            except ImportError:
+-                raise RuntimeError("failed to compile Fortran code:\n" +
+-                                   log_string)
++            except ImportError as exc:
++                # Failed to import the module; include any output from building
++                # the module (even though it was ostensibly successful) in case
++                # it might help
++                msg = "failed to load compiled Fortran code: {}".format(exc)
++                if out:
++                    msg += '\n' + out
++                raise RuntimeError(msg)
+ 
+             if self.verbose:
+-                print(log_string)
++                print(out)
+         finally:
+             os.chdir(old_cwd)
+ 

Deleted: sagemath-python3-notebook.patch
===================================================================
--- sagemath-python3-notebook.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-python3-notebook.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,27 +0,0 @@
-diff --git a/src/bin/sage-notebook b/src/bin/sage-notebook
-index 74192da240..0ede281aad 100755
---- a/src/bin/sage-notebook
-+++ b/src/bin/sage-notebook
-@@ -96,8 +96,7 @@ class NotebookJupyter(object):
-         if not have_prerequisites():
-             print(self.PREREQUISITE_ERROR)
-             raise SystemExit(1)
--        from notebook.notebookapp import main
--        main(argv)
-+        os.execvp('jupyter-notebook', ['jupyter-notebook'] + argv)
- 
- 
- class NotebookJupyterlab(object):
-diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py
-index 3912b8cdf5..bd40cdadda 100644
---- a/src/sage/repl/ipython_kernel/install.py
-+++ b/src/sage/repl/ipython_kernel/install.py
-@@ -303,7 +303,6 @@ def have_prerequisites(debug=True):
-         True
-     """
-     try:
--        from notebook.notebookapp import NotebookApp
-         return True
-     except ImportError:
-         if debug:
-

Copied: sagemath/repos/community-staging-x86_64/sagemath-python3-notebook.patch (from rev 429641, sagemath/trunk/sagemath-python3-notebook.patch)
===================================================================
--- sagemath-python3-notebook.patch	                        (rev 0)
+++ sagemath-python3-notebook.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,27 @@
+diff --git a/src/bin/sage-notebook b/src/bin/sage-notebook
+index 74192da240..0ede281aad 100755
+--- a/src/bin/sage-notebook
++++ b/src/bin/sage-notebook
+@@ -96,8 +96,7 @@ class NotebookJupyter(object):
+         if not have_prerequisites():
+             print(self.PREREQUISITE_ERROR)
+             raise SystemExit(1)
+-        from notebook.notebookapp import main
+-        main(argv)
++        os.execvp('jupyter-notebook', ['jupyter-notebook'] + argv)
+ 
+ 
+ class NotebookJupyterlab(object):
+diff --git a/src/sage/repl/ipython_kernel/install.py b/src/sage/repl/ipython_kernel/install.py
+index 3912b8cdf5..bd40cdadda 100644
+--- a/src/sage/repl/ipython_kernel/install.py
++++ b/src/sage/repl/ipython_kernel/install.py
+@@ -303,7 +303,6 @@ def have_prerequisites(debug=True):
+         True
+     """
+     try:
+-        from notebook.notebookapp import NotebookApp
+         return True
+     except ImportError:
+         if debug:
+

Deleted: sagemath-singular-4.1.1.p4.patch
===================================================================
--- sagemath-singular-4.1.1.p4.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-singular-4.1.1.p4.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,78 +0,0 @@
-diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx
-index 87342e8..9a0d37d 100644
---- a/src/sage/libs/singular/function.pyx
-+++ b/src/sage/libs/singular/function.pyx
-@@ -1258,7 +1258,7 @@ cdef class SingularFunction(SageObject):
-             Traceback (most recent call last):
-             ...
-             RuntimeError: error in Singular function call 'size':
--            Wrong number of arguments (got 2 arguments, arity code is 300)
-+            Wrong number of arguments (got 2 arguments, arity code is 302)
-             sage: size('foobar', ring=P)
-             6
- 
-@@ -1667,17 +1667,17 @@ def singular_function(name):
-         Traceback (most recent call last):
-         ...
-         RuntimeError: error in Singular function call 'factorize':
--        Wrong number of arguments (got 0 arguments, arity code is 303)
-+        Wrong number of arguments (got 0 arguments, arity code is 305)
-         sage: factorize(f, 1, 2)
-         Traceback (most recent call last):
-         ...
-         RuntimeError: error in Singular function call 'factorize':
--        Wrong number of arguments (got 3 arguments, arity code is 303)
-+        Wrong number of arguments (got 3 arguments, arity code is 305)
-         sage: factorize(f, 1, 2, 3)
-         Traceback (most recent call last):
-         ...
-         RuntimeError: error in Singular function call 'factorize':
--        Wrong number of arguments (got 4 arguments, arity code is 303)
-+        Wrong number of arguments (got 4 arguments, arity code is 305)
- 
-     The Singular function ``list`` can be called with any number of
-     arguments::
-diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
-index 8f6576b477..deaf0f5769 100644
---- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
-+++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
-@@ -447,7 +447,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
-             return True
-         for i from 0 <= i < p_d-s_d:
-             s_poly = singular_system("stest",s_poly,1,
--                                     A._degbound,A.__ngens,ring=P)
-+                                     ring=P)
-             if P.monomial_divides(s_poly,p_poly):
-                 return True
-         return False
-@@ -601,7 +601,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
-         # we must put the polynomials into the same ring
-         left._poly = A._current_ring(left._poly)
-         right._poly = A._current_ring(right._poly)
--        rshift = singular_system("stest",right._poly,left._poly.degree(),A._degbound,A.__ngens, ring=A._current_ring)
-+        rshift = singular_system("stest",right._poly,left._poly.degree(), ring=A._current_ring)
-         return FreeAlgebraElement_letterplace(A,left._poly*rshift, check=False)
- 
-     def __pow__(FreeAlgebraElement_letterplace self, int n, k):
-@@ -629,7 +629,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
-         q = p = self._poly
-         cdef int i
-         for i from 0<i<n:
--            q = singular_system("stest",q,d,A._degbound,A.__ngens,
-+            q = singular_system("stest",q,d,
-                                      ring=A._current_ring)
-             p *= q
-         return FreeAlgebraElement_letterplace(A, p, check=False)
-diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
-index 7a8400052e..b3474fa07c 100644
---- a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
-+++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
-@@ -683,7 +683,7 @@ cdef class FreeAlgebra_letterplace(Algebra):
-         degbound = self._degbound
-         cdef list G = [C(x._poly) for x in g]
-         for y in G:
--            out.extend([y]+[singular_system("stest",y,n+1,degbound,ngens,ring=C) for n in xrange(d-y.degree())])
-+            out.extend([y]+[singular_system("stest",y,n+1,ring=C) for n in xrange(d-y.degree())])
-         return C.ideal(out)
- 
-     ###########################

Copied: sagemath/repos/community-staging-x86_64/sagemath-singular-4.1.1.p4.patch (from rev 429641, sagemath/trunk/sagemath-singular-4.1.1.p4.patch)
===================================================================
--- sagemath-singular-4.1.1.p4.patch	                        (rev 0)
+++ sagemath-singular-4.1.1.p4.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,78 @@
+diff --git a/src/sage/libs/singular/function.pyx b/src/sage/libs/singular/function.pyx
+index 87342e8..9a0d37d 100644
+--- a/src/sage/libs/singular/function.pyx
++++ b/src/sage/libs/singular/function.pyx
+@@ -1258,7 +1258,7 @@ cdef class SingularFunction(SageObject):
+             Traceback (most recent call last):
+             ...
+             RuntimeError: error in Singular function call 'size':
+-            Wrong number of arguments (got 2 arguments, arity code is 300)
++            Wrong number of arguments (got 2 arguments, arity code is 302)
+             sage: size('foobar', ring=P)
+             6
+ 
+@@ -1667,17 +1667,17 @@ def singular_function(name):
+         Traceback (most recent call last):
+         ...
+         RuntimeError: error in Singular function call 'factorize':
+-        Wrong number of arguments (got 0 arguments, arity code is 303)
++        Wrong number of arguments (got 0 arguments, arity code is 305)
+         sage: factorize(f, 1, 2)
+         Traceback (most recent call last):
+         ...
+         RuntimeError: error in Singular function call 'factorize':
+-        Wrong number of arguments (got 3 arguments, arity code is 303)
++        Wrong number of arguments (got 3 arguments, arity code is 305)
+         sage: factorize(f, 1, 2, 3)
+         Traceback (most recent call last):
+         ...
+         RuntimeError: error in Singular function call 'factorize':
+-        Wrong number of arguments (got 4 arguments, arity code is 303)
++        Wrong number of arguments (got 4 arguments, arity code is 305)
+ 
+     The Singular function ``list`` can be called with any number of
+     arguments::
+diff --git a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
+index 8f6576b477..deaf0f5769 100644
+--- a/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
++++ b/src/sage/algebras/letterplace/free_algebra_element_letterplace.pyx
+@@ -447,7 +447,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
+             return True
+         for i from 0 <= i < p_d-s_d:
+             s_poly = singular_system("stest",s_poly,1,
+-                                     A._degbound,A.__ngens,ring=P)
++                                     ring=P)
+             if P.monomial_divides(s_poly,p_poly):
+                 return True
+         return False
+@@ -601,7 +601,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
+         # we must put the polynomials into the same ring
+         left._poly = A._current_ring(left._poly)
+         right._poly = A._current_ring(right._poly)
+-        rshift = singular_system("stest",right._poly,left._poly.degree(),A._degbound,A.__ngens, ring=A._current_ring)
++        rshift = singular_system("stest",right._poly,left._poly.degree(), ring=A._current_ring)
+         return FreeAlgebraElement_letterplace(A,left._poly*rshift, check=False)
+ 
+     def __pow__(FreeAlgebraElement_letterplace self, int n, k):
+@@ -629,7 +629,7 @@ cdef class FreeAlgebraElement_letterplace(AlgebraElement):
+         q = p = self._poly
+         cdef int i
+         for i from 0<i<n:
+-            q = singular_system("stest",q,d,A._degbound,A.__ngens,
++            q = singular_system("stest",q,d,
+                                      ring=A._current_ring)
+             p *= q
+         return FreeAlgebraElement_letterplace(A, p, check=False)
+diff --git a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
+index 7a8400052e..b3474fa07c 100644
+--- a/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
++++ b/src/sage/algebras/letterplace/free_algebra_letterplace.pyx
+@@ -683,7 +683,7 @@ cdef class FreeAlgebra_letterplace(Algebra):
+         degbound = self._degbound
+         cdef list G = [C(x._poly) for x in g]
+         for y in G:
+-            out.extend([y]+[singular_system("stest",y,n+1,degbound,ngens,ring=C) for n in xrange(d-y.degree())])
++            out.extend([y]+[singular_system("stest",y,n+1,ring=C) for n in xrange(d-y.degree())])
+         return C.ideal(out)
+ 
+     ###########################

Deleted: sagemath-sphinx-1.8.patch
===================================================================
--- sagemath-sphinx-1.8.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-sphinx-1.8.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,28 +0,0 @@
---- a/src/sage/misc/sphinxify.py	2018-09-14 20:13:32.788831484 +0200
-+++ b/src/sage/misc/sphinxify.py	2018-09-14 20:14:07.142478667 +0200
-@@ -68,6 +68,7 @@
-         sage: assert n == len(sys.path)
-     """
-     srcdir = mkdtemp()
-+    outdir = mkdtemp()
-     base_name = os.path.join(srcdir, 'docstring')
-     rst_name = base_name + '.rst'
- 
-@@ -75,7 +76,7 @@
-         suffix = '.html'
-     else:
-         suffix = '.txt'
--    output_name = base_name + suffix
-+    output_name = os.path.join(outdir, 'docstring') + suffix
- 
-     with open(rst_name, 'w') as filed:
-         filed.write(docstring)
-@@ -93,7 +94,7 @@
- 
-     import sys
-     old_sys_path = list(sys.path)  # Sphinx modifies sys.path
--    sphinx_app = Sphinx(srcdir, confdir, srcdir, doctreedir, format,
-+    sphinx_app = Sphinx(srcdir, confdir, outdir, doctreedir, format,
-                         confoverrides, None, None, True)
-     sphinx_app.build(None, [rst_name])
-     sys.path = old_sys_path

Copied: sagemath/repos/community-staging-x86_64/sagemath-sphinx-1.8.patch (from rev 429641, sagemath/trunk/sagemath-sphinx-1.8.patch)
===================================================================
--- sagemath-sphinx-1.8.patch	                        (rev 0)
+++ sagemath-sphinx-1.8.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,28 @@
+--- a/src/sage/misc/sphinxify.py	2018-09-14 20:13:32.788831484 +0200
++++ b/src/sage/misc/sphinxify.py	2018-09-14 20:14:07.142478667 +0200
+@@ -68,6 +68,7 @@
+         sage: assert n == len(sys.path)
+     """
+     srcdir = mkdtemp()
++    outdir = mkdtemp()
+     base_name = os.path.join(srcdir, 'docstring')
+     rst_name = base_name + '.rst'
+ 
+@@ -75,7 +76,7 @@
+         suffix = '.html'
+     else:
+         suffix = '.txt'
+-    output_name = base_name + suffix
++    output_name = os.path.join(outdir, 'docstring') + suffix
+ 
+     with open(rst_name, 'w') as filed:
+         filed.write(docstring)
+@@ -93,7 +94,7 @@
+ 
+     import sys
+     old_sys_path = list(sys.path)  # Sphinx modifies sys.path
+-    sphinx_app = Sphinx(srcdir, confdir, srcdir, doctreedir, format,
++    sphinx_app = Sphinx(srcdir, confdir, outdir, doctreedir, format,
+                         confoverrides, None, None, True)
+     sphinx_app.build(None, [rst_name])
+     sys.path = old_sys_path

Deleted: sagemath-threejs.patch
===================================================================
--- sagemath-threejs.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ sagemath-threejs.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,11 +0,0 @@
---- a/src/sage/repl/rich_output/display_manager.py
-+++ b/src/sage/repl/rich_output/display_manager.py
-@@ -746,7 +746,7 @@ class DisplayManager(SageObject):
-         """
-         if online:
-             from sage.misc.package import installed_packages
--            version = installed_packages()['threejs'].split('.')[0]
-+            version = 'r80'
-             return """
- <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/build/three.min.js"></script>
- <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/examples/js/controls/OrbitControls.js"></script>

Copied: sagemath/repos/community-staging-x86_64/sagemath-threejs.patch (from rev 429641, sagemath/trunk/sagemath-threejs.patch)
===================================================================
--- sagemath-threejs.patch	                        (rev 0)
+++ sagemath-threejs.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,11 @@
+--- a/src/sage/repl/rich_output/display_manager.py
++++ b/src/sage/repl/rich_output/display_manager.py
+@@ -746,7 +746,7 @@ class DisplayManager(SageObject):
+         """
+         if online:
+             from sage.misc.package import installed_packages
+-            version = installed_packages()['threejs'].split('.')[0]
++            version = 'r80'
+             return """
+ <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/build/three.min.js"></script>
+ <script src="https://cdn.rawgit.com/mrdoob/three.js/{0}/examples/js/controls/OrbitControls.js"></script>

Deleted: test-optional.patch
===================================================================
--- test-optional.patch	2019-02-05 17:30:42 UTC (rev 429641)
+++ test-optional.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -1,25 +0,0 @@
---- src/sage/doctest/control.py.orig       2016-10-20 19:39:53.714618246 +0200
-+++ src/sage/doctest/control.py    2016-10-20 19:40:15.158049920 +0200
-@@ -347,22 +347,6 @@
-                 # Special case to run all optional tests
-                 options.optional = True
-             else:
--                # We replace the 'optional' tag by all optional
--                # packages for which the installed version matches the
--                # latest available version (this implies in particular
--                # that the package is actually installed).
--                if 'optional' in options.optional:
--                    options.optional.discard('optional')
--                    from sage.misc.package import list_packages
--                    for pkg in list_packages('optional', local=True).values():
--                        if pkg['installed_version'] == pkg['remote_version']:
--                            options.optional.add(pkg['name'])
--
--                # Check that all tags are valid
--                for o in options.optional:
--                    if not optionaltag_regex.search(o):
--                        raise ValueError('invalid optional tag {!r}'.format(o))
--
-                 options.optional |= auto_optional_tags
-
-         self.options = options

Copied: sagemath/repos/community-staging-x86_64/test-optional.patch (from rev 429641, sagemath/trunk/test-optional.patch)
===================================================================
--- test-optional.patch	                        (rev 0)
+++ test-optional.patch	2019-02-05 17:33:00 UTC (rev 429642)
@@ -0,0 +1,25 @@
+--- src/sage/doctest/control.py.orig       2016-10-20 19:39:53.714618246 +0200
++++ src/sage/doctest/control.py    2016-10-20 19:40:15.158049920 +0200
+@@ -347,22 +347,6 @@
+                 # Special case to run all optional tests
+                 options.optional = True
+             else:
+-                # We replace the 'optional' tag by all optional
+-                # packages for which the installed version matches the
+-                # latest available version (this implies in particular
+-                # that the package is actually installed).
+-                if 'optional' in options.optional:
+-                    options.optional.discard('optional')
+-                    from sage.misc.package import list_packages
+-                    for pkg in list_packages('optional', local=True).values():
+-                        if pkg['installed_version'] == pkg['remote_version']:
+-                            options.optional.add(pkg['name'])
+-
+-                # Check that all tags are valid
+-                for o in options.optional:
+-                    if not optionaltag_regex.search(o):
+-                        raise ValueError('invalid optional tag {!r}'.format(o))
+-
+                 options.optional |= auto_optional_tags
+
+         self.options = options



More information about the arch-commits mailing list