Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply some of the review comments
  • Loading branch information
Matthias Bussonnier committed Dec 9, 2019
commit a9ab5f00ca815ef4f1c58e4dfaae75e850ba9b32
10 changes: 5 additions & 5 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -968,10 +968,10 @@ form.
.. exception:: ReCompileError(msg, pattern=None, pos=None)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need an explicit index reference for error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would I add and explicit index reference ? .. error: on top ?


Exception raised when a string passed to one of the functions here is not a
valid regular expression (for example, it might contain unmatched parentheses)
or when some other error occurs during compilation or matching. It is never an
error if a string contains no match for a pattern. The `ReCompileError` instance has
the following additional attributes:
valid regular expression (for example, it might contain unmatched
parentheses) or when some other error occurs during compilation or matching.
It is never an error if a string contains no match for a pattern. The
``ReCompileError`` instance has the following additional attributes:

.. attribute:: msg

Expand All @@ -997,7 +997,7 @@ form.
Added additional attributes.

.. versionchanged:: 3.9
ReCompileError was originally named 'error'; the latter is kept as an alias for
``ReCompileError`` was originally named ``error``; the latter is kept as an alias for
backward compatibility.

.. _re-objects:
Expand Down
2 changes: 1 addition & 1 deletion Lib/idlelib/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _replace_expand(self, m, repl):
if self.engine.isre():
try:
new = m.expand(repl)
except re.ReCompileError:
except re.error:
self.engine.report_error(repl, 'Invalid Replace Expression')
new = None
else:
Expand Down
3 changes: 1 addition & 2 deletions Lib/re.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
is the default), and forbidden for bytes patterns.

This module also defines exception 'ReCompileError', aliased to 'error' for
backward compatibility..
backward compatibility.

"""

Expand Down Expand Up @@ -179,7 +179,6 @@ def __repr__(self):
globals().update(RegexFlag.__members__)

# sre exception
error = sre_compile.ReCompileError
ReCompileError = error = sre_compile.ReCompileError

# --------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
The ``re.error`` exception has been renamed to ``ReCompileError`` for
The ``re.error`` exception has been renamed to :exc:`ReCompileError` for
clarity and conformance with pep-8. A ``re.error`` alias has been kept for
backward compatibility.
2 changes: 1 addition & 1 deletion Modules/_xxtestfuzz/fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ PyObject* sre_error_exception = NULL;
int SRE_FLAG_DEBUG = 0;
/* Called by LLVMFuzzerTestOneInput for initialization */
static int init_sre_compile() {
/* Import sre_compile.compile and sre.ReCompileError */
/* Import sre_compile.compile and sre_constants.ReCompileError */
PyObject* sre_compile_module = PyImport_ImportModule("sre_compile");
if (sre_compile_module == NULL) {
return 0;
Expand Down