Use the libyaml FullLoader when libyaml is available - #70943
Open
rjgoyln wants to merge 1 commit into
Open
Conversation
The YAML helper modules promise that YAML operations use the faster C implementation whenever libyaml is installed. For FullLoader that promise was never kept: the branch that looked up CFullLoader discarded its result, so callers always received the pure-Python loader.
rjgoyln
marked this pull request as ready for review
August 3, 2026 12:57
rjgoyln
requested review from
amoghrajesh,
ashb,
bugraoz93,
dheerajturaga,
henry3260,
kaxil and
potiuk
as code owners
August 3, 2026 12:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
These YAML helpers promise the libyaml C implementation whenever it is available.
safe_loadanddumpdeliver it;FullLoadernever has — the__getattr__branch that looks upCFullLoaderdiscards the result and falls through to the pure-Python loader, so the fast path has always been dead code.Change
The module exists in three copies —
airflow.utils,airflow.sdk,airflowctl.ctl.utils— all carrying the same defect, and all three are fixed here. Unifying them is out of scope and already tracked by a TODO in the airflow-ctl copy.Tests
One test per copy, each failing without its fix.
CFullLoaderis injected rather than assumed, so the assertion holds whether or not the machine running the tests has libyaml compiled in.Behavior change
No in-tree caller reads
FullLoaderthrough these wrappers, so nothing in Airflow changes. External callers now receiveCFullLoader, which does not see constructors registered viayaml.add_constructor(tag, fn).Was generative AI tooling used to co-author this PR?
Generated-by: Claude Code (Opus 5) following the guidelines