GH-125413: Add private pathlib.Path method to write metadata
#130238
Merged
pathlib.Path method to write metadata
#130238