[Zope-dev] bug in PythonMethod.py
Ava
ava@dde974.equipement.gouv.fr
Fri, 26 Nov 1999 14:28:16 +0400
Hello,
I found (what I think is) a bug in PythonMethod.py version 0.1.2 from the
PythonMethod product
around line 133 (and 246), we have the following expression:
self._v_selfish = (fc.co_varnames and fc.co_varnames[0]=='self' and
(fc.co_argcount - len(f.func_defaults) - 1))
len(f.func_defaults) is not correct because when your function has no
default argument, it is None, and len(None) raises a TypeError. I changed
this to read:
self._v_selfish = (fc.co_varnames and fc.co_varnames[0]=='self' and
(fc.co_argcount - len(f.func_defaults or ())))
But it seems that I have to drop the 'minus 1' to get a correct behavior
is func(self, args='') selfish? I think so, but with the 'minus 1', it turns
to be wrong!
What do you think?
--
Cordialement,
Jephté CLAIN
minf7@educ.univ-reunion.fr
PS: répondez sur minf7@educ.univ-reunion.fr, et pas sur
ava@dde974.equipement.gouv.fr