[pypy-dev] Using PyPy as a compiler

Hart's Antler bhartsho at yahoo.com
Mon Feb 7 03:25:39 CET 2005


Hi, your right my function did have a print statement in there.  I fixed that and it worked!  Is
there a doc that lists the limitations translator has?

Now i am trying to compile some other functions but having another problem.  pyrexc gives this
error:
mymodule.pyx:11:12: Syntax error in simple statement list
that line from mymodule is:
    cinline "Label2:"

I'm trying to compile a bunch of other functions to, and they all error on lines that look like
that one, and always line 11:12.

Here is the python code:
def moveNode(self, url):
	parent = self.xpath(url)[0]
	self.parentNode.removeChild(self)
	parent.appendChild(self)
	return 'Thanks, finished moving node.'


move node, and the other functions having the problems all need to use this function as well, i
think the problem is somewhere in here:
def _resolveAttribute(self, name):
	if name is 'parentNode':
		if type(self._parentNode) is types.DictType:
			self.materialize(self._parentNode)
		return self._parentNode
	elif name is 'childNodes':
		for child in self._childNodes:
			if type(child) is types.DictType:
				self.materialize(child)
		return self._childNodes
	elif name is 'firstChild':
		if type(self._childNodes[0]) is types.DictType:
			self.materialize(self._childNodes[0])
		return self._childNodes[0]
	elif name is 'lastChild':
		if type(self._childNodes[-1]) is types.DictType:
			self.materialize(self._childNodes[-1])
		return self._childNodes[-1]
	else:
		raise AttributeError



Pyrex translation:
def moveNode(self_18577, url_18578):
  return moveNode__2da99144(self_18577, url_18578)
cdef object moveNode__2da99144(object self_18577, object url_18578):
  # untyped variables: etype_18580 evalue_18581 parent_18592 parent_18692 parent_18697
parent_18703 parent_18710 parent_18718 parent_18727 parent_18737 parent_18748 parent_18758
parent_18767 parent_18775 self_18681 self_18684 self_18688 self_18693 self_18699 self_18706
self_18714 self_18723 self_18733 self_18744 self_18754 self_18763 self_18771 self_18778 self_18784
self_18790 self_18795 url_18682 url_18685 url_18689 url_18694 url_18700 url_18707 url_18715
url_18724 url_18734 url_18745 url_18755 url_18764 url_18772 url_18779 url_18785 url_18791
url_18796 v18579 v18582 v18586 v18600 v18613 v18625 v18639 v18655 v18683 v18686 v18687 v18690
v18691 v18695 v18696 v18698 v18701 v18702 v18704 v18705 v18708 v18709 v18711 v18712 v18713 v18716
v18717 v18719 v18720 v18721 v18722 v18725 v18726 v18728 v18729 v18730 v18731 v18732 v18735 v18736
v18738 v18739 v18740 v18741 v18742 v18743 v18746 v18747 v18749 v18750 v18751 v18752 v18753 v18756
v18757 v18759 v18760 v18761 v18762 v18765 v18766 v18768 v18769 v18770 v18773 v18774 v18776 v18777
v18780 v18781 v18782 v18783 v18786 v18787 v18788 v18789 v18792 v18793 v18794 v18797 v18798
  try:
    v18582 = self_18577.xpath
  except AttributeError, last_exc_value:
    last_exception = last_exc_value.__class__
    self_18795, url_18796, v18797, v18798 = self_18577, url_18578, last_exception, last_exc_value
    etype_18580, evalue_18581 = AttributeError, v18798
    cinline "Label2:"
    raise etype_18580, evalue_18581
  else:
    self_18681, url_18682, v18683 = self_18577, url_18578, v18582
    try:
      v18586 = v18683(url_18682)
    except Exception, last_exc_value:
      last_exception = last_exc_value.__class__
      self_18790, url_18791, v18792, v18793, v18794 = self_18681, url_18682, v18683,
last_exception, last_exc_value
      etype_18580, evalue_18581 = v18793, v18794
      cinline "goto Label2;"
    else:
      self_18684, url_18685, v18686, v18687 = self_18681, url_18682, v18683, v18586
      try:
        parent_18592 = v18687[0]
      except IndexError, last_exc_value:
        last_exception = last_exc_value.__class__
        self_18778, url_18779, v18780, v18781, v18782, v18783 = self_18684, url_18685, v18686,
v18687, last_exception, last_exc_value
        etype_18580, evalue_18581 = IndexError, v18783
        cinline "goto Label2;"
      except KeyError, last_exc_value:
        last_exception = last_exc_value.__class__
        self_18784, url_18785, v18786, v18787, v18788, v18789 = self_18684, url_18685, v18686,
