Menu

#100 Simplify code and support Python 3.5a0

v1.0 (example)
closed-fixed
nobody
None
5
2018-09-19
2017-04-03
No

Hi, I'm trying to run benchmarks on old versions of CPython to get a timeline starting in 2014, but pip fails on Python 3.5a0 (an alpha version!) because of pyparsing.

Bottom of the traceback:

File "/home/haypo/prog/bench_python/tmpdir/prefix/lib/python3.5/site-packages/pip/_vendor/packaging/requirements.py",
line 9, in <module>
from pip._vendor.pyparsing import (
File "/home/haypo/prog/bench_python/tmpdir/prefix/lib/python3.5/site-packages/pip/_vendor/pyparsing.py",
line 4715, in <module>
_escapedPunc = Word( _bslash, r"[]-*.$+^?()~ ", exact=2
).setParseAction(lambda s,l,t:t[0][1])
File "/home/haypo/prog/bench_python/tmpdir/prefix/lib/python3.5/site-packages/pip/_vendor/pyparsing.py",
line 1261, in setParseAction
self.parseAction = list(map(_trim_arity, list(fns)))
File "/home/haypo/prog/bench_python/tmpdir/prefix/lib/python3.5/site-packages/pip/_vendor/pyparsing.py",
line 1043, in _trim_arity
this_line = extract_stack(limit=2)[-1]
File "/home/haypo/prog/bench_python/tmpdir/prefix/lib/python3.5/site-packages/pip/_vendor/pyparsing.py",
line 1028, in extract_stack
return [(frame_summary.filename, frame_summary.lineno)]
AttributeError: 'tuple' object has no attribute 'filename'

Attached patch simplify the code and indirectly adds support for Python 3.5a0 to fix my issue. Currenttly, the code creates a sub-tuple of 2 items for a frame, whereas later the "if" uses summary[:2] again. So it's not need to create the sub-tuple.

On Python 3.5a0, frame summary have no .filename nor .lineno attribute. Maybe the code can now be used on Python 2.7, but I tried to write a minimum patch to fix my issue.

1 Attachments

Discussion

  • STINNER Victor

    STINNER Victor - 2017-04-03

    FYI I first reported this issue to pip, but they asked to report it to pyparsing directly, since they don't modify this vendored copies of requirements.

    https://github.com/pypa/pip/issues/4408

     
  • Paul McGuire

    Paul McGuire - 2018-09-19
    • status: open --> closed-fixed
     
  • Paul McGuire

    Paul McGuire - 2018-09-19

    Fixed in 2.2.1 release

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.