Typing: Image.frombuffer

This commit is contained in:
Eric Soroos 2018-01-05 13:05:30 +00:00
parent 18f5f2c21b
commit 0bbfb3b290

View File

@ -2535,9 +2535,11 @@ def frombuffer(mode, size, data, decoder_name="raw", *args):
args = mode, 0, -1 # may change to (mode, 0, 1) post-1.1.6 args = mode, 0, -1 # may change to (mode, 0, 1) post-1.1.6
if args[0] in _MAPMODES: if args[0] in _MAPMODES:
im = new(mode, (1, 1)) im = new(mode, (1, 1))
# typing -- Getting this to cleanly realize that args is a
# correctly formatted tuple is harder than it's worth
im = im._new( im = im._new(
core.map_buffer(data, size, decoder_name, None, 0, args) core.map_buffer(data, size, decoder_name, None, 0, args)
) ) # type: ignore
im.readonly = 1 im.readonly = 1
return im return im