diff options
Diffstat (limited to 'markdown/extensions/__init__.py')
-rw-r--r-- | markdown/extensions/__init__.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/markdown/extensions/__init__.py b/markdown/extensions/__init__.py index 010e310..4bc8e5f 100644 --- a/markdown/extensions/__init__.py +++ b/markdown/extensions/__init__.py @@ -75,15 +75,18 @@ class Extension: md = args[0] try: self.extendMarkdown(md) - except TypeError: - # Must be a 2.x extension. Pass in a dumby md_globals. - self.extendMarkdown(md, {}) - warnings.warn( - "The 'md_globals' parameter of '{}.{}.extendMarkdown' is " - "deprecated.".format(self.__class__.__module__, self.__class__.__name__), - category=DeprecationWarning, - stacklevel=2 - ) + except TypeError as e: + if "missing 1 required positional argument" in str(e): + # Must be a 2.x extension. Pass in a dumby md_globals. + self.extendMarkdown(md, {}) + warnings.warn( + "The 'md_globals' parameter of '{}.{}.extendMarkdown' is " + "deprecated.".format(self.__class__.__module__, self.__class__.__name__), + category=DeprecationWarning, + stacklevel=2 + ) + else: + raise def extendMarkdown(self, md): """ |