Access to errno from Python?

前端 未结 6 1298
没有蜡笔的小新
没有蜡笔的小新 2020-12-29 05:00

I am stuck with a fairly complex Python module that does not return useful error codes (it actually fails disturbingly silently). However, the underlying C library it calls

6条回答
  •  有刺的猬
    2020-12-29 05:29

    It looks like you can use this patch that will provide you with ctypes.get_errno/set_errno

    http://bugs.python.org/issue1798

    This is the patch that was actually applied to the repository:

    http://svn.python.org/view?view=rev&revision=63977

    Otherwise, adding a new C module that does nothing but return errno /is/ disgusting, but so is the library that you're using. I would do that in preference to patching python myself.

提交回复
热议问题