Opened 7 years ago

Last modified 6 years ago

#17854 closed task

Metaticket: remove c_lib — at Version 17

Reported by: jdemeyer Owned by:
Priority: major Milestone: sage-6.8
Component: c_lib Keywords:
Cc: fbissey Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

Move c_lib code to Cython modules, or refactor code to no longer use c_lib:

  • #17180: Move and fix rational reconstruction
  • #10103: Remove gmp_globals and gmp.pxi
  • #17668: Replace PY_NEW and PY_NEW_SAME_TYPE by new() method
  • #17726: Replace PY_TYPE() by type()
  • #17725: Replace PY_TYPE_CHECK_EXACT
  • #17800: Replace PY_TYPE_CHECK and IS_INSTANCE by isinstance
  • #17862: Remove use of PY_IS_NUMERIC
  • #17625: Remove init_csage_module()
  • #17789: Remove c_lib/src/ZZ_pylong.cpp
  • #17853: Implement mpz <-> Python int/long in Cython
  • #17788: PARI: store GEN as mpz/mpq
  • #17784: Modernize NTL error handler
  • #17819: Use unsigned long for Integer.divisors
  • #17881: Move memory functions from c_lib to Cython
  • #17882: Cython clean-up in fast_eval.pyx
  • #17889: Unify base_extend, base_extend_c, base_extend_c_impl
  • #17890: Remove _(rich)cmp_c_impl
  • #17900: Setup interrupts in Cython
  • #17915: Stop including mpz_pylong.h and mpz_longlong.h

Change History (17)

comment:1 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:2 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:3 Changed 7 years ago by fbissey

  • Cc fbissey added

That's ambitious and will remove one barrier to having simultaneous python2.7 and python3.x installs at the same time (the others being polybori and pynac).

comment:4 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:5 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:6 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:7 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:8 follow-up: Changed 7 years ago by fbissey

Hum... That will get rid of the last doctest that give a different result with gmp than with mpir.

comment:9 in reply to: ↑ 8 Changed 7 years ago by jdemeyer

Replying to fbissey:

Hum... That will get rid of the last doctest that give a different result with gmp than with mpir.

Which doctest?

comment:10 Changed 7 years ago by fbissey

I should have commented in #17881, commenting here was a mistake. I am talking about the doctest you removed so far in sage/rings/integer.pyx it gives a sligthly different answer for gmp than mpir. This is something we have identified a while ago with Jean-Pierre Flori.

For info this is what it gives for gmp:

**********************************************************************
File "/usr/share/sage/src/sage/rings/integer.pyx", line 1938, in sage.rings.integer.Integer.__pow__
Failed example:
    2^(2^63-2)
Expected:
    Traceback (most recent call last):
    ...
    MemoryError: failed to allocate 1152921504606847008 bytes  
Got:
    gmp: overflow in mpz type
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 488, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/usr/lib64/python2.7/site-packages/sage/doctest/forker.py", line 850, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.integer.Integer.__pow__[27]>", line 1, in <module>
        Integer(2)**(Integer(2)**Integer(63)-Integer(2))
      File "sage/rings/integer.pyx", line 1977, in sage.rings.integer.Integer.__pow__ (build/cythonized/sage/rings/integer.c:12942)
        sig_on()
      File "sage/ext/c_lib.pyx", line 85, in sage.ext.c_lib.sig_raise_exception (build/cythonized/sage/ext/c_lib.c:1035)
        raise RuntimeError(msg)
    RuntimeError: Aborted

comment:11 Changed 7 years ago by jdemeyer

Yes, GMP has some extra error checking that MPIR doesn't have.

Anyway, this doctest will not be removed, just moved to a different file in #17881.

comment:12 Changed 7 years ago by fbissey

Indeed it escaped my attention. So it will just move a bit. No biggy in any case.

comment:13 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:14 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:15 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:16 Changed 7 years ago by jdemeyer

  • Description modified (diff)

comment:17 Changed 7 years ago by jdemeyer

  • Description modified (diff)
Note: See TracTickets for help on using tickets.