BUG: validator now handles decorators#496
Conversation
d048920 to
6709682
Compare
larsoner
left a comment
There was a problem hiding this comment.
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_lineto return the correct line number of thedefandclasskeywords when the function/class used decorators.This issue made
validatemiss inline ignore comments:extract_ignore_validation_commentswould return a dictionary with keys corresponding to the line numbers ofdefandclasskeywords, but it would then be indexed usingValidator.source_file_def_line, which would correspond to the line of the first decorator, not thedef/classkeyword.I'll try to add a regression test ASAP.