mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
provides a clearer warning message when cheap inheritance with the underlying socket object is used
This commit is contained in:
parent
f7454fa98d
commit
215b6b392d
1 changed files with 3 additions and 2 deletions
|
@ -407,8 +407,9 @@ class dispatcher:
|
||||||
raise AttributeError("%s instance has no attribute '%s'"
|
raise AttributeError("%s instance has no attribute '%s'"
|
||||||
%(self.__class__.__name__, attr))
|
%(self.__class__.__name__, attr))
|
||||||
else:
|
else:
|
||||||
warnings.warn("cheap inheritance is deprecated", DeprecationWarning,
|
msg = "%(me)s.%(attr)s is deprecated. Use %(me)s.socket.%(attr)s " \
|
||||||
stacklevel=2)
|
"instead." % {'me': self.__class__.__name__, 'attr':attr}
|
||||||
|
warnings.warn(msg, DeprecationWarning, stacklevel=2)
|
||||||
return retattr
|
return retattr
|
||||||
|
|
||||||
# log and log_info may be overridden to provide more sophisticated
|
# log and log_info may be overridden to provide more sophisticated
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue