diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-08-16 12:29:42 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-16 12:29:42 (GMT) |
commit | ea6865242c184c8afc816e0211652f0d04d9b8f8 (patch) | |
tree | ce6269ffb261cdbd6673fb8d3784b63f85740150 /Python/fileutils.c | |
parent | 9c8dfcec645b233dd6f36c286a7c5525c5d713e2 (diff) | |
download | cpython-ea6865242c184c8afc816e0211652f0d04d9b8f8.zip cpython-ea6865242c184c8afc816e0211652f0d04d9b8f8.tar.gz cpython-ea6865242c184c8afc816e0211652f0d04d9b8f8.tar.bz2 |
[3.12] gh-107715: Escape class name in regular expression (GH-107716) (#107726)
* gh-107715: Escape class name in regular expression (GH-107716)
This patch escapes the class name before embedding it in the regular expression
for `pat` in `doctest.DocTestFinder._find_lineno`. While class names do not
ordinarily contain special characters, it is possible to encounter these when a
class is created dynamically. Escaping the name will correctly return `None` in
this scenario, rather than potentially matching a different class or raising
`re.error` depending on the symbols used.
(cherry picked from commit 85793278793708ad6b7132a54ac9fb4b2c5bcac1)
Co-authored-by: Gertjan van Zwieten <git@gjvz.nl>
* Update 2023-08-07-14-12-07.gh-issue-107715.238r2f.rst
---------
Co-authored-by: Gertjan van Zwieten <git@gjvz.nl>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Python/fileutils.c')
0 files changed, 0 insertions, 0 deletions