Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
f34a0cdc
Kaydet (Commit)
f34a0cdc
authored
Kas 18, 2011
tarafından
Antoine Pitrou
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #10227: Add an allocation cache for a single slice object.
Patch by Stefan Behnel.
üst
2251a3d2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
7 deletions
+34
-7
pythonrun.h
Include/pythonrun.h
+1
-0
NEWS
Misc/NEWS
+3
-0
sliceobject.c
Objects/sliceobject.c
+29
-7
pythonrun.c
Python/pythonrun.c
+1
-0
No files found.
Include/pythonrun.h
Dosyayı görüntüle @
f34a0cdc
...
...
@@ -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
...
...
Misc/NEWS
Dosyayı görüntüle @
f34a0cdc
...
...
@@ -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
Stefan Behnel.
- Issue #13393: BufferedReader.read1() now asks the full requested size to
the raw stream instead of limiting itself to the buffer size.
...
...
Objects/sliceobject.c
Dosyayı görüntüle @
f34a0cdc
...
...
@@ -80,19 +80,38 @@ PyObject _Py_EllipsisObject = {
};
/* Slice object implementation
/* Slice object implementation
*/
start, stop, and step are python objects with None indicating no
/* Using a cache is very effective since typically only a single slice is
* created and then deleted again
*/
static
PySliceObject
*
slice_cache
=
NULL
;
void
PySlice_Fini
(
void
)
{
PySliceObject
*
obj
=
slice_cache
;
if
(
obj
!=
NULL
)
{
slice_cache
=
NULL
;
PyObject_Del
(
obj
);
}
}
/* start, stop, and step are python objects with None indicating no
index is present.
*/
PyObject
*
PySlice_New
(
PyObject
*
start
,
PyObject
*
stop
,
PyObject
*
step
)
{
PySliceObject
*
obj
=
PyObject_New
(
PySliceObject
,
&
PySlice_Type
);
if
(
obj
==
NULL
)
return
NULL
;
PySliceObject
*
obj
;
if
(
slice_cache
!=
NULL
)
{
obj
=
slice_cache
;
slice_cache
=
NULL
;
_Py_NewReference
((
PyObject
*
)
obj
);
}
else
{
obj
=
PyObject_New
(
PySliceObject
,
&
PySlice_Type
);
if
(
obj
==
NULL
)
return
NULL
;
}
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
);
PyObject_Del
(
r
);
if
(
slice_cache
==
NULL
)
slice_cache
=
r
;
else
PyObject_Del
(
r
);
}
static
PyObject
*
...
...
Python/pythonrun.c
Dosyayı görüntüle @
f34a0cdc
...
...
@@ -531,6 +531,7 @@ Py_Finalize(void)
PyLong_Fini
();
PyFloat_Fini
();
PyDict_Fini
();
PySlice_Fini
();
/* Cleanup Unicode implementation */
_PyUnicode_Fini
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment