[libcxx-commits] [libcxx] [libcxx] [test] Use `shlex.quote()` to fix Python 3.13 compatibility (PR #93376)

Michał Górny via libcxx-commits libcxx-commits at lists.llvm.org
Sat May 25 02:06:56 PDT 2024


https://github.com/mgorny created https://github.com/llvm/llvm-project/pull/93376

Replace the use of `pipes.quote()` with `shlex.quote()` to fix compatibility with Python 3.13.  The former was always an undocumented alias to the latter, and the `pipes` module was removed completely in Python 3.13.

Fixes #93375

>From 60cf2eabc0c1e692ab5626ad967835eec5eff48d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny at gentoo.org>
Date: Sat, 25 May 2024 11:03:58 +0200
Subject: [PATCH] [libcxx] [test] Use `shlex.quote()` to fix Python 3.13
 compatibility

Replace the use of `pipes.quote()` with `shlex.quote()` to fix
compatibility with Python 3.13.  The former was always an undocumented
alias to the latter, and the `pipes` module was removed completely
in Python 3.13.

Fixes #93375
---
 libcxx/test/libcxx/lit.local.cfg | 5 +++--
 libcxx/utils/libcxx/test/dsl.py  | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/libcxx/test/libcxx/lit.local.cfg b/libcxx/test/libcxx/lit.local.cfg
index 147367323d4a6..4467d8070cc70 100644
--- a/libcxx/test/libcxx/lit.local.cfg
+++ b/libcxx/test/libcxx/lit.local.cfg
@@ -1,4 +1,5 @@
 # The tests in this directory need to run Python
-import pipes, sys
+import shlex
+import sys
 
-config.substitutions.append(("%{python}", pipes.quote(sys.executable)))
+config.substitutions.append(("%{python}", shlex.quote(sys.executable)))
diff --git a/libcxx/utils/libcxx/test/dsl.py b/libcxx/utils/libcxx/test/dsl.py
index 387862ae6f496..7ac66d449b1cf 100644
--- a/libcxx/utils/libcxx/test/dsl.py
+++ b/libcxx/utils/libcxx/test/dsl.py
@@ -8,8 +8,8 @@
 
 import os
 import pickle
-import pipes
 import platform
+import shlex
 import shutil
 import tempfile
 
@@ -290,7 +290,7 @@ def hasAnyLocale(config, locales):
       }
     #endif
   """
-    return programSucceeds(config, program, args=[pipes.quote(l) for l in locales])
+    return programSucceeds(config, program, args=[shlex.quote(l) for l in locales])
 
 
 @_memoizeExpensiveOperation(lambda c, flags="": (c.substitutions, c.environment, flags))



More information about the libcxx-commits mailing list