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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 16 19:02:11 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 533a3ebdd070bf011b57fcc03a1f03ae3d12022b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=533a3ebdd070bf011b57fcc03a1f03ae3d12022b

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>
(cherry picked from commit 93cb3aca0347bf4a9ed31226627672b178841cfb)

---

 .pick_status.json                 |  2 +-
 src/compiler/nir/nir_algebraic.py | 11 +----------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f4f3e109d89..6eceec0d0e2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -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"
     },
diff --git a/src/compiler/nir/nir_algebraic.py b/src/compiler/nir/nir_algebraic.py
index 37fefd87a6b..c5b47ff9282 100644
--- a/src/compiler/nir/nir_algebraic.py
+++ b/src/compiler/nir/nir_algebraic.py
@@ -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
 



More information about the mesa-commit mailing list