mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-22 09:36:48 +03:00
Merge branch 'release/4.31.1' into master
This commit is contained in:
commit
d04596be73
|
@ -7,6 +7,12 @@ that were made in every particular version.
|
|||
From version 0.7.6 *Dependency Injector* framework strictly
|
||||
follows `Semantic versioning`_
|
||||
|
||||
4.31.1
|
||||
------
|
||||
- Fix ``ThreadSafeSingleton`` synchronization issue.
|
||||
See issue: `#433 <https://github.com/ets-labs/python-dependency-injector/issues/433>`_.
|
||||
Thanks to `@garlandhu <https://github.com/garlandhu>`_ for reporting the issue.
|
||||
|
||||
4.31.0
|
||||
------
|
||||
- Implement providers' lazy initialization.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Top-level package."""
|
||||
|
||||
__version__ = '4.31.0'
|
||||
__version__ = '4.31.1'
|
||||
"""Version number.
|
||||
|
||||
:type: str
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -2819,17 +2819,14 @@ cdef class ThreadSafeSingleton(BaseSingleton):
|
|||
if instance is None:
|
||||
with self.__storage_lock:
|
||||
if self.__storage is None:
|
||||
instance = __factory_call(self.__instantiator, args, kwargs)
|
||||
|
||||
if __is_future_or_coroutine(instance):
|
||||
result = __factory_call(self.__instantiator, args, kwargs)
|
||||
if __is_future_or_coroutine(result):
|
||||
future_result = asyncio.Future()
|
||||
instance = asyncio.ensure_future(instance)
|
||||
instance.add_done_callback(functools.partial(self._async_init_instance, future_result))
|
||||
self.__storage = future_result
|
||||
return future_result
|
||||
|
||||
self.__storage = instance
|
||||
|
||||
result = asyncio.ensure_future(result)
|
||||
result.add_done_callback(functools.partial(self._async_init_instance, future_result))
|
||||
result = future_result
|
||||
self.__storage = result
|
||||
instance = self.__storage
|
||||
return instance
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user