mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #20627: xmlrpc.client.ServerProxy is now a context manager.
Patch by Claudiu Popa.
This commit is contained in:
parent
051f37d2e7
commit
33a4000374
5 changed files with 42 additions and 10 deletions
|
@ -1449,6 +1449,12 @@ class ServerProxy:
|
|||
return self.__transport
|
||||
raise AttributeError("Attribute %r not found" % (attr,))
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *args):
|
||||
self.__close()
|
||||
|
||||
# compatibility
|
||||
|
||||
Server = ServerProxy
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue