[Lldb-commits] [lldb] r252348 - Python 3 - Port use of string.maketrans and don't use sets.Set.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Fri Nov 6 13:37:33 PST 2015
Author: zturner
Date: Fri Nov 6 15:37:33 2015
New Revision: 252348
URL: http://llvm.org/viewvc/llvm-project?rev=252348&view=rev
Log:
Python 3 - Port use of string.maketrans and don't use sets.Set.
`sets.Set` has been deprecated in favor of `set` since 2.6, and
`string.maketrans` has to be special cased. In Python 3 there
is `str.maketrans`, `bytes.maketrans`, and `bytearray.maketrans`
and you have to choose the correct one. So we need to introduce
a runtime version check at this site.
Modified:
lldb/trunk/packages/Python/lldbsuite/test/dotest.py
lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/dotest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/dotest.py?rev=252348&r1=252347&r2=252348&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/dotest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/dotest.py Fri Nov 6 15:37:33 2015
@@ -1726,8 +1726,10 @@ def run_suite():
if iterArchs or iterCompilers:
# Translate ' ' to '-' for pathname component.
- from string import maketrans
- tbl = maketrans(' ', '-')
+ if six.PY2:
+ tbl = string.maketrans(' ', '-')
+ else:
+ tbl = str.maketrans(' ', '-')
configPostfix = configString.translate(tbl)
# Check whether we need to split stderr/stdout into configuration
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=252348&r1=252347&r2=252348&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Fri Nov 6 15:37:33 2015
@@ -13,7 +13,6 @@ import platform
import random
import re
import select
-import sets
import signal
import socket
import subprocess
@@ -785,7 +784,7 @@ class GdbRemoteTestCaseBase(TestBase):
def select_modifiable_register(self, reg_infos):
"""Find a register that can be read/written freely."""
- PREFERRED_REGISTER_NAMES = sets.Set(["rax",])
+ PREFERRED_REGISTER_NAMES = set(["rax",])
# First check for the first register from the preferred register name set.
alternative_register_index = None
More information about the lldb-commits
mailing list