Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad7c778

Browse files
authored
gh-123990: Good bye WITH_FREELISTS macro (gh-124358)
1 parentbe76e3f commitad7c778

File tree

16 files changed

+4
-100
lines changed

16 files changed

+4
-100
lines changed

‎Doc/using/configure.rst‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,12 +183,6 @@ General Options
183183

184184
See:envvar:`PYTHONCOERCECLOCALE` and the:pep:`538`.
185185

186-
..option::--without-freelists
187-
188-
Disable all freelists except the empty tuple singleton.
189-
190-
..versionadded::3.11
191-
192186
..option::--with-platlibdir=DIRNAME
193187

194188
Python library directory name (default is ``lib``).

‎Doc/whatsnew/3.11.rst‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2168,7 +2168,7 @@ Build Changes
21682168
(Contributed by Donghee Na and Brett Holman in:issue:`44340`.)
21692169

21702170
* Freelists for object structs can now be disabled. A new:program:`configure`
2171-
option:option:`--without-freelists` can be used to disable all freelists
2171+
option``--without-freelists`` can be used to disable all freelists
21722172
except empty tuple singleton.
21732173
(Contributed by Christian Heimes in:issue:`45522`.)
21742174

‎Include/internal/pycore_freelist.h‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ _Py_freelists_GET(void)
2828
#endif
2929
}
3030

31-
#ifndefWITH_FREELISTS
32-
#define_Py_FREELIST_FREE(NAME,op,freefunc) freefunc(op)
33-
#define_Py_FREELIST_PUSH(NAME,op,limit) (0)
34-
#define_Py_FREELIST_POP(TYPE,NAME) (NULL)
35-
#define_Py_FREELIST_POP_MEM(NAME) (NULL)
36-
#define_Py_FREELIST_SIZE(NAME) (0)
37-
#else
3831
// Pushes `op` to the freelist, calls `freefunc` if the freelist is full
3932
#define_Py_FREELIST_FREE(NAME,op,freefunc) \
4033
_PyFreeList_Free(&_Py_freelists_GET()->NAME, _PyObject_CAST(op), \
@@ -108,7 +101,6 @@ _PyFreeList_PopMem(struct _Py_freelist *fl)
108101
}
109102
returnop;
110103
}
111-
#endif
112104

113105
externvoid_PyObject_ClearFreeLists(struct_Py_freelists*freelists,intis_finalization);
114106

‎Include/internal/pycore_freelist_state.h‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11-
#ifdefWITH_FREELISTS
12-
// with freelists
1311
# definePyTuple_MAXSAVESIZE 20 // Largest tuple to save on freelist
1412
# definePy_tuple_MAXFREELIST 2000 // Maximum number of tuples of each size to save
1513
# definePy_lists_MAXFREELIST 80
@@ -22,9 +20,6 @@ extern "C" {
2220
# definePy_async_gen_asends_MAXFREELIST 80
2321
# definePy_futureiters_MAXFREELIST 255
2422
# definePy_object_stack_chunks_MAXFREELIST 4
25-
#else
26-
# definePyTuple_MAXSAVESIZE 0
27-
#endif
2823

2924
// A generic freelist of either PyObjects or other data structures.
3025
struct_Py_freelist {
@@ -38,7 +33,6 @@ struct _Py_freelist {
3833
};
3934

4035
struct_Py_freelists {
41-
#ifdefWITH_FREELISTS
4236
struct_Py_freelistfloats;
4337
struct_Py_freelisttuples[PyTuple_MAXSAVESIZE];
4438
struct_Py_freelistlists;
@@ -50,9 +44,6 @@ struct _Py_freelists {
5044
struct_Py_freelistasync_gen_asends;
5145
struct_Py_freelistfutureiters;
5246
struct_Py_freelistobject_stack_chunks;
53-
#else
54-
char_unused;// Empty structs are not allowed.
55-
#endif
5647
};
5748

5849
#ifdef__cplusplus

‎Lib/test/pythoninfo.py‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ def collect_sysconfig(info_add):
553553
fornamein (
554554
'WITH_DOC_STRINGS',
555555
'WITH_DTRACE',
556-
'WITH_FREELISTS',
557556
'WITH_MIMALLOC',
558557
'WITH_PYMALLOC',
559558
'WITH_VALGRIND',

‎Lib/test/test_sys.py‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,14 +1042,10 @@ def test_debugmallocstats(self):
10421042
# Output of sys._debugmallocstats() depends on configure flags.
10431043
# The sysconfig vars are not available on Windows.
10441044
ifsys.platform!="win32":
1045-
with_freelists=sysconfig.get_config_var("WITH_FREELISTS")
10461045
with_pymalloc=sysconfig.get_config_var("WITH_PYMALLOC")
1047-
ifwith_freelists:
1048-
self.assertIn(b"free PyDictObjects",err)
1046+
self.assertIn(b"free PyDictObjects",err)
10491047
ifwith_pymalloc:
10501048
self.assertIn(b'Small block threshold',err)
1051-
ifnotwith_freelistsandnotwith_pymalloc:
1052-
self.assertFalse(err)
10531049

10541050
# The function has no parameter
10551051
self.assertRaises(TypeError,sys._debugmallocstats,True)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove ``WITH_FREELISTS`` macro and ``--without-freelists`` build configuration

‎Objects/dictobject.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,12 @@ unicode_get_hash(PyObject *o)
406406
void
407407
_PyDict_DebugMallocStats(FILE*out)
408408
{
409-
#ifdefWITH_FREELISTS
410409
_PyDebugAllocatorStats(out,"free PyDictObject",
411410
_Py_FREELIST_SIZE(dicts),
412411
sizeof(PyDictObject));
413412
_PyDebugAllocatorStats(out,"free PyDictKeysObject",
414413
_Py_FREELIST_SIZE(dictkeys),
415414
sizeof(PyDictKeysObject));
416-
#endif
417415
}
418416

419417
#defineDK_MASK(dk) (DK_SIZE(dk)-1)

‎Objects/floatobject.c‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,10 @@ static void
235235
float_dealloc(PyObject*op)
236236
{
237237
assert(PyFloat_Check(op));
238-
#ifdefWITH_FREELISTS
239-
if (PyFloat_CheckExact(op)) {
238+
if (PyFloat_CheckExact(op))
240239
_PyFloat_ExactDealloc(op);
241-
}
242240
else
243-
#endif
244-
{
245241
Py_TYPE(op)->tp_free(op);
246-
}
247242
}
248243

249244
double
@@ -1975,12 +1970,10 @@ _PyFloat_FiniType(PyInterpreterState *interp)
19751970
void
19761971
_PyFloat_DebugMallocStats(FILE*out)
19771972
{
1978-
#ifdefWITH_FREELISTS
19791973
_PyDebugAllocatorStats(out,
19801974
"free PyFloatObject",
19811975
_Py_FREELIST_SIZE(floats),
19821976
sizeof(PyFloatObject));
1983-
#endif
19841977
}
19851978

19861979

‎Objects/listobject.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,10 @@ list_preallocate_exact(PyListObject *self, Py_ssize_t size)
200200
void
201201
_PyList_DebugMallocStats(FILE*out)
202202
{
203-
#ifdefWITH_FREELISTS
204203
_PyDebugAllocatorStats(out,
205204
"free PyListObject",
206205
_Py_FREELIST_SIZE(lists),
207206
sizeof(PyListObject));
208-
#endif
209207
}
210208

211209
PyObject*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp