File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -501,11 +501,11 @@ class TiledObject(NamedTuple):
501501 type : Optional [str ] = None
502502
503503
504- # This is a temporary workaround for the lack of a way to type annotate
505- # objects implementing the buffer protocol. Although there is a PEP to
506- # add typing, it is scheduled for 3.12. Since that is years away from
507- # being our minimum Python version, we have to use a workaround. See
508- # the PEP and Python doc for more information:
509- # https://peps.python.org/pep-0688/
510- # https://docs .python.org/3/c-api/buffer.html
511- BufferProtocol = Union [ByteString , memoryview , array , ctypes .Array ]
504+ if sys . version_info >= ( 3 , 12 ):
505+ from collections . abc import Buffer as BufferProtocol
506+ else :
507+ # This is used instead of the typing_extensions version since they
508+ # use an ABC which registers virtual subclasses. This will not work
509+ # with ctypes.Array since virtual subclasses must be concrete.
510+ # See: https://peps .python.org/pep-0688/
511+ BufferProtocol = Union [ByteString , memoryview , array , ctypes .Array ]
You can’t perform that action at this time.
0 commit comments