简体   繁体   English

NULL结果,PyObject_Call中没有错误

[英]NULL result without error in PyObject_Call

I'm currently coding a Python C-Extension to perform some calculations in C instead of Python. 我目前正在编写Python C-Extension,以使用C而不是Python进行一些计算。 It works just fine, I already got some nice results, but the point is, I get the following error: 它工作正常,我已经得到了一些不错的结果,但是关键是,我得到了以下错误:

NULL result without error in PyObject_Call

It occurs sometimes, not always, when I want to create an instance of the "C Python Object" I created. 当我想创建自己创建的“ C Python对象”的实例时,有时(并非总是如此)会发生这种情况。 The call looks something like the following: 调用看起来类似于以下内容:

import c_class

obj = c_class.dummy(arg1, arg2, arg3);

Does anyone have any suggestions? 有没有人有什么建议? I don't know where this error comes from, since it works from time to time.. I'm kind of lost here. 我不知道此错误从何而来,因为它有时会起作用。

When you return NULL from ac function exposed to python you must set the error message before, since returning NULL means an error happened. 当您从暴露给python的ac函数返回NULL ,必须先设置错误消息,因为返回NULL表示发生了错误。

If an error happened and you are returning NULL because of that then, use PyErr_SetString() , if no error happened, then use 如果发生错误,并且您因此而返回NULL ,请使用PyErr_SetString() ,如果没有错误发生,请使用

Py_RETURN_NONE;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 多重处理:NULL结果,PyObject_Call中没有错误 - Multiprocessing : NULL result without error in PyObject_Call Python / Numpy错误:PyObject_Call中没有错误的NULL结果 - Python/Numpy error: NULL result without error in PyObject_Call gevent + redis-py:SystemError:在PyObject_Call中没有错误的NULL结果 - gevent + redis-py: SystemError: NULL result without error in PyObject_Call 尝试在scikit-learn中并行化参数搜索会导致“ SystemError:PyObject_Call中没有错误的NULL结果” - Trying to parallelize parameter search in scikit-learn leads to “SystemError: NULL result without error in PyObject_Call” PyObject_Call崩溃 - Crash in PyObject_Call Python-SystemError:NULL结果,PyObject调用中没有错误 - Python - SystemError: NULL result without error in PyObject call 从线程调用 PyObject_Call 导致堆栈溢出 - Calling PyObject_Call from thread causes stack overflow iTunes共享库中带有PyObject_Call()的分段错误 - Segmentation-fault with PyObject_Call() in shared library for iTunes 来自SWIG PyObject_Call Segfault的Python回调 - Python Callback from SWIG PyObject_Call Segfault 在 C++ 中的 PyObject 上调用 `+=` - Call `+=` on a PyObject in C++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM