Mesa (main): Revert "python: Explicitly add the 'L' suffix on Python 3"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 14 22:06:58 UTC 2021


Module: Mesa
Branch: main
Commit: 93cb3aca0347bf4a9ed31226627672b178841cfb
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=93cb3aca0347bf4a9ed31226627672b178841cfb

Author: Eric Engestrom <eric at engestrom.ch>
Date:   Sat Aug  8 16:10:16 2020 +0200

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

This reverts commit ad363913e6766280f53838126d67370f9e97aa12.

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 at engestrom.ch>
Reviewed-by: Alyssa Rosenzweig <alyssa at collabora.com>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3674>

---

 src/compiler/nir/nir_algebraic.py | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 2a4354a7378..548f87bafeb 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -239,16 +239,7 @@ class Constant(Value):
       if isinstance(self.value, int):
          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
 



More information about the mesa-commit mailing list