Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/library/secrets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ Other functions
:term:`bytes-like objects <bytes-like object>`
*a* and *b* are equal, otherwise ``False``,
using a "constant-time compare" to reduce the risk of
`timing attacks <https://codahale.com/a-lesson-in-timing-attacks/>`_.
`timing attacks <https://web.archive.org/web/20250815071532/https://codahale.com/a-lesson-in-timing-attacks/>`__.
See :func:`hmac.compare_digest` for additional details.


Expand Down
8 changes: 4 additions & 4 deletions Lib/collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ def __init__(self, initlist=None):
self.data = []
if initlist is not None:
# XXX should this accept an arbitrary sequence?
if type(initlist) == type(self.data):
if type(initlist) is list:
self.data[:] = initlist
elif isinstance(initlist, UserList):
self.data[:] = initlist.data[:]
Expand Down Expand Up @@ -1335,21 +1335,21 @@ def __delitem__(self, i):
def __add__(self, other):
if isinstance(other, UserList):
return self.__class__(self.data + other.data)
elif isinstance(other, type(self.data)):
elif isinstance(other, list):
return self.__class__(self.data + other)
return self.__class__(self.data + list(other))

def __radd__(self, other):
if isinstance(other, UserList):
return self.__class__(other.data + self.data)
elif isinstance(other, type(self.data)):
elif isinstance(other, list):
return self.__class__(other + self.data)
return self.__class__(list(other) + self.data)

def __iadd__(self, other):
if isinstance(other, UserList):
self.data += other.data
elif isinstance(other, type(self.data)):
elif isinstance(other, list):
self.data += other
else:
self.data += list(other)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Optimize the type checks in :class:`collections.UserList` to use the :class:`list` type directly instead of ``type(self.data)``.
Loading