Author: Adrian Prantl
Date: 2024-12-06T17:01:58-08:00
New Revision: 9f98949c9424addbc573fac7912cc164965b8994

URL: 
https://github.com/llvm/llvm-project/commit/9f98949c9424addbc573fac7912cc164965b8994
DIFF: 
https://github.com/llvm/llvm-project/commit/9f98949c9424addbc573fac7912cc164965b8994.diff

LOG: [lldb] Move the python module import workaround further up

Added: 
    

Modified: 
    lldb/examples/python/formatter_bytecode.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/formatter_bytecode.py 
b/lldb/examples/python/formatter_bytecode.py
index 0930d50013571e..ccd0c68a75483c 100644
--- a/lldb/examples/python/formatter_bytecode.py
+++ b/lldb/examples/python/formatter_bytecode.py
@@ -463,6 +463,12 @@ def next_byte():
 
 
 if __name__ == "__main__":
+    # Work around the fact that one of the local files is called
+    # types.py, which breaks some versions of python.
+    import os, sys
+
+    path = os.path.abspath(os.path.dirname(__file__))
+    sys.path.remove(path)
     import argparse
 
     parser = argparse.ArgumentParser(
@@ -487,12 +493,6 @@ def next_byte():
     # Tests.
     
############################################################################
     if args.test:
-        # Work around the fact that one of the local files is calles
-        # types.py, which breaks some versions of python.
-        import os, sys
-
-        path = os.path.abspath(os.path.dirname(__file__))
-        sys.path.remove(path)
         import unittest
 
         class TestCompiler(unittest.TestCase):


        
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to