From 1add8a0b40577186431cdb5f63f97affadab285b Mon Sep 17 00:00:00 2001 From: Niklas Mertsch <49114330+NMertsch@users.noreply.github.com> Date: Wed, 22 Jul 2026 15:52:00 +0200 Subject: [PATCH] Fix DeprecationWarning in escape_markdown() Using `count` as positional argument to `re.sub` is deprecated since Python 3.13. Fixes #10490 --- discord/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/discord/utils.py b/discord/utils.py index cb826d6d2..c4793b761 100644 --- a/discord/utils.py +++ b/discord/utils.py @@ -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)