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