E&S CVS Commit: PEAK - Note to self: NEVER mix 'object'-derivatives in the bases of a metaclass!

pje at eby-sarna.com pje at eby-sarna.com
Wed Nov 27 19:17:01 EST 2002

Module Name:	PEAK
Committed By:	pje
Date:		Thu Nov 28 00:16:03 UTC 2002

Modified Files:
	PEAK/src/peak/binding: once.py
	PEAK/src/peak/model: api.py

Log Message:
Note to self: NEVER mix 'object'-derivatives in the bases of a metaclass!
It can cause Python 2.2.x (yes, even 2.2.2) to coredump in the 'help()'
function, when it tries to access the screwed-up '__weakref__' member of
instances of the metaclass.  Prior to this check-in, the following code::

 >>> class foo(binding.Base):

 >>> help(foo)

would cause a coredump in 2.2.2!  'binding.OnceClass' and
'binding.AutoCreated' are probably still broken in the same way, but I
think maybe we should get rid of them anyway.  I'll post a proposal to the
mailing list for this.

Note that this bug has absolutely nothing to do with PEAK -- it's a known
Python 2.2.x problem with new-style classes which I keep bumping my head
into.  But the last few times I didn't successfully learn the full range
of things that can cause it.  Now I think I've got the hang of it.  In
theory, Python 2.3 doesn't have these issues, but 2.3 won't be our target
for several months yet.  Though perhaps it would be good to verify the
fixing of this little snafu...  Another way to cause the same coredump is::

 >>> class x(object): pass

 >>> class y(type,x): pass

 >>> class z: __metaclass__ = x

 >>> help(z)


To view diffs of this commit, you can use the following URL(s):

To generate a diff of this commit:
cvs rdiff -r1.27 -r1.28 PEAK/src/peak/binding/once.py
cvs rdiff -r1.54 -r1.55 PEAK/src/peak/model/api.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

More information about the source-changes mailing list