Skip to content

fix: use proper exception objects instead of bare raise/assert strings#13398

Open
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix/raise-string-to-raise-exception
Open

fix: use proper exception objects instead of bare raise/assert strings#13398
Ricardo-M-L wants to merge 1 commit intohuggingface:mainfrom
Ricardo-M-L:fix/raise-string-to-raise-exception

Conversation

@Ricardo-M-L
Copy link
Copy Markdown

Two types of exception handling bugs:

1. raise "string" in attention_processor.py (lines 328-332)

`raise "string"` causes `TypeError: exceptions must derive from BaseException` at runtime instead of the intended error message. Changed 3 occurrences to `raise RuntimeError("...")`.

2. assert ValueError("...") in controlnet_inpainting pipeline (line 1265)

`assert ValueError("...")` always passes because a ValueError object is truthy. Changed to `raise ValueError("...")`.

- attention_processor.py: `raise "string"` causes TypeError at runtime.
  Changed 3 occurrences to `raise RuntimeError("...")`.
- pipeline_stable_diffusion_3_controlnet_inpainting.py:
  `assert ValueError("...")` always passes (ValueError object is truthy).
  Changed to `raise ValueError("...")`.
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.

1 participant