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-47128: Enhance Argument Clinic's NoneType return converter to give `void` by arhadthedev · Pull Request #32126 · python/cpython

Conversation

@arhadthedev

@arhadthedev arhadthedev commented Mar 26, 2022 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

This PR makes the following possible (note that the impl has a void return type):

/*[clinic input]
_io._IOBase.writelines -> NoneType
    lines: object
    /
[clinic start generated code]*/

static void
_io__IOBase_writelines_impl(PyObject *self, PyObject *lines)
/*[clinic end generated code: output=f3feca36db72dbd1 input=286ba711cb7291ad]*/

Previously, the return type would be Object * and a caller would replace non-Py_None values with NULL.

So now there is no need to track whether NULL or Py_None should be returned. Or should it be Py_RETURN_NONE? Argument Clinic does it by itself returning NULL on errors and Py_None otherwise:

static PyObject *
_io__IOBase_writelines(PyObject *self, PyObject *lines)
{
    PyObject *return_value = NULL;

    _io__IOBase_writelines_impl(self, lines);
    if (PyErr_Occurred()) {
        goto exit;
    }
    return_value = Py_None;
    Py_INCREF(Py_None);

exit:
    return return_value;
}

https://bugs.python.org/issue47128

Sorry, something went wrong.

Uh oh!

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

All reactions
@arhadthedev
Map the Argument Clinic's NoneType return to void
b00fa19
@the-knights-who-say-ni the-knights-who-say-ni added the CLA signed label Mar 26, 2022
@bedevere-bot bedevere-bot added the awaiting review label Mar 26, 2022
@arhadthedev

arhadthedev commented Mar 26, 2022

Copy link
Copy Markdown
Member Author

Tests / Check if generated files are up to date fails with the following report.

make regen-deepfreeze
make[1]: Entering directory '/home/runner/work/cpython/cpython'
./_bootstrap_python ./Programs/_freeze_module.py abc ./Lib/abc.py Python/frozen_modules/abc.h
make[1]: execvp: ./_bootstrap_python: Permission denied
make[1]: *** [Makefile:1194: Python/frozen_modules/abc.h] Error 127
make[1]: Leaving directory '/home/runner/work/cpython/cpython'
make: *** [Makefile:1313: regen-global-objects] Error 2
make: *** Waiting for unfinished jobs....

All other checks pass. Reopening the PR to retrigger the checks.

All reactions

Sorry, something went wrong.

Uh oh!

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

@arhadthedev arhadthedev closed this Mar 26, 2022
@arhadthedev arhadthedev reopened this Mar 26, 2022
@arhadthedev
arhadthedev marked this pull request as ready for review March 26, 2022 13:56
@arhadthedev
Add a note on error indication
61d8dfe
@arhadthedev

arhadthedev commented Mar 28, 2022

Copy link
Copy Markdown
Member Author

The feature calls GIL-taking PyErr_Occurred. So I close the PR until GIL is removed so performance penalty decreases.

All reactions

Sorry, something went wrong.

Uh oh!

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

@arhadthedev arhadthedev closed this Mar 28, 2022
@arhadthedev

arhadthedev commented Jul 20, 2022 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member Author

GH-95019 fully removed the NoneType return converter. As a result, this PR has no sense to be reopened anymore.

All reactions

Sorry, something went wrong.

Uh oh!

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

@arhadthedev
arhadthedev deleted the argument-clinic-nonetype-converter branch July 20, 2022 06:27
@arhadthedev arhadthedev mentioned this pull request Jul 20, 2022
Enhance Argument Clinic's NoneType return converter to give void #91284
Closed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
thread: add CPython 3.14 ExceptHookArgs pyre-lang/pyre#843
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

awaiting review

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.

3 participants

@arhadthedev @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.