mirror of https://github.com/python/cpython
gh-123341: Support `tkinter.Event` type subcript (#123353)
Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
This commit is contained in:
parent
64af2b29d2
commit
42a818912b
|
@ -57,6 +57,10 @@ from queue import Queue, SimpleQueue
|
|||
from weakref import WeakSet, ReferenceType, ref
|
||||
import typing
|
||||
from typing import Unpack
|
||||
try:
|
||||
from tkinter import Event
|
||||
except ImportError:
|
||||
Event = None
|
||||
|
||||
from typing import TypeVar
|
||||
T = TypeVar('T')
|
||||
|
@ -139,6 +143,8 @@ class BaseTest(unittest.TestCase):
|
|||
if ValueProxy is not None:
|
||||
generic_types.extend((ValueProxy, DictProxy, ListProxy, ApplyResult,
|
||||
MPSimpleQueue, MPQueue, MPJoinableQueue))
|
||||
if Event is not None:
|
||||
generic_types.append(Event)
|
||||
|
||||
def test_subscriptable(self):
|
||||
for t in self.generic_types:
|
||||
|
|
|
@ -295,6 +295,8 @@ class Event:
|
|||
''.join(' %s=%s' % (k, attrs[k]) for k in keys if k in attrs)
|
||||
)
|
||||
|
||||
__class_getitem__ = classmethod(types.GenericAlias)
|
||||
|
||||
|
||||
_support_default_root = True
|
||||
_default_root = None
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Add :meth:`~object.__class_getitem__` to :class:`!tkinter.Event` for type subscript support at runtime. Patch by Adonis Rakateli.
|
Loading…
Reference in New Issue