class_docstr: Test semantics.
class_docstr_tok: ["Test","semantics","."]
code: def test_custom_iterator_return(self):
      # See issue #15568
      class MyIter:
          def __iter__(self):
              return self
  
          def __next__(self):
              raise StopIteration(42)
  
      def gen():
          nonlocal ret
          ret = yield from MyIter()
  
      ret = None
      list(gen())
      self.assertEqual(ret, 42)
  
imports: import unittest
  import inspect
  from test.support import captured_stderr, disable_gc, gc_collect
  from test import support
label_desc: Use image node_id 31 for calling the TestPEP380Operation obj's underlying member method code with example usage: obj.test_custom_iterator_return() and returns: self