mirror of
https://github.com/Rapptz/discord.py.git
synced 2026-09-21 03:27:42 +00:00
Fix DeprecationWarning in escape_markdown()
Using `count` as positional argument to `re.sub` is deprecated since Python 3.13. Fixes #10490
This commit is contained in:
+1
-1
@@ -1008,7 +1008,7 @@ def escape_markdown(text: str, *, as_needed: bool = False, ignore_links: bool =
|
||||
regex = _MARKDOWN_STOCK_REGEX
|
||||
if ignore_links:
|
||||
regex = f'(?:{_URL_REGEX}|{regex})'
|
||||
return re.sub(regex, replacement, text, 0, re.MULTILINE)
|
||||
return re.sub(regex, replacement, text, count=0, flags=re.MULTILINE)
|
||||
else:
|
||||
text = re.sub(r'\\', r'\\\\', text)
|
||||
return _MARKDOWN_ESCAPE_REGEX.sub(r'\\\1', text)
|
||||
|
||||
Reference in New Issue
Block a user