From: Batuhan Taşkaya Date: Tue, 7 Apr 2020 21:37:19 +0000 (+0300) Subject: bpo-39481: Make os.DirEntry generic (GH-19415) X-Git-Tag: v3.9.0a6~176 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9dd51e7db27d04e0b716d41a2804d5acbf145d1;p=thirdparty%2FPython%2Fcpython.git bpo-39481: Make os.DirEntry generic (GH-19415) --- diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py index 9d8dbfe04205..9c5b23e5e5b0 100644 --- a/Lib/test/test_genericalias.py +++ b/Lib/test/test_genericalias.py @@ -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}"): diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4264bf1a36dc..57f148726bc2 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -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} };