New submission from Dimitri Papadopoulos Orfanos <dimitri.papadopou...@cea.fr>:

The fnmatch documentation should explicitly mention the type of exceptions 
raised by fnmatch.fnmatch():
https://docs.python.org/3/library/fnmatch.html

In my case it raised sre_constants.error, and it took some time to understand 
that the proper way to catch this type of exceptions is to catch the re.error 
superclass, by reading https://bugs.python.org/issue795379.

Actually that would be the case for any module using the re module under the 
hood, possibly passing an ill-formed regex to a re function.

----------
assignee: docs@python
components: Documentation, Library (Lib), Regular Expressions
files: sre_constants.error_stderr.txt
messages: 406396
nosy: DimitriPapadopoulosOrfanos, docs@python, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: Document exceptions raised by fnmtach
versions: Python 3.11
Added file: https://bugs.python.org/file50442/sre_constants.error_stderr.txt

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45815>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to