Opened 11 years ago

Closed 10 years ago

#12223 closed defect (fixed)

the 'sage.rings.complex_mpc' optional extension is broken in sage-4.8.alpha3 and over

Reported by: fbissey Owned by: tbd
Priority: blocker Milestone: sage-5.0
Component: packages: optional Keywords:
Cc: Merged in: sage-5.0.beta5
Authors: Jeroen Demeyer Reviewers: François Bissey
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

The optional mpc package installs fine but when I execute sage -b to built the sage code I get

Successfully installed mpc-0.8.3-dev-svn793
Now cleaning up tmp files.
Making Sage/Python scripts relocatable...
Finished installing mpc-0.8.3-dev-svn793.spkg
fbissey@QCD-nzi3 /home/work/fbissey/sandbox/sage-4.8.alpha4 $ ./sage -b

----------------------------------------------------------
sage: Building and installing modified Sage library files.


Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Building sage/rings/complex_mpc.pyx because it depends on /home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/mpc.h.
Execute 1 commands (using 1 threads)
python `which cython`  --old-style-globals --disable-function-redefinition --embed-positions --directive cdivision=True,autotestdict=False,fast_getattr=True -I/home/work/fbissey/sandbox/sage-4.8.alpha4/devel/sage-main -o sage/rings/complex_mpc.c sage/rings/complex_mpc.pyx
sage/rings/complex_mpc.pyx --> /home/work/fbissey/sandbox/sage-4.8.alpha4/local/lib/python2.6/site-packages//sage/rings/complex_mpc.pyx
Time to execute 1 commands: 3.12862586975 seconds
Finished compiling Cython code (time = 4.00216197968 seconds)
running install
running build
running build_py
running build_ext
building 'sage.rings.complex_mpc' extension
Execute 1 commands (using 1 threads)
gcc -fno-strict-aliasing -g -O2 -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/csage -I/home/work/fbissey/sandbox/sage-4.8.alpha4/devel/sage/sage/ext -I/home/work/fbissey/sandbox/sage-4.8.alpha4/local/include/python2.6 -c sage/rings/complex_mpc.c -o build/temp.linux-x86_64-2.6/sage/rings/complex_mpc.o -w
sage/rings/complex_mpc.c: In function '__pyx_pf_4sage_5rings_11complex_mpc_15MPComplexNumber_16__float__':
sage/rings/complex_mpc.c:9720:48: error: cast specifies array type
error: command 'gcc' failed with exit status 1
sage: There was an error installing modified sage library code.

Attachments (1)

12223_mpc.patch (1.2 KB) - added by jdemeyer 11 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 11 years ago by fbissey

the faulty C code:

    /* "sage/rings/complex_mpc.pyx":1107
 *         if mpfr_zero_p(self.value.im):
 *             return mpfr_get_d(<mpfr_t> self.value.re,\
 *                                    rnd_re((<MPComplexField_class>self._parent).__rnd))             # <<<<<<<<<<<<<<
 *         else:
 *             raise TypeError, "can't convert complex to float; use abs(z)"
 */
    __pyx_t_2 = PyFloat_FromDouble(mpfr_get_d(((mpfr_t)((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *)__pyx_v_self)->value->re), __pyx_f_4sage_5rings_11complex_mpc_rnd_re(((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexField_class *)((struct __pyx_obj_4sage_5rings_11complex_mpc_MPComplexNumber *)__pyx_v_self)->__pyx_base.__pyx_base.__pyx_base.__pyx_base.__pyx_base._parent)->__pyx___rnd))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;}  <=line 9720
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    goto __pyx_L0;
    goto __pyx_L5;
  }
  /*else*/ {

    /* "sage/rings/complex_mpc.pyx":1109
 *                                    rnd_re((<MPComplexField_class>self._parent).__rnd))
 *         else:
 *             raise TypeError, "can't convert complex to float; use abs(z)"             # <<<<<<<<<<<<<<
 *
 *     def __complex__(self):
 */
    __Pyx_Raise(__pyx_builtin_TypeError, ((PyObject *)__pyx_kp_s_76), 0, 0);
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
  }
  __pyx_L5:;

  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_AddTraceback("sage.rings.complex_mpc.MPComplexNumber.__float__", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

comment:2 Changed 11 years ago by fbissey

  • Priority changed from major to blocker

I am putting this to blocker since the spkg builds correctly and then because the extension is broken it breaks sage -b.

comment:3 Changed 11 years ago by jdemeyer

Just wondering: why isn't this a standard package? I guess complex arithmetic in Sage would benefit from it.

comment:4 Changed 11 years ago by fbissey

There was some discussion a while back when David Kirkby put it in shape last. If I remember correctly the gist of it was that you could do complex arithmetic some other way in sage and that there wasn't much benefits from it. I would have to dig sage-devel to find it.

Changed 11 years ago by jdemeyer

comment:5 Changed 11 years ago by jdemeyer

  • Authors set to Jeroen Demeyer
  • Description modified (diff)
  • Status changed from new to needs_review

comment:6 Changed 11 years ago by jdemeyer

See #12515 to make this a standard spkg.

comment:7 Changed 11 years ago by fbissey

  • Reviewers set to François Bissey
  • Status changed from needs_review to positive_review

Ok I tested the patch and it works. I am giving this a positive review.

comment:8 Changed 10 years ago by jdemeyer

  • Merged in set to sage-5.0.beta5
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.