[Python-checkins] (no subject)

Batuhan Taşkaya webhook-mailer at python.org
Tue Apr 7 17:37:23 EDT 2020




To: python-checkins at python.org
Subject: bpo-39481: Make os.DirEntry generic (GH-19415)
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

https://github.com/python/cpython/commit/f9dd51e7db27d04e0b716d41a2804d5acbf1=
45d1
commit: f9dd51e7db27d04e0b716d41a2804d5acbf145d1
branch: master
author: Batuhan Ta=C5=9Fkaya <batuhanosmantaskaya at gmail.com>
committer: GitHub <noreply at github.com>
date: 2020-04-07T14:37:19-07:00
summary:

bpo-39481: Make os.DirEntry generic (GH-19415)

files:
M Lib/test/test_genericalias.py
M Modules/posixmodule.c

diff --git a/Lib/test/test_genericalias.py b/Lib/test/test_genericalias.py
index 9d8dbfe04205f..9c5b23e5e5b0f 100644
--- a/Lib/test/test_genericalias.py
+++ b/Lib/test/test_genericalias.py
@@ -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
@@ -34,7 +35,7 @@ def test_subscriptable(self):
                   Mapping, MutableMapping, MappingView,
                   KeysView, ItemsView, ValuesView,
                   Sequence, MutableSequence,
-                  MappingProxyType,
+                  MappingProxyType, DirEntry
                   ):
             tname =3D t.__name__
             with self.subTest(f"Testing {tname}"):
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 4264bf1a36dce..57f148726bc22 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -12976,6 +12976,8 @@ static PyMethodDef DirEntry_methods[] =3D {
     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}
 };
=20



More information about the Python-checkins mailing list