Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit b141cf0

Browse files
author
John Andersen
committed
util: asynchelper: aenter_stack bind lambdas
Signed-off-by: John Andersen <[email protected]>
1 parent 36d88ae commit b141cf0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2626
- skel modules have `long_description_content_type` set to "text/markdown"
2727
- Base Orchestrator `__aenter__` and `__aexit__` methods were moved to the
2828
Memory Orchestrator because they are specific to that config.
29+
- Async helper `aenter_stack` uses `inspect.isfunction` so it will bind lambdas
2930

3031
## [0.2.0] - 2019-05-23
3132
### Added

dffml/util/asynchelper.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,7 @@ async def aenter_stack(
127127
if context_managers is not None:
128128
for key, ctxmanager in context_managers.items():
129129
if call:
130-
# Bind if not bound
131-
if hasattr(ctxmanager, "__self__"):
130+
if inspect.isfunction(ctxmanager):
132131
ctxmanager = ctxmanager.__get__(obj, obj.__class__)
133132
setattr(
134133
obj, key, await stack.enter_async_context(ctxmanager())

0 commit comments

Comments
 (0)