Skip to content

docx fails to import when python run with -OO optimizations #375

@rasjidw

Description

@rasjidw

The docx.enum.base module fails to load when python is run with -OO optimizations turned on, which means that docx itself cannot be imported.

The issue is in line 60 of docx.enum.base.py:
cls_docstring = self._clsdict['__doc__']

A KeyError is not raised, but instead cls_docstring is set to None, which causes the textwrap.dedent call to fail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions