[issue27258] Exception in BytesGenerator.flatten

2021-12-12 Thread Irit Katriel
Irit Katriel added the comment: I am also unable to reproduce the issue on 3.11 with the attached script and input. Please create a new issue if this problem still exists in a current python version (>= 3.9). -- nosy: +iritkatriel resolution: -> works for me stage: -> resolved

[issue27258] Exception in BytesGenerator.flatten

2016-06-18 Thread Pedro Lacerda
Pedro Lacerda added the comment: Now the file is back! If any previous header has a newline before the value the error will not happen. But even with the output correct it isn't as expected. -- Added file: http://bugs.python.org/file43457/flatten-no-exception.mail

[issue27258] Exception in BytesGenerator.flatten

2016-06-18 Thread Pedro Lacerda
Pedro Lacerda added the comment: Now the file is back! If any previous header has a newline before the value the error will not happen. But even with the output correct it isn't as expected. -- Added file: http://bugs.python.org/file43456/flatten-no-exception.mail

[issue27258] Exception in BytesGenerator.flatten

2016-06-17 Thread Pedro Lacerda
Pedro Lacerda added the comment: Seems that ``token.has_fws`` evaluates to True in the following condition if token.has_fws: causing ``token._fold(self)`` where isn't needed and raising the exception. Hope it helps! By the way, why the _header_value_parser.py was removed from the

[issue27258] Exception in BytesGenerator.flatten

2016-06-16 Thread Hans-Peter Jansen
Hans-Peter Jansen added the comment: Sorry guys for not providing this earlier. It turned out, that the sub optimal behaviour is related to a unfortunate policy choice: email.policy.SMTP. -- Added file: http://bugs.python.org/file43415/email_flatten.py

[issue27258] Exception in BytesGenerator.flatten

2016-06-16 Thread Berker Peksag
Berker Peksag added the comment: Thanks for helping to triage this, Pedro. I think there is a typo in your example: ``email.message_from_binary_file(fp)`` needs to be passed to ``bs.flatten()``. With the following script I'm also unable to reproduce the issue in Python 3.4+: import email

[issue27258] Exception in BytesGenerator.flatten

2016-06-16 Thread Pedro Lacerda
Pedro Lacerda added the comment: I was unable to reproduce this bug using the following snippet import email, sys from email.generator import BytesGenerator from email.mime.text import MIMEText fp = open('flatten-exception.mail', 'rb') email.message_from_binary_file(fp)

[issue27258] Exception in BytesGenerator.flatten

2016-06-07 Thread Hans-Peter Jansen
New submission from Hans-Peter Jansen: Attached mail, parsed with email.message_from_binary_file results in: Traceback (most recent call last): File "./mail_filter.py", line 616, in ret = main.run() File "./mail_filter.py", line 605, in run self.process(fp) File