Skip to content

Fix command-line macro option ordering - #107

Closed
shkyyy18 wants to merge 1 commit into
ned14:masterfrom
shkyyy18:fix/ordered-macro-options
Closed

shkyyy18 wants to merge 1 commit into
ned14:masterfrom
shkyyy18:fix/ordered-macro-options

Conversation

@shkyyy18

@shkyyy18 shkyyy18 commented Oct 1, 2026

Copy link
Copy Markdown

Summary

Fixes #105. Command-line -D and -U options were collected separately and applied as all definitions followed by all undefinitions, losing their order. For example, -DFOO=1 -UFOO -DFOO=2 leaves FOO undefined instead of expanding it to 2.

Record the operations as argparse processes them and replay them in order. Preserve the existing args.defines and args.undefines lists and definition parsing, including bare definitions and values containing =. -N behavior is unchanged.

Verification

Tests use unittest and synthetic stdin/stdout, as required by AGENTS.md. On Windows and Python 3.12.10:

  • Before the source fix, the 10 new regression/control tests had 5 failures and 5 passes.
  • After the fix, python -m unittest tests.issue0105 -v: 10 passed.
  • Full pytest suite before: 77 passed, 2 failed; after: 87 passed, the same 2 failed. Both failures are the pre-existing alternate_input_encodings.py UTF-16 input cases in this environment. They were not changed or hidden.
  • python setup.py build: passed (existing setuptools deprecation warnings).
  • git diff --check: passed.
  • The documented python setup.py test cannot run with installed setuptools 84 because its test command has been removed. Full CI/Python/platform matrix was not run locally.

No changes were made inside the PLY submodule. AI assistance (OpenAI Codex) was used for investigation, implementation and testing; the minimal diff and before/after results were reviewed against current upstream master.

@shkyyy18 shkyyy18 closed this by deleting the head repository Oct 16, 2026
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.

-D and -U options processed in the wrong order.

1 participant