Skip to content

fix: initialize conversion result before checking failed converter output#1599

Open
stablegenius49 wants to merge 1 commit intomicrosoft:mainfrom
stablegenius49:pr-factory/issue-81-res-init
Open

fix: initialize conversion result before checking failed converter output#1599
stablegenius49 wants to merge 1 commit intomicrosoft:mainfrom
stablegenius49:pr-factory/issue-81-res-init

Conversation

@stablegenius49
Copy link

Summary

  • initialize res before each converter attempt in MarkItDown._convert
  • avoid UnboundLocalError when an accepting converter raises before returning a result
  • add a regression test that verifies converter failures surface as FileConversionException

Testing

  • python -m pytest /Users/frank-mac-mini/.openclaw/workspace/markitdown/packages/markitdown/tests/test_module_misc.py -k "test_exceptions or test_converter_failure_does_not_raise_unboundlocalerror"

Fixes #81

@stablegenius49
Copy link
Author

@microsoft-github-policy-service agree

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.

UnboundLocalError: local variable 'res' referenced before assignment

2 participants