| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d8b9ae6 commit 9a812cb
8 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -209,3 +209,10 @@ Dictionary Objects | |||
| 209 | 209 | for key, value in seq2: | |
| 210 | 210 | if override or key not in a: | |
| 211 | 211 | a[key] = value | |
| 212 | + | ||
| 213 | + | ||
| 214 | + .. c:function:: int PyDict_ClearFreeList() | ||
| 215 | + | ||
| 216 | + Clear the free list. Return the total number of freed items. | ||
| 217 | + | ||
| 218 | + .. versionadded:: 3.3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -142,3 +142,10 @@ List Objects | |||
| 142 | 142 | ||
| 143 | 143 | Return a new tuple object containing the contents of *list*; equivalent to | |
| 144 | 144 | ``tuple(list)``. | |
| 145 | + | ||
| 146 | + | ||
| 147 | + .. c:function:: int PyList_ClearFreeList() | ||
| 148 | + | ||
| 149 | + Clear the free list. Return the total number of freed items. | ||
| 150 | + | ||
| 151 | + .. versionadded:: 3.3 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -129,6 +129,8 @@ PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, Py_hash_t hash); | |||
| 129 | 129 | PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); | |
| 130 | 130 | PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); | |
| 131 | 131 | PyAPI_FUNC(int) _PyDict_HasOnlyStringKeys(PyObject *mp); | |
| 132 | + | ||
| 133 | + PyAPI_FUNC(int) PyDict_ClearFreeList(void); | ||
| 132 | 134 | #endif | |
| 133 | 135 | ||
| 134 | 136 | /* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,6 +62,8 @@ PyAPI_FUNC(int) PyList_Reverse(PyObject *); | |||
| 62 | 62 | PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); | |
| 63 | 63 | #ifndef Py_LIMITED_API | |
| 64 | 64 | PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); | |
| 65 | + | ||
| 66 | + PyAPI_FUNC(int) PyList_ClearFreeList(void); | ||
| 65 | 67 | #endif | |
| 66 | 68 | ||
| 67 | 69 | /* Macro, trading safety for speed */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -10,6 +10,10 @@ What's New in Python 3.3 Alpha 1? | |||
| 10 | 10 | Core and Builtins | |
| 11 | 11 | ----------------- | |
| 12 | 12 | ||
| 13 | + - Issue #13389: Full garbage collection passes now clear the freelists for | ||
| 14 | + list and dict objects. They already cleared other freelists in the | ||
| 15 | + interpreter. | ||
| 16 | + | ||
| 13 | 17 | - Issue #13327: Remove the need for an explicit None as the second argument | |
| 14 | 18 | to os.utime, os.lutimes, os.futimes, os.futimens, os.futimesat, in | |
| 15 | 19 | order to update to the current time. Also added keyword argument | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -762,6 +762,8 @@ clear_freelists(void) | |||
| 762 | 762 | (void)PyTuple_ClearFreeList(); | |
| 763 | 763 | (void)PyUnicode_ClearFreeList(); | |
| 764 | 764 | (void)PyFloat_ClearFreeList(); | |
| 765 | + (void)PyList_ClearFreeList(); | ||
| 766 | + (void)PyDict_ClearFreeList(); | ||
| 765 | 767 | } | |
| 766 | 768 | ||
| 767 | 769 | static double | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -217,16 +217,23 @@ show_track(void) | |||
| 217 | 217 | static PyDictObject *free_list[PyDict_MAXFREELIST]; | |
| 218 | 218 | static int numfree = 0; | |
| 219 | 219 | ||
| 220 | - void | ||
| 221 | - PyDict_Fini(void) | ||
| 220 | + int | ||
| 221 | + PyDict_ClearFreeList(void) | ||
| 222 | 222 | { | |
| 223 | 223 | PyDictObject *op; | |
| 224 | - | ||
| 224 | + int ret = numfree; | ||
| 225 | 225 | while (numfree) { | |
| 226 | 226 | op = free_list[--numfree]; | |
| 227 | 227 | assert(PyDict_CheckExact(op)); | |
| 228 | 228 | PyObject_GC_Del(op); | |
| 229 | 229 | } | |
| 230 | + return ret; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + void | ||
| 234 | + PyDict_Fini(void) | ||
| 235 | + { | ||
| 236 | + PyDict_ClearFreeList(); | ||
| 230 | 237 | } | |
| 231 | 238 | ||
| 232 | 239 | PyObject * | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -97,16 +97,23 @@ show_alloc(void) | |||
| 97 | 97 | static PyListObject *free_list[PyList_MAXFREELIST]; | |
| 98 | 98 | static int numfree = 0; | |
| 99 | 99 | ||
| 100 | - void | ||
| 101 | - PyList_Fini(void) | ||
| 100 | + int | ||
| 101 | + PyList_ClearFreeList(void) | ||
| 102 | 102 | { | |
| 103 | 103 | PyListObject *op; | |
| 104 | - | ||
| 104 | + int ret = numfree; | ||
| 105 | 105 | while (numfree) { | |
| 106 | 106 | op = free_list[--numfree]; | |
| 107 | 107 | assert(PyList_CheckExact(op)); | |
| 108 | 108 | PyObject_GC_Del(op); | |
| 109 | 109 | } | |
| 110 | + return ret; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + void | ||
| 114 | + PyList_Fini(void) | ||
| 115 | + { | ||
| 116 | + PyList_ClearFreeList(); | ||
| 110 | 117 | } | |
| 111 | 118 | ||
| 112 | 119 | PyObject * | |
| Back | FazBrowse Home | New Git URL |
0 commit comments