Repository navigation
Conversation
This was referenced Oct 8, 2026
ru551n
force-pushed
the
escape-string-args
branch
from
October 14, 2026 09:20
d346e30 to
fa73b4c
Compare
LarsAsplund
reviewed
Oct 15, 2026
| ## Changes | ||
|
|
||
| - `import_module_from_file` resolves a relative path against the directory of the testbench file, like `exec_file`, rather than against the working directory of the simulator. It must be called after `test_runner_setup`. Callers that relied on a path relative to the working directory must pass an absolute path instead. See #7. | ||
| - `arg(value : string)` and `kwarg(kw, value : string)` now produce a valid Python string literal: quotes, backslashes and control characters in the text are escaped. Callers that escaped the text themselves (for example passing `\\n` to get a newline) now get that text escaped again, and must pass the plain text instead. |
Contributor
There was a problem hiding this comment.
Make it a news fragment
Collaborator
Author
There was a problem hiding this comment.
Claude (AI assistant) here, on behalf of @ru551n:
Fixed in a482910. The note is now release_notes/news.d/16.breaking.md. The repository had no news fragments yet, so the commit also:
- configures towncrier (
[tool.towncrier]in pyproject.toml, types breaking/feature/bugfix/doc/misc), sotowncrier build --version <version>collects the fragments intorelease_notes/unreleased.mdwhen releasing; - shows the fragments under Unreleased in the docs;
- makes
tools/release.py validate --tagfail while fragments are left.
arg and kwarg for string now escape quotes, backslashes and control characters, so any text round-trips exactly. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The release notes of the next release are now news fragments in release_notes/news.d, which towncrier collects into release_notes/unreleased.md when releasing. The documentation shows them under Unreleased, and the release check fails while any are left. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ru551n
force-pushed
the
escape-string-args
branch
from
October 15, 2026 07:35
fa73b4c to
a482910
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
arg(value : string)andkwarg(kw, value : string)wrapped the text in double quotes verbatim, so a"or\(or a line break) in the text produced invalid or wrong Python.Change
Both now build the literal with
p_quoted, which escapes",\, LF and CR, and now also TAB and all other control characters (code < 32 and DEL) as\xNN. Bytes >= 128 are kept as they are so UTF-8 text is decoded by Python as the same characters.python_pkg.vhdis regenerated from the template. The user guide is updated, and the release note is the news fragmentrelease_notes/news.d/16.breaking.md. News fragments are new: towncrier collects them intorelease_notes/unreleased.mdwhen releasing, and the docs show them under Unreleased.Behaviour change
Callers that escaped the text themselves (for example passing
\nto get a newline) now get that text escaped again, and must pass the plain text instead.Tests
tb_python_pkg_bridge: round trip of quote, backslash, single quote, LF, TAB, CR, NUL, DEL and non-ASCII througharg/kwarg, plus theto_call_stroutput.tb_python_pkg(also run on VHPI simulators): length/ord checks of escaped strings.tests/run.py, the embedded_python example andpytest tests/test_python_bridge.pypass on NVC and GHDL.🤖 Generated with Claude Code