[New-bugs-announce] [issue45815] Document exceptions raised by fnmtach

Dimitri Papadopoulos Orfanos report at bugs.python.org
Tue Nov 16 05:46:44 EST 2021


New submission from Dimitri Papadopoulos Orfanos <dimitri.papadopoulos at 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 at python
components: Documentation, Library (Lib), Regular Expressions
files: sre_constants.error_stderr.txt
messages: 406396
nosy: DimitriPapadopoulosOrfanos, docs at 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 <report at bugs.python.org>
<https://bugs.python.org/issue45815>
_______________________________________


More information about the New-bugs-announce mailing list