Skip to content

Conversation

@yunchipang
Copy link
Contributor

@yunchipang yunchipang commented Jul 17, 2025

related: #53395

original warning:
providers/elasticsearch/src/airflow/providers/elasticsearch/log/es_task_handler.py:511: error: Statement is unreachable [unreachable]

this was caused by:

if self.handler is None:
    self.closed = True
    return

because self.handler was not allowed to be None in the type hint, mypy considered the if condition always false, marking self.closed = True as unreachable.

fix: updated the type of self.handler to include None and initialized it with None.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@yunchipang yunchipang force-pushed the 53395-fix-unreachable-warnings-for-elasticsearch-provider branch from f9626ed to 7f2caa4 Compare July 18, 2025 17:15
Copy link
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is reasonable. But another expert review who knows elastic would be good.

@shahar1 shahar1 merged commit 1f8b397 into apache:main Jul 19, 2025
71 checks passed
@yunchipang yunchipang deleted the 53395-fix-unreachable-warnings-for-elasticsearch-provider branch July 22, 2025 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants