-
-
Notifications
You must be signed in to change notification settings - Fork 161
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
BUG: validator now handles decorators #496
Conversation
d048920
to
6709682
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.
Looks good so far, let me know when the test is there and things are green and I think we can merge!
@larsoner I've written a simple regression test, but I'm unsure if this fits in the existing testing pipeline. Please don't hesitate to indicate any issue or possible improvement, I don't mind rewritting these to better fit the existing tests. On another note, I've just noticed that a similar bug still exists for I think we may be able to fix this by passing the EDIT: I've tested the proposed fix and it works correctly when fixing |
Failure looks related, can you check?
Probably better as a follow-up PR if we can merge this one quickly, which I think we can. But the current changes are small so if you think it makes sense to combine them then I can live with that, too. |
Ok this is a weird one. Seems like |
This was indeed a bug in CPython: python/cpython#60060. The fix was only implemented starting with 3.9 if I understand it correctly. Tests should be passing for 3.8 now. |
Feel free to merge if everything is OK and I'll start the follow up PR. 🙂 |
Marking for merge-when-green, thanks in advance @sdiebolt ! |
This PR fixes a bug that prevented
Validator.source_file_def_line
to return the correct line number of thedef
andclass
keywords when the function/class used decorators.This issue made
validate
miss inline ignore comments:extract_ignore_validation_comments
would return a dictionary with keys corresponding to the line numbers ofdef
andclass
keywords, but it would then be indexed usingValidator.source_file_def_line
, which would correspond to the line of the first decorator, not thedef
/class
keyword.I'll try to add a regression test ASAP.