Ma Lin <malin...@163.com> added the comment:
This bug was fixed in Python 3.7, see issue32308. Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 23 2018, 23:31:17) [MSC v.1916 32 bit (Intel)] on win32 >>> re.compile('(?m)(?P<trailing_ws>[ >>> \t]+\r*$)|(?P<no_final_newline>(?<=[^\n])\Z)').subn(lambda m:next('<'+k+'>' >>> for k,v in m.groupdict().items() if v is not None), 'foobar ') ('foobar<trailing_ws>', 1) Python 3.7.3rc1 (tags/v3.7.3rc1:69785b2127, Mar 12 2019, 22:37:55) [MSC v.1916 64 bit (AMD64)] on win32 >>> re.compile('(?m)(?P<trailing_ws>[ >>> \t]+\r*$)|(?P<no_final_newline>(?<=[^\n])\Z)').subn(lambda m:next('<'+k+'>' >>> for k,v in m.groupdict().items() if v is not None), 'foobar ') ('foobar<trailing_ws><no_final_newline>', 2) ---------- nosy: +Ma Lin _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue10328> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com