django / asgiref

ASGI specification and utilities
https://asgi.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
1.46k stars 207 forks source link

Parameters to Generic[...] must all be type variables when use with sys.setprofile #430

Closed lonsdale8734 closed 2 months ago

lonsdale8734 commented 8 months ago

main.py:

import sys

def trace_call(frame, event, arg):
   pass

if __name__ == "__main__":
    sys.setprofile(trace_call)
    import asgiref.sync

Reproduce:

python version: 3.8.5

python -m venv venv
source ./venv/bin/activate
pip install asgiref
python main.py
lonsdale8734 commented 8 months ago

Bug of typing_extensions. https://github.com/python/typing_extensions/issues/318

andrewgodwin commented 8 months ago

I'm not sure there's much we can do about this in asgiref?

EndermanAPM commented 7 months ago

Running Python 3.8 and Pinning asgiref to 3.6.0 avoids the issue while a better fix is found.

Some more perhaps helpful info: I encountered this while doing a Django upgrade to 4.2.9, running tests works just fine, but when running on debug the exception is risen.