Skip to content

Commit f207637

Browse files
committed
Implement new specification of template type
1 parent 22f9dc6 commit f207637

File tree

5 files changed

+278
-66
lines changed

5 files changed

+278
-66
lines changed

Include/internal/pycore_interpolation.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern PyTypeObject _PyInterpolation_Type;
1818
PyAPI_FUNC(PyObject *) _PyInterpolation_FromStackRefSteal(_PyStackRef *values);
1919

2020
extern PyStatus _PyInterpolation_InitTypes(PyInterpreterState *interp);
21+
extern PyObject *_PyInterpolation_GetValue(PyObject *interpolation);
2122

2223
#ifdef __cplusplus
2324
}

Include/internal/pycore_template.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C" {
1212
#include "pycore_stackref.h" // _PyStackRef
1313

1414
extern PyTypeObject _PyTemplate_Type;
15+
extern PyTypeObject _PyTemplateIter_Type;
1516

1617
PyAPI_FUNC(PyObject *) _PyTemplate_FromValues(PyObject **values, Py_ssize_t n);
1718
PyAPI_FUNC(PyObject *) _PyTemplate_FromListStackRef(_PyStackRef ref);

Objects/interpolationobject.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,9 @@ _PyInterpolation_FromStackRefSteal(_PyStackRef *values)
250250
Py_DECREF(args);
251251
return interpolation;
252252
}
253+
254+
PyObject *
255+
_PyInterpolation_GetValue(PyObject *interpolation)
256+
{
257+
return ((interpolationobject *) interpolation)->value;
258+
}

Objects/object.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2398,6 +2398,7 @@ static PyTypeObject* static_types[] = {
23982398
&_PyNoDefault_Type,
23992399
&_PyInterpolation_Type,
24002400
&_PyTemplate_Type,
2401+
&_PyTemplateIter_Type,
24012402

24022403
// subclasses: _PyTypes_FiniTypes() deallocates them before their base
24032404
// class

0 commit comments

Comments
 (0)