summaryrefslogtreecommitdiffstats
path: root/Objects/tupleobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/tupleobject.c')
-rw-r--r--Objects/tupleobject.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Objects/tupleobject.c b/Objects/tupleobject.c
index 4d4a9ad..f1e3aee 100644
--- a/Objects/tupleobject.c
+++ b/Objects/tupleobject.c
@@ -603,6 +603,12 @@ tuplesubscript(PyTupleObject* self, PyObject* item)
if (slicelength <= 0) {
return PyTuple_New(0);
}
+ else if (start == 0 && step == 1 &&
+ slicelength == PyTuple_GET_SIZE(self) &&
+ PyTuple_CheckExact(self)) {
+ Py_INCREF(self);
+ return (PyObject *)self;
+ }
else {
result = PyTuple_New(slicelength);
if (!result) return NULL;