Skip to content

Commit 5b8435b

Browse files
mishushakovclaude
andcommitted
fix: restore mcp falsy-check semantics and simplify sandbox_url access
Revert `mcp` from `is not None` check back to truthiness check so empty dicts are treated as UNSET. Remove unnecessary local alias in get_sandbox_url and use self._sandbox_url directly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ce1799a commit 5b8435b

3 files changed

Lines changed: 4 additions & 5 deletions

File tree

packages/python-sdk/e2b/connection_config.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,8 @@ def get_request_timeout(self, request_timeout: Optional[float] = None):
137137
return self._get_request_timeout(self.request_timeout, request_timeout)
138138

139139
def get_sandbox_url(self, sandbox_id: str, sandbox_domain: str) -> str:
140-
sandbox_url: Optional[str] = self._sandbox_url # type: ignore[assignment]
141-
if sandbox_url:
142-
return sandbox_url
140+
if self._sandbox_url:
141+
return self._sandbox_url
143142

144143
return f"{'http' if self.debug else 'https'}://{self.get_host(sandbox_id, sandbox_domain, self.envd_port)}"
145144

packages/python-sdk/e2b/sandbox_async/sandbox_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async def _create_sandbox(
171171
metadata=metadata or {},
172172
timeout=timeout,
173173
env_vars=env_vars or {},
174-
mcp=cast(Any, mcp) if mcp is not None else UNSET,
174+
mcp=cast(Any, mcp) or UNSET,
175175
secure=secure,
176176
allow_internet_access=allow_internet_access,
177177
network=SandboxNetworkConfig(**network) if network else UNSET,

packages/python-sdk/e2b/sandbox_sync/sandbox_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def _create_sandbox(
170170
metadata=metadata or {},
171171
timeout=timeout,
172172
env_vars=env_vars or {},
173-
mcp=cast(Any, mcp) if mcp is not None else UNSET,
173+
mcp=cast(Any, mcp) or UNSET,
174174
secure=secure,
175175
allow_internet_access=allow_internet_access,
176176
network=SandboxNetworkConfig(**network) if network else UNSET,

0 commit comments

Comments
 (0)