Make the space in error comments optional#19546
Make the space in error comments optional#19546wyattscarpenter wants to merge 22 commits intopython:masterfrom
Conversation
|
Ah, there are a lot of urls with fragments in there. Hmm. Maybe the whole parser should be changed and simplified... Or perhaps just match space and beginning of line. |
|
Why the heck am I still getting test failures like |
|
I added a .strip to it... it's then constructed with a template string... what the hell... [edit: commit with .strip not pictured in current branch history] |
|
Oh... |
for more information, see https://pre-commit.ci
|
Amusingly, this seems to have uncovered several problems with the expected values in some test cases, which I will now fix... |
There are some advanced edge cases that were indirectly described here or not described at all; this fixes that. This PR conflicts slightly with python#19546 as it documents the current behavior, not the improved behavior that relies less on spaces.
| for i in range(len(input)): | ||
| # The first in the split things isn't a comment | ||
| for possible_err_comment in input[i].split(" # ")[1:]: | ||
| for possible_err_comment in re.split(r"(?!\\)#\s*(?=[ENW]\s*:)", input[i])[1:]: |
There was a problem hiding this comment.
This split regex is too complicated, and a new one should be made based on #21172. (we can rebase/cherry-pick this whole PR onto the new master once that's accepted) The documentation should also, I guess, be updated according to the actual rules, which will involve \s probably. I'm very skeptical of the \S I added below, but I can think that through later.
Make the spaces in test error comments optional and more flexible, so instead of
# E: whateveryou can now write#E :whatever(for example). This will prevent people from erroneously entering error lines which are then ignored. Fixes #19547.I have written tests for this feature, but have not affirmatively documented it, because I don't want to encourage irregularity in the error comments people write.
Amusingly, this seems to have uncovered several problems with the expected values in some test cases, which I have also fixed. These fixes fell into 3 categories:
# E:or an# N:type: ignorecommand not recognized after other comment #19366# E :, so now that that syntax with the interstitial space is valid the E triggers. I turned this one into an xfail instead, based on what it was doing.