Skip to content

Commit

Permalink
Since __new__ can only be called once, the try/except is not needed.
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Aug 17, 2023
1 parent f20aa9d commit 014428b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,10 @@ class OrderedDict(dict):
def __new__(cls, /, *args, **kwds):
"Create the ordered dict object and set up the underlying structures."
self = dict.__new__(cls)
try:
self.__root
except AttributeError:
self.__hardroot = _Link()
self.__root = root = _proxy(self.__hardroot)
root.prev = root.next = root
self.__map = {}
self.__hardroot = _Link()
self.__root = root = _proxy(self.__hardroot)
root.prev = root.next = root
self.__map = {}
return self

def __init__(self, other=(), /, **kwds):
Expand Down

0 comments on commit 014428b

Please sign in to comment.