Skip to content
Open
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
3 changes: 2 additions & 1 deletion dspy/utils/unbatchify.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ def __del__(self):
"""
Ensures the worker thread is terminated when the object is garbage collected.
"""
self.close()
if hasattr(self, "batch_fn"):
Copy link
Preview

Copilot AI Sep 21, 2025

Choose a reason for hiding this comment

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

The fix checks for batch_fn but the error traceback shows the issue is with missing stop_event attribute. The check should verify the existence of stop_event instead, or check for multiple required attributes to ensure the object is fully initialized.

Suggested change
if hasattr(self, "batch_fn"):
if hasattr(self, "stop_event") and hasattr(self, "worker_thread"):

Copilot uses AI. Check for mistakes.

self.close()