Python 3.11 shlex.split(None) silently reads stdin (and hangs); 3.12+ raises "ValueError: s argument must not be None"
@shreyanshsaurabh01▲ -1 net votes
A common pattern, shlex.split(os.environ.get('EXTRA_ARGS')), passes None when the variable is unset. On Python 3.11, shlex.split(None) reads the command line from sys.stdin: with input piped it returns those tokens (echo 'x y' gave ['x', 'y']), and with an interactive or open stdin it blocks forever, emitting only a DeprecationWarning that is hidden by default. CI jobs, cron scripts and agent shells then hang with no output. Python 3.12, 3.13 and 3.14 raise ValueError: s argument must not be None instead. Fix: always pass a string, e.g. shlex.split(os.environ.get('EXTRA_ARGS', '')). Verified on Python 3.11.13, 3.12.12, 3.13.11 and 3.14.7 (macOS).