Function
_value_from_stopiteration
(e: Union[StopIteration, "Return"])
Source from the content-addressed store, hash-verified
| 129 | |
| 130 | |
| 131 | def _value_from_stopiteration(e: Union[StopIteration, "Return"]) -> Any: |
| 132 | try: |
| 133 | # StopIteration has a value attribute beginning in py33. |
| 134 | # So does our Return class. |
| 135 | return e.value |
| 136 | except AttributeError: |
| 137 | pass |
| 138 | try: |
| 139 | # Cython backports coroutine functionality by putting the value in |
| 140 | # e.args[0]. |
| 141 | return e.args[0] |
| 142 | except (AttributeError, IndexError): |
| 143 | return None |
| 144 | |
| 145 | |
| 146 | def _create_future() -> Future: |
Tested by
no test coverage detected