Skip to content

Fix IndexError in Log.build_msg on empty string argument - #3087

Merged
janiversen merged 2 commits into
pymodbus-dev:devfrom
feralice:fix/log-build-msg-empty-string
Nov 11, 2026
Merged

janiversen merged 2 commits into
pymodbus-dev:devfrom
feralice:fix/log-build-msg-empty-string

Conversation

@feralice

@feralice feralice commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

fixes #3085.

An empty str after another argument made args[i + 1][0] raise IndexError. startswith(":") treats it as a plain value. Other ":..." strings still raise TypeError, as discussed.

Adds one case to test_log_parms: it fails without the change and passes with it.

An empty str after another argument made args[i + 1][0] raise
IndexError. startswith(":") treats it as a plain value. Other
":..." strings still raise TypeError, as intended.

Refs pymodbus-dev#3085

@janiversen janiversen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks.

@janiversen
janiversen merged commit 7509a6b into pymodbus-dev:dev Nov 11, 2026
16 checks passed
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.

Log.build_msg raises on a string argument that is empty or starts with ":"

2 participants