File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change 88
99Unreleased
1010------------------
11+ Fixed
12+ - *Scancode * and *KeySym * enums no longer crash when SDL returns an unexpected value.
1113
121412.7.1 - 2021-06-30
1315-------------------
Original file line number Diff line number Diff line change @@ -1598,6 +1598,14 @@ def scancode(self) -> "Scancode":
15981598 """
15991599 return self
16001600
1601+ @classmethod
1602+ def _missing_ (cls , value : object ) -> "Optional[Scancode]" :
1603+ if not isinstance (value , int ):
1604+ return None
1605+ result = cls (0 )
1606+ result ._value_ = value
1607+ return result
1608+
16011609 def __eq__ (self , other : Any ) -> bool :
16021610 if isinstance (other , KeySym ):
16031611 raise TypeError (
@@ -2137,6 +2145,14 @@ def scancode(self) -> Scancode:
21372145 _init_sdl_video ()
21382146 return Scancode (lib .SDL_GetScancodeFromKey (self .value ))
21392147
2148+ @classmethod
2149+ def _missing_ (cls , value : object ) -> "Optional[KeySym]" :
2150+ if not isinstance (value , int ):
2151+ return None
2152+ result = cls (0 )
2153+ result ._value_ = value
2154+ return result
2155+
21402156 def __eq__ (self , other : Any ) -> bool :
21412157 if isinstance (other , Scancode ):
21422158 raise TypeError (
You can’t perform that action at this time.
0 commit comments