mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Use bytes literals instead of bytes(str)
Bytes literals are available on all supported Python versions. Rather than convert strings literals to bytes at runtime, simply use a bytes literal.
This commit is contained in:
parent
bbfa8bc1ca
commit
922f55c265
|
@ -4,9 +4,5 @@
|
|||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
from PIL._util import py3
|
||||
|
||||
if py3:
|
||||
Image.open(BytesIO(bytes("icns\x00\x00\x00\x10hang\x00\x00\x00\x00", "latin-1")))
|
||||
else:
|
||||
Image.open(BytesIO(bytes("icns\x00\x00\x00\x10hang\x00\x00\x00\x00")))
|
||||
Image.open(BytesIO(b"icns\x00\x00\x00\x10hang\x00\x00\x00\x00"))
|
||||
|
|
|
@ -4,19 +4,5 @@
|
|||
from io import BytesIO
|
||||
|
||||
from PIL import Image
|
||||
from PIL._util import py3
|
||||
|
||||
if py3:
|
||||
Image.open(
|
||||
BytesIO(
|
||||
bytes(
|
||||
"\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang",
|
||||
"latin-1",
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
else:
|
||||
Image.open(
|
||||
BytesIO(bytes("\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang"))
|
||||
)
|
||||
Image.open(BytesIO(b"\x00\x00\x00\x0cjP\x20\x20\x0d\x0a\x87\x0a\x00\x00\x00\x00hang"))
|
||||
|
|
Loading…
Reference in New Issue
Block a user