Python 相当于 PyErr_Print()

发布于 2024-08-16 16:12:15 字数 396 浏览 6 评论 0原文

来自 C 接口的 PyErr_Print() 的 Python API 等效项是什么?

我假设在 systraceback 模块中进行调用,但在其中找不到任何调用 PyErr_Print() 的函数>。

附录

我在Python调用之后获得与PyErr_PrintEx()相同的功能,描述为:

Print a standard traceback to sys.stderr and clear the error indicator.

那就是我想要进行具有此效果的Python调用。

What is the Python API equivalent of PyErr_Print(), from the C interface?

I'm assuming a call in either the sys, or traceback modules, but can't find any functions therein that make calls to PyErr_Print().

Addendum

I'm after the Python call to get the same functionality as PyErr_PrintEx(), described as:

Print a standard traceback to sys.stderr and clear the error indicator.

That is I want to make the Python call that has this effect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

下壹個目標 2024-08-23 16:12:15

没有与 PyErr_PrintExPyErr_Print 的真实名称;-)完全等效的 Python 函数,包括例如设置 sys.last_traceback 和朋友(这些设置应该只是为了帮助交互式解释器对捕获的异常进行事后调试)。您正在寻找什么样的功能组合?

There's no Python function that's exactly equivalent to PyErr_PrintEx (the real name of PyErr_Print;-), including for example setting sys.last_traceback and friends (which are only supposed to be set to help a post-mortem debugging from the interactive interpreter for exceptions which have not been caught). What exact combination of functionality are you looking for?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文