mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-25 22:54:46 +03:00
Typing: Note about fromarray and the buffer interface
This commit is contained in:
parent
4a30b7af69
commit
02a1aa4ee8
|
@ -2592,8 +2592,11 @@ def fromarray(obj, mode=None):
|
||||||
else:
|
else:
|
||||||
obj_bytes = obj.tostring()
|
obj_bytes = obj.tostring()
|
||||||
|
|
||||||
# UNDONE typing: can from buffer et al take an array_interface exporting object?
|
# Typing: At this point, obj should be an item exporting a buffer interface
|
||||||
return frombuffer(mode, size, obj_bytes or obj, "raw", rawmode, 0, 1)
|
# and obj_bytes, if it exists, is a bytes exporting a buffer interface.
|
||||||
|
# Unfortunately at this point, there's no protocol for the buffer interface
|
||||||
|
# and due to it's c-level implementation, I don't see how to make one.
|
||||||
|
return frombuffer(mode, size, obj_bytes or obj, "raw", rawmode, 0, 1) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
def fromqimage(im):
|
def fromqimage(im):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user