Commit 2292e09
committed
fix(proof): escape backslashes in stub text instead of padding them (#952)
CI caught what my local run did not: appending a space after a trailing
backslash produced '\ ' inside a non-raw docstring — an invalid escape
sequence, which this repo's pytest config escalates from SyntaxWarning to an
error. My fix for an escaping bug introduced a different escaping bug.
Padding a dangerous character is not escaping it. _inline now escapes every
backslash ('\\' renders identically when the docstring is read), which also
covers Windows paths and regexes anywhere in the text, not just at the
delimiter boundary. The trailing-quote case keeps its separating space, which
is safe.
The tests were too weak to catch it: ast.parse succeeds on source that merely
warns. They now assert under warnings.simplefilter('error') and cover
'C:\\path', 're: \\d+' and '\\n' as well as the boundary tails.
Also records the lesson, including: run the CI invocation locally, not a
single-file subset — warning behaviour differs.1 parent fb64b38 commit 2292e09
2 files changed
Lines changed: 31 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
187 | 187 | | |
188 | 188 | | |
189 | 189 | | |
190 | | - | |
191 | | - | |
192 | | - | |
193 | | - | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
198 | 203 | | |
199 | | - | |
200 | | - | |
| 204 | + | |
| 205 | + | |
201 | 206 | | |
202 | 207 | | |
203 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
505 | | - | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
506 | 508 | | |
507 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
508 | 514 | | |
| 515 | + | |
509 | 516 | | |
510 | 517 | | |
511 | 518 | | |
512 | 519 | | |
513 | | - | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
514 | 523 | | |
515 | | - | |
| 524 | + | |
516 | 525 | | |
517 | 526 | | |
| 527 | + | |
518 | 528 | | |
519 | 529 | | |
520 | 530 | | |
521 | 531 | | |
522 | | - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
523 | 535 | | |
524 | 536 | | |
525 | 537 | | |
| |||
0 commit comments