Merge branch 'release/3.14.6' into master

This commit is contained in:
Roman Mogylatov 2019-05-09 15:02:28 -04:00
commit 35cb351e72
7 changed files with 1022 additions and 795 deletions

View File

@ -7,6 +7,11 @@ that were made in every particular version.
From version 0.7.6 *Dependency Injector* framework strictly
follows `Semantic versioning`_
3.14.6
------
- Fix ``FactoryAggregate`` provider copying issue.
- Regenerate C sources using Cython 0.29.7.
3.14.5
------
- Fix issue causing ``ThreadLocalSingleton`` provider to return ``None`` after

View File

@ -1,4 +1,4 @@
cython==0.29.6
cython==0.29.7
tox
unittest2
coverage

View File

@ -1,6 +1,6 @@
"""Dependency injector top-level package."""
__version__ = '3.14.5'
__version__ = '3.14.6'
"""Version number that follows semantic versioning.
:type: str

View File

@ -1,4 +1,4 @@
/* Generated by Cython 0.29.6 */
/* Generated by Cython 0.29.7 */
#define PY_SSIZE_T_CLEAN
#include "Python.h"
@ -7,8 +7,8 @@
#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000)
#error Cython requires Python 2.6+ or Python 3.3+.
#else
#define CYTHON_ABI "0_29_6"
#define CYTHON_HEX_VERSION 0x001D06F0
#define CYTHON_ABI "0_29_7"
#define CYTHON_HEX_VERSION 0x001D07F0
#define CYTHON_FUTURE_DIVISION 0
#include <stddef.h>
#ifndef offsetof
@ -10992,10 +10992,9 @@ if (!__Pyx_RefNanny) {
__pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
Py_INCREF(__pyx_d);
__pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
#if CYTHON_COMPILING_IN_PYPY
Py_INCREF(__pyx_b);
#endif
__pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error)
Py_INCREF(__pyx_cython_runtime);
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
/*--- Initialize various global constants etc. ---*/
if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)

File diff suppressed because it is too large Load Diff

View File

@ -1449,6 +1449,21 @@ cdef class FactoryAggregate(Provider):
self.__factories = factories
super(FactoryAggregate, self).__init__()
def __deepcopy__(self, memo):
"""Create and return full copy of provider."""
cdef FactoryAggregate copied
copied = memo.get(id(self))
if copied is not None:
return copied
copied = self.__class__()
copied.__factories = deepcopy(self.__factories, memo)
self._copy_overridings(copied, memo)
return copied
def __call__(self, factory_name, *args, **kwargs):
"""Create new object using factory with provided name.

View File

@ -498,6 +498,20 @@ class FactoryAggregateTests(unittest.TestCase):
dict(example_a=self.example_a_factory,
example_b=self.example_b_factory))
def test_deepcopy(self):
provider_copy = providers.deepcopy(self.factory_aggregate)
self.assertIsNot(self.factory_aggregate, provider_copy)
self.assertIsInstance(provider_copy, type(self.factory_aggregate))
self.assertIsNot(self.factory_aggregate.example_a, provider_copy.example_a)
self.assertIsInstance(self.factory_aggregate.example_a, type(provider_copy.example_a))
self.assertIs(self.factory_aggregate.example_a.cls, provider_copy.example_a.cls)
self.assertIsNot(self.factory_aggregate.example_b, provider_copy.example_b)
self.assertIsInstance(self.factory_aggregate.example_b, type(provider_copy.example_b))
self.assertIs(self.factory_aggregate.example_b.cls, provider_copy.example_b.cls)
def test_repr(self):
self.assertEqual(repr(self.factory_aggregate),
'<dependency_injector.providers.'