anthony shaw <anthony.p.s...@gmail.com> added the comment:

This is because PyUnicode_DecodeFSDefaultAndSize calls 
_PyInterpreterState_GET_UNSAFE(), which already documents the potential NULL 
return value. 

/* Get the current interpreter state.

   The macro is unsafe: it does not check for error and it can return NULL.

   The caller must hold the GIL.

   See also _PyInterpreterState_Get()
   and _PyGILState_GetInterpreterStateUnsafe(). */
#define _PyInterpreterState_GET_UNSAFE() (_PyThreadState_GET()->interp)

> Python has a *very large* C API. It doesn't seem worth it to me to modify 
> every single Python function to detect when the API is misused.

Understood, happy for this to be closed. Aware that I was misusing the API :-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue36386>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to