This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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

Created on 2018-10-09 18:13 by chrisjbremner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13127 closed anthonypjshaw, 2019-05-06 18:40
Messages (5)
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 committer) 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 committer) 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
msg341607 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2019-05-06 19:06
Submitted PR to add the deprecation warning, since this initial discussion, some other functions also raise DeprecationWarning's in code.
msg359269 - (view) Author: anthony shaw (anthonypjshaw) * (Python triager) Date: 2020-01-04 01:40
Resolved by another bpo
History
Date User Action Args
2022-04-11 14:59:07adminsetgithub: 79127
2020-01-04 01:40:19anthonypjshawsetstatus: open -> closed
resolution: fixed
messages: + msg359269

stage: patch review -> resolved
2019-05-06 19:06:42anthonypjshawsetnosy: + anthonypjshaw
messages: + msg341607
2019-05-06 18:40:31anthonypjshawsetkeywords: + patch
stage: patch review
pull_requests: + pull_request13040
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