Skip to content

[v3-1-test] fix(task-sdk): exclude pathlib.Path from Resolvable.resolve() in templater (#63306)#63633

Merged
eladkal merged 1 commit into
v3-1-testfrom
backport-23dec8d-v3-1-test
Mar 15, 2026
Merged

[v3-1-test] fix(task-sdk): exclude pathlib.Path from Resolvable.resolve() in templater (#63306)#63633
eladkal merged 1 commit into
v3-1-testfrom
backport-23dec8d-v3-1-test

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

pathlib.Path objects have a resolve() method for filesystem resolution
(strict parameter), which conflicts with the Resolvable.resolve(context)
protocol used by the templater. When a pathlib.Path subclass is passed as
a templated field value, the templater incorrectly calls
path.resolve(context), where the context dict is interpreted as
strict=True, causing FileNotFoundError if the path doesn't exist.

This adds an isinstance(value, os.PathLike) guard before calling
resolve() to ensure pathlib.Path objects are returned as-is.
(cherry picked from commit 23dec8d)

Co-authored-by: Yoann 60654707+YoannAbriel@users.noreply.github.com
Closes: #55412

…ve() in templater (#63306)

pathlib.Path objects have a resolve() method for filesystem resolution
(strict parameter), which conflicts with the Resolvable.resolve(context)
protocol used by the templater. When a pathlib.Path subclass is passed as
a templated field value, the templater incorrectly calls
path.resolve(context), where the context dict is interpreted as
strict=True, causing FileNotFoundError if the path doesn't exist.

This adds an isinstance(value, os.PathLike) guard before calling
resolve() to ensure pathlib.Path objects are returned as-is.
(cherry picked from commit 23dec8d)

Co-authored-by: Yoann <60654707+YoannAbriel@users.noreply.github.com>
Closes: #55412
@eladkal eladkal marked this pull request as ready for review March 15, 2026 12:05
@eladkal eladkal added this to the Airflow 3.1.9 milestone Mar 15, 2026
@eladkal eladkal merged commit 555a47c into v3-1-test Mar 15, 2026
59 checks passed
@eladkal eladkal deleted the backport-23dec8d-v3-1-test branch March 15, 2026 12:48
vatsrahul1001 pushed a commit that referenced this pull request Mar 25, 2026
…ve() in templater (#63306) (#63633)

pathlib.Path objects have a resolve() method for filesystem resolution
(strict parameter), which conflicts with the Resolvable.resolve(context)
protocol used by the templater. When a pathlib.Path subclass is passed as
a templated field value, the templater incorrectly calls
path.resolve(context), where the context dict is interpreted as
strict=True, causing FileNotFoundError if the path doesn't exist.

This adds an isinstance(value, os.PathLike) guard before calling
resolve() to ensure pathlib.Path objects are returned as-is.
(cherry picked from commit 23dec8d)


Closes: #55412

Co-authored-by: Yoann <60654707+YoannAbriel@users.noreply.github.com>
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.

2 participants