classification
Title: inspect.getcallargs is marked as deprecated in documentation, but doesn't issue a DeprecationWarning when used
Type: behavior Stage:
Components: Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: chrisjbremner, xtreak, yselivanov
Priority: normal Keywords:

Created on 2018-10-09 18:13 by chrisjbremner, last changed 2018-10-09 19:19 by xtreak.

Messages (3)
msg327428 - (view) Author: Chris Bremner (chrisjbremner) Date: 2018-10-09 18:13
Looking in the documentation for inspect.getcallargs (https://docs.python.org/3/library/inspect.html#inspect.getcallargs), it appears that inspect.getcallargs is deprecated in favor of inspect.Signature.bind and inspect.Signature.bind_partial.

However, when I use inspect.getcallargs, I do not get a DeprecationWarning, while I do get one for other methods that have been deprecated in the inspect library.

Because a warning is not issued when inspect.getcallargs is used, it confuses me as to whether this method is actually deprecated or not, since there seems to be a lot of discussion in previous issues about whether this method should be deprecated or not. If it is truly deprecated, should a DeprecationWarning be added?

For my situation, I would prefer to use inspect.getcallargs due to its more descriptive error messages when incorrect arguments are used, but if it truly is deprecated, then I should use inspect.Signature.bind instead.
msg327430 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2018-10-09 18:59
There was some discussion over undeprecating getcallargs at https://bugs.python.org/issue27172#msg281825 that there are some behavior changes with signature.bind
msg327431 - (view) Author: Karthikeyan Singaravelan (xtreak) * (Python triager) Date: 2018-10-09 19:19
As far as I can see from https://bugs.python.org/issue20438 this deprecation is meant to be a documentation level deprecation discouraging usage than a code level deprecation adding a DeprecationWarning to be removed later. I might be wrong here. I am adding Yury for clarification.

Thanks
History
Date User Action Args
2018-10-09 19:19:32xtreaksetnosy: + yselivanov
messages: + msg327431
2018-10-09 18:59:32xtreaksetmessages: + msg327430
2018-10-09 18:51:24xtreaksetnosy: + xtreak
2018-10-09 18:13:59chrisjbremnercreate