Couldn't you do the following instead?

```python
with gil:
    raise NotImplementedError()
```