Opened 8 years ago

Closed 8 years ago

#51364 closed defect (duplicate)

py34-parsing @ 2.1.2 fails to build

Reported by: josephsacco Owned by: nerdling (Jeremy Lavergne)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: mojca (Mojca Miklavec)
Port: py-parsing

Description (last modified by mojca (Mojca Miklavec))

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

comment:1 Changed 8 years ago by mojca (Mojca Miklavec)

Cc: mojca@… added; snc@… removed
Description: modified (diff)
Owner: changed from macports-tickets@… to snc@…
Version: 2.3.4

comment:2 Changed 8 years ago by nerdling (Jeremy Lavergne)

Resolution: duplicate
Status: newclosed

Duplicate of #49905

Note: See TracTickets for help on using tickets.