Opened 19 months ago

Last modified 2 months ago

#27696 closed enhancement

py3: deprecate long and __long__, and remove doctesting special-case for long — at Initial Version

Reported by: jhpalmieri Owned by:
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: python3 Keywords:
Cc: mkoeppe Merged in:
Authors: John Palmieri Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:


The main point of this ticket is this change:

  • src/sage/doctest/

    diff --git a/src/sage/doctest/ b/src/sage/doctest/
    index 4b222dd1db..d97034090f 100644
    a b class DocTestTask(object): 
    23772377        sage: sorted(results.keys())
    23782378        ['cputime', 'err', 'failures', 'optionals', 'tests', 'walltime', 'walltime_skips']
    23792379    """
    2381     if six.PY2:
    2382         extra_globals = {}
    2383     else:
    2384         extra_globals = {'long': int}
     2380    extra_globals = {}
    23852381    """
    23862382    Extra objects to place in the global namespace in which tests are run.
    23872383    Normally this should be empty but there are special cases where it may
    23882384    be useful.
    2390     In particular, on Python 3 add ``long`` as an alias for ``int`` so that
    2391     tests that use the ``long`` built-in (of which there are many) still pass.
    2392     We do this so that the test suite can run on Python 3 while Python 2 is
    2393     still the default.
    23942385    """
    23962387    def __init__(self, source):

With Python 3 doctesting, long has been automatically converted to int. It would be better to not have such a big difference in the behavior of doctesting vs. ordinary Sage usage: with Python 3, evaluating long(3) would fail at the command line but work in doctesting.

Change History (0)

Note: See TracTickets for help on using tickets.