Nick Coghlan added the comment: I updated the patch to apply cleanly to the default branch. I also added several new test cases which uncovered issues with Daniel's previous patch.
Specifically: - the reverse functions were not be tested properly (added a separate test to ensure they all return NotImplemented when appropriate) - the checks in the in-place operands were not being tested, and were also too strict (added tests for their input checking, and also ensured they still accepted arbitrary iterables as input) I've also reduced the target versions to just 3.4 - this will require a porting note in the What's New, since the inappropriate handling of arbitrary iterables in the ABC methods has been removed, which means that things that previously worked when they shouldn't (like accepting a list as the RHS of a binary set operator) will now throw TypeError. Python 3.3: >>> set() | list() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'set' and 'list' >>> from test.test_collections import WithSet >>> WithSet() | list() <test.test_collections.WithSet object at 0x7f71ff2f6210> After applying the attached patch: >>> set() | list() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'set' and 'list' >>> from test.test_collections import WithSet >>> WithSet() | list() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for |: 'WithSet' and 'list' ---------- versions: -Python 2.7, Python 3.2, Python 3.3 Added file: http://bugs.python.org/file33863/issue8743-set-ABC-interoperability.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8743> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com