Bug report
Checklist
A clear and concise description of the bug
Doctests initialization may fail with re.error in case a module contains (dynamically generated) class objects with special characters in their name. This is caused by the regular expression compiled in doctest.DocTestFinder._find_lineno failing to escape the class name before embedding it. If compilation does succeed, then invalid matches may result from interpreting the class name as a search pattern.
Your environment
- CPython versions tested on: 3.9.2
- Operating system and architecture: Debian linux amd64
Linked PRs
Bug report
Checklist
A clear and concise description of the bug
Doctests initialization may fail with
re.errorin case a module contains (dynamically generated) class objects with special characters in their name. This is caused by the regular expression compiled indoctest.DocTestFinder._find_linenofailing to escape the class name before embedding it. If compilation does succeed, then invalid matches may result from interpreting the class name as a search pattern.Your environment
Linked PRs