jackylee-ch opened a new pull request, #3915: URL: https://github.com/apache/iceberg-python/pull/3915
# Rationale for this change `_load_yaml` passes `strictyaml.load(...).data` straight to `_lowercase_dictionary_keys`. For an empty or comment-only document that value is a `str`, not a mapping, so the call raises `AttributeError: 'str' object has no attribute 'items'`. `Config()` runs at import time, so commenting out `~/.pyiceberg.yaml` makes the import fail with an error that names neither YAML nor the file: ``` >>> import pyiceberg.catalog AttributeError: 'str' object has no attribute 'items' ``` Return `None` instead. The annotated return type is already `RecursiveDict | None`, and the caller already treats `None` as "keep looking in the next directory". ## Are these changes tested? Yes, `test_from_configuration_files_without_a_mapping` in `tests/utils/test_config.py`, parametrized over an empty file, a newline, and a comment-only file. All three fail with the `AttributeError` without the change. ## Are there any user-facing changes? A `.pyiceberg.yaml` that holds no mapping is skipped instead of raising. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
