]> granicus.if.org Git - python/commitdiff
#2963: fix method cache types.
authorGeorg Brandl <georg@python.org>
Sun, 25 May 2008 09:32:09 +0000 (09:32 +0000)
committerGeorg Brandl <georg@python.org>
Sun, 25 May 2008 09:32:09 +0000 (09:32 +0000)
Misc/NEWS
Objects/typeobject.c

index 08bd0924d7e3b77c698b7a652f201e08c57a8088..a8da635cacfdcf2ceaec34e904e04fe8bf294751 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,8 @@ What's new in Python 3.0b1?
 Core and Builtins
 -----------------
 
+- Issue #2963: fix merging oversight that disabled method cache for all types.
+
 - Issue #2964: fix a missing INCREF in instancemethod_descr_get.
 
 - Issue 2895: Don't crash when given bytes objects as keyword names.
index 8880cabcc1183ef1f31cdc299a37af8179f515c0..88ce67f70d4b4be78948f66e8ec94309de686000 100644 (file)
                 >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP))
 #define MCACHE_HASH_METHOD(type, name)                                  \
                MCACHE_HASH((type)->tp_version_tag,                     \
-                           ((PyStringObject *)(name))->ob_shash)
+                           ((PyUnicodeObject *)(name))->hash)
 #define MCACHE_CACHEABLE_NAME(name)                                     \
-               PyString_CheckExact(name) &&                            \
-               PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE
+               PyUnicode_CheckExact(name) &&                            \
+               PyUnicode_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE
 
 struct method_cache_entry {
        unsigned int version;