Skip to content

bpo-41585 When max-line-length is None default to 0#21955

Closed
s3bw wants to merge 1 commit into
python:masterfrom
s3bw:bpo-41585-max-line-length
Closed

bpo-41585 When max-line-length is None default to 0#21955
s3bw wants to merge 1 commit into
python:masterfrom
s3bw:bpo-41585-max-line-length

Conversation

@s3bw

@s3bw s3bw commented Aug 25, 2020

Copy link
Copy Markdown
Contributor

The docs indicate:

max_line_length
The maximum length of any line in the serialized output, not counting the end of line character(s). Default is 78, per RFC 5322. A value of 0 or None indicates that no line wrapping should be done at all.

https://docs.python.org/3/library/email.policy.html#email.policy.Policy.max_line_length

Since the behaviour for both 0 and None should be the same, I've defaulted to using 0 when None is passed, this will fix errors caused by comparisons with None. Like we see in the issue:

TypeError: '<=' not supported between instances of 'int' and 'NoneType'

https://bugs.python.org/issue41585

@s3bw

s3bw commented Aug 25, 2020

Copy link
Copy Markdown
Contributor Author

This PR conflict with this:
https://github.com/python/cpython/blob/master/Lib/email/_policybase.py#L364-L368

If Policy has max_line_length set to 78. Then Compat32 will default to 78 without needing to check if max_line_length was passed as None. Maybe this check needs to be updated too?

@s3bw s3bw closed this Aug 25, 2020
@s3bw s3bw reopened this Aug 25, 2020
@s3bw s3bw closed this Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants