Skip to content

hasattr(genblaze_core, "ParquetSink") raises OptionalDependencyError instead of returning False #165

Description

@mark124

The lazy module __getattr__ on genblaze_core raises OptionalDependencyError, which does not subclass AttributeError, when the parquet extra is not installed. hasattr only swallows AttributeError, so capability probing crashes instead of returning False:

>>> import genblaze_core
>>> hasattr(genblaze_core, "ParquetSink")
OptionalDependencyError: ...

This breaks the standard feature-detection idiom, and also inspect and some IDE introspection that walk module attributes.

This is related to #40 (using OptionalDependencyError for guards), but the specific problem here is that raising it from __getattr__ makes hasattr and getattr(module, name, default) throw rather than behave.

Suggested fix: raise an error that subclasses both OptionalDependencyError and AttributeError (keeping the install hint in the message), or catch and re-raise as AttributeError from __getattr__.

Environment: genblaze-core 0.3.4, Python 3.14.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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