Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-108901: Deprecate inspect.getargvalues and inspect.formatargvalues, provide modern alternative#112639

Closed
sobolevn wants to merge 6 commits into
python:mainpython/cpython:mainfrom
sobolevn:issue-108901-getargsvaluessobolevn/cpython:issue-108901-getargsvaluesCopy head branch name to clipboard
Closed

gh-108901: Deprecate inspect.getargvalues and inspect.formatargvalues, provide modern alternative#112639
sobolevn wants to merge 6 commits into
python:mainpython/cpython:mainfrom
sobolevn:issue-108901-getargsvaluessobolevn/cpython:issue-108901-getargsvaluesCopy head branch name to clipboard

Conversation

@sobolevn

@sobolevn sobolevn commented Dec 3, 2023

Copy link
Copy Markdown
Member

@vkhodygo

Copy link
Copy Markdown

Any progress?

@sobolevn sobolevn requested review from AlexWaygood and hugovk March 9, 2024 08:01
@sobolevn

sobolevn commented Mar 9, 2024

Copy link
Copy Markdown
Member Author

@hugovk I've implemented your suggestion about porting to Python 3.13, please take a look.
@AlexWaygood We discussed this deprecation in #112279

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please start with a separated PR which adds Signature.from_frame(). Once it will be merge, you can simplify this PR to only deprecate methods.

Comment thread Lib/inspect.py
Comment on lines +3123 to +3125
for name in arg_names[:pos_count]:
if frame.f_locals and name in frame.f_locals:
defaults.append(frame.f_locals[name])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like you can move if frame.f_locals: out of this loop and the one below.

@hugovk

hugovk commented Mar 9, 2024

Copy link
Copy Markdown
Member

(Copying and pasting my reply from elsewhere :)

PEP 387 says two releases of deprecation is the minimum but also:

  • If the deprecated feature is replaced by a new one, it should generally be removed only after the last Python version without the new feature reaches end of support.

Does that apply here? If so, and if the replacement is added in 3.13, then the removals should be when 3.13 is EOL in October 2029, meaning removal in 3.18, not 3.15.

class TestSignatureFromFrame(unittest.TestCase):
def test_signature_from_frame(self):
def inner(a=1, /, b=2, *e, c: int = 3, d, **f) -> None:
global fr

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a global sounds like a bad idea. You can use a "nonlocal" instead.

Sometimes, I use a mutable type instead, which is more or less the same:

ns = {}
def func():
    ns['name'] = value

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 14, 2026
@vstinner

Copy link
Copy Markdown
Member

@sobolevn: This change is now outdated since it refers to Python 3.13. Do you still plan to work on this PR? If not, I suggest closing it.

@sobolevn sobolevn closed this May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.