summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-04-05 08:14:48 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-04-05 08:14:48 (GMT)
commited9192e2ae144706f6ecb9bdfb903220e2d33845 (patch)
tree2e7e34e9cd4035dca4d175e6c7d45d83bcb5becf
parente2eda606a83cbe68846faf44b478053e250fb025 (diff)
downloadcpython-ed9192e2ae144706f6ecb9bdfb903220e2d33845.zip
cpython-ed9192e2ae144706f6ecb9bdfb903220e2d33845.tar.gz
cpython-ed9192e2ae144706f6ecb9bdfb903220e2d33845.tar.bz2
Improve previous checkin to use a slot check instead of equivalent
attribute name lookup.
-rw-r--r--Objects/abstract.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c
index 307ef86..f586d6d 100644
--- a/Objects/abstract.c
+++ b/Objects/abstract.c
@@ -1607,7 +1607,8 @@ PyMapping_Check(PyObject *o)
return o && o->ob_type->tp_as_mapping &&
o->ob_type->tp_as_mapping->mp_subscript &&
- !PyObject_HasAttrString(o, "__getslice__");
+ !(o->ob_type->tp_as_sequence &&
+ o->ob_type->tp_as_sequence->sq_slice);
}
int