Opened 11 years ago

Last modified 8 years ago

#12927 needs_work defect

Logging synchronises input and output wrongly.

Reported by: Itai Bar-Natan Owned by: Jason Grout
Priority: major Milestone: sage-6.4
Component: misc Keywords: log logging
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

In sage/misc/log.py, the following is in the documentation:

        """
        There is an off-by-one issue with IPython's input and output
        history; ``__IPYTHON__.input_hist_raw`` is a *list* containing
        the un-preparsed Sage commands. However,
        ``__IPYTHON__.output_hist`` is a dictionary whose keys are
        integers and whose values are outputs.  This is good because
        not every input has an output.

        **BUT**, the output from::
        
            __IPYTHON__.input_hist_raw[n]

        is stored in::

            __IPYTHON__.output_hist[n+1] !

        This is annoying and it may be a bug. Right now the loggers
        correct for this, but if modifying or extending this code,
        consider yourself warned.
        """        

This is incorrect. In fact, the compensation for this inside the code makes the input and output out of synchronisation. This can be seen in the following log:

Sage Log 2012-05-08-190000
1 sage: sage.misc.preparser.load(sage.misc.preparser.base64.b64decode("L2hvbWUvaXRhaWJuLy5zYWdlLy9pbml0LnNhZ2U="),globals(),False)

  2

2 sage: 1+1
3 sage: log_text()

Attachments (1)

trac_12927 (2.0 KB) - added by Itai Bar-Natan 10 years ago.
A patch to fix this bug

Download all attachments as: .zip

Change History (8)

Changed 10 years ago by Itai Bar-Natan

Attachment: trac_12927 added

A patch to fix this bug

comment:1 Changed 9 years ago by Jeroen Demeyer

Milestone: sage-5.11sage-5.12

comment:2 Changed 9 years ago by Itai Bar-Natan

Status: newneeds_review

comment:3 Changed 9 years ago by Volker Braun

Is the patch reversed?

Also, needs commit message instead of [mq]: trac_12927 and ideally some doctest (e.g. using the IPython test shell framework or via a separate Sage session)

comment:4 Changed 9 years ago by For batch modifications

Milestone: sage-6.1sage-6.2

comment:5 Changed 9 years ago by Ralf Stephan

Status: needs_reviewneeds_work

comment:6 Changed 9 years ago by For batch modifications

Milestone: sage-6.2sage-6.3

comment:7 Changed 8 years ago by For batch modifications

Milestone: sage-6.3sage-6.4
Note: See TracTickets for help on using tickets.