Skip to content

Fix mutable default argument in lora_base.py #14052

Description

@shunfeng8421

Issue: Found mutable default arguments ([], {}) in lora_base.py and related files. 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 state leaks between function 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. There are multiple occurrences in this repository - please verify if these are actually reachable code paths.

Thanks for your work on diffusers and open source!


This issue was generated by Code Health Auditor

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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