Opened 9 years ago

Last modified 7 years ago

#12927 needs_work defect

Logging synchronises input and output wrongly.

Reported by: itaibn Owned by: jason
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


In sage/misc/, 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::

        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 sage: 1+1
3 sage: log_text()

Attachments (1)

trac_12927 (2.0 KB) - added by itaibn 9 years ago.
A patch to fix this bug

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by itaibn

A patch to fix this bug

comment:1 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:2 Changed 8 years ago by itaibn

  • Status changed from new to needs_review

comment:3 Changed 7 years ago by vbraun

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 7 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:5 Changed 7 years ago by rws

  • Status changed from needs_review to needs_work

comment:6 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:7 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.