[Biopython-dev] Bio.Restriction "super" call (Python vs PyPy?)
Peter Cock
p.j.a.cock at googlemail.com
Thu Nov 24 06:54:35 EST 2011
Dear all,
Aside from a problem with leaking handles, the remaining problem
with Biopython's test suite under PyPy is in Bio.Restriction,
specifically this line in the RestrictionType class __init__ method,
super(RestrictionType, cls).__init__(cls, name, bases, dct)
Here is the error under PyPy 1.7 (same with PyPy 1.6),
$ pypy
Python 2.7.1 (7773f8fc4223, Nov 18 2011, 22:15:49)
[PyPy 1.7.0 with GCC 4.0.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``<arigato> no, normal work is so
much less tiring than vacations''
>>>> from Bio import Restriction
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "Bio/Restriction/__init__.py", line 61, in <module>
from Bio.Restriction.Restriction import *
File "Bio/Restriction/Restriction.py", line 2404, in <module>
newenz = T(k, bases, enzymedict[k])
File "Bio/Restriction/Restriction.py", line 241, in __init__
super(RestrictionType, cls).__init__(cls, name, bases, dct)
TypeError: unbound method __init__() must be called with BssMI
instance as first argument (got RestrictionType instance instead)
>>>> quit()
Note that we had to tweak the super call to get this to work under Python 2.6,
http://lists.open-bio.org/pipermail/biopython-dev/2008-October/004369.html
https://github.com/biopython/biopython/commit/11332d6d4951406f3cc001cea41ea75fce177f89
It used to be:
super(RestrictionType, cls).__init__(name, bases, dct)
PyPy doesn't like that either,
$ pypy
Python 2.7.1 (7773f8fc4223, Nov 18 2011, 22:15:49)
[PyPy 1.7.0 with GCC 4.0.1] on darwin
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``"3 + 3 = 8" - Anto in the JIT
talk''
>>>> from Bio import Restriction
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "Bio/Restriction/__init__.py", line 61, in <module>
from Bio.Restriction.Restriction import *
File "Bio/Restriction/Restriction.py", line 2405, in <module>
newenz = T(k, bases, enzymedict[k])
File "Bio/Restriction/Restriction.py", line 242, in __init__
super(RestrictionType, cls).__init__(name, bases, dct)
TypeError: unbound method __init__() must be called with BssMI
instance as first argument (got str instance instead)
>>>>
What I find interesting is if we comment out the super call, everything
seems to work - test_Restriction.py and test_CAPS.py pass under PyPy,
Jython, Python 2, and Python 3. I'm tempted to just do that - but I don't
fully understand what is going on and why.
Can anyone throw some light on this?
Thanks,
Peter
More information about the Biopython-dev
mailing list