]> granicus.if.org Git - python/commitdiff
Issue #19218: Rename collections.abc to _collections_abc in order to speed up interpr...
authorChristian Heimes <christian@cheimes.de>
Sun, 13 Oct 2013 00:04:20 +0000 (02:04 +0200)
committerChristian Heimes <christian@cheimes.de>
Sun, 13 Oct 2013 00:04:20 +0000 (02:04 +0200)
Doc/library/collections.abc.rst
Lib/_collections_abc.py [moved from Lib/collections/abc.py with 100% similarity]
Lib/collections/__init__.py
Lib/os.py
Lib/random.py
Lib/test/test_site.py
Misc/NEWS

index 06dfe806ea484553a24be54c8a7c3eae6810275a..09fa4c7824cb34e7275060ec9e3088ed54cb1d8f 100644 (file)
@@ -15,7 +15,7 @@
    import itertools
    __name__ = '<doctest>'
 
-**Source code:** :source:`Lib/collections/abc.py`
+**Source code:** :source:`Lib/_collections_abc.py`
 
 --------------
 
index 0f19f30b4b2f39f740c6db9a477f07ea206cdf8f..02bdc57c9feeeed7488ccc37d62ebf08a85a757e 100644 (file)
@@ -3,9 +3,9 @@ __all__ = ['deque', 'defaultdict', 'namedtuple', 'UserDict', 'UserList',
 
 # For backwards compatibility, continue to make the collections ABCs
 # available through the collections module.
-from collections.abc import *
-import collections.abc
-__all__ += collections.abc.__all__
+from _collections_abc import *
+import _collections_abc
+__all__ += _collections_abc.__all__
 
 from _collections import deque, defaultdict
 from operator import itemgetter as _itemgetter, eq as _eq
index 1b1ce181e7b757407ab0b9fb03f841a0e0cc78ef..e9880a1e4c7af9d310c93328560057e4dbc057d6 100644 (file)
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -631,7 +631,7 @@ def get_exec_path(env=None):
 
 
 # Change environ to automatically call putenv(), unsetenv if they exist.
-from collections.abc import MutableMapping
+from _collections_abc import MutableMapping
 
 class _Environ(MutableMapping):
     def __init__(self, data, encodekey, decodekey, encodevalue, decodevalue, putenv, unsetenv):
index 4a9fbd10594f1bf08623e4a8644caaaae922dda5..808175ab4a100ea6ea0775ddf6d7ff0a098c0a05 100644 (file)
@@ -41,7 +41,7 @@ from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethod
 from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
 from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin
 from os import urandom as _urandom
-from collections.abc import Set as _Set, Sequence as _Sequence
+from _collections_abc import Set as _Set, Sequence as _Sequence
 from hashlib import sha512 as _sha512
 
 __all__ = ["Random","seed","random","uniform","randint","choice","sample",
index 20e18688de448842dc9b4c435dae53ae76c0c603..3ada0a671c7692be6ab678fd35bc6250bb026801 100644 (file)
@@ -445,6 +445,11 @@ class StartupImportTests(unittest.TestCase):
         self.assertNotIn('locale', modules, stderr)
         # http://bugs.python.org/issue19209
         self.assertNotIn('copyreg', modules, stderr)
+        # http://bugs.python.org/issue19218>
+        collection_mods = {'_collections', 'collections', 'functools',
+                           'heapq', 'itertools', 'keyword', 'operator',
+                           'reprlib', 'types', 'weakref'}
+        self.assertFalse(modules.intersection(re_mods), stderr)
 
 
 if __name__ == "__main__":
index 68df3590dd03d32864c40badf0209ca406513e27..ded3bb4dcc0e63f9de2f2679d2cb605f00e659fc 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -42,6 +42,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #19218: Rename collections.abc to _collections_abc in order to
+  speed up interpreter start.
+
 - Issue #18582: Add 'pbkdf2_hmac' to the hashlib module. It implements PKCS#5
   password-based key derivation functions with HMAC as pseudorandom function.