Skip to content

Commit 6c38af7

Browse files
authored
Fix cpplint sre_compile deprecation warning (#262)
sre_compile is an implementation detail of the re module that moved in Python 3.11.
1 parent b7a8101 commit 6c38af7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

wpiformat/wpiformat/cpplint.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@
4949
import math # for log
5050
import os
5151
import regex
52-
import sre_compile
5352
import string
5453
import sys
5554

55+
try:
56+
import re._compiler as sre_compile
57+
except ImportError: # Python < 3.11
58+
import sre_compile
59+
5660
# if empty, use defaults
5761
_header_regex = regex.compile("a^")
5862

0 commit comments

Comments
 (0)