Skip to content

Commit d28e79a

Browse files
committed
gh-145860: Add the Steal suffix to _PyInterpolation_Build and _PyTemplate_Build
1 parent 420f190 commit d28e79a

11 files changed

Lines changed: 23 additions & 23 deletions

File tree

‎Include/internal/pycore_interpolation.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ extern PyTypeObject _PyInterpolation_Type;
1414
#define _PyInterpolation_CheckExact(op) Py_IS_TYPE((op), &_PyInterpolation_Type)
1515

1616
// Steals references to value, str, and format_spec (even on failure).
17-
PyAPI_FUNC(PyObject *) _PyInterpolation_Build(PyObject *value, PyObject *str,
18-
int conversion, PyObject *format_spec);
17+
PyAPI_FUNC(PyObject *) _PyInterpolation_BuildSteal(PyObject *value, PyObject *str,
18+
int conversion, PyObject *format_spec);
1919

2020
extern PyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp);
2121
extern PyObject *_PyInterpolation_GetValueRef(PyObject *interpolation);

‎Include/internal/pycore_template.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern PyTypeObject _PyTemplateIter_Type;
1818
extern PyObject *_PyTemplate_Concat(PyObject *self, PyObject *other);
1919

2020
// Steals references to strings and interpolations (even on failure).
21-
PyAPI_FUNC(PyObject *) _PyTemplate_Build(PyObject *strings, PyObject *interpolations);
21+
PyAPI_FUNC(PyObject *) _PyTemplate_BuildSteal(PyObject *strings, PyObject *interpolations);
2222

2323
#ifdef __cplusplus
2424
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Eliminate unnecessary reference count operations in ``BUILD_INTERPOLATION``
22
and ``BUILD_TEMPLATE`` bytecode instructions by making
3-
:c:func:`!_PyInterpolation_Build` and :c:func:`!_PyTemplate_Build` steal
4-
references to their arguments.
3+
:c:func:`!_PyInterpolation_BuildSteal` and :c:func:`!_PyTemplate_BuildSteal`
4+
steal references to their arguments.

‎Modules/_testinternalcapi/test_cases.c.h‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Modules/_testinternalcapi/testbytecodes.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "pycore_emscripten_signal.h" // _Py_CHECK_EMSCRIPTEN_SIGNALS
1616
#include "pycore_function.h"
1717
#include "pycore_instruments.h"
18-
#include "pycore_interpolation.h" // _PyInterpolation_Build()
18+
#include "pycore_interpolation.h" // _PyInterpolation_BuildSteal()
1919
#include "pycore_intrinsics.h"
2020
#include "pycore_long.h" // _PyLong_ExactDealloc(), _PyLong_GetZero()
2121
#include "pycore_moduleobject.h" // PyModuleObject
@@ -29,7 +29,7 @@
2929
#include "pycore_setobject.h" // _PySet_NextEntry()
3030
#include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs
3131
#include "pycore_stackref.h"
32-
#include "pycore_template.h" // _PyTemplate_Build()
32+
#include "pycore_template.h" // _PyTemplate_BuildSteal()
3333
#include "pycore_tuple.h" // _PyTuple_ITEMS()
3434
#include "pycore_typeobject.h" // _PySuper_Lookup()
3535

‎Objects/interpolationobject.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ _PyInterpolation_InitTypes(PyInterpreterState *interp)
188188
}
189189

190190
PyObject *
191-
_PyInterpolation_Build(PyObject *value, PyObject *str, int conversion, PyObject *format_spec)
191+
_PyInterpolation_BuildSteal(PyObject *value, PyObject *str, int conversion, PyObject *format_spec)
192192
{
193193
interpolationobject *interpolation = PyObject_GC_New(interpolationobject, &_PyInterpolation_Type);
194194
if (!interpolation) {

‎Objects/templateobject.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ template_new_impl(PyTypeObject *type, PyObject * const *args,
186186
PyTuple_SET_ITEM(strings, stringsidx++, &_Py_STR(empty));
187187
}
188188

189-
return _PyTemplate_Build(strings, interpolations);
189+
return _PyTemplate_BuildSteal(strings, interpolations);
190190
}
191191

192192
static void
@@ -301,7 +301,7 @@ template_concat_templates(templateobject *self, templateobject *other)
301301
return NULL;
302302
}
303303

