Fix method name parsing in NoMethodMatchPythonExceptionInterpreter#9573
Merged
jhonabreul merged 1 commit intoJul 1, 2026
Merged
Conversation
The interpreter extracted the method name with LastIndexOf(" "), which
returned the last space-delimited token of the pythonnet message (a
fragment of the argument type list, e.g. "'QuantConnect.Resolution'>)")
instead of the actual method name. Parse the name from between the
"for " keyword and the following ":" instead.
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.
Description
NoMethodMatchPythonExceptionInterpreterbuilds a user-facing message that names the method that failed overload resolution. It extracted that name withLastIndexOf(" "), which returns the last space-delimited token of the pythonnet message rather than the method name. The pythonnet message has the form:so the last token is a fragment of the argument-type list (e.g.
'QuantConnect.Resolution'>)), producing a garbled message:The method name is now parsed from between the
"for "keyword and the following":", yielding the correctRSI/SetCashetc.Related Issue
N/A — bug found while running a Python algorithm whose
initializecalledself.rsi(symbol, 15, Resolution.DAILY)(the third argument should be aMovingAverageType).Motivation and Context
The interpreted exception is meant to help users fix a bad call by telling them which method's parameters didn't match. The broken parsing instead pointed at a piece of the argument list, making the guidance confusing and useless.
Requires Documentation Change
No.
How Has This Been Tested?
Added two tests to
NoMethodMatchPythonExceptionInterpreterTests:VerifyMessageContainsTheMethodName— using the existingset_cash('SPY')reproduction, asserts the interpreted message containsSetCashand not the">)"argument-list fragment.VerifyMessageContainsTheMethodNameForOverloadedMethod— reproduces the reported scenario via a newno_method_match_rsimethod (self.rsi(symbol, 15, Resolution.DAILY)) and asserts the message containsRSIand not">)".Both tests fail before the fix and pass after. The full
NoMethodMatchPythonExceptionInterpreterTestsfixture passes (13/13).Types of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>