Skip to content

Regression in keyword passing in XLSXWriter.__init__() causes uncontrolled memory usage #12

@ShaheedHaque

Description

@ShaheedHaque

The change to XLSXWriter.__init__() in bf0e271:

  • causes the intended defaults for constant_memory and default_date_format to be ignored
  • makes it impossible to provide overriding values for those defaults

because these two keywords arguments are not passed into the options passed to the underlying xlsxwriter.Workbook(). I think a fix like this is needed:

    def __init__(
        self,
        file_alike_object,
        file_type,
        constant_memory=True,
        default_date_format="dd/mm/yy",
        **keywords
    ):
        if "single_sheet_in_book" in keywords:
            keywords.pop("single_sheet_in_book")
        keywords['constant_memory'] = constant_memory             # <<< new line
        keywords['default_date_format'] = default_date_format     # <<< new line
        self.xlsx_book = xlsxwriter.Workbook(
            file_alike_object, options=keywords
        )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions