summaryrefslogtreecommitdiffstats
path: root/Lib/sre_constants.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-05-27 13:12:48 (GMT)
committerGitHub <noreply@github.com>2017-05-27 13:12:48 (GMT)
commit12d6b5d156377c0877931a03ef2439dccb2f3711 (patch)
treed48dd9397abdaa5733a6533eaaba1c4c66777768 /Lib/sre_constants.py
parent5becf38a03e53a7c2a996285c7bf0ac5e2ef7d2a (diff)
downloadcpython-12d6b5d156377c0877931a03ef2439dccb2f3711.zip
cpython-12d6b5d156377c0877931a03ef2439dccb2f3711.tar.gz
cpython-12d6b5d156377c0877931a03ef2439dccb2f3711.tar.bz2
bpo-30398: Add a docstring for re.error. (#1647)
Also document that some attributes may be None.
Diffstat (limited to 'Lib/sre_constants.py')
-rw-r--r--Lib/sre_constants.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
index b016431..0261e9e 100644
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -21,6 +21,17 @@ from _sre import MAXREPEAT, MAXGROUPS
# should this really be here?
class error(Exception):
+ """Exception raised for invalid regular expressions.
+
+ Attributes:
+
+ msg: The unformatted error message
+ pattern: The regular expression pattern
+ pos: The index in the pattern where compilation failed (may be None)
+ lineno: The line corresponding to pos (may be None)
+ colno: The column corresponding to pos (may be None)
+ """
+
def __init__(self, msg, pattern=None, pos=None):
self.msg = msg
self.pattern = pattern