mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-30398: Add a docstring for re.error. (#1647)
Also document that some attributes may be None.
This commit is contained in:
parent
5becf38a03
commit
12d6b5d156
2 changed files with 14 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue