Skip to content

Commit b2ea773

Browse files
committed
Merge branch 'release/4.23.1' into master
2 parents 6c06548 + 12d53c7 commit b2ea773

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

docs/main/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ that were made in every particular version.
77
From version 0.7.6 *Dependency Injector* framework strictly
88
follows `Semantic versioning`_
99

10+
4.23.1
11+
------
12+
- Hotfix a bug with importing FastAPI ``Request``.
13+
See issue: `#398 <https://github.com/ets-labs/python-dependency-injector/issues/398>`_.
14+
Thanks to `@tapm <https://github.com/tapm>`_ for reporting the bug.
15+
1016
4.23.0
1117
------
1218
- Add support of aliases for ``Configuration`` provider.

src/dependency_injector/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Top-level package."""
22

3-
__version__ = '4.23.0'
3+
__version__ = '4.23.1'
44
"""Version number.
55
66
:type: str

src/dependency_injector/wiring.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,13 @@ def _unpatch(
345345
def _fetch_reference_injections(
346346
fn: Callable[..., Any],
347347
) -> Tuple[Dict[str, Any], Dict[str, Any]]:
348-
# # Hotfix, see: https://github.com/ets-labs/python-dependency-injector/issues/362
349-
if GenericAlias and fn is GenericAlias:
348+
# Hotfix, see:
349+
# - https://github.com/ets-labs/python-dependency-injector/issues/362
350+
# - https://github.com/ets-labs/python-dependency-injector/issues/398
351+
if GenericAlias and any((
352+
fn is GenericAlias,
353+
getattr(fn, '__func__', None) is GenericAlias
354+
)):
350355
fn = fn.__init__
351356

352357
signature = inspect.signature(fn)

tests/unit/samples/wiringfastapi/web.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import sys
22

33
from fastapi import FastAPI, Depends
4+
from fastapi import Request # See: https://github.com/ets-labs/python-dependency-injector/issues/398
45
from fastapi.security import HTTPBasic, HTTPBasicCredentials
56
from dependency_injector import containers, providers
67
from dependency_injector.wiring import inject, Provide

0 commit comments

Comments
 (0)