Closed mpitt closed 8 months ago
The documentation for load_all and safe_load_all states (emphasis mine):
load_all
safe_load_all
... returns a sequence of Python objects ...
In reality, those methods return a generator, which is not the same thing as a sequence. For example:
with open(filename) as f: docs = yaml.safe_load_all(f) for d in docs: # do stuff
will raise ValueError: I/O operation on closed file. which if docs was really a sequence doesn't make sense.
ValueError: I/O operation on closed file.
docs
Mhm I realised that it should probably be a bug against https://github.com/yaml/pyyaml.org, I will move it there
The documentation for
load_all
andsafe_load_all
states (emphasis mine):In reality, those methods return a generator, which is not the same thing as a sequence. For example:
will raise
ValueError: I/O operation on closed file.
which ifdocs
was really a sequence doesn't make sense.