Cannot unpickle object with broken interface provided on it

Bug #646661 reported by Sylvain Viollon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zope 2
Invalid
Undecided
Unassigned

Bug Description

On a ZODB object I do an alsoProvide of an interface.

Now I remove the corresponding code for that interface (and that
object but it is not required) and I restart my server. I didn't
moved them, I just removed them. (If I moved them I would use
zodbupdate, and have no problem).

But let say I need to remove that object from ZODB. Unpickling that
object fail in the custom set_state of zope.interface with the well known
error:

   File ".../zope.interface-3.5.3-py2.6-linux-i686.egg/zope/interface/adapter.py", line 470, in add_extendor for i in provided.__iro__:

   AttributeError: type object 'IMyInterface' has no attribute '__iro__'

Because it expect to get an interface to restore the alsoProvides,
and got a broken interface instead (which is just like a regular
broken object).

And you cannot access your ZODB anymore, since this broken object, with
its broken interface is unpickled when its container is.

I found a way 'to prevent' this error, by adding an attribute
__iro__ which is an empty tuple to OFS.Uninstalled.BrokenClass.
That let me load this broken object, and delete it (along with the reference
to the broken interface).

I think it is the good behavior, and since you cannot modify a broken
object, if you put back the code after, your object will work again,
with its interface provided as well.

Changed in zope2:
status: New → Confirmed
Revision history for this message
Colin Watson (cjwatson) wrote :

The zope2 project on Launchpad has been archived at the request of the Zope developers (see https://answers.launchpad.net/launchpad/+question/683589 and https://answers.launchpad.net/launchpad/+question/685285). If this bug is still relevant, please refile it at https://github.com/zopefoundation/zope2.

Changed in zope2:
status: Confirmed → Invalid
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.