From 728f0f66e9a8f63a59b6b303f08b35eb9bdc3af9 Mon Sep 17 00:00:00 2001 From: Jim Garrison Date: Fri, 22 Nov 2024 14:04:10 -0500 Subject: [PATCH] Don't `decode` a unicode string when using git version In #907, the git sha1 was added to the version string on development builds. In #2158, `encoding="utf-8"` was added in `_minimal_ext_cmd`, which changed the output from a bytestring to a regular string. However, the original code path still expects a bytestring and calls `.decode()` on it. This fixes it in the way most obvious to me. --- qiskit_aer/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiskit_aer/version.py b/qiskit_aer/version.py index 110bceb957..9135ba3d98 100644 --- a/qiskit_aer/version.py +++ b/qiskit_aer/version.py @@ -50,7 +50,7 @@ def git_version(): # Determine if we're at main try: out = _minimal_ext_cmd(["git", "rev-parse", "HEAD"]) - git_revision = out.strip().decode("ascii") + git_revision = out.strip() except OSError: git_revision = "Unknown"