]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-39481: Make os.DirEntry generic (GH-19415)
authorBatuhan Taşkaya <batuhanosmantaskaya@gmail.com>
Tue, 7 Apr 2020 21:37:19 +0000 (00:37 +0300)
committerGitHub <noreply@github.com>
Tue, 7 Apr 2020 21:37:19 +0000 (14:37 -0700)
Lib/test/test_genericalias.py
Modules/posixmodule.c

index 9d8dbfe04205fd500f4bd7ad0e13175026e2b7ad..9c5b23e5e5b0fc600c048bdf4fc2bb5fbdddfabf 100644 (file)
@@ -7,6 +7,7 @@ from collections import (
 )
 from collections.abc import *
 from contextlib import AbstractContextManager, AbstractAsyncContextManager
+from os import DirEntry
 from re import Pattern, Match
 from types import GenericAlias, MappingProxyType
 import typing
@@ -34,7 +35,7 @@ class BaseTest(unittest.TestCase):
                   Mapping, MutableMapping, MappingView,
                   KeysView, ItemsView, ValuesView,
                   Sequence, MutableSequence,
-                  MappingProxyType,
+                  MappingProxyType, DirEntry
                   ):
             tname = t.__name__
             with self.subTest(f"Testing {tname}"):
index 4264bf1a36dce09e0f160cb5dde78fb383c6f1ea..57f148726bc223dd7f3b62971f9eb887aa0e4874 100644 (file)
@@ -12976,6 +12976,8 @@ static PyMethodDef DirEntry_methods[] = {
     OS_DIRENTRY_STAT_METHODDEF
     OS_DIRENTRY_INODE_METHODDEF
     OS_DIRENTRY___FSPATH___METHODDEF
+    {"__class_getitem__",       (PyCFunction)Py_GenericAlias,
+    METH_O|METH_CLASS,          PyDoc_STR("See PEP 585")},
     {NULL}
 };