From: Nikita Sobolev Date: Sun, 31 Jul 2022 10:08:36 +0000 (+0300) Subject: Remove `__cmp__` methods (#8313) X-Git-Tag: rel_2_0_0b1~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1657312ba77cf2a8751aed195b4d246afb28b64e;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Remove `__cmp__` methods (#8313) --- diff --git a/lib/sqlalchemy/cyextension/collections.pyx b/lib/sqlalchemy/cyextension/collections.pyx index fe2cb94ffe..07bc85e23d 100644 --- a/lib/sqlalchemy/cyextension/collections.pyx +++ b/lib/sqlalchemy/cyextension/collections.pyx @@ -213,9 +213,6 @@ cdef class IdentitySet: def clear(self): self._members.clear() - def __cmp__(self, other): - raise TypeError("cannot compare sets using cmp()") - def __eq__(self, other): cdef IdentitySet other_ if isinstance(other, IdentitySet): diff --git a/lib/sqlalchemy/sql/annotation.py b/lib/sqlalchemy/sql/annotation.py index 61849d0539..95dc1d4d49 100644 --- a/lib/sqlalchemy/sql/annotation.py +++ b/lib/sqlalchemy/sql/annotation.py @@ -257,7 +257,7 @@ class Annotated(SupportsAnnotations): """clones a SupportsAnnotations and applies an 'annotations' dictionary. Unlike regular clones, this clone also mimics __hash__() and - __cmp__() of the original element so that it takes its place + __eq__() of the original element so that it takes its place in hashed collections. A reference to the original element is maintained, for the important diff --git a/lib/sqlalchemy/util/_py_collections.py b/lib/sqlalchemy/util/_py_collections.py index d36157b105..f8348714c5 100644 --- a/lib/sqlalchemy/util/_py_collections.py +++ b/lib/sqlalchemy/util/_py_collections.py @@ -296,9 +296,6 @@ class IdentitySet: def clear(self) -> None: self._members.clear() - def __cmp__(self, other: Any) -> NoReturn: - raise TypeError("cannot compare sets using cmp()") - def __eq__(self, other: Any) -> bool: if isinstance(other, IdentitySet): return self._members == other._members