Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vllm/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2082,6 +2082,7 @@ async def _run_task_with_lock(task: Callable, lock: asyncio.Lock, *args,
return await task(*args, **kwargs)


@lru_cache
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Applying @lru_cache directly to supports_kw can lead to a TypeError if it's called with an unhashable callable argument. While common callables like functions and methods are hashable, this isn't guaranteed for all callables (e.g., a class instance with __call__ and __hash__ = None). This change could introduce a regression, causing runtime errors where the code previously worked.

To make this more robust, consider handling the TypeError and falling back to an uncached call for unhashable arguments. This could be done by wrapping the cached function call in a try...except block.

def supports_kw(
callable: Callable[..., object],
kw_name: str,
Expand Down