[MacPorts] #51364: py34-parsing @ 2.1.2 fails to build

MacPorts noreply at macports.org
Wed May 11 08:08:40 PDT 2016


#51364: py34-parsing @ 2.1.2 fails to build
--------------------------+-------------------
  Reporter:  drjesacco@…  |      Owner:  snc@…
      Type:  defect       |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  py-parsing   |
--------------------------+-------------------
Changes (by mojca@…):

 * cc: snc@… (removed)
 * cc: mojca@… (added)
 * owner:  macports-tickets@… => snc@…
 * version:  2.3.4 =>


Old 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

New 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:


 {{{
 #!python
 # 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

--

-- 
Ticket URL: <https://trac.macports.org/ticket/51364#comment:1>
MacPorts <https://www.macports.org/>
Ports system for OS X


More information about the macports-tickets mailing list