| 150 | return self.end |
| 151 | |
| 152 | def resolve_interp(self, interp, other, extra): |
| 153 | if self.interp == 'same': |
| 154 | return interp |
| 155 | elif self.interp == 'other': |
| 156 | if other is None: |
| 157 | raise RuntimeError |
| 158 | return other |
| 159 | elif self.interp == 'extra': |
| 160 | if extra is None: |
| 161 | raise RuntimeError |
| 162 | return extra |
| 163 | elif self.interp == 'main': |
| 164 | if interp.name == 'main': |
| 165 | return interp |
| 166 | elif other and other.name == 'main': |
| 167 | return other |
| 168 | else: |
| 169 | raise RuntimeError |
| 170 | # Per __init__(), there aren't any others. |
| 171 | |
| 172 | |
| 173 | class ChannelState(namedtuple('ChannelState', 'pending closed')): |