-
Notifications
You must be signed in to change notification settings - Fork 15.1k
[libcxx] [test] Use shlex.quote()
to fix Python 3.13 compatibility
#93376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 llvm#93375
@llvm/pr-subscribers-libcxx Author: Michał Górny (mgorny) ChangesReplace the use of Fixes #93375 Full diff: https://github.com/llvm/llvm-project/pull/93376.diff 2 Files Affected:
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))
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix.
CI failures are flukes, merging. |
Thanks! |
@ldionne, do you think we could backport this to 18.x too? It's rather trivial change, and previous LLVM versions tend to linger for years. |
@mgorny Yes, you can follow the cherry-pick request process and I'll approve it. Are we still doing point releases for LLVM 18 though? |
Oh, we aren't indeed. I haven't noticed, thanks for letting me know. |
The 'pipes' Python module has been deprecated for a while and been removed in Python 3.13 [1]. A drop-in replacement for 'pipes.quote()' is 'shlex.quote()' [2][3]. [1]: https://www.python.org/downloads/release/python-3130/ [2]: tox-dev/tox#2418 [3]: llvm/llvm-project#93376
Replace the use of
pipes.quote()
withshlex.quote()
to fix compatibility with Python 3.13. The former was always an undocumented alias to the latter, and thepipes
module was removed completely in Python 3.13.Fixes #93375