Commit d751c86e authored by Mike Frysinger's avatar Mike Frysinger Committed by Commit Bot

grit: fix long handling with Python 3

We need to convert numeric strings ids into numbers, but the integer
is too large for int() on Python 2.  Add an alias for long=int so we
can keep using long() in both environments.

Bug: 983071
Test: `./grit/test_suite_all.py` passes
Change-Id: Ied5c18f457e4ee499f5697f54621eb72fe15f7d8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1700481
Auto-Submit: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Nico Weber <thakis@chromium.org>
Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#677107}
parent 5ea6354a
...@@ -21,6 +21,14 @@ from grit.node import message ...@@ -21,6 +21,14 @@ from grit.node import message
from grit.node import node_io from grit.node import node_io
# Python 3 doesn't have long() as int() works everywhere. But we really do need
# the long() behavior on Python 2 as our ids are much too large for int().
try:
long
except NameError:
long = int
# RTL languages # RTL languages
# TODO(jennyz): remove this fixed set of RTL language array # TODO(jennyz): remove this fixed set of RTL language array
# now that generic expand_variable code exists. # now that generic expand_variable code exists.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment