We have an app that parses yaml files into Python data structures.
We then take those data structures and convert them to application objects. When there's a problem in the conversion, line numbers would be very helpful in error messages.
I imagine that this is a common pattern.
(Arguably, we could use !! markers. This is a reasonable approach, but for our needs, that clutters the yaml data and is less flexible than controlling conversion directly.)
In our application, we think we can do this for now using a custom Constructor/Loader subclass.