67+ results for 'PyCFunction_NewEx ' (0 ms)
Not the results you expected?
methodobject.h
(http://unladen-swallow.googlecode.com/svn/trunk/)
C Header · 126 lines
✨ Summary
This C header file defines an interface for Python’s method objects, which represent functions and methods within Python classes. It provides macros, types, and functions to interact with these objects, including creating new method definitions, calling methods, and checking if a function is a method. The code is part of the Python C API.
This C header file defines an interface for Python’s method objects, which represent functions and methods within Python classes. It provides macros, types, and functions to interact with these objects, including creating new method definitions, calling methods, and checking if a function is a method. The code is part of the Python C API.
methodobject.h (https://github.com/tmacreturns/XBMC_wireless_setup.git) C Header · 91 lines
modsupport.py (https://github.com/nicolaslara/pypy.git) Python · 128 lines
5 from pypy.interpreter.module import Module
6 from pypy.module.cpyext.methodobject import (
7 W_PyCFunctionObject, PyCFunction_NewEx, PyDescr_NewMethod,
8 PyMethodDef, PyStaticMethod_New)
9 from pypy.module.cpyext.pyerrors import PyErr_BadInternalCall
95 w_obj = space.w_Ellipsis # XXX
96 elif flags & METH_STATIC:
97 w_func = PyCFunction_NewEx(space, method, None, None)
98 w_obj = PyStaticMethod_New(space, w_func)
99 else:
methodobject.c (https://github.com/brosner/cleese.git) C · 118 lines
methodobject.h (https://gitlab.com/Alioth-Project/clang-r445002) C Header · 110 lines
42 typedef struct PyMethodDef PyMethodDef;
44 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
45 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
48 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
49 #define PyCFunction_NewEx(ML, SELF, MOD) PyCMethod_New((ML), (SELF), (MOD), NULL)
50 PyAPI_FUNC(PyObject *) PyCMethod_New(PyMethodDef *, PyObject *,
51 PyObject *, PyTypeObject *);
methodobject.h (https://github.com/cguardia/empythoned.git) C Header · 93 lines
libpython.c (https://github.com/mrkn/pycall.rb.git) C · 228 lines
methodobject.h (https://gitlab.com/amra.zidani/DjangoWebProject1) C Header · 94 lines
Python-dynload.h (https://github.com/n1nj4sec/pupy.git) C Header · 219 lines
test_trampoline.cc (https://github.com/lisa-lab/PLearn.git) C++ · 89 lines
1 // Ensure that the Python function PyCFunction_NewEx works correctly
3 #include <plearn/python/PythonCodeSnippet.h>
60 py_method.ml_flags = METH_VARARGS;
61 py_method.ml_doc = NULL;
62 PyObject* py_funcobj = PyCFunction_NewEx(&py_method,
63 reinterpret_cast<PyObject*>(&xfunc),
64 NULL /* module */);
methodobject.h (https://github.com/ngbinh/libBlenderWindows.git) C Header · 87 lines
function.rs (https://github.com/PyO3/pyo3.git) Rust · 92 lines
methodobject.rs (https://github.com/PyO3/pyo3.git) Rust · 138 lines
modsupport.c (https://github.com/brosner/cleese.git) C · 405 lines
pyapi.h (https://pykd.svn.codeplex.com/svn) C Header · 206 lines
46 PyObject* PyList_GetItem(PyObject *list, size_t index);
48 PyObject* __stdcall PyCFunction_NewEx(PyMethodDef *, PyObject *, PyObject *);
49 PyObject* __stdcall PyClass_New(PyObject* className, PyObject* classBases, PyObject* classDict);
50 PyObject* __stdcall PyMethod_New(PyObject *func, PyObject *self, PyObject *classobj);
pygstexception.c (http://ossbuild.googlecode.com/svn/trunk/) C · 270 lines
mktab.py (https://github.com/n1nj4sec/pupy.git) Python · 135 lines
gnatcoll-python.adb (git://pkgs.fedoraproject.org/gnatcoll) Ada · 1133 lines
import-tab.h (https://github.com/Kkevsterrr/backdoorme.git) C Header · 61 lines
20 #define Py_IsInitialized ((int(*)(void))imports[19].proc)
21 #define PyObject_SetAttrString ((int(*)(PyObject *, char *, PyObject *))imports[20].proc)
22 #define PyCFunction_NewEx ((PyObject *(*)(PyMethodDef *, PyObject *, PyObject *))imports[21].proc)
23 #define PyObject_GetAttrString ((PyObject *(*)(PyObject *, char *))imports[22].proc)
24 #define Py_BuildValue ((PyObject *(*)(char *, ...))imports[23].proc)
pyclass.h (https://pykd.svn.codeplex.com/svn) C Header · 208 lines
126 {\
127 static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \
128 PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \
129 PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \
130 PyObject_SetAttrString(classTypeObj, name, methodObj); \
146 {\
147 static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \
148 PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \
149 PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \
150 PyObject_SetAttrString(classTypeObj, name, methodObj); \
165 {\
166 static PyMethodDef methodDef = { name, Call_##fn::pycall, METH_VARARGS }; \
167 PyObject* cFuncObj = PyCFunction_NewEx(&methodDef, NULL, NULL); \
168 PyObject* methodObj = IsPy3() ? PyInstanceMethod_New(cFuncObj) : PyMethod_New(cFuncObj, NULL, classTypeObj); \
169 PyObject* args = PyTuple_New(4); \
methodobject.swift (https://github.com/apple/swift-3-api-guidelines-review.git) Swift · 44 lines
17 }
18 func Py_FindMethod(_ _: UnsafeMutablePointer<PyMethodDef>, _ _: UnsafeMutablePointer<PyObject>, _ _: UnsafePointer<Int8>) -> UnsafeMutablePointer<PyObject>
19 func PyCFunction_NewEx(_ _: UnsafeMutablePointer<PyMethodDef>, _ _: UnsafeMutablePointer<PyObject>, _ _: UnsafeMutablePointer<PyObject>) -> UnsafeMutablePointer<PyObject>
20 var METH_OLDARGS: Int32 { get }
21 var METH_VARARGS: Int32 { get }
mktab.py (https://github.com/AlessandroZ/pupy.git) Python · 119 lines
recipe-579110.c (https://github.com/ActiveState/code.git) C · 141 lines
modsupport.py (https://github.com/thepian/pypy.git) Python · 128 lines
5 from pypy.interpreter.module import Module
6 from pypy.module.cpyext.methodobject import (
7 W_PyCFunctionObject, PyCFunction_NewEx, PyDescr_NewMethod,
8 PyMethodDef, PyCFunction, PyStaticMethod_New)
9 from pypy.module.cpyext.pyerrors import PyErr_BadInternalCall
95 w_obj = space.w_Ellipsis # XXX
96 elif flags & METH_STATIC:
97 w_func = PyCFunction_NewEx(space, method, None, None)
98 w_obj = PyStaticMethod_New(space, w_func)
99 else:
methodobject.h (https://github.com/gvanrossum/cpython.git) C Header · 114 lines
44 /* PyCFunction_New is declared as a function for stable ABI (declaration is
45 * needed for e.g. GCC with -fvisibility=hidden), but redefined as a macro
46 * that calls PyCFunction_NewEx. */
47 PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
48 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
50 /* PyCFunction_NewEx is similar: on 3.9+, this calls PyCMethod_New. */
51 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
54 #if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03090000
55 #define PyCFunction_NewEx(ML, SELF, MOD) PyCMethod_New((ML), (SELF), (MOD), NULL)
56 PyAPI_FUNC(PyObject *) PyCMethod_New(PyMethodDef *, PyObject *,
57 PyObject *, PyTypeObject *);
gc_guard.rb (https://github.com/mrkn/pycall.rb.git) Ruby · 84 lines
methodobject.rs (https://github.com/dgrunwald/rust-cpython.git) Rust · 123 lines
83 #[inline(always)]
84 pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {
85 PyCFunction_NewEx(ml, slf, ptr::null_mut())
86 }
88 #[cfg_attr(windows, link(name = "pythonXY"))]
89 extern "C" {
90 pub fn PyCFunction_NewEx(
91 arg1: *mut PyMethodDef,
92 arg2: *mut PyObject,
import-tab.c (https://github.com/Kkevsterrr/backdoorme.git) C · 69 lines
gc.c (https://github.com/mrkn/pycall.rb.git) C · 74 lines
ngx_python_sleep.c (https://github.com/arut/nginx-python-module.git) C · 108 lines
methodobject.d (https://github.com/ariovistus/pyd.git) D · 149 lines
methodobject.rs (https://github.com/dgrunwald/rust-cpython.git) Rust · 121 lines
cfunction.clj (https://github.com/cnuernber/libpython-clj.git) Clojure · 76 lines
_undefined.c (https://github.com/llllllllll/lazy_python.git) C · 92 lines
methodwrapper.cs (https://github.com/Unity-Technologies/pythonnet.git) C# · 56 lines
cfunction.go (git://github.com/qur/gopy.git) Go · 171 lines
methodobject.h (https://github.com/thepian/pypy.git) C Header · 66 lines
MethodObjectTest.cc (https://github.com/ianloic/unladen-swallow.git) C++ · 52 lines
methodobject.c (https://github.com/graalvm/graalpython.git) C · 56 lines
45 PyTypeObject PyCFunction_Type = PY_TRUFFLE_TYPE_WITH_VECTORCALL("builtin_function_or_method", &PyType_Type, Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | _Py_TPFLAGS_HAVE_VECTORCALL, sizeof(PyCFunctionObject), offsetof(PyCFunctionObject, vectorcall));
47 PyObject* PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {
48 return to_sulong(polyglot_invoke(PY_TRUFFLE_CEXT,
49 "PyCFunction_NewEx",
PyVTKExtras.cxx (https://github.com/HopeFOAM/HopeFOAM.git) C++ · 154 lines
clientmodule.cpp (https://github.com/Mutilador/Wolfpack.git) C++ · 190 lines
callback.jl (https://gitlab.com/math4youbyusgroupillinois/PyCall.jl.git) Julia · 79 lines
3 # Note that this will typically involve two functions: the
4 # desired Julia function/closure, and a top-level C-callable
5 # wrapper function used with PyCFunction_NewEx -- the latter
6 # is called from Python and calls the former as needed.
15 def = gensym("PyMethodDef")
16 @eval const $def = PyMethodDef($name, $f, $flags)
17 PyObject(@pycheckn ccall((@pysym :PyCFunction_NewEx), PyPtr,
18 (Ptr{PyMethodDef}, Ptr{Void}, Ptr{Void}),
19 &eval(def), C_NULL, C_NULL))
_loader.c (https://github.com/llllllllll/quasiquotes.git) C · 55 lines
pygstexception.c (https://github.com/zaheerm/gst-python.git) C · 267 lines
descrobject.c (https://bitbucket.org/akruis/fg2python) C · 1625 lines
116 return NULL;
117 }
118 return PyCFunction_NewEx(descr->d_method, type, NULL);
119 }
126 if (descr_check((PyDescrObject *)descr, obj, &res))
127 return res;
128 return PyCFunction_NewEx(descr->d_method, obj, NULL);
129 }
240 }
242 func = PyCFunction_NewEx(descr->d_method, self, NULL);
243 if (func == NULL)
244 return NULL;
pickle_support.hpp (https://github.com/gfrd/egfrd.git) C++ Header · 85 lines
archive_api.html (https://gitlab.com/ignition-io/ignition-dev) HTML · 84 lines
60 * print n
61 */
62 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11archive_api_fib, NULL, __pyx_n_s__archive_api);<span class='error_goto'> if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
63 <span class='pyx_macro_api'><span class='refnanny'>__Pyx_GOTREF</span></span>(__pyx_t_1);
64 if (<span class='py_c_api'>PyObject_SetAttr</span>(__pyx_m, __pyx_n_s__fib, __pyx_t_1) <code><</code> 0)<span class='error_goto'> {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}</span>
PyROOTPickle.cxx (https://bitbucket.org/binet/mana-core-rootutils) C++ · 135 lines
methodobject.h (https://github.com/jtauber/cleese.git) C Header · 57 lines
methodobject.h (https://github.com/ianloic/unladen-swallow.git) C Header · 118 lines
modsupport.py (https://bitbucket.org/price/pypy) Python · 134 lines
5 from pypy.interpreter.module import Module
6 from pypy.module.cpyext.methodobject import (
7 W_PyCFunctionObject, PyCFunction_NewEx, PyDescr_NewMethod,
8 PyMethodDef, PyDescr_NewClassMethod, PyStaticMethod_New)
9 from pypy.module.cpyext.pyerrors import PyErr_BadInternalCall
100 w_obj = PyDescr_NewClassMethod(space, w_type, method)
101 elif flags & METH_STATIC:
102 w_func = PyCFunction_NewEx(space, method, None, None)
103 w_obj = PyStaticMethod_New(space, w_func)
104 else:
modsupport.c (https://github.com/jtauber/cleese.git) C · 241 lines
_dynfunc.c (https://github.com/agamdua/numba.git) C · 73 lines
pystub.cxx (https://bitbucket.org/unkier/panda3d) C++ · 305 lines
21 EXPCL_PYSTUB int PyBool_FromLong(...);
22 EXPCL_PYSTUB int PyCFunction_New(...);
23 EXPCL_PYSTUB int PyCFunction_NewEx(...);
24 EXPCL_PYSTUB int PyCallable_Check(...);
25 EXPCL_PYSTUB int PyDict_DelItemString(...);
161 int PyBool_FromLong(...) { return 0; }
162 int PyCFunction_New(...) { return 0; };
163 int PyCFunction_NewEx(...) { return 0; };
164 int PyCallable_Check(...) { return 0; }
165 int PyDict_DelItemString(...) { return 0; }
pyaddfunc.py (https://github.com/blep/llvmpy.git) Python · 40 lines
12 ]
14 PyCFunction_NewEx = ctypes.pythonapi.PyCFunction_NewEx
15 PyCFunction_NewEx.argtypes = (ctypes.POINTER(PyMethodDef),
16 ctypes.c_void_p,
17 ctypes.c_void_p)
18 PyCFunction_NewEx.restype = ctypes.py_object
20 cache = {} # Unsure if this is necessary to keep the PyMethodDef
33 1, # == METH_VARARGS (hopefully remains so...)
34 func_doc)
35 ret_val = PyCFunction_NewEx(ctypes.byref(mdef), 0, 0)
36 cache[key] = (mdef, ret_val)
37 return ret_val
evincemodule.c (https://github.com/dieterv/gnome-python-desktop.git) C · 66 lines
59 // note: py_atexit_method_def has to be static, since python keeps a pointer to it
60 static PyMethodDef py_atexit_method_def = {NULL, (PyCFunction)_wrap_ev_shutdown, METH_NOARGS, NULL};
61 PyObject *py_atexit_func = PyCFunction_NewEx(&py_atexit_method_def, NULL, NULL);
62 PyObject *atexit = PyImport_ImportModule("atexit");
63 PyObject_CallMethod(atexit, "register", "N", py_atexit_func);
PyVTKExtras.cxx (https://github.com/CDAT/VTK.git) C++ · 154 lines
pmethodobject.c (https://github.com/nodebox/nodebox-opengl.git) C · 141 lines
2606.html (https://github.com/cocoatomo/Python3.2_C_API_Tutorial.git) HTML · 14 lines
1 <html>
2 <head>
3 <title>PyCFunction_NewEx</title>
4 <meta name='robots' content='noindex,nofollow'>
5 <meta name='generator' content='GLOBAL-5.8.1'>
7 <body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
8 <pre>
9 <a href='../S/540.html#L48'>PyCFunction_NewEx</a> 48 Include/methodobject.h #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
10 <a href='../S/2801.html#L317'>PyCFunction_NewEx</a> 317 Objects/methodobject.c return PyCFunction_NewEx(ml, self, NULL);
11 <a href='../S/2802.html#L131'>PyCFunction_NewEx</a> 131 Objects/moduleobject.c v = PyCFunction_NewEx(ml, (PyObject*)m, n);
12 </pre>
13 </body>
methodobject.h (https://bitbucket.org/karolasty8/cwe) C++ Header · 80 lines
2716.html (https://github.com/cocoatomo/Python3.2_C_API_Tutorial.git) HTML · 56 lines
15 <a href='../S/538.html#L21'>PyAPI_FUNC</a> 21 Include/memoryobject.h PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
16 <a href='../S/540.html#L23'>PyAPI_FUNC</a> 23 Include/methodobject.h PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
17 <a href='../S/540.html#L49'>PyAPI_FUNC</a> 49 Include/methodobject.h PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
18 <a href='../S/542.html#L15'>PyAPI_FUNC</a> 15 Include/moduleobject.h PyAPI_FUNC(PyObject *) PyModule_New(const char *);
19 <a href='../S/544.html#L405'>PyAPI_FUNC</a> 405 Include/object.h PyAPI_FUNC(PyObject*) PyType_FromSpec(PyType_Spec*);
pickle_support.hpp (https://github.com/ecell/object_matrix_standalone.git) C++ Header · 85 lines
2860.html (https://github.com/cocoatomo/Python3.2_C_API_Tutorial.git) HTML · 13 lines
7 <body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
8 <pre>
9 <a href='../S/540.html#L48'>PyCFunction_New</a> 48 Include/methodobject.h #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
10 <a href='../S/2801.html#L311'>PyCFunction_New</a> 311 Objects/methodobject.c #undef PyCFunction_New
11 </pre>
2501.html (https://github.com/cocoatomo/CTPython.git) HTML · 54 lines
16 <a href='../S/795.html#L19'>PyAPI_FUNC</a> 19 Include/memoryobject.h PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base,
17 <a href='../S/797.html#L23'>PyAPI_FUNC</a> 23 Include/methodobject.h PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *);
18 <a href='../S/797.html#L47'>PyAPI_FUNC</a> 47 Include/methodobject.h PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
19 <a href='../S/799.html#L15'>PyAPI_FUNC</a> 15 Include/moduleobject.h PyAPI_FUNC(PyObject *) PyModule_New(const char *);
20 <a href='../S/801.html#L714'>PyAPI_FUNC</a> 714 Include/object.h PyAPI_FUNC(void) Py_IncRef(PyObject *);
2644.html (https://github.com/cocoatomo/CTPython.git) HTML · 14 lines
7 <body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
8 <pre>
9 <a href='../S/797.html#L46'>PyCFunction_New</a> 46 Include/methodobject.h #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
10 <a href='../S/2761.html#L311'>PyCFunction_New</a> 311 Objects/methodobject.c #undef PyCFunction_New
11 </pre>
const-methods.patch (https://github.com/gdw2/pycorn.git) Patch · 207 lines
6 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);
8 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)
9 -PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,
10 +PyAPI_FUNC(PyObject *) PyCFunction_NewEx(const PyMethodDef *, PyObject *,
11 PyObject *);
44 PyObject *
45 -PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
46 +PyCFunction_NewEx(const PyMethodDef *ml, PyObject *self, PyObject *module)