Skip to content

Commit f44d6ce

Browse files
committed
Fix AttributeError exception when CachedSchemaRegistryClient constructor raises a valid exception.
1 parent 27cfea6 commit f44d6ce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ v1.8.2 is a maintenance release with the following fixes and enhancements:
1515
- Fix crash in header parsing (Armin Ronacher, #1165)
1616
- Added long package description in setuptools (Bowrna, #1172).
1717
- Documentation fixes by Aviram Hassan and Ryan Slominski.
18+
- Don't raise AttributeError exception when CachedSchemaRegistryClient
19+
constructor raises a valid exception.
1820

1921
confluent-kafka-python is based on librdkafka v1.8.2, see the
2022
[librdkafka release notes](https://github.com/edenhill/librdkafka/releases/tag/v1.8.2)

src/confluent_kafka/avro/cached_schema_registry_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def __exit__(self, *args):
125125
self.close()
126126

127127
def close(self):
128-
self._session.close()
128+
# Constructor exceptions may occur prior to _session being set.
129+
if hasattr(self, '_session'):
130+
self._session.close()
129131

130132
@staticmethod
131133
def _configure_basic_auth(url, conf):

0 commit comments

Comments
 (0)