[New-bugs-announce] [issue46483] `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`

Nikita Sobolev report at bugs.python.org
Sun Jan 23 03:16:30 EST 2022

New submission from Nikita Sobolev <mail at sobolevn.me>:

After reviewing https://github.com/python/cpython/pull/30777 I had a chance to look through other definitions of `def __class_getitem__`. And I found that the only one left is: `pathlib.PurePath.__class_getitem__`

All other definitions already have this form: `__class_getitem__ = classmethod(GenericAlias)`.

I don't think that there's anything special about `PurePath` in this regard. So, I propose to make `__class_getitem__` to return `GenericAlias` as all other types do.

Initial PR: https://github.com/python/cpython/pull/17498

PR is on its way.

components: Library (Lib)
messages: 411354
nosy: sobolevn
priority: normal
severity: normal
status: open
title: `pathlib.PurePath.__class_getitem__` does not return `GenericAlias`
type: behavior
versions: Python 3.11

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list