GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame by vstinner · Pull Request #31583 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Feb 25, 2022 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.

https://bugs.python.org/issue46836

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner vstinner added the skip news label Feb 25, 2022
@vstinner
vstinner requested review from 1st1, iritkatriel and markshannon as code owners February 25, 2022 14:57
@bedevere-bot bedevere-bot added the awaiting core review label Feb 25, 2022
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Feb 25, 2022
@vstinner
bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame
688dae4
Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.
@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

While most people should not use the internal C API, there are some legit use cases to use pycore_frame.h: mostly debuggers and profilers.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

cc @markshannon @brandtbucher

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner
vstinner merged commit 87af12b into python:main Feb 25, 2022
@vstinner
vstinner deleted the interp_frame branch February 25, 2022 15:22
@bedevere-bot bedevere-bot removed the awaiting core review label Feb 25, 2022
@markshannon

markshannon commented Feb 25, 2022

Copy link
Copy Markdown
Member

Please stop renaming things without any review.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@markshannon

markshannon commented Feb 25, 2022

Copy link
Copy Markdown
Member

If any debuggers or profilers were including these headers, then you have just broken them.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

If any debuggers or profilers were including these headers, then you have just broken them.

Python 3.11.0 final is not released yet. I prefer to rename it now.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

The problem of the InterpreterFrame type is that it's used by the PyInterpreterState.eval_frame callback API which is somehow public: https://www.python.org/dev/peps/pep-0523/

Technically, PyInterpreterState is part of the internal C API. So I would say that it's an internal C API. But well, people use it for debuggers. So it's better to make this "internal" API comply with Python C code code: prefix symbols with Py or _Py.

See also this private API (private, not internal ;-)):

typedef PyObject* (*_PyFrameEvalFunction)(PyThreadState *tstate, struct _PyInterpreterFrame *, int);

PyAPI_FUNC(_PyFrameEvalFunction) _PyInterpreterState_GetEvalFrameFunc(
    PyInterpreterState *interp);
PyAPI_FUNC(void) _PyInterpreterState_SetEvalFrameFunc(
    PyInterpreterState *interp,
    _PyFrameEvalFunction eval_frame);
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

Moreover, my short term plan to update Cython and gevent for https://bugs.python.org/issue46836 (to port them to Python 3.11 with opaque PyFrameObject type) is to make them use the internal C API pycore_frame.h. I would prefer to not have do that, but https://bugs.python.org/issue40421 is not fixed yet: there are not enough getter and setter functions for PyFrameObject.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 25, 2022

Copy link
Copy Markdown
Member Author

If any debuggers or profilers were including these headers, then you have just broken them.

That's fine. There is no backward compatibility on the internal C API (nor on the private C API).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

asvetlov pushed a commit that referenced this pull request Feb 26, 2022
@vstinner @asvetlov
bpo-46836: Rename InterpreterFrame to _PyInterpreterFrame (GH-31583)
f34987a
Rename also struct _interpreter_frame to struct _PyInterpreterFrame.

Reduce risk of name conflicts if a project includes pycore_frame.h.
@markshannon

markshannon commented Feb 28, 2022

Copy link
Copy Markdown
Member

That is true, but it makes our life more difficult if those tools are constantly broken, as it can hide real problems.
So, please be a bit more cautious in future. Thanks.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Feb 28, 2022

Copy link
Copy Markdown
Member Author

That is true, but it makes our life more difficult if those tools are constantly broken, as it can hide real problems.
So, please be a bit more cautious in future. Thanks.

Ok, gotcha.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request May 2, 2022
[C API] Move PyFrameObject to the internal C API #90992
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel Awaiting requested review from iritkatriel
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner
@1st1 1st1 Awaiting requested review from 1st1

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@vstinner @markshannon @the-knights-who-say-ni @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.