304-
return _PyTemplate_Build(newstrings, newinterpolations);
304+
return _PyTemplate_BuildSteal(newstrings, newinterpolations);
305305
}
306306

307307
PyObject *
@@ -409,7 +409,7 @@ PyTypeObject _PyTemplate_Type = {
409409
};
410410

411411
PyObject *
412-
_PyTemplate_Build(PyObject *strings, PyObject *interpolations)
412+
_PyTemplate_BuildSteal(PyObject *strings, PyObject *interpolations)
413413
{
414414
templateobject *template = PyObject_GC_New(templateobject, &_PyTemplate_Type);
415415
if (template == NULL) {

‎Python/bytecodes.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "pycore_function.h"
1919
#include "pycore_import.h" // _PyImport_LoadLazyImportTstate()
2020
#include "pycore_instruments.h"
21-
#include "pycore_interpolation.h" // _PyInterpolation_Build()
21+
#include "pycore_interpolation.h" // _PyInterpolation_BuildSteal()
2222
#include "pycore_intrinsics.h"
2323
#include "pycore_lazyimportobject.h" // PyLazyImport_CheckExact()
2424
#include "pycore_long.h" // _PyLong_ExactDealloc(), _PyLong_GetZero()
@@ -33,7 +33,7 @@
3333
#include "pycore_setobject.h" // _PySet_NextEntry()
3434
#include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs
3535
#include "pycore_stackref.h"
36-
#include "pycore_template.h" // _PyTemplate_Build()
36+
#include "pycore_template.h" // _PyTemplate_BuildSteal()
3737
#include "pycore_tuple.h" // _PyStolenTuple_Free(), _PyTuple_ITEMS()
3838
#include "pycore_typeobject.h" // _PySuper_Lookup()
3939

@@ -2446,7 +2446,7 @@ dummy_func(
24462446
format_o = Py_NewRef(&_Py_STR(empty));
24472447
DEAD(format);
24482448
}
2449-
PyObject *interpolation_o = _PyInterpolation_Build(value_o, str_o, conversion, format_o);
2449+
PyObject *interpolation_o = _PyInterpolation_BuildSteal(value_o, str_o, conversion, format_o);
24502450
ERROR_IF(interpolation_o == NULL);
24512451
interpolation = PyStackRef_FromPyObjectSteal(interpolation_o);
24522452
}
@@ -2456,7 +2456,7 @@ dummy_func(
24562456
DEAD(strings);
24572457
PyObject *interpolations_o = PyStackRef_AsPyObjectSteal(interpolations);
24582458
DEAD(interpolations);
2459-
PyObject *template_o = _PyTemplate_Build(strings_o, interpolations_o);
2459+
PyObject *template_o = _PyTemplate_BuildSteal(strings_o, interpolations_o);
24602460
ERROR_IF(template_o == NULL);
24612461
template = PyStackRef_FromPyObjectSteal(template_o);
24622462
}

‎Python/ceval.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include "pycore_import.h" // _PyImport_IsDefaultImportFunc()
1818
#include "pycore_instruments.h"
1919
#include "pycore_interpframe.h" // _PyFrame_SetStackPointer()
20-
#include "pycore_interpolation.h" // _PyInterpolation_Build()
20+
#include "pycore_interpolation.h" // _PyInterpolation_BuildSteal()
2121
#include "pycore_intrinsics.h"
2222
#include "pycore_jit.h"
2323
#include "pycore_lazyimportobject.h"
@@ -35,7 +35,7 @@
3535
#include "pycore_setobject.h" // _PySet_Update()
3636
#include "pycore_sliceobject.h" // _PyBuildSlice_ConsumeRefs
3737
#include "pycore_sysmodule.h" // _PySys_GetOptionalAttrString()
38-
#include "pycore_template.h" // _PyTemplate_Build()
38+
#include "pycore_template.h" // _PyTemplate_BuildSteal()
3939
#include "pycore_traceback.h" // _PyTraceBack_FromFrame
4040
#include "pycore_tuple.h" // _PyTuple_ITEMS()
4141
#include "pycore_uop_ids.h" // Uops

‎Python/executor_cases.c.h‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)