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 Mark.Shannon, asvetlov, daniel.urban, dstanek, jcea, mdengler, ncoghlan, rhettinger, serhiy.storchaka, stutzbach, terry.reedy, yselivanov, ysj.ray
Date 2014-02-02.08:01:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1391328091.74.0.419613924035.issue8743@psf.upfronthosting.co.za>
In-reply-to
Content
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'
History
Date User Action Args
2014-02-02 08:01:32ncoghlansetrecipients: + ncoghlan, rhettinger, terry.reedy, jcea, dstanek, stutzbach, asvetlov, daniel.urban, ysj.ray, Mark.Shannon, serhiy.storchaka, mdengler, yselivanov
2014-02-02 08:01:31ncoghlansetmessageid: <1391328091.74.0.419613924035.issue8743@psf.upfronthosting.co.za>
2014-02-02 08:01:31ncoghlanlinkissue8743 messages
2014-02-02 08:01:31ncoghlancreate