mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 11:26:27 +03:00
Merge pull request #3580 from jdufresne/bytes-warning
Fix 'BytesWarning: Comparison between bytes and string' in PdfDict
This commit is contained in:
commit
df6d429789
|
@ -269,14 +269,9 @@ class PdfDict(UserDict):
|
||||||
else:
|
else:
|
||||||
self.__dict__[key] = value
|
self.__dict__[key] = value
|
||||||
else:
|
else:
|
||||||
if isinstance(key, str):
|
self[key.encode("us-ascii")] = value
|
||||||
key = key.encode("us-ascii")
|
|
||||||
self[key] = value
|
|
||||||
|
|
||||||
def __getattr__(self, key):
|
def __getattr__(self, key):
|
||||||
try:
|
|
||||||
value = self[key]
|
|
||||||
except KeyError:
|
|
||||||
try:
|
try:
|
||||||
value = self[key.encode("us-ascii")]
|
value = self[key.encode("us-ascii")]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user