Skip to content

Commit

Permalink
Move string construction out of non-error path in check (#11701)
Browse files Browse the repository at this point in the history
### Summary & Motivation

This string construction happens on every call to check, not just on failure. Lots of unnecessary string construction. Blames to #7605

### How I Tested These Changes

BK
  • Loading branch information
schrockn committed Jan 15, 2023
1 parent c7b3974 commit 585cff5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python_modules/dagster/dagster/_check/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,8 +1066,8 @@ def two_dim_mapping_param(
def not_none_param(
obj: Optional[T], param_name: str, additional_message: Optional[str] = None
) -> T:
additional_message = " " + additional_message if additional_message else ""
if obj is None:
additional_message = " " + additional_message if additional_message else ""
raise _param_invariant_exception(
param_name, f"Param {param_name} cannot be none.{additional_message}"
)
Expand Down

0 comments on commit 585cff5

Please sign in to comment.