summaryrefslogtreecommitdiff
path: root/sphinx/util/inspect.py
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/util/inspect.py')
-rw-r--r--sphinx/util/inspect.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py
index 603fa88ae..d5d2c330b 100644
--- a/sphinx/util/inspect.py
+++ b/sphinx/util/inspect.py
@@ -16,9 +16,11 @@ import inspect
import re
import sys
import typing
+import warnings
from functools import partial
from io import StringIO
+from sphinx.deprecation import RemovedInSphinx30Warning
from sphinx.util import logging
from sphinx.util.pycompat import NoneType
@@ -128,11 +130,8 @@ def isclassmethod(obj):
"""Check if the object is classmethod."""
if isinstance(obj, classmethod):
return True
- elif inspect.ismethod(obj):
- if getattr(obj, 'im_self', None): # py2
- return True
- elif getattr(obj, '__self__', None): # py3
- return True
+ elif inspect.ismethod(obj) and obj.__self__ is not None:
+ return True
return False
@@ -288,6 +287,9 @@ class Parameter:
self.default = default
self.annotation = self.empty
+ warnings.warn('sphinx.util.inspect.Parameter is deprecated.',
+ RemovedInSphinx30Warning, stacklevel=2)
+
class Signature:
"""The Signature object represents the call signature of a callable object and