From: Raymond Hettinger Date: Tue, 22 Mar 2011 00:50:28 +0000 (-0700) Subject: Issue #11628: cmp_to_key should use __slots__. X-Git-Tag: v3.2.1b1~235 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0d1d96771f41e24c1c369ef8b10e5a8f7d6c36a;p=python Issue #11628: cmp_to_key should use __slots__. --- diff --git a/Lib/functools.py b/Lib/functools.py index 03de69ae16..e92a2fcd68 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -96,6 +96,7 @@ def total_ordering(cls): def cmp_to_key(mycmp): """Convert a cmp= function into a key= function""" class K(object): + __slots__ = ['obj'] def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): diff --git a/Misc/NEWS b/Misc/NEWS index 0bf7550864..5589daf850 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -49,6 +49,8 @@ Core and Builtins Library ------- +- Issue #11628: cmp_to_key generated class should use __slots__ + - Issue #5537: Fix time2isoz() and time2netscape() functions of httplib.cookiejar for expiration year greater than 2038 on 32-bit systems.