This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients alexandre.vassalotti, georg.brandl, hagen, july, ncoghlan
Date 2009-07-17.22:21:04
SpamBayes Score 1.0708079e-10
Marked as misclassified No
Message-id <1247869266.89.0.631175770643.issue6477@psf.upfronthosting.co.za>
In-reply-to
Content
Given that dumps(type(Ellipsis)) and dumps(type(NotImplemented)) don't
work either, I am reclassifying this as a documentation bug.

The thing about the types of these three objects (None, Ellipsis,
NotImplemented) is that they are all designed to be singletons and they
all disallow creation of new instances of them.

>>> type(None)()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot create 'NoneType' instances
>>> type(NotImplemented)()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot create 'NotImplementedType' instances
>>> type(Ellipsis)()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: cannot create 'ellipsis' instances

This does mean None has to be special cased if pickling "(object,
type(object))" pairs, but passing types through pickle strikes me as a
dubious enough exercise that it would take a fairly convincing use case
to accept an RFE to make NoneType pickleable (note that any such patch
would have to make sure that doing loads() on such a pickle didn't
manage to create a second copy of NoneType or None).
History
Date User Action Args
2009-07-17 22:21:07ncoghlansetrecipients: + ncoghlan, georg.brandl, alexandre.vassalotti, hagen, july
2009-07-17 22:21:06ncoghlansetmessageid: <1247869266.89.0.631175770643.issue6477@psf.upfronthosting.co.za>
2009-07-17 22:21:05ncoghlanlinkissue6477 messages
2009-07-17 22:21:04ncoghlancreate