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

Improve "Extending Python with C or C++" docs #93677

Open
erlend-aasland opened this issue Jun 10, 2022 · 4 comments
Open

Improve "Extending Python with C or C++" docs #93677

erlend-aasland opened this issue Jun 10, 2022 · 4 comments
Assignees
Labels
docs Documentation in the Doc dir topic-C-API

Comments

@erlend-aasland
Copy link
Contributor

Quoting Petr in issue gh-93078:

Anyway, the more important thing to do here is converting the tutorial. That will, in my opinion, make the new way official :)
But I don't want to do that until PEP 687 is accepted, and more PEP 630 open issues are solved. (FWIW: Metaclasses and Per-class scope look like they could go in anearly 3.12 alpha, Type checking should hopefully go in 3.12 as well, and lossless conversion isn't blocking for me.)

But yes, all that is out of scope of this PR.

Originally posted by @encukou in #93078 (comment)

@erlend-aasland erlend-aasland added docs Documentation in the Doc dir topic-C-API labels Jun 10, 2022
@encukou encukou self-assigned this Jun 10, 2022
@encukou
Copy link
Member

encukou commented Oct 13, 2023

cc @ericsnowcurrently

@elmbeech
Copy link

elmbeech commented Feb 8, 2024

Hello!
I have just written my first extended python module. Thank you for the documentation, it was a good help! A minor thing I found in the example code, that I think, should be different.
Under 1. Extending Python with C or C++ : 1.1. A Simple Example , 1.2. Intermezzo: Errors and Exceptions, and 1.3. Back to the Example.

static PyObject *
spam_system(PyObject *self, PyObject *args)
{
    const char *command;
    int sts;

    if (!PyArg_ParseTuple(args, "s", &command))
        return NULL;
    sts = system(command);
    return PyLong_FromLong(sts);
}

Should return NULL; not better be return Py_None;?

@erlend-aasland
Copy link
Contributor Author

should return NULL; not better be return Py_None;?

Take a look at the immediately following section (1.2 Intermezzo: Errors and Exceptions), where this is explained.

@elmbeech
Copy link

elmbeech commented Feb 8, 2024

thank you! and sorry if this is just because I not understood everything.

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 topic-C-API
Projects
None yet
Development

No branches or pull requests

3 participants