Skip to content

Commit

Permalink
avoid extra function call
Browse files Browse the repository at this point in the history
  • Loading branch information
pnico committed Aug 21, 2023
1 parent fb42ca1 commit cf447e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/google/appengine/ext/ndb/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -2741,9 +2741,10 @@ def _db_get_value(self, v, p):
sval = modelclass._from_pb(pb)
elif meaning != entity_pb2.Property.BYTESTRING:
try:
decoded = sval.decode('ascii')
if meaning == entity_pb2.Property.TEXT:
sval = six.ensure_str(decoded, encoding='ascii')
if six.PY2:
sval.decode('ascii')
elif meaning == entity_pb2.Property.TEXT:
sval = sval.decode('ascii')
except UnicodeDecodeError:
try:
sval = six.text_type(sval.decode('utf-8'))
Expand Down

0 comments on commit cf447e0

Please sign in to comment.