[issue22253] ConfigParser does not handle files without sections
Pedro Lacerda added the comment: Hi, there is a working PR at https://github.com/python/cpython/pull/2735. I was in doubt about get the default section with `__init__(..., allow_unnamed_section=True)` and `config.get('', 'option')` or with `config.get(DEFAULT_SECTION, 'option')`. I'd prefer the later. -- ___ Python tracker <https://bugs.python.org/issue22253> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27268] Incorrect error message on float('')
Changes by Pedro Lacerda <pslace...@gmail.com>: -- pull_requests: +2805 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27268> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22253] ConfigParser does not handle files without sections
Pedro Lacerda added the comment: Thank you 林自均! I just made a pull-request with the relevant bits. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22253> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27258] Exception in BytesGenerator.flatten
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 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27258> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27258] Exception in BytesGenerator.flatten
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 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27258> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27258] Exception in BytesGenerator.flatten
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 repository? https://github.com/python/cpython/blob/master/Lib/email/_header_value_parser.py#L144 -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27258> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27258] Exception in BytesGenerator.flatten
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) bs = BytesGenerator(sys.stdout.buffer) bs.flatten(MIMEText('msg', 'plain', 'utf-8')) -- nosy: +Pedro Lacerda ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27258> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27268] Incorrect error message on float('')
Pedro Lacerda added the comment: Following the bug pointed by Adam and Eryk. -- keywords: +patch nosy: +Pedro Lacerda Added file: http://bugs.python.org/file43405/float.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27268> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue26836] Add memfd_create to os module
Pedro Lacerda added the comment: Maybe useful at mmapmodule.c replacing /* SVR4 method to map anonymous memory is to open /dev/zero */ fd = devzero = _Py_open("/dev/zero", O_RDWR); tagname is unused at UNIX version of new_mmap_object() so if provided something like could be added for Linux only fd = memfd_create(tagname, O_RDWR); -- nosy: +Pedro Lacerda ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26836> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27320] ./setup.py --help-commands should sort extra commands
Pedro Lacerda added the comment: Please look if these simple patches are acceptable. I don't know if standard commands are already in a sane order or if it also need to be sorted. -- keywords: +patch nosy: +Pedro Lacerda Added file: http://bugs.python.org/file43402/sortextra.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27320> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue27320] ./setup.py --help-commands should sort extra commands
Changes by Pedro Lacerda <pslace...@gmail.com>: Added file: http://bugs.python.org/file43403/sortcommands.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27320> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22253] ConfigParser does not handle files without sections
Pedro Lacerda added the comment: I also never found a mixture of sectionless options followed by sectioned options. So an unnamed section that is also the DEFAULTSECTION will probably work. In this patch when `default_section=None` is passed to `RawConfigParser` it will parse top level options into the default section and skip writing its title. As drawback, default options is not showed in `options()` or `has_section()` reducing it usefulness. It works with `items()` and `keys()` however. > Using DEFAULTSECT for this purpose is equally wrong since it would > silently inject default values to every section I disagree with that because I really *never* found in wild a file where it will happen. > All in all, it comes down to the question whether the programmer > expects section-less configuration. If not, the '' section will not be > helpful anyway. If yes, then it's desirable to be able to specify a > section name for global options at *read time*. Pass a name at read time will improve the API as `sections()` and `has_section()` will work as usual and not like a DEFAULTSECTION. Please look my patch and tell if it's acceptable, if you prefer that a section name must be given at read and write time we can manage it. It's my first post in this tracker and I'm very glad that I got it working even if not merged! -- keywords: +patch nosy: +Pedro Lacerda versions: -Python 3.5 Added file: http://bugs.python.org/file43345/nosection.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue22253> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com