[issue38008] ContextManager and AsyncContextManager protocols can't be subclassed

Divij Rajkumar report at bugs.python.org
Mon Sep 2 07:47:29 EDT 2019


New submission from Divij Rajkumar <drajkuma1 at gmail.com>:

Reported this initially on github - https://github.com/python/typing/pull/650

The problem is in the typing code that checks if any of the parent classes for a Protocol are builtin protocols. The code today maintains a whitelist of builtin protocols that are okay to be subclassed, but expects them all to live within the 'collections.abc' module. This means 'typing.ContextManager' and 'typing.AsyncContextManager' cannot be subclassed, even though those protocols are listing in the whitelist.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38008>
_______________________________________


More information about the Python-bugs-list mailing list