Skip to content

translation failure with rpython in default branch of pypy but success with py3.6 branch #98

@nobodxbodon

Description

@nobodxbodon

As I'm trying to translate cycy, first I used rpython in default branch of the cloned pypy source, ending in this error:

(py27) Xuans-MBP:cycy xuanwu$ python ~/git/pypy/rpython/bin/rpython cycy/target.py
[translation:info] 2.7.17 |Anaconda, Inc.| (default, Oct 21 2019, 14:10:59) 
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
[platform:msg] Set platform with 'host' cc=None, using cc='clang -arch x86_64', version='Unknown'
[translation:info] Translating target as defined by cycy/target
/Users/xuanwu/git/cycy/cycy/parser/core.py:507: ParserGeneratorWarning: 184 shift/reduce conflicts
  _parser = _pg.build()
/Users/xuanwu/git/cycy/cycy/parser/core.py:507: ParserGeneratorWarning: 30 reduce/reduce conflicts
  _parser = _pg.build()
[translation] translate.py configuration:
[translation] [translate]
    targetspec = cycy/target
[translation] translation configuration:
[translation] [translation]
    gc = incminimark
    gctransformer = framework
    list_comprehension_operations = True
    withsmallfuncsets = 5
[translation:info] Annotating&simplifying...
[f7] {translation-task
starting annotate
[translation:info] with policy: rpython.annotator.policy.AnnotatorPolicy
.....++++++++++++++****************************%%%%%%%%%%%%%%%%%%%%%###%########%%%#####################################%%%%%%%%%%%%###%***************
..++++++++++++++****[1b6] translation-task}

[Timer] Timings:
[Timer] annotate                       --- 3.5 s
[Timer] ========================================
[Timer] Total:                         --- 3.5 s
[translation:info] Error:
   File "/Users/xuanwu/git/pypy/rpython/translator/goal/translate.py", line 318, in main
    drv.proceed(goals)
   File "/Users/xuanwu/git/pypy/rpython/translator/driver.py", line 555, in proceed
    result = self._execute(goals, task_skip = self._maybe_skip())
   File "/Users/xuanwu/git/pypy/rpython/translator/tool/taskengine.py", line 114, in _execute
    res = self._do(goal, taskcallable, *args, **kwds)
   File "/Users/xuanwu/git/pypy/rpython/translator/driver.py", line 278, in _do
    res = func()
   File "/Users/xuanwu/git/pypy/rpython/translator/driver.py", line 315, in task_annotate
    s = annotator.build_types(self.entry_point, self.inputtypes)
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 92, in build_types
    return self.build_graph_types(flowgraph, inputs_s, complete_now=complete_now)
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 140, in build_graph_types
    self.complete()
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 229, in complete
    self.complete_pending_blocks()
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 224, in complete_pending_blocks
    self.processblock(graph, block)
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 398, in processblock
    self.flowin(graph, block)
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 501, in flowin
    self.consider_op(op)
   File "/Users/xuanwu/git/pypy/rpython/annotator/annrpython.py", line 653, in consider_op
    resultcell = op.consider(self)
   File "/Users/xuanwu/git/pypy/rpython/flowspace/operation.py", line 104, in consider
    return spec(annotator, *self.args)
   File "/Users/xuanwu/git/pypy/rpython/annotator/unaryop.py", line 118, in simple_call_SomeObject
    return s_func.call(argspec)
   File "/Users/xuanwu/git/pypy/rpython/annotator/unaryop.py", line 978, in call
    return bookkeeper.pbc_call(self, args)
   File "/Users/xuanwu/git/pypy/rpython/annotator/bookkeeper.py", line 535, in pbc_call
    results.append(desc.pycall(whence, args, s_previous_result, op))
   File "/Users/xuanwu/git/pypy/rpython/annotator/classdesc.py", line 732, in pycall
    s_init.call(args)
   File "/Users/xuanwu/git/pypy/rpython/annotator/unaryop.py", line 978, in call
    return bookkeeper.pbc_call(self, args)
   File "/Users/xuanwu/git/pypy/rpython/annotator/bookkeeper.py", line 535, in pbc_call
    results.append(desc.pycall(whence, args, s_previous_result, op))
   File "/Users/xuanwu/git/pypy/rpython/annotator/description.py", line 284, in pycall
    inputcells = self.parse_arguments(args)
   File "/Users/xuanwu/git/pypy/rpython/annotator/description.py", line 269, in parse_arguments
    (self.name, e.getmsg()))
[translation:ERROR] AnnotatorError: 

signature mismatch: __init__() takes exactly 4 arguments (5 given)


Occurred processing the following simple_call:
  function StrMatchContext.__init__ </Users/xuanwu/git/pypy/rpython/rlib/rsre/rsre_core.py, line 256> returning

    ctx_0 = simple_call((type StrMatchContext), s_0, pos_0, v6, v7)

In <FunctionGraph of (rply.lexergenerator:30)matches at 0x10911fb10>:
Happened at file /opt/miniconda3/envs/py27/lib/python2.7/site-packages/rply/lexergenerator.py line 36

==>             ctx = rsre_core.StrMatchContext(s, pos, len(s), self.flags)
    
                matched = rsre_core.match_context(ctx, self._pattern)
                if matched:

Known variable annotations:
 s_0 = SomeString(no_nul=True)
 pos_0 = SomeInteger(const=0, knowntype=int, nonneg=True, unsigned=False)
 v6 = SomeInteger(knowntype=int, nonneg=True, unsigned=False)
 v7 = SomeInteger(const=0, knowntype=int, nonneg=True, unsigned=False)

Processing block:
 block@101[pos_0...] is a <class 'rpython.flowspace.flowcontext.SpamBlock'> 
 in (rply.lexergenerator:30)matches 
 containing the following operations: 
       v6 = len(s_0) 
       v7 = getattr(self_0, ('flags')) 
       ctx_0 = simple_call((type StrMatchContext), s_0, pos_0, v6, v7) 
       v8 = getattr(self_0, ('_pattern')) 
       matched_0 = simple_call((function match_context), ctx_0, v8) 
       v9 = bool(matched_0) 
 --end--
[translation] start debugger...
> /Users/xuanwu/git/pypy/rpython/annotator/description.py(269)parse_arguments()
-> (self.name, e.getmsg()))

Then I switched to py3.6 branch with $ hg update py3.6 in pypy source path, and succeeded to translate.

Being new to both pypy and rply, I wonder what's the difference of rpython between these two branches?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions