mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Move initialization of root link to __init__.
This commit is contained in:
parent
f1e2df9780
commit
906f95e80b
1 changed files with 2 additions and 1 deletions
|
|
@ -41,11 +41,12 @@ class OrderedDict(dict, MutableMapping):
|
|||
try:
|
||||
self.__root
|
||||
except AttributeError:
|
||||
self.__root = _Link() # sentinel node for the doubly linked list
|
||||
self.clear()
|
||||
self.update(*args, **kwds)
|
||||
|
||||
def clear(self):
|
||||
self.__root = root = _Link() # sentinel node for the doubly linked list
|
||||
root = self.__root
|
||||
root.prev = root.next = root
|
||||
self.__map = {}
|
||||
dict.clear(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue