Merge 3.5
diff --git a/Include/patchlevel.h b/Include/patchlevel.h
index b5cac68..246eba8 100644
--- a/Include/patchlevel.h
+++ b/Include/patchlevel.h
@@ -17,13 +17,13 @@
/* Version parsed out into numeric values */
/*--start constants--*/
#define PY_MAJOR_VERSION 3
-#define PY_MINOR_VERSION 5
+#define PY_MINOR_VERSION 6
#define PY_MICRO_VERSION 0
-#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_BETA
-#define PY_RELEASE_SERIAL 1
+#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA
+#define PY_RELEASE_SERIAL 0
/* Version as a string */
-#define PY_VERSION "3.5.0b1+"
+#define PY_VERSION "3.6.0a0"
/*--end constants--*/
/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2.
diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index fc60e13..9c22d86 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -736,14 +736,22 @@
def __pos__(self):
'Adds an empty counter, effectively stripping negative and zero counts'
- return self + Counter()
+ result = Counter()
+ for elem, count in self.items():
+ if count > 0:
+ result[elem] = count
+ return result
def __neg__(self):
'''Subtracts from an empty counter. Strips positive and zero counts,
and flips the sign on negative counts.
'''
- return Counter() - self
+ result = Counter()
+ for elem, count in self.items():
+ if count < 0:
+ result[elem] = 0 - count
+ return result
def _keep_positive(self):
'''Internal method to strip elements with a negative or zero count'''
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index ec86466..ac7b9af 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -1867,6 +1867,13 @@
od = OrderedDict(**d)
self.assertGreater(sys.getsizeof(od), sys.getsizeof(d))
+ def test_views(self):
+ # See http://bugs.python.org/issue24286
+ s = 'the quick brown fox jumped over a lazy dog yesterday before dawn'.split()
+ od = OrderedDict.fromkeys(s)
+ self.assertEqual(od.keys(), dict(od).keys())
+ self.assertEqual(od.items(), dict(od).items())
+
def test_override_update(self):
# Verify that subclasses can override update() without breaking __init__()
class MyOD(OrderedDict):
diff --git a/Lib/test/test_dictviews.py b/Lib/test/test_dictviews.py
index 280353a..d96832e 100644
--- a/Lib/test/test_dictviews.py
+++ b/Lib/test/test_dictviews.py
@@ -1,3 +1,4 @@
+import collections
import unittest
class DictSetTest(unittest.TestCase):
@@ -197,6 +198,27 @@
d[42] = d.values()
self.assertRaises(RuntimeError, repr, d)
+ def test_abc_registry(self):
+ d = dict(a=1)
+
+ self.assertIsInstance(d.keys(), collections.KeysView)
+ self.assertIsInstance(d.keys(), collections.MappingView)
+ self.assertIsInstance(d.keys(), collections.Set)
+ self.assertIsInstance(d.keys(), collections.Sized)
+ self.assertIsInstance(d.keys(), collections.Iterable)
+ self.assertIsInstance(d.keys(), collections.Container)
+
+ self.assertIsInstance(d.values(), collections.ValuesView)
+ self.assertIsInstance(d.values(), collections.MappingView)
+ self.assertIsInstance(d.values(), collections.Sized)
+
+ self.assertIsInstance(d.items(), collections.ItemsView)
+ self.assertIsInstance(d.items(), collections.MappingView)
+ self.assertIsInstance(d.items(), collections.Set)
+ self.assertIsInstance(d.items(), collections.Sized)
+ self.assertIsInstance(d.items(), collections.Iterable)
+ self.assertIsInstance(d.items(), collections.Container)
+
if __name__ == "__main__":
unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
index f3745ac..a01c238 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -2,6 +2,18 @@
Python News
+++++++++++
+What's New in Python 3.6.0 alpha 1?
+===================================
+
+Release date: XXXX-XX-XX
+
+Core and Builtins
+-----------------
+
+Library
+-------
+
+
What's New in Python 3.5.0 beta 2?
==================================