For Python3.12 generic classes the following is ok:
class Foo0: ...
class Foo1[T](Foo0): ...
class Foo2(Foo1[int]): ...
But for HTTPMethodView subclass there is an error:
from sanic.views import HTTPMethodView
class Bar1[T](HTTPMethodView): ...
class Bar2(Bar1[int]): ...
class Bar2(Bar1[int]): ...
~~~~^^^^^
File "/usr/local/lib/python3.12/typing.py", line 374, in inner
return _caches[func](*args, **kwds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/typing.py", line 1055, in _generic_class_getitem
for param in cls.__parameters__:
^^^^^^^^^^^^^^^^^^
AttributeError: type object 'Bar1' has no attribute '__parameters__'
Is there an existing issue for this?
Describe the bug
For Python3.12 generic classes the following is ok:
But for
HTTPMethodView
subclass there is an error:Code snippet
No response
Expected Behavior
No error expected
How do you run Sanic?
As a script (
app.run
orSanic.serve
)Operating System
Linux
Sanic Version
Sanic 23.12.1; Routing 23.12.0
Additional context
No response