From b4ed0af8bc2ca699d23b6350c630bb78af8d0531 Mon Sep 17 00:00:00 2001 From: cclauss Date: Mon, 3 Dec 2018 12:00:14 +0100 Subject: [PATCH] tools: prepare tools/js2c.py for Python 3 PR-URL: https://github.com/nodejs/node/pull/24798 Reviewed-By: Rich Trott Reviewed-By: Anna Henningsen (cherry picked from commit 26b58eabc6348ff12047cc2f7575f5b10cd3f317) --- tools/js2c.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/js2c.py b/tools/js2c.py index 39bfdefebc0b3b..f49ca66e2e1405 100755 --- a/tools/js2c.py +++ b/tools/js2c.py @@ -36,6 +36,11 @@ import sys import string +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + def ToCArray(elements, step=10): slices = (elements[i:i+step] for i in xrange(0, len(elements), step))