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 ppperry
Recipients ppperry
Date 2017-03-11.16:00:20
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1489248021.29.0.604014111232.issue29794@psf.upfronthosting.co.za>
In-reply-to
Content
If you try to set the __class__ of a type which doesn't support "__class__" assignments, you get the error message:

    TypeError: __class__ assignment only supported for heap types or ModuleType subclasses

However, the actual restriction doesn't require a subclass of "ModuleType"; the below code works:

    import random
    class M(type(random)):pass
    random.__class__ = M

Thus the error message is incorrect.
History
Date User Action Args
2017-03-11 16:00:21ppperrysetrecipients: + ppperry
2017-03-11 16:00:21ppperrysetmessageid: <1489248021.29.0.604014111232.issue29794@psf.upfronthosting.co.za>
2017-03-11 16:00:21ppperrylinkissue29794 messages
2017-03-11 16:00:20ppperrycreate