[Python] Generated code is out of contract - application hangs indefinitely
Created by: fabianvf
Bug originally reported by @gaborbernat in the swagger-codegen project, but the same issue applies here: https://github.com/swagger-api/swagger-codegen/issues/9991
The generated code snippet from - https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/python/api_client.mustache#L78 is not allowed:
def __del__(self):
if self._pool is not None:
self._pool.close()
self._pool.join()
The very simple program of creating a global client, and then just exiting will hang indefinitely on Python3.8. Initially raised as CPython bug under https://bugs.python.org/issue39360, but @pablogsal (core CPython developer) investigated and concluded that this way of cleaning up pools is not supported. Instead one should either allow the user to close or if the user did not do the generated code should do by registering https://docs.python.org/3.8/library/atexit.html callbacks.
Fix incoming