-
-
Notifications
You must be signed in to change notification settings - Fork 114
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
fix MultiStrategyDispatch to work with new GenConverter and attrs inheritance #117
fix MultiStrategyDispatch to work with new GenConverter and attrs inheritance #117
Conversation
…eritance Because the GenConverter specifically handles generating code for attrs classes, and because it registers hooks that don't require function dispatch, singledispatch was preventing subclasses from having code generated for them, because they would trigger the previously-generated base class's structure/unstructure code. This changes MultiStrategyDispatch to allow for a class-based hook to specifically avoid single-dispatch. Since we know that a given attrs class can always have code generated for it, we don't really want to share dispatch across subclasses - like the original Converter, we want to make sure we're structuring each individual attrs class as its own separate type.
a25ca9a
to
285b608
Compare
Codecov Report
@@ Coverage Diff @@
## master #117 +/- ##
==========================================
+ Coverage 98.23% 98.25% +0.02%
==========================================
Files 7 7
Lines 453 459 +6
==========================================
+ Hits 445 451 +6
Misses 8 8
Continue to review full report at Codecov.
|
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.
Please add a HISTORY entry with a link to the PR and issue and I'll merge this in :)
i put the entry in 1.2.0 but if you decide to do a bugfix release first, let me know and I can change it to a 1.1.3. |
02d4793
to
a8f28df
Compare
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.
Thanks for this. I might add a few tests and then release this as 1.2.0 in a few days.
I had to tweak this a little so that direct dispatch is consulted after the singledispatch, not before, to get some tests to pass. |
Because the GenConverter specifically handles generating code for
attrs classes, and because it registers hooks that don't require
function dispatch, singledispatch was preventing subclasses from
having code generated for them, because they would trigger the
previously-generated base class's structure/unstructure code.
This changes MultiStrategyDispatch to allow for a class-based hook to
specifically avoid single-dispatch. Since we know that a given attrs
class can always have code generated for it, we don't really want to
share dispatch across subclasses - like the original Converter, we
want to make sure we're structuring each individual attrs class as its
own separate type.
fixes #116