Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not proxy _is_coroutine attr, fixes #136 #137

Merged
merged 1 commit into from
May 30, 2023

Conversation

brondsem
Copy link
Contributor

Fix #136 with similar approach to dunder methods

@coveralls
Copy link

coveralls commented May 16, 2023

Coverage Status

Coverage: 100.0%. Remained the same when pulling b171594 on brondsem:proxy_iscoroutinefunction into fdbea31 on TurboGears:development.

@@ -16,11 +16,12 @@ def __dir__(self):
return dir_list

def __getattr__(self, attr):
if attr.startswith("__"):
if attr.startswith("__") or attr == '_is_coroutine':
Copy link
Member

@amol- amol- May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dunder methods were a general solution, but I'd like to avoid growing a chain of or on long term. Can't we just add _is_coroutine as an attribute of TurboGearsObjectProxy? It simply can be None to make iscoroutinefunction happy: https://github.com/python/cpython/blob/3bc94e678f2961eafc9d665898d73afc6204d314/Lib/asyncio/coroutines.py#L20-L23

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I think that'd work well

@brondsem brondsem force-pushed the proxy_iscoroutinefunction branch from ec1bcaf to b171594 Compare May 20, 2023 14:31
@brondsem
Copy link
Contributor Author

I force-pushed an updated commit with your suggestion

@amol- amol- merged commit 98682e6 into TurboGears:development May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error with objectproxy globals and current versions of mock
3 participants