-
-
Notifications
You must be signed in to change notification settings - Fork 126
Fixes for argument mutations when calling view methods #476
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
Conversation
Comments start with "#" or ";", and no inline comments. See: https://editorconfig-specification.readthedocs.io/
- no more mutation of arguments in _call_method_name() - fixed broad TypeError except in _call_method_name() - it was shadowing exceptions - result of parse_call_method_name is now immutable (which ends up in lru_cache) - updated related tests
@@ -81,10 +83,10 @@ def validate_checksum(self): | |||
|
|||
|
|||
class Return: | |||
def __init__(self, method_name, args=[], kwargs={}): | |||
def __init__(self, method_name, args=None, kwargs=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, thanks for this fix!
Thank you so much for digging into this bug and making this PR. I can't believe I never ran into it while testing. I really appreciate it and will merge it into |
@all-contributors add @stat1c-void for code and tests |
I've put up a pull request to add @stat1c-void! 🎉 |
Nice, cheers! |
I just published 0.49.2 to https://pypi.org/project/django-unicorn/. Thanks again for the fixes. 🦄 |
I was experiencing a problem with Unicorn, so here are some fixes.
Given: a component view method with single argument, type-hinted as a Model.
Problem: consecutive calls to the method with the same arguments would result in successful first call, but exceptions in next calls. Behavior repeats with restart of a worker.
It would seem that
parse_call_method_name()
output in thelru_cache
would later be mutated, resulting in incorrect caching.P.S. And a few other fixes - I noticed some small problems on the way.