changeset: 100409:a5bc5c9490f5 branch: 3.5 parent: 100404:256339c28d42 parent: 100408:0cae6b6e3d7d user: Benjamin Peterson date: Thu Mar 03 22:08:01 2016 -0800 files: Lib/test/test_dictviews.py Misc/NEWS Objects/clinic/dictobject.c.h Objects/dictobject.c description: merge 3.4 (closes #26478) diff -r 256339c28d42 -r a5bc5c9490f5 Lib/test/test_dictviews.py --- a/Lib/test/test_dictviews.py Wed Mar 02 19:40:30 2016 +0200 +++ b/Lib/test/test_dictviews.py Thu Mar 03 22:08:01 2016 -0800 @@ -96,6 +96,7 @@ self.assertEqual(d1.keys() & set(d1.keys()), {'a', 'b'}) self.assertEqual(d1.keys() & set(d2.keys()), {'b'}) self.assertEqual(d1.keys() & set(d3.keys()), set()) + self.assertEqual(d1.keys() & tuple(d1.keys()), {'a', 'b'}) self.assertEqual(d1.keys() | d1.keys(), {'a', 'b'}) self.assertEqual(d1.keys() | d2.keys(), {'a', 'b', 'c'}) @@ -104,6 +105,7 @@ self.assertEqual(d1.keys() | set(d2.keys()), {'a', 'b', 'c'}) self.assertEqual(d1.keys() | set(d3.keys()), {'a', 'b', 'd', 'e'}) + self.assertEqual(d1.keys() | (1, 2), {'a', 'b', 1, 2}) self.assertEqual(d1.keys() ^ d1.keys(), set()) self.assertEqual(d1.keys() ^ d2.keys(), {'a', 'c'}) @@ -112,6 +114,7 @@ self.assertEqual(d1.keys() ^ set(d2.keys()), {'a', 'c'}) self.assertEqual(d1.keys() ^ set(d3.keys()), {'a', 'b', 'd', 'e'}) + self.assertEqual(d1.keys() ^ tuple(d2.keys()), {'a', 'c'}) self.assertEqual(d1.keys() - d1.keys(), set()) self.assertEqual(d1.keys() - d2.keys(), {'a'}) @@ -119,6 +122,7 @@ self.assertEqual(d1.keys() - set(d1.keys()), set()) self.assertEqual(d1.keys() - set(d2.keys()), {'a'}) self.assertEqual(d1.keys() - set(d3.keys()), {'a', 'b'}) + self.assertEqual(d1.keys() - (0, 1), {'a', 'b'}) self.assertFalse(d1.keys().isdisjoint(d1.keys())) self.assertFalse(d1.keys().isdisjoint(d2.keys())) diff -r 256339c28d42 -r a5bc5c9490f5 Misc/NEWS --- a/Misc/NEWS Wed Mar 02 19:40:30 2016 +0200 +++ b/Misc/NEWS Thu Mar 03 22:08:01 2016 -0800 @@ -76,6 +76,9 @@ __bytes__, __trunc__, and __float__ returning instances of subclasses of bytes, int, and float to subclasses of bytes, int, and float correspondingly. +- Issue #26478: Fix semantic bugs when using binary operators with dictionary + views and tuples. + - Issue #26171: Fix possible integer overflow and heap corruption in zipimporter.get_data(). diff -r 256339c28d42 -r a5bc5c9490f5 Objects/dictobject.c --- a/Objects/dictobject.c Wed Mar 02 19:40:30 2016 +0200 +++ b/Objects/dictobject.c Thu Mar 03 22:08:01 2016 -0800 @@ -3448,7 +3448,7 @@ if (result == NULL) return NULL; - tmp = _PyObject_CallMethodId(result, &PyId_difference_update, "O", other); + tmp = _PyObject_CallMethodIdObjArgs(result, &PyId_difference_update, other, NULL); if (tmp == NULL) { Py_DECREF(result); return NULL; @@ -3468,7 +3468,7 @@ if (result == NULL) return NULL; - tmp = _PyObject_CallMethodId(result, &PyId_intersection_update, "O", other); + tmp = _PyObject_CallMethodIdObjArgs(result, &PyId_intersection_update, other, NULL); if (tmp == NULL) { Py_DECREF(result); return NULL; @@ -3488,7 +3488,7 @@ if (result == NULL) return NULL; - tmp = _PyObject_CallMethodId(result, &PyId_update, "O", other); + tmp = _PyObject_CallMethodIdObjArgs(result, &PyId_update, other, NULL); if (tmp == NULL) { Py_DECREF(result); return NULL; @@ -3508,8 +3508,7 @@ if (result == NULL) return NULL; - tmp = _PyObject_CallMethodId(result, &PyId_symmetric_difference_update, "O", - other); + tmp = _PyObject_CallMethodIdObjArgs(result, &PyId_symmetric_difference_update, other, NULL); if (tmp == NULL) { Py_DECREF(result); return NULL;