Skip to content

Commit 84bf2ca

Browse files
committed
Read USE_SHELL in Git.execute without DeprecationWarning
This changes how Git.execute itself accesses the USE_SHELL attribute, so that its own read of it does not issue a warning.
1 parent c5d5b16 commit 84bf2ca

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

git/cmd.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1189,7 +1189,12 @@ def execute(
11891189

11901190
stdout_sink = PIPE if with_stdout else getattr(subprocess, "DEVNULL", None) or open(os.devnull, "wb")
11911191
if shell is None:
1192-
shell = self.USE_SHELL
1192+
# Get the value of USE_SHELL with no deprecation warning. Do this without
1193+
# warnings.catch_warnings, to avoid a race condition with application code
1194+
# configuring warnings. The value could be looked up in type(self).__dict__
1195+
# or Git.__dict__, but those can break under some circumstances. This works
1196+
# the same as self.USE_SHELL in more situations; see Git.__getattribute__.
1197+
shell = super().__getattribute__("USE_SHELL")
11931198
_logger.debug(
11941199
"Popen(%s, cwd=%s, stdin=%s, shell=%s, universal_newlines=%s)",
11951200
redacted_command,

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy