Revert "python: Explicitly add the 'L' suffix on Python 3"

This reverts commit ad363913e6.

This code was added to be able to compare the output file while porting
the script from python2 to python3, but this has long been finished and
the extra complexity is not needed anymore.

Signed-off-by: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>
(cherry picked from commit 93cb3aca03)
This commit is contained in:
Eric Engestrom 2020-08-08 16:10:16 +02:00 committed by Dylan Baker
parent ca9ab792c6
commit 533a3ebdd0
2 changed files with 2 additions and 11 deletions

View file

@ -472,7 +472,7 @@
"description": "Revert \"python: Explicitly add the 'L' suffix on Python 3\"",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "ad363913e6766280f53838126d67370f9e97aa12"
},

View file

@ -249,16 +249,7 @@ class Constant(Value):
if isinstance(self.value, integer_types):
return hex(self.value)
elif isinstance(self.value, float):
i = struct.unpack('Q', struct.pack('d', self.value))[0]
h = hex(i)
# On Python 2 this 'L' suffix is automatically added, but not on Python 3
# Adding it explicitly makes the generated file identical, regardless
# of the Python version running this script.
if h[-1] != 'L' and i > sys.maxsize:
h += 'L'
return h
return hex(struct.unpack('Q', struct.pack('d', self.value))[0])
else:
assert False