bpo-35028: cgi: Fix max_num_fields off by one error#9973
Merged
miss-islington merged 2 commits intoOct 23, 2018
Conversation
Contributor
Author
Contributor
Author
|
I figure this shouldn't need a merge entry since there hasn't been a release since #9660. If it does let me know and I'll add one. |
methane
reviewed
Oct 20, 2018
| max_num_fields = self.max_num_fields | ||
| sub_max_num_fields = self.max_num_fields | ||
| if max_num_fields is not None: | ||
| sub_max_num_fields -= len(self.list) |
Member
There was a problem hiding this comment.
I'm not so happy for maintain two local variables.
How about keep only max_num_fields?
max_num_fields = self.max_num_fields
if max_num_fields is not None:
max_num_fields -= len(self.list)
Member
There was a problem hiding this comment.
Oh, github removed my one comment.
[snip]
part = klass(..., max_num_fields)
[snip]
if max_num_fields is not None:
max_num_fields -= 1
if part.list:
max_num_fields -= len(part.list)
if max_num_fields < 0:
raise ValueError('Max number of fields exceeded')
Contributor
Author
There was a problem hiding this comment.
Good idea, that is simpler. I fixed that in a7203c8.
methane
approved these changes
Oct 23, 2018
Contributor
|
Thanks @matthewbelisle-wf for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 23, 2018
https://bugs.python.org/issue35028 (cherry picked from commit b79b5c0) Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
|
GH-10053 is a backport of this pull request to the 3.7 branch. |
|
GH-10054 is a backport of this pull request to the 3.6 branch. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Oct 23, 2018
https://bugs.python.org/issue35028 (cherry picked from commit b79b5c0) Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
miss-islington
added a commit
that referenced
this pull request
Oct 23, 2018
https://bugs.python.org/issue35028 (cherry picked from commit b79b5c0) Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
miss-islington
added a commit
that referenced
this pull request
Oct 23, 2018
https://bugs.python.org/issue35028 (cherry picked from commit b79b5c0) Co-authored-by: matthewbelisle-wf <matthew.belisle@workiva.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bugs.python.org/issue35028