cpython: fa2f8dd077e0 (original) (raw)

Mercurial > cpython

changeset 73617:fa2f8dd077e0

Issue #10227: Add an allocation cache for a single slice object. Patch by Stefan Behnel. [#10227]

Antoine Pitrou solipsis@pitrou.net
date Fri, 18 Nov 2011 20:14:34 +0100
parents 196d485ed26d
children 76d414cc3e38
files Include/pythonrun.h Misc/NEWS Objects/sliceobject.c Python/pythonrun.c
diffstat 4 files changed, 34 insertions(+), 7 deletions(-)[+] [-] Include/pythonrun.h 1 Misc/NEWS 3 Objects/sliceobject.c 36 Python/pythonrun.c 1

line wrap: on

line diff

--- a/Include/pythonrun.h +++ b/Include/pythonrun.h @@ -211,6 +211,7 @@ PyAPI_FUNC(void) PyByteArray_Fini(void); PyAPI_FUNC(void) PyFloat_Fini(void); PyAPI_FUNC(void) PyOS_FiniInterrupts(void); PyAPI_FUNC(void) _PyGC_Fini(void); +PyAPI_FUNC(void) PySlice_Fini(void); PyAPI_DATA(PyThreadState *) _Py_Finalizing; #endif

--- a/Misc/NEWS +++ b/Misc/NEWS @@ -10,6 +10,9 @@ What's New in Python 3.3 Alpha 1? Core and Builtins ----------------- +- Issue #10227: Add an allocation cache for a single slice object. Patch by

--- a/Objects/sliceobject.c +++ b/Objects/sliceobject.c @@ -80,19 +80,38 @@ PyObject _Py_EllipsisObject = { }; -/* Slice object implementation +/* Slice object implementation */

+} + +/* start, stop, and step are python objects with None indicating no index is present. */ PyObject * PySlice_New(PyObject *start, PyObject *stop, PyObject *step) {

-

if (step == NULL) step = Py_None; Py_INCREF(step); @@ -260,7 +279,10 @@ slice_dealloc(PySliceObject *r) Py_DECREF(r->step); Py_DECREF(r->start); Py_DECREF(r->stop);

} static PyObject *

--- a/Python/pythonrun.c +++ b/Python/pythonrun.c @@ -531,6 +531,7 @@ Py_Finalize(void) PyLong_Fini(); PyFloat_Fini(); PyDict_Fini();

/* Cleanup Unicode implementation */ _PyUnicode_Fini();