Skip to content

Accept tuple arguments when spawning processes - #87

Open
fly1d wants to merge 1 commit into
pexpect:masterfrom
fly1d:fix/tuple-argv
Open

fly1d wants to merge 1 commit into
pexpect:masterfrom
fly1d:fix/tuple-argv

Conversation

@fly1d

@fly1d fly1d commented Oct 29, 2026

Copy link
Copy Markdown

PtyProcess.spawn accepts a list or tuple, but slicing a tuple leaves it immutable. Replacing argv[0] with the resolved executable then raises TypeError before the child starts. Copy the accepted arguments to a list without changing the caller's input.

The regressions run real Python children through both PtyProcess and PtyProcessUnicode, checking PATH resolution, arguments with spaces, output, exit status and unchanged list/tuple inputs.

Validation on Python 3.14.7/macOS arm64:

  • The identical four regression cases give two tuple failures and two passing list controls on the original code; all four pass here within the full suite.
  • Full python -m pytest --timeout 60 -v: 19 passed, none skipped.
  • python -m compileall -q ptyprocess tests/test_spawn.py and git diff --check pass.

Other Python versions and platforms were not tested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant