Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C API docs: PyRun_StringFlags: what is a "start token"? #129368

Open
jwuttke opened this issue Jan 27, 2025 · 2 comments
Open

C API docs: PyRun_StringFlags: what is a "start token"? #129368

jwuttke opened this issue Jan 27, 2025 · 2 comments
Labels
docs Documentation in the Doc dir easy topic-C-API

Comments

@jwuttke
Copy link
Contributor

jwuttke commented Jan 27, 2025

Documentation

I was advised to use function PyRun_String to retrieve information on complex Python constructs from C.

The doc at https://docs.python.org/3/c-api/veryhigh.html refers from PyRun_String to PyRun_StringFlags , where I am told "The parameter start specifies the start token that should be used to parse the source code."

What is a "start token" please?

@jwuttke jwuttke added the docs Documentation in the Doc dir label Jan 27, 2025
@erlend-aasland
Copy link
Contributor

What is a "start token" please?

Quoting the introduction at the top of the page you linked to:

Several of these functions accept a start symbol from the grammar as a parameter. The available start symbols are Py_eval_input, Py_file_input, and Py_single_input. These are described following the functions which accept them as parameters.

It does say start symbols, not start tokens, though.

Further down on the page (I just grepped the page for "start token"), you find this:

The start token is given by start; this can be used to constrain the code which can be compiled and should be Py_eval_input, Py_file_input, or Py_single_input.

@iamrajhans
Copy link

hi @erlend-aasland, can i take this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir easy topic-C-API
Projects
Status: Todo
Development

No branches or pull requests

4 participants