Subject: Re: [PATCH net-next] tools: ynl: try to avoid the very slow YAML loader

From: Jakub Kicinski <[email-masked]>
Date: Wed, 3 Jun 2026 16:35:18 -0700

On Wed, 3 Jun 2026 15:08:46 -0700 Jacob Keller wrote:
> Hmm. I was a bit confused at first by the switch from safe_load to
> load.. but we're passing Loader as _yaml_loader which will either be
> CSafeLoader *or* the default SafeLoader, so we'll get the appropriate
> loader equivalent to what safe_load would have done, so there's no
> change. Ok

Maybe I should have mentioned this in the commit msg. I was also super
confused by these APIs but IDK how much is this me not knowing Python
and how much it's special. AFAIU basically:

somewhere in pyyaml...

	def safe_load(file):
		return load(file, Loader=SafeLoader)

so safe_load() is just a "shorthand" for using SafeLoader, which unlike
load()s default loader doesn't allow constructing real/binary Python
objects ?

Why it doesn't default to the C one is beyond my understanding.