#18578: Python 3 preparation: Special function __div__() is used no more in Py3
-------------------------+-------------------------------------------------
       Reporter:         |        Owner:  wluebbe
  wluebbe                |       Status:  new
           Type:         |    Milestone:  sage-6.8
  enhancement            |   Resolution:
       Priority:  major  |    Merged in:
      Component:  misc   |    Reviewers:
       Keywords:         |  Work issues:
  python3                |       Commit:
        Authors:         |  9701674d59213529ef6476ecc973a8f2cf69bfb3
Report Upstream:  N/A    |     Stopgaps:
         Branch:         |
  u/wluebbe/18578        |
   Dependencies:         |
-------------------------+-------------------------------------------------

Comment (by wluebbe):

 That gives a compile error:
 {{{
 Cythonizing sage/ext/fast_callable.pyx

 Error compiling Cython file:
 ------------------------------------------------------------
 ...
             div(1, v_0)
         """
         return _expression_binop_helper(s, o, op_div)

     # for Python 2 without from __future__ import division
     from cpython.number cimport PyNumber_TrueDivide
    ^
 ------------------------------------------------------------

 sage/ext/fast_callable.pyx:917:4: cimport only allowed at module level

 Error compiling Cython file:
 ------------------------------------------------------------
 ...
         return _expression_binop_helper(s, o, op_div)

     # for Python 2 without from __future__ import division
     from cpython.number cimport PyNumber_TrueDivide
     def __div__(self, other):
         return PyNumber_TrueDivide(self, other)
                                  ^
 ------------------------------------------------------------

 sage/ext/fast_callable.pyx:919:34: undeclared name not builtin:
 PyNumber_TrueDivide
 }}}

 Copying the code from {{{def __div__}}} to {{{def ___truediv__}}} clearly
 works - but there must be a better way!

--
Ticket URL: <http://trac.sagemath.org/ticket/18578#comment:6>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to