Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging synchronises input and output wrongly. #12927

Open
itaibn mannequin opened this issue May 8, 2012 · 3 comments
Open

Logging synchronises input and output wrongly. #12927

itaibn mannequin opened this issue May 8, 2012 · 3 comments

Comments

@itaibn
Copy link
Mannequin

itaibn mannequin commented May 8, 2012

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()

Component: misc

Keywords: log logging

Issue created by migration from https://trac.sagemath.org/ticket/12927

@itaibn itaibn mannequin added this to the sage-5.11 milestone May 8, 2012
@itaibn itaibn mannequin added p: major / 3 labels May 8, 2012
@itaibn itaibn mannequin assigned jasongrout May 8, 2012
@itaibn
Copy link
Mannequin Author

itaibn mannequin commented Nov 4, 2012

A patch to fix this bug

@jdemeyer
Copy link

comment:1

Attachment: trac_12927.gz

@jdemeyer jdemeyer modified the milestones: sage-5.11, sage-5.12 Aug 13, 2013
@itaibn itaibn mannequin added the s: needs review label Aug 27, 2013
@vbraun
Copy link
Member

vbraun commented Nov 23, 2013

comment:3

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)

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants