| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
I am kicking myself on the __annotate__ access. Honestly surprised it didn't trip any existing tests. It looks like the sqlalchemy field issue is from replacing and subsequently attempting to restore annotations in order to add fields to a dataclass as there's no mechanism for doing so without annotations. The check to fix this is fine, I'm actually surprised I hadn't written this as a comprehension. Again, sorry for missing these possibilities. |
Sorry, something went wrong.
Co-authored-by: sobolevn <mail@sobolevn.me>
There was a problem hiding this comment.
I just locally applied the changes in Lib/dataclasses.py and it fixed all the failing tests on github.com/pipefunc/pipefunc.
Sorry, something went wrong.
There was a problem hiding this comment.
A small nit, but otherwise looks good to me.
Sorry, something went wrong.
| # gh-142214: The annotation may be missing in unusual dynamic cases. | ||
| # If so, just skip it. | ||
| if k in cls_annotations: | ||
| new_annotations[k] = cls_annotations[k] |
There was a problem hiding this comment.
Don't in and [] both do a lookup? Maybe it would be better as:
if ann := cls_annotations.get(k):
new_annotations[k] = ann
Sorry, something went wrong.
There was a problem hiding this comment.
I believe that None is a valid annotation here so this would miss None values?
Sorry, something went wrong.
There was a problem hiding this comment.
Correct. To save a lookup we could do a try-except KeyError instead. I don't have a preference but I can switch to that if you like.
Sorry, something went wrong.
There was a problem hiding this comment.
I think try/except makes sense as in most cases the key should be there. The key not being there should only be in cases where something has modified annotations and removed things after the class has been processed.
Sorry, something went wrong.
There was a problem hiding this comment.
Done
Sorry, something went wrong.
|
When you're done making the requested changes, leave the comment: I have made the requested changes; please review again. |
Sorry, something went wrong.
|
I have made the requested changes; please review again |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ericvsmith: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
Looks good to me. Thanks!
Sorry, something went wrong.
|
Thanks @JelleZijlstra for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
(cherry picked from commit 53ec7c8) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
GH-142277 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.