graphql-core icon indicating copy to clipboard operation
graphql-core copied to clipboard

Both `typing.ByteString` and `typing.Text` are deprecated and slated for removal in Python 3.14

Open flying-sheep opened this issue 2 years ago • 1 comments

Since 3.12, Python raises a DeprecationWarning for typing.ByteString

https://github.com/graphql-python/graphql-core/blob/0c93b8452eed38d4f800c7e71cf6f3f3758cd1c6/src/graphql/pyutils/is_iterable.py#L2 https://github.com/graphql-python/graphql-core/blob/0c93b8452eed38d4f800c7e71cf6f3f3758cd1c6/src/graphql/pyutils/is_iterable.py#L22

It says:

This type represents the types bytes, bytearray, and memoryview of byte sequences.

Deprecated since version 3.9, will be removed in version 3.14: Prefer collections.abc.Buffer, or a union like bytes | bytearray | memoryview.

Since typing.Text is a deprecated (since 3.11) alias to str, both should be removed here at the same time.

I’d do a PR, but I’m not sure if it should be

 not_iterable_types: tuple[type, ...] = (bytes, Mapping, str)

or

 not_iterable_types: tuple[type, ...] = (Buffer, Mapping, str)

flying-sheep avatar Nov 08 '23 11:11 flying-sheep

Thanks. Will care about that. Still waiting for a free moment to work on graphql-core again.

Cito avatar Nov 09 '23 18:11 Cito

I think these issues have been fixed in HEAD.

srittau avatar Apr 30 '24 10:04 srittau

Yes, should be fixed in 3.3.0a5.

Cito avatar Apr 30 '24 10:04 Cito