Opened 8 years ago

Last modified 8 years ago

#51364 closed defect

py34-parsing @ 2.1.2 fails to build — at Initial Version

Reported by: josephsacco Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: snc@…
Port: py-parsing

Description

The python3.x build of py-parsing @2.1.2 fails. Traceback (most recent call last):

File "setup.py", line 9, in <module>

from pyparsing import version as pyparsing_version

File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-parsing/py34-parsing/work/pyparsing-2.1.2/pyparsing.py", line 3478, in <module>

_escapedPunc = Word( _bslash, r"\[]-*.$+?()~ ", exact=2 ).setParseAction(lambda s,l,t:t[0][1])

File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-parsing/py34-parsing/work/pyparsing-2.1.2/pyparsing.py", line 948, in setParseAction

self.parseAction = list(map(_trim_arity, list(fns)))

File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-parsing/py34-parsing/work/pyparsing-2.1.2/pyparsing.py", line 808, in _trim_arity

this_line = extract_stack()[-1]

File "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_python_py-parsing/py34-parsing/work/pyparsing-2.1.2/pyparsing.py", line 793, in extract_stack

return [(frame_summary.filename, frame_summary.lineno)]

AttributeError: 'tuple' object has no attribute 'filename'

The culprit is found in pyparsing.py:

# this version is Python 2.x-3.x cross-compatible
'decorator to trim function calls to match the arity of the target'
def _trim_arity(func, maxargs=2):
    if func in singleArgBuiltins:
        return lambda s,l,t: func(t)
    limit = [0]
    foundArity = [False]

    if PY_3:
        def extract_stack():
            frame_summary = traceback.extract_stack()[-3]
            return [(frame_summary.filename, frame_summary.lineno)]
        def extract_tb(tb):
            frames = traceback.extract_tb(tb)
            frame_summary = frames[-1]
            return [(frame_summary.filename, frame_summary.lineno)]
    else:
        extract_stack = traceback.extract_stack
        extract_tb = traceback.extract_tb

In python3.x 'traceback.extract_stack()' returns a list of quadruples (filename, line number, function name, text), each of whose elements is accessed by index.

-Joseph

Change History (0)

Note: See TracTickets for help on using tickets.