mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-68552: fix defects policy (#138579)
Extend defect handling via policy to a couple of missed defects. --------- Co-authored-by: Martin Panter <vadmium@users.noreply.github.com> Co-authored-by: Ivo Bellin Salarin <ivo@nilleb.com>
This commit is contained in:
parent
ed4f78a4b3
commit
9d707d8a64
4 changed files with 48 additions and 94 deletions
|
|
@ -504,10 +504,9 @@ def _parse_headers(self, lines):
|
|||
self._input.unreadline(line)
|
||||
return
|
||||
else:
|
||||
# Weirdly placed unix-from line. Note this as a defect
|
||||
# and ignore it.
|
||||
# Weirdly placed unix-from line.
|
||||
defect = errors.MisplacedEnvelopeHeaderDefect(line)
|
||||
self._cur.defects.append(defect)
|
||||
self.policy.handle_defect(self._cur, defect)
|
||||
continue
|
||||
# Split the line on the colon separating field name from value.
|
||||
# There will always be a colon, because if there wasn't the part of
|
||||
|
|
@ -519,7 +518,7 @@ def _parse_headers(self, lines):
|
|||
# message. Track the error but keep going.
|
||||
if i == 0:
|
||||
defect = errors.InvalidHeaderDefect("Missing header name.")
|
||||
self._cur.defects.append(defect)
|
||||
self.policy.handle_defect(self._cur, defect)
|
||||
continue
|
||||
|
||||
assert i>0, "_parse_headers fed line with no : and no leading WS"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue