Skip to content

Prevent attribute error by checking for 'forced' attribute before flushing cache#2042

Merged
martindurant merged 2 commits into
fsspec:masterfrom
TLCFEM:tlc/suppress-attr-error
Jun 1, 2026
Merged

Prevent attribute error by checking for 'forced' attribute before flushing cache#2042
martindurant merged 2 commits into
fsspec:masterfrom
TLCFEM:tlc/suppress-attr-error

Conversation

@TLCFEM

@TLCFEM TLCFEM commented May 31, 2026

Copy link
Copy Markdown
Contributor

This is not a critical bug; however, if a NotImplementedError is raised during initialization due to an invalid mode, attributes such as forced are not created.
Consequently, subsequent cleanup operations (e.g., close or delete) may raise an AttributeError.
While this exception is typically suppressed, it may still be exposed in some scenarios.
This PR adds safeguards to prevent such cases and avoid unnecessary visual clutter.

@martindurant

Copy link
Copy Markdown
Member

Perhaps have forced be set early in the init function, or even have a backup class attribute?

@TLCFEM

TLCFEM commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Fixed, shall be Okay now.

@TLCFEM TLCFEM force-pushed the tlc/suppress-attr-error branch from 59da5d2 to e840297 Compare June 1, 2026 16:17
@TLCFEM

TLCFEM commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Looks like early initialization would cause some logical error elsewhere.

Comment thread fsspec/spec.py Outdated
Co-authored-by: Martin Durant <martindurant@users.noreply.github.com>
@martindurant martindurant merged commit c879384 into fsspec:master Jun 1, 2026
11 checks passed
@TLCFEM TLCFEM deleted the tlc/suppress-attr-error branch June 1, 2026 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants