Repository navigation
Conversation
getMessagesStringInternal() prints the file of a message as filename = "..." in older omc versions and as fileName = "..." after OpenModelica/OpenModelica#17893 (issue OpenModelica/OpenModelica#17891). With only filename in the regex, the messages of a newer omc are not parsed, and an omc error does not raise OMSessionException. Accept both names. The new test checks that an omc error raises OMSessionException with the file name of the message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Related issues
OpenModelica/OpenModelica#17891, OpenModelica/OpenModelica#17893.
Purpose
OpenModelica/OpenModelica#17893 changes the field of the file name in the messages of
getMessagesStringInternal()fromfilenametofileName, the name of the declared recordOpenModelica.Scripting.SourceInfo. The other fields are camel case too (lineStart,columnStart, ...).OMCSessionABC.sendExpressionparses these messages with a regex that accepts onlyfilename = "...". With a newer omc, no message is parsed: OMPython logs "Invalid ErrorMessage record" for each one, and an omc error does not raiseOMSessionException.Approach
filenameandfileName, so OMPython works with older and newer omc versions.test_error_message_file:loadStringwith a syntax error and the file namebad.momust raiseOMSessionExceptionwith[bad.mo:in the message.Tests
pytest tests/test_OMSessionCmd.pypasses with omc 1.28.0-dev from/usr/bin(printsfilename) and with an omc built from [API] Use fileName in SourceInfo values (#17891) OpenModelica#17893 (printsfileName).test_error_message_filefails with the omc of [API] Use fileName in SourceInfo values (#17891) OpenModelica#17893 (DID NOT RAISE OMSessionException).pre-commit runon the changed files passes (flake8, codespell, mypy).An AI agent (Claude Code) wrote this change and ran the tests above locally (Linux).
🤖 Generated with Claude Code