Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/serhiy-storchaka'closed_at=<Date2018-02-09.11:57:42.153>created_at=<Date2018-02-05.20:07:22.506>labels= ['3.7', 'type-bug', 'library']
title='fnmatch.translate() can produce a pattern which emits a nested set warning'updated_at=<Date2018-02-09.11:57:42.152>user='https://github.com/timgraham'
As discussed in bpo-30349#msg311684, fnmatch.translate() can produce a pattern which emits a nested set warning:
>>> import fnmatch, re
>>> re.compile(fnmatch.translate('[[]foo]'))
__main__:1: FutureWarning: Possible nested set at position 10
re.compile('(?s:\\(.s:[[]foo\\\\\\]\\)\\\\Z)\\Z')
It is easy to fix sets starting with '['. It is more hard to fix sets with doubled '-', '&', '|' or '~'.
>>> fnmatch.fnmatch('#', '[#--]')
/home/serhiy/py/cpython/Lib/fnmatch.py:46: FutureWarning: Possible set difference at position 6
return re.compile(res).match
True
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: