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 brandon-rhodes
Recipients belopolsky, benjamin.peterson, brandon-rhodes, daniel.urban, eric.araujo, ncoghlan, pitrou
Date 2011-03-19.13:40:07
SpamBayes Score 3.284172e-08
Marked as misclassified No
Message-id <87zkor9qkp.fsf@asaph.rhodesmill.org>
In-reply-to <1300541804.99.0.135380035012.issue11572@psf.upfronthosting.co.za> ("ÉricAraujo"'s message of "Sat, 19 Mar 2011 13:36:45 +0000")
Content
Éric Araujo <report@bugs.python.org> writes:

> -            reductor = getattr(x, "__reduce__", None)
> -            if reductor:
> -                rv = reductor()
> -            else:
> -                raise Error("un(shallow)copyable object of type %s" % cls)
> +            raise Error("un(shallow)copyable object of type %s" % cls)
>
> Why change this?

Because it is impossible for this code to be called in Python 3 -
"object" now itself supplies __reduce_ex__, so the fall-through to look
for plain "__reduce__" does not occur here.  This default __reduce_ex__
then calls any user-defined __reduce__, if present.

>>         self.assertTrue(issubclass(copy.Error, Exception))
> You could change that to assertIsInstance.

I will do so on Monday to make a final form of the patch, along with any
other suggestions that come in!

>> -def _test():
> I assume that all cases that were tested in that function are covered
> by unit tests.

Yes!
History
Date User Action Args
2011-03-19 13:40:08brandon-rhodessetrecipients: + brandon-rhodes, ncoghlan, belopolsky, pitrou, benjamin.peterson, eric.araujo, daniel.urban
2011-03-19 13:40:07brandon-rhodeslinkissue11572 messages
2011-03-19 13:40:07brandon-rhodescreate