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 abarnert
Recipients abarnert, gvanrossum, martin.panter, ncoghlan, r.david.murray, serhiy.storchaka
Date 2016-01-05.02:28:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Is an hg export patch usable? If not, let me know and I'll flatten it.

Anyway, the attached patch fixes #25987 and #25864 as well as this one, as follows:

 * Every ABC in that has a subclass hook now treats None as blocking, instead of a few checking falsiness and others not checking anything. (And all the hooks are now identical, which eliminates any unintended inconsistencies.)

 * = None (fixes #25864).

 * added (fixes #25987).

 * iter(), reversed(), and in operator all have custom text in their TypeError instead of the generic "'NoneType' object is not callable".

 * Unit tests for all of the above, plus that None blocking also works appropriately (i.e., same as in CPython 2.3-3.6) for __spam__ -> __rspam__, __ispam__ -> __spam__.

  * I didn't try to write tests for _everything_ with fallback. For example, blocking fallback from __str__ to __repr__, or anything to do with __*attr*__, does work, but I can't think of any conceivable case where you'd ever do such a thing. (The fact that you can write a class that isn't repr-able isn't a feature of Python we want to guarantee, it's just a side-effect of other stuff that will hopefully never come up, so it seems wrong to write a unit test to guarantee it.)

 * Data Model docs document that you can set a special method to None to block behavior (including blocking fallback to old-style sequence protocol, inheritance from superclass, etc.).

(Note that this patch is not yet fully tested, because my Windows and Cygwin builds are for some reason taking forever. But if I don't post an update tomorrow, that will mean they passed the overnight tests. I doubt anyone was going to commit this tonight anyway, but, just in case...)
Date User Action Args
2016-01-05 02:28:45abarnertsetrecipients: + abarnert, gvanrossum, ncoghlan, r.david.murray, martin.panter, serhiy.storchaka
2016-01-05 02:28:44abarnertsetmessageid: <>
2016-01-05 02:28:44abarnertlinkissue25958 messages
2016-01-05 02:28:43abarnertcreate