Skip to content

bpo-39481: Generic alias to os.DirEntry #19415

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2020
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
3 changes: 2 additions & 1 deletion Lib/test/test_genericalias.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
)
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
Expand Down Expand Up @@ -34,7 +35,7 @@ def test_subscriptable(self):
Mapping, MutableMapping, MappingView,
KeysView, ItemsView, ValuesView,
Sequence, MutableSequence,
MappingProxyType,
MappingProxyType, DirEntry
):
tname = t.__name__
with self.subTest(f"Testing {tname}"):
Expand Down
2 changes: 2 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -12975,6 +12975,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}
};

Expand Down