You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While this is clearly a bug in the user code and current behaviour is not worse than that of the C library, a Python module can probably do better than crash the interpreter.
One way to fix this would be to add a Context reference to all Objects to ensure that context lives long enough. Another - to add a weak reference instead, so objects would be able to check if context is alive before making library calls and handle released context gracefully.
Personally, I think that the weakref approach would be better as it is more consistent with the style of the C API, even if it has slightly more overhead. What do you think?
The text was updated successfully, but these errors were encountered:
Demo.
While this is clearly a bug in the user code and current behaviour is not worse than that of the C library, a Python module can probably do better than crash the interpreter.
One way to fix this would be to add a Context reference to all Objects to ensure that context lives long enough. Another - to add a weak reference instead, so objects would be able to check if context is alive before making library calls and handle released context gracefully.
Personally, I think that the weakref approach would be better as it is more consistent with the style of the C API, even if it has slightly more overhead. What do you think?
The text was updated successfully, but these errors were encountered: