[Interface-dev] possible bug in zope/interface/declarations.py

Jim Fulton jim at zope.com
Sat Jun 12 08:36:58 EDT 2004


Jonathan Simms wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hey all,
> 
> I was messing around and i think i found a small bug in declarations.py.
> I would submit a patch, but I'm not really sure what the correction
> should be.
> 
> at line 990:
> 
> ~   raise TypeError(name+" can be used only from a class definition.")
> 
> only the variable 'name' isn't defined in the scope of classProvides
> 
> this is as of revision 25371.
> 
> 
> here is an interpreter session that causes the bug:
> 
> |>> import zope.interface as zi
> |>> class FooBar:
> ...     pass
> ...
> |>> zi.classProvides(FooBar)
> Traceback (most recent call last):
> ~  File "<stdin>", line 1, in ?
> ~  File
> "/home/slyphon/Projects/Twisted/trial-1/zope/interface/declarations.py",
> line 990, in classProvides
> ~    raise TypeError(name+" can be used only from a class definition.")
> NameError: global name 'name' is not defined
> |>>

It should be:

     raise TypeError("classProvides can be used only from a class definition.")

I'd make this change, but a test is needed first, and I don't have time
to do that at the moment.  If you want to help, you could send me a patch
with a test. :) (If you don't want to help, that's OK too.)


> 
> If there is an issue tracker where I should file this bug, please just
> point me in the right direction :).

http://collector.zope.org/Zope3-dev

Thanks.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org




More information about the Interface-dev mailing list