Skip to content

Commit f9dd51e

Browse files
authored
bpo-39481: Make os.DirEntry generic (GH-19415)
1 parent 87255be commit f9dd51e

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

‎Lib/test/test_genericalias.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
)
88
from collections.abc import *
99
from contextlib import AbstractContextManager, AbstractAsyncContextManager
10+
from os import DirEntry
1011
from re import Pattern, Match
1112
from types import GenericAlias, MappingProxyType
1213
import typing
@@ -34,7 +35,7 @@ def test_subscriptable(self):
3435
Mapping, MutableMapping, MappingView,
3536
KeysView, ItemsView, ValuesView,
3637
Sequence, MutableSequence,
37-
MappingProxyType,
38+
MappingProxyType, DirEntry
3839
):
3940
tname = t.__name__
4041
with self.subTest(f"Testing {tname}"):

‎Modules/posixmodule.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12976,6 +12976,8 @@ static PyMethodDef DirEntry_methods[] = {
1297612976
OS_DIRENTRY_STAT_METHODDEF
1297712977
OS_DIRENTRY_INODE_METHODDEF
1297812978
OS_DIRENTRY___FSPATH___METHODDEF
12979+
{"__class_getitem__", (PyCFunction)Py_GenericAlias,
12980+
METH_O|METH_CLASS, PyDoc_STR("See PEP 585")},
1297912981
{NULL}
1298012982
};
1298112983

0 commit comments

Comments
 (0)