mirror of
https://github.com/python/cpython.git
synced 2025-07-07 19:35:27 +00:00
gh-133970: Make PEP750 types generic (#133976)
This commit is contained in:
parent
e123a1d09b
commit
c3a1da5b93
4 changed files with 11 additions and 1 deletions
|
@ -61,6 +61,7 @@ try:
|
||||||
from tkinter import Event
|
from tkinter import Event
|
||||||
except ImportError:
|
except ImportError:
|
||||||
Event = None
|
Event = None
|
||||||
|
from string.templatelib import Template, Interpolation
|
||||||
|
|
||||||
from typing import TypeVar
|
from typing import TypeVar
|
||||||
T = TypeVar('T')
|
T = TypeVar('T')
|
||||||
|
@ -139,7 +140,10 @@ class BaseTest(unittest.TestCase):
|
||||||
DictReader, DictWriter,
|
DictReader, DictWriter,
|
||||||
array,
|
array,
|
||||||
staticmethod,
|
staticmethod,
|
||||||
classmethod]
|
classmethod,
|
||||||
|
Template,
|
||||||
|
Interpolation,
|
||||||
|
]
|
||||||
if ctypes is not None:
|
if ctypes is not None:
|
||||||
generic_types.extend((ctypes.Array, ctypes.LibraryLoader, ctypes.py_object))
|
generic_types.extend((ctypes.Array, ctypes.LibraryLoader, ctypes.py_object))
|
||||||
if ValueProxy is not None:
|
if ValueProxy is not None:
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
Make :class:`!string.templatelib.Template` and
|
||||||
|
:class:`!string.templatelib.Interpolation` generic.
|
|
@ -137,6 +137,8 @@ interpolation_reduce(PyObject *op, PyObject *Py_UNUSED(dummy))
|
||||||
static PyMethodDef interpolation_methods[] = {
|
static PyMethodDef interpolation_methods[] = {
|
||||||
{"__reduce__", interpolation_reduce, METH_NOARGS,
|
{"__reduce__", interpolation_reduce, METH_NOARGS,
|
||||||
PyDoc_STR("__reduce__() -> (cls, state)")},
|
PyDoc_STR("__reduce__() -> (cls, state)")},
|
||||||
|
{"__class_getitem__", Py_GenericAlias,
|
||||||
|
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -444,6 +444,8 @@ template_reduce(PyObject *op, PyObject *Py_UNUSED(dummy))
|
||||||
|
|
||||||
static PyMethodDef template_methods[] = {
|
static PyMethodDef template_methods[] = {
|
||||||
{"__reduce__", template_reduce, METH_NOARGS, NULL},
|
{"__reduce__", template_reduce, METH_NOARGS, NULL},
|
||||||
|
{"__class_getitem__", Py_GenericAlias,
|
||||||
|
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue