Skip to content

Commit 7d22412

Browse files
committed
Fix error when closing session in transport destructor
Fixes #1347
1 parent 09019c8 commit 7d22412

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

CHANGES

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
4.2.0 (2022-111-03)
1+
4.2.1 (2022-11-10)
2+
-------------------
3+
- Fix error regarding closing session in async transport (#1347)
4+
5+
4.2.0 (2022-11-03)
26
-------------------
37
- Drop support for Python 3.6
48
- Allow embedding CDATA elements in simple types (#1339)

src/zeep/transports.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def __init__(self, cache=None, timeout=300, operation_timeout=None, session=None
3737
self.operation_timeout = operation_timeout
3838
self.logger = logging.getLogger(__name__)
3939

40-
self.__close_session = not session
40+
self._close_session = not session
4141
self.session = session or requests.Session()
4242
self.session.mount("file://", FileAdapter())
4343
self.session.headers["User-Agent"] = "Zeep/%s (www.python-zeep.org)" % (
@@ -156,7 +156,7 @@ def settings(self, timeout=None):
156156
self.operation_timeout = old_timeout
157157

158158
def __del__(self):
159-
if self.__close_session:
159+
if self._close_session:
160160
self.session.close()
161161

162162

@@ -181,6 +181,7 @@ def __init__(
181181
if httpx is None:
182182
raise RuntimeError("The AsyncTransport is based on the httpx module")
183183

184+
self._close_session = False
184185
self.cache = cache
185186
self.wsdl_client = wsdl_client or httpx.Client(
186187
verify=verify_ssl,

0 commit comments

Comments
 (0)