mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-127873: Only check sys.flags.ignore_environment
for PYTHON*
env vars (#127877)
This commit is contained in:
parent
13475e0a5a
commit
05d12eecbd
22 changed files with 94 additions and 65 deletions
|
@ -42,15 +42,14 @@ def can_colorize(*, file=None) -> bool:
|
|||
return False
|
||||
if os.environ.get("PYTHON_COLORS") == "1":
|
||||
return True
|
||||
if "NO_COLOR" in os.environ:
|
||||
return False
|
||||
if "NO_COLOR" in os.environ:
|
||||
return False
|
||||
if not COLORIZE:
|
||||
return False
|
||||
if not sys.flags.ignore_environment:
|
||||
if "FORCE_COLOR" in os.environ:
|
||||
return True
|
||||
if os.environ.get("TERM") == "dumb":
|
||||
return False
|
||||
if "FORCE_COLOR" in os.environ:
|
||||
return True
|
||||
if os.environ.get("TERM") == "dumb":
|
||||
return False
|
||||
|
||||
if not hasattr(file, "fileno"):
|
||||
return False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue