This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Document exceptions raised by fnmtach
Type: Stage:
Components: Documentation, Library (Lib), Regular Expressions Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: DimitriPapadopoulosOrfanos, docs@python, ezio.melotti, mrabarnett
Priority: normal Keywords:

Created on 2021-11-16 10:46 by DimitriPapadopoulosOrfanos, last changed 2022-04-11 14:59 by admin.

File name Uploaded Description Edit
sre_constants.error_stderr.txt DimitriPapadopoulosOrfanos, 2021-11-16 10:46 Last part of the stderr output of a Python script that calls fnmatch() on a bad glob
Messages (1)
msg406396 - (view) Author: Dimitri Papadopoulos Orfanos (DimitriPapadopoulosOrfanos) * Date: 2021-11-16 10:46
The fnmatch documentation should explicitly mention the type of exceptions raised by fnmatch.fnmatch():

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

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.
Date User Action Args
2022-04-11 14:59:52adminsetgithub: 89973
2021-11-16 10:46:44DimitriPapadopoulosOrfanoscreate