File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -237,8 +237,9 @@ PyListBuilder
237237The :c:type: `PyListBuilder ` API can be used to create a Python :class: `list `
238238object.
239239
240- On Free Threading, it's more efficient than the ``PyList `` C API to create a
241- :class: `list `, because it can avoid the critical section on the created list.
240+ On the free-threaded build, it's more efficient than the ``PyList `` C API to
241+ create a :class: `list `, because it can avoid the critical section on the
242+ created list.
242243
243244.. versionadded :: next
244245
Original file line number Diff line number Diff line change @@ -1608,9 +1608,9 @@ New features
16081608 (Contributed by Victor Stinner in :gh: `148233 `.)
16091609
16101610* Add a new :ref: `PyListBuilder <pylistbuilder >` C API to create a :class: `list `
1611- object. On Free Threading , it's more efficient than the ``PyList `` C API to
1612- create a :class: `list `, because it can avoid the critical section on the
1613- created list. Add functions:
1611+ object. On the free-threaded build , it's more efficient than the ``PyList `` C
1612+ API to create a :class: `list `, because it can avoid the critical section on
1613+ the created list. Add functions:
16141614
16151615 * :c:func: `PyListBuilder_Create `
16161616 * :c:func: `PyListBuilder_Finish `
Original file line number Diff line number Diff line change 11Add a new :ref: `PyListBuilder <pylistbuilder >` C API to create a :class: `list `
2- object. On Free Threading , it's more efficient than the ``PyList `` C API to
3- create a :class: `list `, because it can avoid the critical section on the
2+ object. On the free-threaded build , it's more efficient than the ``PyList `` C
3+ API to create a :class: `list `, because it can avoid the critical section on the
44created list. Add functions:
55
66* :c:func: `PyListBuilder_Create `
Original file line number Diff line number Diff line change @@ -4493,17 +4493,10 @@ PyListBuilder_Finish(PyListBuilder *builder)
44934493 // Shrink the list if the allocated size is greater than the double size.
44944494 // For example, if PyListBuilder_Create() argument overestimated the final
44954495 // size.
4496- if (Py_SIZE (list ) < (list -> allocated >> 1 )
4497- && list -> allocated > LIST_SMALL_ALLOCATED )
4498- {
4499- if (list_resize (list , Py_SIZE (list )) < 0 ) {
4500- // This case cannot happen: list_resize() never fails when
4501- // shrinking
4502- PyListBuilder_Discard (builder );
4503- return NULL ;
4504- }
4505- // Note: cannot test that list->allocated changed in debug mode, since
4506- // it's left unchanged on memory allocation failure.
4496+ if (list_resize (list , Py_SIZE (list )) < 0 ) {
4497+ // This case cannot happen: list_resize() never fails when shrinking
4498+ PyListBuilder_Discard (builder );
4499+ return NULL ;
45074500 }
45084501
45094502#if _PyListBuilder_INIT_ITEMS
You can’t perform that action at this time.
0 commit comments