[ZCM] [ZC] 2005/11 Comment " Adding a ZClass instance failing in Zope-2.9.0 (was working in Zope-2.8.5-final)"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Mon Aug 28 22:43:19 EDT 2006


Issue #2005 Update (Comment) " Adding a ZClass instance failing in Zope-2.9.0 (was working in Zope-2.8.5-final)"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2005

==============================================================
= Comment - Entry #11 by tseaver on Aug 28, 2006 10:43 pm

Those tests *are* run (and pass) when running the whole suite::

$ ../bin/python test.py -vv | grep ZClass
    /home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/_pmc.txt    /home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/ZClass.txt
    /home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/27.txt
    checkZClassesArentResolved (tempstorage.tests.testTemporaryStorage.TemporaryStorageTests)


but they *don't* pass when run by themselves::

$ ../bin/python test.py -s ZClasses -t ZClass
Running tests at level 1
Running unit tests:
  Running:
    .................................................

Failure in test /home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/ZClass.txt
Failed doctest test for ZClass.txt
  File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/ZClass.txt", line 0

----------------------------------------------------------------------
File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZClasses/ZClass.txt", line 161, in ZClass.txt
Failed example:
    transaction.commit()
Exception raised:
    Traceback (most recent call last):
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/zope/testing/doctest.py", line 1256, in __run
        compileflags, 1) in test.globs
      File "<doctest ZClass.txt[54]>", line 1, in ?
        transaction.commit()
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/transaction/_manager.py", line 96, in commit
        return self.get().commit(sub, deprecation_wng=False)
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/transaction/_transaction.py", line 380, in commit
        self._saveCommitishError() # This raises!
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/transaction/_transaction.py", line 378, in commit
        self._commitResources()
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/transaction/_transaction.py", line 433, in _commitResources
        rm.commit(self)
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZODB/Connection.py", line 484, in commit
        self._commit(transaction)
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZODB/Connection.py", line 526, in _commit
        self._store_objects(ObjectWriter(obj), transaction)
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZODB/Connection.py", line 553, in _store_objects
        p = writer.serialize(obj)  # This calls __getstate__ of obj
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZODB/serialize.py", line 407, in serialize
        return self._dump(meta, obj.__getstate__())
      File "/home/tseaver/projects/Zope-CVS/Zope-2.9-branch/lib/python/ZODB/serialize.py", line 416, in _dump
        self._p.dump(state)
      File "/home/tseaver/projects/Zope-CVS/lib/python2.4/copy_reg.py", line 70, in _reduce_ex
        state = base(self)
    TypeError: default __new__ takes no parameters

________________________________________
= Comment - Entry #10 by hya on Aug 28, 2006 10:29 pm

Problem still exists with Zope 2.9.4, Python 2.4.3 ... Was working fine on Zope 2.8.x.
________________________________________
= Comment - Entry #9 by ajung on Mar 29, 2006 1:48 am

"A big problem for us" does not mean a big problem for the majority..sorry, but bugs like this one are fixed when ppl that know about the problem and its solution have time to fix it. 
ZClasses are of low interest to most Zope 2 core developers.
________________________________________
= Comment - Entry #8 by adegreiff on Mar 28, 2006 4:40 pm

This problem still exists in 2.9.2
this is a big problem for us. doesn't anybody miss this function?

________________________________________
= Comment - Entry #7 by ajung on Jan 18, 2006 2:02 pm

Waah..looks as if the unittests for ZClasses are not executed for "make test" :-(
________________________________________
= Comment - Entry #6 by efge on Jan 18, 2006 2:00 pm

Indeed this reveals a problem:
  bin/zopectl test -s ZClasses -t ZClass

Adding some debug gives:

   raise TypeError("%s state %s classmeta %s" % (str(e), repr(state), repr(classmeta)))

TypeError: default __new__ takes no parameters

state ((<class 'ZClasses.ZClass.PersistentClass'>, <class 'OFS.SimpleItem.SimpleItem'>), {'__module__': '*C5oPOXHjGxkrlvoi9lrsfQ==', '__ac_permissions__': ..., 'manage_options': ..., '__provides__': <zope.interface.declarations.ClassProvides object at 0x32fa370>, 'propertysheets': <C_PropertySheetsClass object at 0x32d2230>, 'meta_type': 'C', 'eek': <ZClasses.Method.MWp object at 0x3302070>, 'y': 42, 'x': 'hee ', '__implemented__': <implementedBy *C5oPOXHjGxkrlvoi9lrsfQ==.C>, '__doc__': 'C', 'icon': ''})

classmeta (<class 'ZClasses._pmc.ZClassPersistentMetaClass'>, ('C', (<class 'ZClasses.ZClass.PersistentClass'>, <class 'OFS.SimpleItem.SimpleItem'>), {}, None))

________________________________________
= Comment - Entry #5 by ajung on Jan 18, 2006 1:59 pm

And what is the conclusion?
________________________________________
= Comment - Entry #4 by efge on Jan 18, 2006 1:56 pm

If you print the buggy state, you see some __implemented__ and __provides__ attributes that must be unpicklable. Mixed with persistentclasses, that must crash.

________________________________________
= Comment - Entry #3 by ajung on Jan 18, 2006 12:52 pm

pdb gives me this:

(Pdb) list
 79                 raise TypeError("a class that defines __slots__ without "
 80                                 "defining __getstate__ cannot be pickled")
 81             try:
 82                 dict = self.__dict__
 83             except AttributeError:
 84                 dict = None
 85         else:
 86             dict = getstate()
 87         if dict:
 88             return _reconstructor, args, dict
 89         else:
(Pdb) print base
<type '_interface_coptimizations.SpecificationBase'>
(Pdb) print self
<implementedBy *alsFbb7P5R421dD2S025SQ==.myclass>


But no further idea about that. Perhaps ZODB related?
________________________________________
= Edit - Entry #2 by ajung on Jan 18, 2006 1:03 am

 Changes: submitter email, importance (critical => medium)
________________________________________
= Request - Entry #1 by ottrey on Jan 17, 2006 11:58 pm

Adding a ZClass instance failing in Zope-2.9.0 (was working in Zope-2.8.5-final)
(using Python 2.4.2, as instructed on http://www.zope.org/Products/Zope/2.9.0/Zope-2_9_0-released )

Scenario: Add a new instance of a ZClass.

1. Added a new product

   http://localhost:8080/Control_Panel/Products/manage_addProduct?id=Product01&title=

2. Added a ZClass to that product
    
http://localhost:8080/Control_Panel/Products/Product01?id=ZClass_01&title=ZClass_01&meta_type=ZClass_01&CreateAFactory%3Aint=1&manage_addZClass%3Amethod=+Add+&zope_object%3Adefault%3Aint=1&CreateAFactory%3Adefault%3Aint=0

3. [Tried] to add an instance of that ZClass

   http://localhost:8080/manage_addProduct/Product01/ZClass_01_add?id=zc01


which worked fine in Zope-2.8.5-final,

    ( from http://localhost:8080/Control_Panel/manage_main )
    Zope Version    (Zope 2.8.5-final, python 2.4.2, linux2)
    Python Version  2.4.2 (#1, Jan 13 2006, 14:52:28) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)]
    System Platform linux2

but fails in Zope 2.9.0

    ( from http://localhost:8080/Control_Panel/manage_main )
    Zope Version    (Zope 2.9.0-, python 2.4.2, linux2)
    Python Version   2.4.2 (#1, Jan 13 2006, 14:52:28) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)]
    System Platform linux2


giving this error:

    Request URL     http://localhost:8080/manage_addProduct/Product01/ZClass_01_add
    Exception Type  TypeError
    Exception Value     default __new__ takes no parameters

    Traceback (innermost last):

        * Module ZPublisher.Publish, line 119, in publish
        * Module Zope2.App.startup, line 234, in commit
        * Module transaction._manager, line 96, in commit
        * Module transaction._transaction, line 380, in commit
        * Module transaction._transaction, line 378, in commit
        * Module transaction._transaction, line 433, in _commitResources
        * Module ZODB.Connection, line 484, in commit
        * Module ZODB.Connection, line 526, in _commit
        * Module ZODB.Connection, line 553, in _store_objects
        * Module ZODB.serialize, line 407, in serialize
        * Module ZODB.serialize, line 416, in _dump
        * Module copy_reg, line 70, in _reduce_ex

    TypeError: default __new__ takes no parameters



So then tried running the unit tests with:

    make test

Apart from 4 failures to do with timezones (which am not too concerned about)
it passed all the tests for Zope-2.8.5-final, but the unit tests wouldn't work
with the Zope-2.9.0 tarball ( http://www.zope.org/Products/Zope/2.9.0/Zope-2.9.0.tgz )

So checked out the 2.9.0 version from the svn repository:

    svn co svn://svn.zope.org/repos/main/Zope/tags/2.9.0

The unit tests then ran, giving the same results as Zope-2.8.5-final


Also tried the above scenario on the code from the repository:

    ( from http://localhost:8080/Control_Panel/manage_main )
    Zope Version    (unreleased version, python 2.4.2, linux2)
    Python Version  2.4.2 (#1, Jan 13 2006, 14:52:28) [GCC 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)]
    System Platform linux2

but got the same error.
==============================================================



More information about the Zope-Collector-Monitor mailing list