zope.interface.declarations ('__module__' not in locals) fails in Jython

Bug #204022 reported by Nicholas Riley
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Unassigned
zope.interface
Won't Fix
Undecided
Unassigned

Bug Description

Jython's current compiler evaluates the body of the class before it fills in the class . In two places in declarations.py, zope.interface checks that a local __module__ variable exists, but in Jython trunk (which reports itself as 2.3.0a0) this is not the case, so the test always fails.

We (Jython developers) are not going to fix this in the current compiler, but we will fix it in the new 2.5-compatible compiler. We have worked around another case tested for in zope.interface with __doc__ assignment/docstring precedence so it behaves the same as CPython.

Since you already make this test conditional on Python version, perhaps you could just remove it entirely? Otherwise, you can make it conditional on Jython (sys.platform.startswith('java') and sys.version_info[:3] < (2, 5, 0)) (the first version of Jython with the newcompiler will report itself as 2.5.0a0; the current trunk is 2.3.0a0). Note that, for whatever reason, zope.interface.declarations only checks the CPython version in one place, not both.

A setup.py change is also necessary to get zope.interface working on Jython trunk (so it doesn't fail on trying to compile the extension module); I'll file that as a separate bug.

Tres Seaver (tseaver)
Changed in zope3:
status: New → Won't Fix
Revision history for this message
Tres Seaver (tseaver) wrote :

We no longer support Python < 2.6. We can't add Jython support until the tox/pip mess is fixed.

Changed in zope.interface:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.