From 1657312ba77cf2a8751aed195b4d246afb28b64e Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sun, 31 Jul 2022 13:08:36 +0300 Subject: [PATCH] Remove `__cmp__` methods (#8313) --- lib/sqlalchemy/cyextension/collections.pyx | 3 --- lib/sqlalchemy/sql/annotation.py | 2 +- lib/sqlalchemy/util/_py_collections.py | 3 --- 3 files changed, 1 insertion(+), 7 deletions(-) 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 -- 2.47.2