[Python-checkins] r84714 - in python/branches/py3k: Misc/NEWS Objects/abstract.c
benjamin.peterson
python-checkins at python.org
Sat Sep 11 18:02:06 CEST 2010
Author: benjamin.peterson
Date: Sat Sep 11 18:02:03 2010
New Revision: 84714
Log:
check for NULL tp_as_mapping in PySequence_(Get/Set/Del)Slice #9834
Modified:
python/branches/py3k/Misc/NEWS
python/branches/py3k/Objects/abstract.c
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Sat Sep 11 18:02:03 2010
@@ -108,6 +108,13 @@
guaranteed to exist in all Python implementations and the names of hash
algorithms available in the current process.
+C-API
+-----
+
+- Issue #9834: Don't segfault in PySequence_GetSlice, PySequence_SetSlice, or
+ PySequence_DelSlice when the object doesn't have any mapping operations
+ defined.
+
Tools/Demos
-----------
Modified: python/branches/py3k/Objects/abstract.c
==============================================================================
--- python/branches/py3k/Objects/abstract.c (original)
+++ python/branches/py3k/Objects/abstract.c Sat Sep 11 18:02:03 2010
@@ -1612,7 +1612,7 @@
if (!s) return null_error();
mp = s->ob_type->tp_as_mapping;
- if (mp->mp_subscript) {
+ if (mp && mp->mp_subscript) {
PyObject *res;
PyObject *slice = _PySlice_FromIndices(i1, i2);
if (!slice)
@@ -1690,7 +1690,7 @@
}
mp = s->ob_type->tp_as_mapping;
- if (mp->mp_ass_subscript) {
+ if (mp && mp->mp_ass_subscript) {
int res;
PyObject *slice = _PySlice_FromIndices(i1, i2);
if (!slice)
@@ -1715,7 +1715,7 @@
}
mp = s->ob_type->tp_as_mapping;
- if (mp->mp_ass_subscript) {
+ if (mp && mp->mp_ass_subscript) {
int res;
PyObject *slice = _PySlice_FromIndices(i1, i2);
if (!slice)
More information about the Python-checkins
mailing list