Author fbeyer
Recipients fbeyer
Date 2013-02-18.13:19:26
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1361193566.84.0.658685915007.issue17225@psf.upfronthosting.co.za>
In-reply-to
Content
The linecol() function in json/decoder.py computes the line and column numbers for a byte offset in a string.  Both numbers are expected to start with 1 (as in text editors).

If the position is in the first line, the returned column is off by one (or starting with zero):

    >>> from json.decoder import linecol
    >>> linecol('spam', 0)  # Should be (1, 1)
    (1, 0)
    >>> linecol('\nspam', 1)
    (2, 1)

The problem is the line:

    if lineno == 1:
        colno = pos

that should read

    if lineno == 1:
        colno = pos + 1
History
Date User Action Args
2013-02-18 13:19:26fbeyersetrecipients: + fbeyer
2013-02-18 13:19:26fbeyersetmessageid: <1361193566.84.0.658685915007.issue17225@psf.upfronthosting.co.za>
2013-02-18 13:19:26fbeyerlinkissue17225 messages
2013-02-18 13:19:26fbeyercreate