Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Python dict race condition (#351)
Jakub Novák168e59faf6f7
diff --git a/.changeset/shiny-houses-fry.md b/.changeset/shiny-houses-fry.mdnew file mode 100644index 000000000..084a0cc71--- /dev/null+++ b/.changeset/shiny-houses-fry.md@@ -0,0 +1,5 @@+---+"@e2b/python-sdk": patch+---++Fix race condition in python SDKdiff --git a/packages/python-sdk/e2b/sandbox/sandbox_rpc.py b/packages/python-sdk/e2b/sandbox/sandbox_rpc.pyindex ee13d8131..b5c3abebb 100644--- a/packages/python-sdk/e2b/sandbox/sandbox_rpc.py+++ b/packages/python-sdk/e2b/sandbox/sandbox_rpc.py@@ -186,7 +186,8 @@ class SandboxRpc(BaseModel):self._process_cleanup.clear()- for handler in self._waiting_for_replies.values():+ # .copy() prevents a RuntimeError: dictionary changed size during iteration+ for handler in self._waiting_for_replies.copy().values():handler.cancel()del handler