Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

gh-104770: Let generator.close() return value#104771

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gvanrossum merged 9 commits intopython:mainfromntessore:generator-close-return
May 23, 2023
Merged
Changes from1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
use _PyGen_FetchStopIterationValue()
  • Loading branch information
@ntessore
ntessore committedMay 23, 2023
commit678332a88317ef2436b83e47bd736ddbb48247c4
9 changes: 4 additions & 5 deletionsObjects/genobject.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -409,11 +409,10 @@ gen_close(PyGenObject *gen, PyObject *args)
return NULL;
}
if (PyErr_ExceptionMatches(PyExc_StopIteration)) {
/* retrieve the StopIteration exception instance being handled, and
* extract its value */
PyObject *exc = PyErr_GetRaisedException(); /* clears the error indicator */
PyObject *value = Py_NewRef(((PyStopIterationObject *)exc)->value);
Py_DECREF(exc);
/* fetch the value of the StopIteration instance being handled;
* this clears the error indicator */
PyObject *value;
_PyGen_FetchStopIterationValue(&value);
return value;
}
if (PyErr_ExceptionMatches(PyExc_GeneratorExit)) {
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp