Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
f6e50b4a
Commit
f6e50b4a
authored
Apr 13, 2014
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sending tuples to custom generator objects with yield from (closes #21209)
Debugged by Victor.
parent
584f5cbf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
Lib/test/test_pep380.py
Lib/test/test_pep380.py
+19
-0
Misc/NEWS
Misc/NEWS
+3
-0
Python/ceval.c
Python/ceval.c
+1
-1
No files found.
Lib/test/test_pep380.py
View file @
f6e50b4a
...
...
@@ -993,6 +993,25 @@ class TestPEP380Operation(unittest.TestCase):
del
inner_gen
gc_collect
()
def
test_send_tuple_with_custom_generator
(
self
):
# See issue #21209.
class
MyGen
:
def
__iter__
(
self
):
return
self
def
__next__
(
self
):
return
42
def
send
(
self
,
what
):
nonlocal
v
v
=
what
return
None
def
outer
():
v
=
yield
from
MyGen
()
g
=
outer
()
next
(
g
)
v
=
None
g
.
send
((
1
,
2
,
3
,
4
))
self
.
assertEqual
(
v
,
(
1
,
2
,
3
,
4
))
def
test_main
():
from
test
import
support
...
...
Misc/NEWS
View file @
f6e50b4a
...
...
@@ -10,6 +10,9 @@ Release date: TBA
Core and Builtins
-----------------
- Issue #21209: Fix sending tuples to custom generator objects with the yield
from syntax.
- Issue #21134: Fix segfault when str is called on an uninitialized
UnicodeEncodeError, UnicodeDecodeError, or UnicodeTranslateError object.
...
...
Python/ceval.c
View file @
f6e50b4a
...
...
@@ -1902,7 +1902,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
if
(
v
==
Py_None
)
retval
=
Py_TYPE
(
reciever
)
->
tp_iternext
(
reciever
);
else
retval
=
_PyObject_CallMethodId
(
reciever
,
&
PyId_send
,
"O"
,
v
);
retval
=
_PyObject_CallMethodId
ObjArgs
(
reciever
,
&
PyId_send
,
v
,
NULL
);
}
Py_DECREF
(
v
);
if
(
retval
==
NULL
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment