[Python-modules-team] Bug#824566: Debian bug report

Paul McGuire ptmcg at austin.rr.com
Sun Jun 5 22:15:42 UTC 2016


Re: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=824566

 

The problem actually lies in the rstlib package, which has this code
fragment:

 

        value = tokin[0].asDict()

        ref_path = value.get('ref_path')

        if ref_path is not None:

            ref_path = " ".join(ref_path.asList())

 

 

In this code, 'tokin' is a pyparsing ParseResults object that is passed into
a parse-time callback.  In version 2.1.0 of pyparsing, I fixed a
long-standing problem in ParseResults.asDict, which did only the shallowest
of conversions of pyparsing's ParseResults objects to nested lists and
dicts. In this case, the 'ref_path' element of 'value' used to be a
ParseResults, which the developer is converting to a list using asList().
With my change in pyparsing 2.1.0, ref_path is now being converted to a list
as part of the improved behavior of asDict(). Unfortunately, this code then
tries to call 'asList()' on that list, which of course, is an error.

 

The fix is to change this code in rstlib to just:

 

        value = tokin[0].asDict()

        ref_path = value.get('ref_path')

        if ref_path is not None:

            ref_path = " ".join(ref_path)

 

This change is actually compatible with the old version of pyparsing as well
(since ParseResults also implements list-like iterator behavior). The call
to 'asList()' in this case was never really necessary.

 

I would encourage you to try to get this change in place, as opposed to
reverting pyparsing back to 2.0.3 - there are many other fixes and changes
in the latest 2.1.4 version, and I have a 2.1.5 about to go out this month.

-- Paul McGuire
Austin, Texas, USA
maintainer of pyparsing

(I have also copied Jerome Martin, jxm at netiant.com <mailto:jxm at netiant.com>
, as he is the nominal maintainer of rstlib.)

 



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20160605/8661d4d2/attachment.html>


More information about the Python-modules-team mailing list