v18687, last_exception, last_exc_value
        etype_18580, evalue_18581 = KeyError, v18789
        cinline "goto Label2;"
      else:
        self_18688, url_18689, v18690, v18691, parent_18692 = self_18684, url_18685, v18686,
v18687, parent_18592
        try:
          v18600 = self_18688.parentNode
        except AttributeError, last_exc_value:
          last_exception = last_exc_value.__class__
          self_18771, url_18772, v18773, v18774, parent_18775, v18776, v18777 = self_18688,
url_18689, v18690, v18691, parent_18692, last_exception, last_exc_value
          etype_18580, evalue_18581 = AttributeError, v18777
          cinline "goto Label2;"
        else:
          self_18693, url_18694, v18695, v18696, parent_18697, v18698 = self_18688, url_18689,
v18690, v18691, parent_18692, v18600
          try:
            v18613 = v18698.removeChild
          except AttributeError, last_exc_value:
            last_exception = last_exc_value.__class__
            self_18763, url_18764, v18765, v18766, parent_18767, v18768, v18769, v18770 =
self_18693, url_18694, v18695, v18696, parent_18697, v18698, last_exception, last_exc_value
            etype_18580, evalue_18581 = AttributeError, v18770
            cinline "goto Label2;"
          else:
            self_18699, url_18700, v18701, v18702, parent_18703, v18704, v18705 = self_18693,
url_18694, v18695, v18696, parent_18697, v18698, v18613
            try:
              v18625 = v18705(self_18699)
            except Exception, last_exc_value:
              last_exception = last_exc_value.__class__
              self_18754, url_18755, v18756, v18757, parent_18758, v18759, v18760, v18761, v18762
= self_18699, url_18700, v18701, v18702, parent_18703, v18704, v18705, last_exception,
last_exc_value
              etype_18580, evalue_18581 = v18761, v18762
              cinline "goto Label2;"
            else:
              self_18706, url_18707, v18708, v18709, parent_18710, v18711, v18712, v18713 =
self_18699, url_18700, v18701, v18702, parent_18703, v18704, v18705, v18625
              try:
                v18639 = parent_18710.appendChild
              except AttributeError, last_exc_value:
                last_exception = last_exc_value.__class__
                self_18744, url_18745, v18746, v18747, parent_18748, v18749, v18750, v18751,
v18752, v18753 = self_18706, url_18707, v18708, v18709, parent_18710, v18711, v18712, v18713,
last_exception, last_exc_value
                etype_18580, evalue_18581 = AttributeError, v18753
                cinline "goto Label2;"
              else:
                self_18714, url_18715, v18716, v18717, parent_18718, v18719, v18720, v18721,
v18722 = self_18706, url_18707, v18708, v18709, parent_18710, v18711, v18712, v18713, v18639
                try:
                  v18655 = v18722(self_18714)
                except Exception, last_exc_value:
                  last_exception = last_exc_value.__class__
                  self_18733, url_18734, v18735, v18736, parent_18737, v18738, v18739, v18740,
v18741, v18742, v18743 = self_18714, url_18715, v18716, v18717, parent_18718, v18719, v18720,
v18721, v18722, last_exception, last_exc_value
                  etype_18580, evalue_18581 = v18742, v18743
                  cinline "goto Label2;"
                else:
                  self_18723, url_18724, v18725, v18726, parent_18727, v18728, v18729, v18730,
v18731, v18732 = self_18714, url_18715, v18716, v18717, parent_18718, v18719, v18720, v18721,
v18722, v18655
                  v18579 = 'Thanks, finished moving node.'
                  return v18579






--- Adrien Di Mascio <adimasci at gmail.com> wrote:

> Hi Brett,
> 
> On Sun, 6 Feb 2005 05:31:37 -0800 (PST), Hart's Antler
> <bhartsho at yahoo.com> wrote:
> > The pyrex generated code looks like this:
> > def hi():
> >   return hi__2ad67a3c()
> > cdef object hi__2ad67a3c():
> >   # untyped variables: v0 v13 v21 v3 v7
> >   v3 = <Function sys_stdout>()
> >   v7 = <Function print_item_to>('hello world', v3)
> [...]
> > which was generated from a function that looks like this:
> > def hi(): return 'hello world'
> 
> Your original function probably has a print statement and print
> statements, AFAIK, are not properly translated for now. This is a
> "known" issue, however I'm not sure someone is actively looking at how
> to fix it.
> 
> Cheers,
> Adrien.
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the Pypy-dev mailing list