#2963: fix method cache types.

This commit is contained in:
Georg Brandl 2008-05-25 09:32:09 +00:00
parent c9b0953bda
commit 1bcf35ae39
2 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,8 @@ What's new in Python 3.0b1?
Core and Builtins 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 #2964: fix a missing INCREF in instancemethod_descr_get.
- Issue 2895: Don't crash when given bytes objects as keyword names. - Issue 2895: Don't crash when given bytes objects as keyword names.

View File

@ -20,10 +20,10 @@
>> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP))
#define MCACHE_HASH_METHOD(type, name) \ #define MCACHE_HASH_METHOD(type, name) \
MCACHE_HASH((type)->tp_version_tag, \ MCACHE_HASH((type)->tp_version_tag, \
((PyStringObject *)(name))->ob_shash) ((PyUnicodeObject *)(name))->hash)
#define MCACHE_CACHEABLE_NAME(name) \ #define MCACHE_CACHEABLE_NAME(name) \
PyString_CheckExact(name) && \ PyUnicode_CheckExact(name) && \
PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE PyUnicode_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE
struct method_cache_entry { struct method_cache_entry {
unsigned int version; unsigned int version;