Skip to content

Avoid mutable default for toolsets#36

Open
kingrubic wants to merge 1 commit into
perforce:mainfrom
kingrubic:avoid-mutable-toolsets-default
Open

Avoid mutable default for toolsets#36
kingrubic wants to merge 1 commit into
perforce:mainfrom
kingrubic:avoid-mutable-toolsets-default

Conversation

@kingrubic

Copy link
Copy Markdown

Summary

  • use None as the default constructor value for toolsets
  • initialize self.toolsets to a fresh empty list when omitted

Why

Using a list as a default argument can accidentally share state between instances. This keeps the current omitted-argument behavior while avoiding that Python footgun.

Tests

  • python3 -m compileall -q p4mcp

@kingrubic kingrubic force-pushed the avoid-mutable-toolsets-default branch from 3f0a8e6 to 671c848 Compare June 30, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant