So... this time I got a really weird one. I'm storing a subclass of File (Archetypes newBaseUnit, File is the only base class) into a PersistentMapping, and I'm getting: 'Can't pickle objects in acquisition wrappers' However, as far as I can see, the object is *not* acquisition wrapper. If I put a try: except in ZODB.serialize and try obj.aq_base, I get an attribute error, and aq_base(obj) is obj returns True. It *smells* like Implicit.__getstate__ is being called, though I can't really tell :( Any ideas? -- Sidnei da Silva <sidnei@awkly.org> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Sic transit discus mundi -- From the System Administrator's Guide, by Lars Wirzenius
On Mon, Dec 15, 2003 at 09:21:47PM -0200, Sidnei da Silva wrote: | So... this time I got a really weird one. I'm storing a subclass of | File (Archetypes newBaseUnit, File is the only base class) into a | PersistentMapping, and I'm getting: | | 'Can't pickle objects in acquisition wrappers' | | However, as far as I can see, the object is *not* acquisition | wrapper. If I put a try: except in ZODB.serialize and try obj.aq_base, | I get an attribute error, and aq_base(obj) is obj returns True. It | *smells* like Implicit.__getstate__ is being called, though I can't | really tell :( Answering my own question, a visit to gdb showed that the problem was not the newBaseUnit, but an object that it was referencing. Its fun that it didn't happen with 2.7. Breakpoint 1, Wrappers_are_not_picklable (Wrapper=0x41a17840, args=0x418e696c) at Acquisition/_Acquisition.c:1114 1114 } (gdb) l 1109 Wrappers_are_not_picklable(PyObject *Wrapper, PyObject *args) 1110 { 1111 PyErr_SetString(PyExc_TypeError, 1112 "Can't pickle objects in acquisition wrappers."); 1113 return NULL; 1114 } 1115 1116 1117 static struct PyMethodDef Wrapper_methods[] = { 1118 {"__init__", (PyCFunction)Wrapper__init__, 0, (gdb) pyo Wrapper object : <mimetype text/plain> type : ImplicitAcquirerWrapper refcount: 4 address : 0x41a17840 -- Sidnei da Silva <sidnei@awkly.org> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher Whip me. Beat me. Make me maintain AIX. -- Stephan Zielinski
Does the last report mean your problem is fixed? Or do you still need help tracking something down? Jeremy
On Wed, Dec 17, 2003 at 12:34:38AM -0500, Jeremy Hylton wrote: | Does the last report mean your problem is fixed? Or do you still need | help tracking something down? It's fixed, though I would like to discuss it a bit more. It *seems* to me that the Zope HEAD is being more picky about storing acquisition wrappers, which on one side is a good thing. OTOH, it was relatively hard to track it down, meaning several visits to gdb. The fact that the parameter is called 'Wrapper' at 'Wrappers_are_not_picklable' makes it even harder, because is practically impossible to cast the object to a Wrapper. So, I would like to propose two changes: 1. Rename the 'Wrapper' parameter to 'wrapper' in that function 2. Include 'Wrapper->container' and 'Wrapper->obj' in the traceback, in order to make it easier for people to find out where is the problem when it happens. (note that the 'Wrapper' parameter is not even being used currently) Thoughts? -- Sidnei da Silva <sidnei@awkly.org> http://awkly.org - dreamcatching :: making your dreams come true http://plone.org/about/team#dreamcatcher "Don't fear the pen. When in doubt, draw a pretty picture." --Baker's Third Law of Design.
participants (2)
-
Jeremy Hylton -
Sidnei da Silva