Skip to content

Fix mutable default argument in awxkit/cli/__init__.py #16518

Description

@shunfeng8421

Issue: Found a mutable default argument [] in awxkit/cli/init.py. This is a classic Python bug pattern.

Problem: Mutable default arguments are created once at function definition time, and shared across all calls. This can cause unexpected behavior where state leaks between calls.

Suggested fix:

# Before (buggy):
def some_function(arg=[]):
    pass

# After (fixed):
def some_function(arg=None):
    if arg is None:
        arg = []
    pass

This is a static analysis finding. Please verify if this is actually reachable code and if a fix is appropriate.

Thanks for your work on open source!


This issue was generated by Code Health Auditor

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions