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.

74 PyObject *);

75

76 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

77 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

methodobject.h (https://github.com/tmacreturns/XBMC_wireless_setup.git) C Header · 91 lines

46 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *);

47

48 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

49 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

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

7

8 PyObject *

9 PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)

10 {

11 PyCFunctionObject *op;

methodobject.h (https://gitlab.com/Alioth-Project/clang-r445002) C Header · 110 lines

42 typedef struct PyMethodDef PyMethodDef;

43

44 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

45 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

47

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

46 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);

47

48 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

49 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

libpython.c (https://github.com/mrkn/pycall.rb.git) C · 228 lines

121 INIT_API_TABLE_ENTRY(PyType_GenericNew, required);

122

123 INIT_API_TABLE_ENTRY(PyCFunction_NewEx, required);

124

125 INIT_API_TABLE_ENTRY(PyWeakref_NewRef, required);

methodobject.h (https://gitlab.com/amra.zidani/DjangoWebProject1) C Header · 94 lines

47 typedef struct PyMethodDef PyMethodDef;

48

49 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

50 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

Python-dynload.h (https://github.com/n1nj4sec/pupy.git) C Header · 219 lines

89 #define METH_STATIC 0x0020

90

91 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

92

93 #define PyInt_Check(op) PyObject_IsInstance(op, &PyInt_Type) /* ??? */

test_trampoline.cc (https://github.com/lisa-lab/PLearn.git) C++ · 89 lines

1 // Ensure that the Python function PyCFunction_NewEx works correctly

2

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

46 typedef struct PyMethodDef PyMethodDef;

47

48 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

49 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

function.rs (https://github.com/PyO3/pyo3.git) Rust · 92 lines

77

78 unsafe {

79 py.from_owned_ptr_or_err::<PyCFunction>(ffi::PyCFunction_NewEx(

80 Box::into_raw(Box::new(def)),

81 mod_ptr,

methodobject.rs (https://github.com/PyO3/pyo3.git) Rust · 138 lines

98

99 extern "C" {

100 #[cfg_attr(PyPy, link_name = "PyPyCFunction_NewEx")]

101 pub fn PyCFunction_NewEx(

105 ) -> *mut PyObject;

106

107 #[cfg_attr(PyPy, link_name = "PyPyCFunction_NewEx")]

108 pub fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject;

109 }

modsupport.c (https://github.com/brosner/cleese.git) C · 405 lines

20 return NULL;

21 for (ml = methods; ml->ml_name != NULL; ml++) {

22 v = PyCFunction_NewEx(ml, passthrough, n);

23 if (v == NULL)

24 return NULL;

pyapi.h (https://pykd.svn.codeplex.com/svn) C Header · 206 lines

46 PyObject* PyList_GetItem(PyObject *list, size_t index);

47

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

71 goto exception;

72

73 func = PyCFunction_NewEx (method, NULL, module);

74 if (func == NULL)

75 goto exception;

mktab.py (https://github.com/n1nj4sec/pupy.git) Python · 135 lines

20 int, Py_IsInitialized, (void)

21 int, PyObject_SetAttrString, (PyObject *, const char *, PyObject *)

22 PyObject *, PyCFunction_NewEx, (PyMethodDef *, PyObject *, PyObject *)

23 PyObject *, PyObject_GetAttrString, (PyObject *, const char *)

24 PyObject *, Py_BuildValue, (const char *, ...)

gnatcoll-python.adb (git://pkgs.fedoraproject.org/gnatcoll) Ada · 1133 lines

41 Self : PyObject;

42 Module : PyObject := null) return PyObject;

43 pragma Import (C, PyCFunction_New, "ada_pycfunction_newex");

44 -- Create a new callable object, which, when called from python, will call

45 -- the Ada subprogram.

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

25 int, Py_IsInitialized, (void)

26 int, PyObject_SetAttrString, (PyObject *, char *, PyObject *)

27 PyObject *, PyCFunction_NewEx, (PyMethodDef *, PyObject *, PyObject *)

28 PyObject *, PyObject_GetAttrString, (PyObject *, char *)

29 PyObject *, Py_BuildValue, (char *, ...)

recipe-579110.c (https://github.com/ActiveState/code.git) C · 141 lines

54

55 builtin_dict = PyModule_GetDict(builtin);

56 myfunc = PyCFunction_NewEx(&mymodule_methods[0], (PyObject*)NULL, builtinname);

57 PyDict_SetItemString(builtin_dict, "usleep", myfunc);

58

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)

49

50 /* PyCFunction_NewEx is similar: on 3.9+, this calls PyCMethod_New. */

51 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

53

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

75 end

76 method_def = LibPython::PyMethodDef.new("weakref_callback", @weakref_callback_func, LibPython::METH_O, nil)

77 @weakref_callback = LibPython.PyCFunction_NewEx(method_def, nil, nil).tap {|po| LibPython.Py_IncRef(po) }

78 end

79 @weakref_callback

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 }

87

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

28 { "Py_IsInitialized", NULL },

29 { "PyObject_SetAttrString", NULL },

30 { "PyCFunction_NewEx", NULL },

31 { "PyObject_GetAttrString", NULL },

32 { "Py_BuildValue", NULL },

gc.c (https://github.com/mrkn/pycall.rb.git) C · 74 lines

71 rb_ivar_set(mPyCall, id_gcguard_table, rb_hash_new());

72

73 weakref_callback_pyobj = Py_API(PyCFunction_NewEx)(&gcguard_weakref_callback_def, NULL, NULL);

74 }

75

ngx_python_sleep.c (https://github.com/arut/nginx-python-module.git) C · 108 lines

89 }

90

91 sleep = PyCFunction_NewEx(&ngx_python_sleep_function, NULL, NULL);

92 if (sleep == NULL) {

93 Py_DECREF(tm);

methodobject.d (https://github.com/ariovistus/pyd.git) D · 149 lines

75 }

76 /// _

77 PyObject* PyCFunction_NewEx(PyMethodDef*, PyObject*,PyObject*);

78 /// _

79 PyObject* PyCFunction_New()(PyMethodDef* ml, PyObject* self) {

80 return PyCFunction_NewEx(ml, self, null);

81 }

82

methodobject.rs (https://github.com/dgrunwald/rust-cpython.git) Rust · 121 lines

103 name: *const c_char,

104 ) -> *mut PyObject;

105 pub fn PyCFunction_NewEx(

106 ml: *mut PyMethodDef,

107 slf: *mut PyObject,

118 #[inline(always)]

119 pub unsafe fn PyCFunction_New(ml: *mut PyMethodDef, slf: *mut PyObject) -> *mut PyObject {

120 PyCFunction_NewEx(ml, slf, ptr::null_mut())

121 }

122

cfunction.clj (https://github.com/cnuernber/libpython-clj.git) Clojure · 76 lines

52

53

54 (def-pylib-fn PyCFunction_NewEx

55 "Create a new callable from an item."

56 Pointer

_undefined.c (https://github.com/llllllllll/lazy_python.git) C · 92 lines

67

68

69 if (!(strict_meth = PyCFunction_NewEx(&strict, undefined_inner, m))) {

70 goto error;

71 }

methodwrapper.cs (https://github.com/Unity-Technologies/pythonnet.git) C# · 56 lines

29 mdef = Runtime.PyMem_Malloc(4 * IntPtr.Size);

30 TypeManager.WriteMethodDef(mdef, name, _thunk.Address, 0x0003);

31 ptr = Runtime.PyCFunction_NewEx(mdef, IntPtr.Zero, IntPtr.Zero);

32 }

33

cfunction.go (git://github.com/qur/gopy.git) Go · 171 lines

56 }

57

58 ret := C.PyCFunction_NewEx(ml, saveFunc(fn), mod_name)

59 if ret == nil {

60 C.free(unsafe.Pointer(ml))

methodobject.h (https://github.com/thepian/pypy.git) C Header · 66 lines

50 #define METH_COEXIST 0x0040

51

52 #define PyCFunction_New(ml, self) PyCFunction_NewEx((ml), (self), NULL)

53

54 /* Macros for direct access to these values. Type checks are *not*

MethodObjectTest.cc (https://github.com/ianloic/unladen-swallow.git) C++ · 52 lines

40 ASSERT_TRUE(module != NULL);

41

42 // This PyCFunction_NewEx call used to trigger a PyErr_BadInternalCall.

43 PyErr_Clear();

44 PyObject *my_function = PyCFunction_NewEx(method_def, self, module);

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));

46

47 PyObject* PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) {

48 return to_sulong(polyglot_invoke(PY_TRUFFLE_CEXT,

49 "PyCFunction_NewEx",

python_callback.cc (https://github.com/GoogleCloudPlatform/cloud-debug-python.git) C++ · 69 lines

37 py_object_cast<PythonCallback>(callback_obj.get())->callback_ = callback;

38

39 ScopedPyObject callback_method(PyCFunction_NewEx(

40 &callback_method_def_,

41 callback_obj.get(),

PyVTKExtras.cxx (https://github.com/HopeFOAM/HopeFOAM.git) C++ · 154 lines

146 // Third argument would be the module object, but all we have is

147 // the module's dict, and it's safe to set it to NULL.

148 o = PyCFunction_NewEx(meth, NULL, NULL);

149 if (o && PyDict_SetItemString(dict, meth->ml_name, o) != 0)

150 {

clientmodule.cpp (https://github.com/Mutilador/Wolfpack.git) C++ · 190 lines

137

138 for (ml = &clientMethods[0]; ml->ml_name != NULL; ml++) {

139 PyObject *v = PyCFunction_NewEx(ml, 0, n);

140 if (v == NULL)

141 return;

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.

7

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

26 return NULL;

27 }

28 return PyCFunction_NewEx(qq_methoddef, NULL, NULL);

29 }

30

pygstexception.c (https://github.com/zaheerm/gst-python.git) C · 267 lines

70 goto exception;

71

72 func = PyCFunction_NewEx(method, NULL, module);

73 if (func == NULL)

74 goto exception;

descrobject.c (https://bitbucket.org/akruis/fg2python) C · 1625 lines

116 return NULL;

117 }

118 return PyCFunction_NewEx(descr->d_method, type, NULL);

119 }

120

126 if (descr_check((PyDescrObject *)descr, obj, &res))

127 return res;

128 return PyCFunction_NewEx(descr->d_method, obj, NULL);

129 }

130

240 }

241

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

76 METH_VARARGS, const_cast<char*>("")

77 };

78 scope().attr(reconstruct_func_name) = borrowed(PyCFunction_NewEx(

79 &def, NULL, getattr(scope(), "__name__").ptr()));

80 }

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

105

106 PyObject* pymname = PyString_FromString( PyModule_GetName( libpyroot_pymodule ) );

107 gExpand = PyCFunction_NewEx( &s_pdefExp, NULL, pymname );

108 Py_DECREF( pymname );

109 Bool_t isOk = PyObject_SetAttrString( libpyroot_pymodule, s_pdefExp.ml_name, gExpand ) == 0;

methodobject.h (https://github.com/jtauber/cleese.git) C Header · 57 lines

31 typedef struct PyMethodDef PyMethodDef;

32

33 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

34 PyObject *);

35

methodobject.h (https://github.com/ianloic/unladen-swallow.git) C Header · 118 lines

67 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *);

68

69 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

70 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

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

18 return NULL;

19 for (ml = methods; ml->ml_name != NULL; ml++) {

20 v = PyCFunction_NewEx(ml, passthrough, n);

21 if (v == NULL)

22 return NULL;

_dynfunc.c (https://github.com/agamdua/numba.git) C · 73 lines

36 desc->ml_doc = mldoc;

37

38 return PyCFunction_NewEx(desc, NULL, module);

39 }

40

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 ]

13

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

19

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

146 // Third argument would be the module object, but all we have is

147 // the module's dict, and it's safe to set it to NULL.

148 o = PyCFunction_NewEx(meth, nullptr, nullptr);

149 if (o && PyDict_SetItemString(dict, meth->ml_name, o) != 0)

150 {

pmethodobject.c (https://github.com/nodebox/nodebox-opengl.git) C · 141 lines

18

19 /* call PyCFunction_New() */

20 #ifdef PyCFunction_New /* Python >= 2.3 introduced PyCFunction_NewEx() */

21 newobj = psyco_generic_call(po, PyCFunction_NewEx,

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

41 PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, char *);

42

43 #define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL)

44 PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *,

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

76 METH_VARARGS, ""

77 };

78 scope().attr(reconstruct_func_name) = borrowed(PyCFunction_NewEx(

79 &def, NULL, getattr(scope(), "__name__").ptr()));

80 }

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 *);

7

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 *);

12

43

44 PyObject *

45 -PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)

46 +PyCFunction_NewEx(const PyMethodDef *ml, PyObject *self, PyObject *module)