aboutsummaryrefslogtreecommitdiffstats
path: root/signald/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'signald/main.py')
-rw-r--r--signald/main.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/signald/main.py b/signald/main.py
index 15125d9..047baae 100644
--- a/signald/main.py
+++ b/signald/main.py
@@ -6,6 +6,9 @@ from typing import Iterator, List # noqa
from .types import Attachment, Message
+# We'll need to know the compiled RE object later.
+RE_TYPE = type(re.compile(""))
+
def readlines(s: socket.socket) -> Iterator[bytes]:
"Read a socket, line by line."
@@ -142,7 +145,7 @@ class Signal:
"""
A decorator that registers a chat handler function with a regex.
"""
- if not isinstance(regex, re._pattern_type):
+ if not isinstance(regex, RE_TYPE):
regex = re.compile(regex, re.I)
def decorator(func):