[3.6] bpo-30398: Add a docstring for re.error. (GH-1647) (#1830)

Also document that some attributes may be None.
(cherry picked from commit 12d6b5d)
diff --git a/Lib/sre_constants.py b/Lib/sre_constants.py
index fc684ae..a6e8a1f 100644
--- a/Lib/sre_constants.py
+++ b/Lib/sre_constants.py
@@ -21,6 +21,17 @@
 # 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