From 227afdfddae953cf3fe77a607778052fc5b9cca4 Mon Sep 17 00:00:00 2001 From: Michael Penkov Date: Sun, 10 Oct 2021 21:23:52 +0900 Subject: [PATCH 1/2] fix AttributeError when reading passthrough zstandard --- smart_open/smart_open_lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smart_open/smart_open_lib.py b/smart_open/smart_open_lib.py index cd80f47f..4cc93b6a 100644 --- a/smart_open/smart_open_lib.py +++ b/smart_open/smart_open_lib.py @@ -387,7 +387,11 @@ def _open_binary_stream(uri, mode, transport_params): # if there is no such an attribute, we return "unknown" - this # effectively disables any compression if not hasattr(uri, 'name'): - uri.name = getattr(uri, 'name', 'unknown') + name = getattr(uri, 'name', 'unknown') + try: + uri.name = name + except AttributeError: + pass return uri if not isinstance(uri, str): From 47ed330fc004b56391432869e36423b7bec3fc1c Mon Sep 17 00:00:00 2001 From: Michael Penkov Date: Sun, 10 Oct 2021 22:25:04 +0900 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8b5edd..60530788 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Use pytest instead of parameterizedtestcase (PR [#657](https://github.com/RaRe-Technologies/smart_open/pull/657), [@mpenkov](https://github.com/mpenkov)) - Support container client and blob client for azure blob storage (PR [#652](https://github.com/RaRe-Technologies/smart_open/pull/652), [@cbare](https://github.com/cbare)) +- Fix AttributeError when reading passthrough zstandard (PR [#658](https://github.com/RaRe-Technologies/smart_open/pull/658), [@mpenkov](https://github.com/mpenkov)) # 5.2.1, 28 August 2021