a type without a __mro__?

Alex Martelli aleaxit at yahoo.com
Sat Feb 5 05:37:10 EST 2005


Can anybody suggest where to find (within the standard library) or how
to easily make (e.g. in a C extension) a type without a __mro__, except
for those (such as types.InstanceType) which are explicitly recorded in
the dispatch table copy._deepcopy_dispatch...?

Weird request, I know, so let me explain.  There's a bug in the
forthcoming 2.3.5's copy.py which can be tickled only by such a type.

Fixing the bug is trivially easy (I'll just use inspect.getmro(cls)
instead of cls.__mro__), but I also want to add to test_copy.py a unit
test that tickles the bug, rather than just commit an ``untested fix''.

I'm stumped at finding a type that's suitable for reproducing the bug;
I've asked the submitter of the original bug report (which comes up with
Zope and some specific application -- unsuitable for a core python unit
test, sigh), I've asked on python-dev, I've even IM'd a couple of
Python-guru friends, but the friends are equally stumped and I'm getting
no answers on python-dev nor from the submitter of the bug report.  So,
I thought I'd turn to the collective ingenuity of comp.lang.python...
thanks in advance for any help!


Alex



More information about the Python-list mailing list