Fix Python 3.10 segmentation fault in FilteredStream threading

- Remove race condition in FilteredStream.write() method
- Remove class-level _lock = None that caused threading issues
- Ensures proper lock initialization in __init__ only

Fixes Python 3.10 CI test failures with exit code 139

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-25 05:20:35 +00:00
parent 4e0501007a
commit e79f591d70

View File

@@ -56,16 +56,11 @@ load_dotenv()
class FilteredStream(io.TextIOBase):
_lock = None
def __init__(self, original_stream: TextIO):
self._original_stream = original_stream
self._lock = threading.Lock()
def write(self, s: str) -> int:
if not self._lock:
self._lock = threading.Lock()
with self._lock:
# Filter out extraneous messages from LiteLLM
if (