Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Lib/string/templatelib.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from _templatelib import Template, Interpolation
"""Support for template string literals (t-strings)."""

__all__ = ['Template', 'Interpolation']
from _templatelib import Template, Interpolation
1 change: 1 addition & 0 deletions Modules/Setup
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ PYTHONPATH=$(COREPYTHONPATH)
#_socket socketmodule.c
#_statistics _statisticsmodule.c
#_struct _struct.c
#_templatelib _templatelibmodule.c
#_types _typesmodule.c
#_typing _typingmodule.c
#_zoneinfo _zoneinfo.c
Expand Down
27 changes: 8 additions & 19 deletions Modules/_templatelibmodule.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
/* interpreter-internal types for templatelib */

#ifndef Py_BUILD_CORE
#define Py_BUILD_CORE
#endif
/* interpreter-internal types for string.templatelib */

#include "Python.h"
#include "pycore_template.h"
#include "pycore_interpolation.h"
#include "pycore_template.h" // _PyTemplate_Type
#include "pycore_interpolation.h" // _PyInterpolation_Type

static int
_templatelib_exec(PyObject *m)
Expand All @@ -20,9 +16,6 @@ _templatelib_exec(PyObject *m)
return 0;
}

PyDoc_STRVAR(_templatelib_doc,
"Interpreter-internal types for t-string templates.\n");

static struct PyModuleDef_Slot _templatelib_slots[] = {
{Py_mod_exec, _templatelib_exec},
{Py_mod_multiple_interpreters, Py_MOD_PER_INTERPRETER_GIL_SUPPORTED},
Expand All @@ -31,15 +24,11 @@ static struct PyModuleDef_Slot _templatelib_slots[] = {
};

static struct PyModuleDef _templatemodule = {
PyModuleDef_HEAD_INIT,
"_templatelib",
_templatelib_doc,
0,
NULL,
_templatelib_slots,
NULL,
NULL,
NULL
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "_templatelib",
.m_doc = "Interpreter-internal types for t-string templates.",
.m_size = 0,
.m_slots = _templatelib_slots,
};

PyMODINIT_FUNC
Expand Down
2 changes: 1 addition & 1 deletion Objects/interpolationobject.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Interpolation object implementation */
/* t-string Interpolation object implementation */
#include "Python.h"
#include <stddef.h>

Expand Down
2 changes: 1 addition & 1 deletion Objects/templateobject.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Interpolation object implementation */
/* t-string Template object implementation */
#include "Python.h"
#include <stddef.h>

Expand Down
2 changes: 2 additions & 0 deletions PC/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extern PyObject* PyInit__operator(void);
extern PyObject* PyInit__signal(void);
extern PyObject* PyInit__statistics(void);
extern PyObject* PyInit__sysconfig(void);
extern PyObject* PyInit__templatelib(void);
extern PyObject* PyInit__types(void);
extern PyObject* PyInit__typing(void);
extern PyObject* PyInit_time(void);
Expand Down Expand Up @@ -106,6 +107,7 @@ struct _inittab _PyImport_Inittab[] = {
{"_signal", PyInit__signal},
{"_sysconfig", PyInit__sysconfig},
{"time", PyInit_time},
{"_templatelib", PyInit__templatelib},
{"_thread", PyInit__thread},
{"_tokenize", PyInit__tokenize},
{"_types", PyInit__types},
Expand Down
1 change: 1 addition & 0 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@
<ClCompile Include="..\Modules\_statisticsmodule.c" />
<ClCompile Include="..\Modules\symtablemodule.c" />
<ClCompile Include="..\Modules\_sysconfig.c" />
<ClCompile Include="..\Modules\_templatelibmodule.c" />
<ClCompile Include="..\Modules\_threadmodule.c" />
<ClCompile Include="..\Modules\_tracemalloc.c" />
<ClCompile Include="..\Modules\_typesmodule.c" />
Expand Down
9 changes: 9 additions & 0 deletions PCbuild/pythoncore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,9 @@
<ClInclude Include="..\Include\internal\pycore_interpframe_structs.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_interpolation.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_intrinsics.h">
<Filter>Include\cpython</Filter>
</ClInclude>
Expand Down Expand Up @@ -840,6 +843,9 @@
<ClInclude Include="..\Include\internal\pycore_stackref.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_template.h">
<Filter>Include\internal</Filter>
</ClInclude>
<ClInclude Include="..\Include\internal\pycore_time.h">
<Filter>Include\internal</Filter>
</ClInclude>
Expand Down Expand Up @@ -998,6 +1004,9 @@
<ClCompile Include="..\Modules\_statisticsmodule.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\_templatelibmodule.c">
<Filter>Modules</Filter>
</ClCompile>
<ClCompile Include="..\Modules\_typesmodule.c">
<Filter>Modules</Filter>
</ClCompile>
Expand Down
28 changes: 28 additions & 0 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7787,6 +7787,7 @@ PY_STDLIB_MOD_SIMPLE([_queue])
PY_STDLIB_MOD_SIMPLE([_random])
PY_STDLIB_MOD_SIMPLE([select])
PY_STDLIB_MOD_SIMPLE([_struct])
PY_STDLIB_MOD_SIMPLE([_templatelib])
PY_STDLIB_MOD_SIMPLE([_types])
PY_STDLIB_MOD_SIMPLE([_typing])
PY_STDLIB_MOD_SIMPLE([_interpreters])
Expand Down