python-c-api
How to get current function name in Python C-API?
I implemented a bunch of functions and they are dispatched from the same C function called by the Python interpreter:[详细]
2023-03-16 21:15 分类:问答How do you make python recognize read a precompiled shared file?
I have a package I\'ve created in C++ and, have already compiled it into a shared library. When I link against it with my own main function, I can initialize the package by calling the initialization[详细]
2023-03-15 11:47 分类:问答How to create a custom Python exception type in C extension?
I\'m writing a Python module in C. I need to report errors that can\'t be described by built-in Python exceptions. I therefore wish to throw exceptions of my own type. The problem is, that Python poli[详细]
2023-03-13 22:49 分类:问答How do I find out why importing failed with PyImportModule?
I have this code in a C application that\'s embedding Python (2.7.1): { PyObject *user_dict; PyObject *user_func;[详细]
2023-03-12 04:18 分类:问答Returning objects to Python from C
I\'ve read the documentation for the Python C-API, and even written a few extension modules.However, I\'m still a bit unclear on the exact semantics when it comes to returning Python objects from a C[详细]
2023-03-09 01:17 分类:问答Python C API: How to get PyRun_String with Py_eval_input to use imported modules?
PyRun_String(\"random.randint(1,10)\", Py_eval_input, globals, globals); returns error with: Traceback (most recent call last):[详细]
2023-03-08 22:59 分类:问答Python C API: why doesn't PyRun_String evaluate simple conditional expressions?
PyRun_String(\"if True: 1\\nelse: 0\", Py_eval_input, globals, globals); returns error with PyErr_Print() printing out:[详细]
2023-03-08 14:34 分类:问答Limitations of PyTuple_SetItem
I have a Python extension module which creates a tuple as an attribute of another object, and sets items in the tuple.Whenever I execute this module in Python, I keep getting the error SystemError: ba[详细]
2023-03-07 21:31 分类:问答Create a Python type from C that implements a __dict__?
How is a type created to have a __dict__ as per a \"normal\" class 开发者_运维技巧would have were it defined in Python?[详细]
2023-02-12 10:08 分类:问答How is __slots__ implemented in Python?
How is __slots__ implemented in P开发者_高级运维ython? Is this exposed in the C interface? How do I get __slots__ behaviour when defining a Python class in C via PyTypeObject?[详细]
2023-02-11 08:44 分类:问答