/HTML/S/2801.html
HTML | 356 lines | 356 code | 0 blank | 0 comment | 0 complexity | 674dc5115ae4625842501c17646ecb56 MD5 | raw file
- <html>
- <head>
- <title>Objects/methodobject.c</title>
- <meta name='robots' content='noindex,nofollow'>
- <meta name='generator' content='GLOBAL-5.8.1'>
- </head>
- <body text='#191970' bgcolor='#f5f5dc' vlink='gray'>
- <a name='TOP'><h2><a href='../mains.html'>root</a>/<a href='../files/3391.html'>Objects</a>/methodobject.c</h2>
- <i><font color='green'>/* [<][>]<a href='#L17'>[^]</a><a href='#L312'>[v]</a>[top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
- <hr>
- <h2>DEFINITIONS</h2>
- This source file includes following definitions.
- <ol>
- <li><a href='#L17' title='Defined at 17.'>PyCFunction_NewEx</a>
- <li><a href='#L41' title='Defined at 41.'>PyCFunction_GetFunction</a>
- <li><a href='#L51' title='Defined at 51.'>PyCFunction_GetSelf</a>
- <li><a href='#L61' title='Defined at 61.'>PyCFunction_GetFlags</a>
- <li><a href='#L71' title='Defined at 71.'>PyCFunction_Call</a>
- <li><a href='#L122' title='Defined at 122.'>meth_dealloc</a>
- <li><a href='#L138' title='Defined at 138.'>meth_get__doc__</a>
- <li><a href='#L149' title='Defined at 149.'>meth_get__name__</a>
- <li><a href='#L155' title='Defined at 155.'>meth_traverse</a>
- <li><a href='#L163' title='Defined at 163.'>meth_get__self__</a>
- <li><a href='#L189' title='Defined at 189.'>meth_repr</a>
- <li><a href='#L201' title='Defined at 201.'>meth_richcompare</a>
- <li><a href='#L228' title='Defined at 228.'>meth_hash</a>
- <li><a href='#L286' title='Defined at 286.'>PyCFunction_ClearFreeList</a>
- <li><a href='#L301' title='Defined at 301.'>PyCFunction_Fini</a>
- <li><a href='#L312' title='Defined at 312.'>PyAPI_FUNC</a>
- </ol>
- <hr>
- <pre>
- <a name='L1'>
- <a name='L2'><i><font color='green'>/* Method object implementation */</font></i>
- <a name='L3'>
- <a name='L4'><font color='darkred'>#include</font> "<a href='570.html'>Python.h</a>"
- <a name='L5'><font color='darkred'>#include</font> "<a href='577.html'>structmember.h</a>"
- <a name='L6'>
- <a name='L7'><i><font color='green'>/* Free list for method objects to safe malloc/free overhead</font></i>
- <a name='L8'><i><font color='green'> * The m_self element is used to chain the objects.</font></i>
- <a name='L9'><i><font color='green'> */</font></i>
- <a name='L10'><b>static</b> PyCFunctionObject *free_list = <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L11'><b>static</b> <b>int</b> numfree = 0;
- <a name='L12'><font color='darkred'>#ifndef</font> <a href='../S/2801.html#L13' title='Defined at 13 in Objects/methodobject.c.'>PyCFunction_MAXFREELIST</a>
- <a name='L13'><font color='darkred'>#define</font> <a href='../R/2604.html' title='Multiple refered from 2 places.'>PyCFunction_MAXFREELIST</a> 256
- <a name='L14'><font color='darkred'>#endif</font>
- <a name='L15'>
- <a name='L16'><a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L17'><a href='../R/2606.html' title='Multiple refered from 3 places.'>PyCFunction_NewEx</a>(PyMethodDef *ml, PyObject *self, PyObject *module)
- <a name='L18'><font color='red'>{</font>
- <a name='L19'> PyCFunctionObject *op;
- <a name='L20'> op = free_list;
- <a name='L21'> <b>if</b> (op != <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>) <font color='red'>{</font>
- <a name='L22'> free_list = (PyCFunctionObject *)(op->m_self);
- <a name='L23'> PyObject_INIT(op, &PyCFunction_Type);
- <a name='L24'> numfree--;
- <a name='L25'> <font color='red'>}</font>
- <a name='L26'> <b>else</b> <font color='red'>{</font>
- <a name='L27'> op = PyObject_GC_New(PyCFunctionObject, &PyCFunction_Type);
- <a name='L28'> <b>if</b> (op == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>)
- <a name='L29'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L30'> <font color='red'>}</font>
- <a name='L31'> op->m_ml = ml;
- <a name='L32'> <a href='../S/544.html#L766' title='Defined at 766 in Include/object.h.'>Py_XINCREF</a>(self);
- <a name='L33'> op->m_self = self;
- <a name='L34'> <a href='../S/544.html#L766' title='Defined at 766 in Include/object.h.'>Py_XINCREF</a>(module);
- <a name='L35'> op->m_module = module;
- <a name='L36'> <a href='../S/545.html#L266' title='Defined at 266 in Include/objimpl.h.'>_PyObject_GC_TRACK</a>(op);
- <a name='L37'> <b>return</b> (<a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *)op;
- <a name='L38'><font color='red'>}</font>
- <a name='L39'>
- <a name='L40'>PyCFunction
- <a name='L41'><a href='../S/2576.html#L1182' title='Refered from 1182 in Modules/_json.c.'>PyCFunction_GetFunction</a>(PyObject *op)
- <a name='L42'><font color='red'>{</font>
- <a name='L43'> <b>if</b> (!PyCFunction_Check(op)) <font color='red'>{</font>
- <a name='L44'> <a href='../D/3142.html' title='Multiple defined in 3 places.'>PyErr_BadInternalCall</a>();
- <a name='L45'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L46'> <font color='red'>}</font>
- <a name='L47'> <b>return</b> ((PyCFunctionObject *)op) -> m_ml -> ml_meth;
- <a name='L48'><font color='red'>}</font>
- <a name='L49'>
- <a name='L50'><a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L51'>PyCFunction_GetSelf(PyObject *op)
- <a name='L52'><font color='red'>{</font>
- <a name='L53'> <b>if</b> (!PyCFunction_Check(op)) <font color='red'>{</font>
- <a name='L54'> <a href='../D/3142.html' title='Multiple defined in 3 places.'>PyErr_BadInternalCall</a>();
- <a name='L55'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L56'> <font color='red'>}</font>
- <a name='L57'> <b>return</b> ((PyCFunctionObject *)op) -> m_self;
- <a name='L58'><font color='red'>}</font>
- <a name='L59'>
- <a name='L60'><b>int</b>
- <a name='L61'>PyCFunction_GetFlags(PyObject *op)
- <a name='L62'><font color='red'>{</font>
- <a name='L63'> <b>if</b> (!PyCFunction_Check(op)) <font color='red'>{</font>
- <a name='L64'> <a href='../D/3142.html' title='Multiple defined in 3 places.'>PyErr_BadInternalCall</a>();
- <a name='L65'> <b>return</b> -1;
- <a name='L66'> <font color='red'>}</font>
- <a name='L67'> <b>return</b> ((PyCFunctionObject *)op) -> m_ml -> ml_flags;
- <a name='L68'><font color='red'>}</font>
- <a name='L69'>
- <a name='L70'><a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L71'><a href='../R/2600.html' title='Multiple refered from 4 places.'>PyCFunction_Call</a>(PyObject *func, PyObject *arg, PyObject *kw)
- <a name='L72'><font color='red'>{</font>
- <a name='L73'> PyCFunctionObject* f = (PyCFunctionObject*)func;
- <a name='L74'> PyCFunction meth = PyCFunction_GET_FUNCTION(func);
- <a name='L75'> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *self = PyCFunction_GET_SELF(func);
- <a name='L76'> <a href='../D/4364.html' title='Multiple defined in 6 places.'>Py_ssize_t</a> size;
- <a name='L77'>
- <a name='L78'> <b>switch</b> (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) <font color='red'>{</font>
- <a name='L79'> <b>case</b> <a href='../S/2858.html#L633' title='Defined at 633 in PC/bdist_wininst/install.c.'>METH_VARARGS</a>:
- <a name='L80'> <b>if</b> (kw == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a> || <a href='../S/2787.html#L1620' title='Defined at 1620 in Objects/dictobject.c.'>PyDict_Size</a>(kw) == 0)
- <a name='L81'> <b>return</b> (*meth)(self, <a href='../D/6730.html' title='Multiple defined in 2 places.'>arg</a>);
- <a name='L82'> <b>break</b>;
- <a name='L83'> <b>case</b> <a href='../S/2858.html#L633' title='Defined at 633 in PC/bdist_wininst/install.c.'>METH_VARARGS</a> | METH_KEYWORDS:
- <a name='L84'> <b>return</b> (*(PyCFunctionWithKeywords)meth)(self, <a href='../D/6730.html' title='Multiple defined in 2 places.'>arg</a>, kw);
- <a name='L85'> <b>case</b> <a href='../S/2858.html#L634' title='Defined at 634 in PC/bdist_wininst/install.c.'>METH_NOARGS</a>:
- <a name='L86'> <b>if</b> (kw == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a> || <a href='../S/2787.html#L1620' title='Defined at 1620 in Objects/dictobject.c.'>PyDict_Size</a>(kw) == 0) <font color='red'>{</font>
- <a name='L87'> size = PyTuple_GET_SIZE(<a href='../D/6730.html' title='Multiple defined in 2 places.'>arg</a>);
- <a name='L88'> <b>if</b> (size == 0)
- <a name='L89'> <b>return</b> (*meth)(self, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>);
- <a name='L90'> <a href='../S/3106.html#L600' title='Defined at 600 in Python/errors.c.'>PyErr_Format</a>(PyExc_TypeError,
- <a name='L91'> "%.200s() takes no arguments (%zd given)",
- <a name='L92'> f->m_ml->ml_name, size);
- <a name='L93'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L94'> <font color='red'>}</font>
- <a name='L95'> <b>break</b>;
- <a name='L96'> <b>case</b> METH_O:
- <a name='L97'> <b>if</b> (kw == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a> || <a href='../S/2787.html#L1620' title='Defined at 1620 in Objects/dictobject.c.'>PyDict_Size</a>(kw) == 0) <font color='red'>{</font>
- <a name='L98'> size = PyTuple_GET_SIZE(<a href='../D/6730.html' title='Multiple defined in 2 places.'>arg</a>);
- <a name='L99'> <b>if</b> (size == 1)
- <a name='L100'> <b>return</b> (*meth)(self, PyTuple_GET_ITEM(<a href='../D/6730.html' title='Multiple defined in 2 places.'>arg</a>, 0));
- <a name='L101'> <a href='../S/3106.html#L600' title='Defined at 600 in Python/errors.c.'>PyErr_Format</a>(PyExc_TypeError,
- <a name='L102'> "%.200s() takes exactly one argument (%zd given)",
- <a name='L103'> f->m_ml->ml_name, size);
- <a name='L104'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L105'> <font color='red'>}</font>
- <a name='L106'> <b>break</b>;
- <a name='L107'> <b>default</b>:
- <a name='L108'> <a href='../S/3106.html#L122' title='Defined at 122 in Python/errors.c.'>PyErr_SetString</a>(PyExc_SystemError, "Bad call flags in "
- <a name='L109'> "PyCFunction_Call. METH_OLDARGS is no "
- <a name='L110'> "longer supported!");
- <a name='L111'>
- <a name='L112'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L113'> <font color='red'>}</font>
- <a name='L114'> <a href='../S/3106.html#L600' title='Defined at 600 in Python/errors.c.'>PyErr_Format</a>(PyExc_TypeError, "%.200s() takes no keyword arguments",
- <a name='L115'> f->m_ml->ml_name);
- <a name='L116'> <b>return</b> <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>;
- <a name='L117'><font color='red'>}</font>
- <a name='L118'>
- <a name='L119'><i><font color='green'>/* Methods (the standard built-in methods, that is) */</font></i>
- <a name='L120'>
- <a name='L121'><b>static</b> <b>void</b>
- <a name='L122'><a href='../S/2801.html#L253' title='Refered from 253 in Objects/methodobject.c.'>meth_dealloc</a>(PyCFunctionObject *m)
- <a name='L123'><font color='red'>{</font>
- <a name='L124'> <a href='../S/545.html#L281' title='Defined at 281 in Include/objimpl.h.'>_PyObject_GC_UNTRACK</a>(m);
- <a name='L125'> <a href='../S/544.html#L767' title='Defined at 767 in Include/object.h.'>Py_XDECREF</a>(m->m_self);
- <a name='L126'> <a href='../S/544.html#L767' title='Defined at 767 in Include/object.h.'>Py_XDECREF</a>(m->m_module);
- <a name='L127'> <b>if</b> (numfree < <a href='../S/2801.html#L13' title='Defined at 13 in Objects/methodobject.c.'>PyCFunction_MAXFREELIST</a>) <font color='red'>{</font>
- <a name='L128'> m->m_self = (<a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *)free_list;
- <a name='L129'> free_list = m;
- <a name='L130'> numfree++;
- <a name='L131'> <font color='red'>}</font>
- <a name='L132'> <b>else</b> <font color='red'>{</font>
- <a name='L133'> <a href='../D/3617.html' title='Multiple defined in 2 places.'>PyObject_GC_Del</a>(m);
- <a name='L134'> <font color='red'>}</font>
- <a name='L135'><font color='red'>}</font>
- <a name='L136'>
- <a name='L137'><b>static</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L138'><a href='../S/2801.html#L175' title='Refered from 175 in Objects/methodobject.c.'>meth_get__doc__</a>(PyCFunctionObject *m, <b>void</b> *closure)
- <a name='L139'><font color='red'>{</font>
- <a name='L140'> <b>const</b> <b>char</b> *doc = m->m_ml->ml_doc;
- <a name='L141'>
- <a name='L142'> <b>if</b> (doc != <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>)
- <a name='L143'> <b>return</b> <a href='../D/4012.html' title='Multiple defined in 3 places.'>PyUnicode_FromString</a>(doc);
- <a name='L144'> Py_INCREF(Py_None);
- <a name='L145'> <b>return</b> Py_None;
- <a name='L146'><font color='red'>}</font>
- <a name='L147'>
- <a name='L148'><b>static</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L149'><a href='../S/2801.html#L176' title='Refered from 176 in Objects/methodobject.c.'>meth_get__name__</a>(PyCFunctionObject *m, <b>void</b> *closure)
- <a name='L150'><font color='red'>{</font>
- <a name='L151'> <b>return</b> <a href='../D/4012.html' title='Multiple defined in 3 places.'>PyUnicode_FromString</a>(m->m_ml->ml_name);
- <a name='L152'><font color='red'>}</font>
- <a name='L153'>
- <a name='L154'><b>static</b> <b>int</b>
- <a name='L155'><a href='../S/2801.html#L270' title='Refered from 270 in Objects/methodobject.c.'>meth_traverse</a>(PyCFunctionObject *m, visitproc visit, <b>void</b> *arg)
- <a name='L156'><font color='red'>{</font>
- <a name='L157'> Py_VISIT(m->m_self);
- <a name='L158'> Py_VISIT(m->m_module);
- <a name='L159'> <b>return</b> 0;
- <a name='L160'><font color='red'>}</font>
- <a name='L161'>
- <a name='L162'><b>static</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L163'><a href='../S/2801.html#L177' title='Refered from 177 in Objects/methodobject.c.'>meth_get__self__</a>(PyCFunctionObject *m, <b>void</b> *closure)
- <a name='L164'><font color='red'>{</font>
- <a name='L165'> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *self;
- <a name='L166'>
- <a name='L167'> self = m->m_self;
- <a name='L168'> <b>if</b> (self == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>)
- <a name='L169'> self = Py_None;
- <a name='L170'> Py_INCREF(self);
- <a name='L171'> <b>return</b> self;
- <a name='L172'><font color='red'>}</font>
- <a name='L173'>
- <a name='L174'><b>static</b> <a href='../D/3272.html' title='Multiple defined in 2 places.'>PyGetSetDef</a> meth_getsets [] = <font color='red'>{</font>
- <a name='L175'> <font color='red'>{</font>"__doc__", (getter)<a href='../S/2801.html#L138' title='Defined at 138 in Objects/methodobject.c.'>meth_get__doc__</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a><font color='red'>}</font>,
- <a name='L176'> <font color='red'>{</font>"__name__", (getter)<a href='../S/2801.html#L149' title='Defined at 149 in Objects/methodobject.c.'>meth_get__name__</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a><font color='red'>}</font>,
- <a name='L177'> <font color='red'>{</font>"__self__", (getter)<a href='../S/2801.html#L163' title='Defined at 163 in Objects/methodobject.c.'>meth_get__self__</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a><font color='red'>}</font>,
- <a name='L178'> <font color='red'>{</font>0<font color='red'>}</font>
- <a name='L179'><font color='red'>}</font>;
- <a name='L180'>
- <a name='L181'><font color='darkred'>#define</font> <a href='../R/2175.html' title='Multiple refered from 57 places.'>OFF</a>(x) <a href='../D/10194.html' title='Multiple defined in 2 places.'>offsetof</a>(PyCFunctionObject, x)
- <a name='L182'>
- <a name='L183'><b>static</b> <a href='../D/3506.html' title='Multiple defined in 2 places.'>PyMemberDef</a> meth_members[] = <font color='red'>{</font>
- <a name='L184'> <font color='red'>{</font>"__module__", <a href='../S/577.html#L44' title='Defined at 44 in Include/structmember.h.'>T_OBJECT</a>, <a href='../D/2402.html' title='Multiple defined in 16 places.'>OFF</a>(m_module), <a href='../S/577.html#L75' title='Defined at 75 in Include/structmember.h.'>PY_WRITE_RESTRICTED</a><font color='red'>}</font>,
- <a name='L185'> <font color='red'>{</font><a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a><font color='red'>}</font>
- <a name='L186'><font color='red'>}</font>;
- <a name='L187'>
- <a name='L188'><b>static</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L189'><a href='../S/2801.html#L258' title='Refered from 258 in Objects/methodobject.c.'>meth_repr</a>(PyCFunctionObject *m)
- <a name='L190'><font color='red'>{</font>
- <a name='L191'> <b>if</b> (m->m_self == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a> || PyModule_Check(m->m_self))
- <a name='L192'> <b>return</b> <a href='../D/4008.html' title='Multiple defined in 3 places.'>PyUnicode_FromFormat</a>("<built-in function %s>",
- <a name='L193'> m->m_ml->ml_name);
- <a name='L194'> <b>return</b> <a href='../D/4008.html' title='Multiple defined in 3 places.'>PyUnicode_FromFormat</a>("<built-in method %s of %s object at %p>",
- <a name='L195'> m->m_ml->ml_name,
- <a name='L196'> m->m_self->ob_type->tp_name,
- <a name='L197'> m->m_self);
- <a name='L198'><font color='red'>}</font>
- <a name='L199'>
- <a name='L200'><b>static</b> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *
- <a name='L201'><a href='../S/2801.html#L272' title='Refered from 272 in Objects/methodobject.c.'>meth_richcompare</a>(PyObject *self, PyObject *other, <b>int</b> op)
- <a name='L202'><font color='red'>{</font>
- <a name='L203'> PyCFunctionObject *a, *<a href='../D/6949.html' title='Multiple defined in 12 places.'>b</a>;
- <a name='L204'> <a href='../D/3593.html' title='Multiple defined in 2 places.'>PyObject</a> *res;
- <a name='L205'> <b>int</b> eq;
- <a name='L206'>
- <a name='L207'> <b>if</b> ((op != <a href='../S/546.html#L151' title='Defined at 151 in Include/opcode.h.'>Py_EQ</a> && op != <a href='../S/546.html#L151' title='Defined at 151 in Include/opcode.h.'>Py_NE</a>) ||
- <a name='L208'> !PyCFunction_Check(self) ||
- <a name='L209'> !PyCFunction_Check(<a href='../S/2669.html#L1431' title='Defined at 1431 in Modules/expat/xmltok_impl.c.'>other</a>))
- <a name='L210'> <font color='red'>{</font>
- <a name='L211'> Py_INCREF(Py_NotImplemented);
- <a name='L212'> <b>return</b> Py_NotImplemented;
- <a name='L213'> <font color='red'>}</font>
- <a name='L214'> a = (PyCFunctionObject *)self;
- <a name='L215'> <a href='../D/6949.html' title='Multiple defined in 12 places.'>b</a> = (PyCFunctionObject *)<a href='../S/2669.html#L1431' title='Defined at 1431 in Modules/expat/xmltok_impl.c.'>other</a>;
- <a name='L216'> eq = a->m_self == <a href='../D/6949.html' title='Multiple defined in 12 places.'>b</a>->m_self;
- <a name='L217'> <b>if</b> (eq)
- <a name='L218'> eq = a->m_ml->ml_meth == <a href='../D/6949.html' title='Multiple defined in 12 places.'>b</a>->m_ml->ml_meth;
- <a name='L219'> <b>if</b> (op == <a href='../S/546.html#L151' title='Defined at 151 in Include/opcode.h.'>Py_EQ</a>)
- <a name='L220'> res = eq ? Py_True : Py_False;
- <a name='L221'> <b>else</b>
- <a name='L222'> res = eq ? Py_False : Py_True;
- <a name='L223'> Py_INCREF(res);
- <a name='L224'> <b>return</b> res;
- <a name='L225'><font color='red'>}</font>
- <a name='L226'>
- <a name='L227'><b>static</b> <a href='../S/565.html#L186' title='Defined at 186 in Include/pyport.h.'>Py_hash_t</a>
- <a name='L228'><a href='../S/2801.html#L262' title='Refered from 262 in Objects/methodobject.c.'>meth_hash</a>(PyCFunctionObject *a)
- <a name='L229'><font color='red'>{</font>
- <a name='L230'> <a href='../S/565.html#L186' title='Defined at 186 in Include/pyport.h.'>Py_hash_t</a> x, y;
- <a name='L231'> <b>if</b> (a->m_self == <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>)
- <a name='L232'> x = 0;
- <a name='L233'> <b>else</b> <font color='red'>{</font>
- <a name='L234'> x = <a href='../S/2803.html#L758' title='Defined at 758 in Objects/object.c.'>PyObject_Hash</a>(a->m_self);
- <a name='L235'> <b>if</b> (x == -1)
- <a name='L236'> <b>return</b> -1;
- <a name='L237'> <font color='red'>}</font>
- <a name='L238'> y = <a href='../S/2803.html#L736' title='Defined at 736 in Objects/object.c.'>_Py_HashPointer</a>((<b>void</b>*)(a->m_ml->ml_meth));
- <a name='L239'> <b>if</b> (y == -1)
- <a name='L240'> <b>return</b> -1;
- <a name='L241'> x ^= y;
- <a name='L242'> <b>if</b> (x == -1)
- <a name='L243'> x = -2;
- <a name='L244'> <b>return</b> x;
- <a name='L245'><font color='red'>}</font>
- <a name='L246'>
- <a name='L247'>
- <a name='L248'><a href='../D/3899.html' title='Multiple defined in 3 places.'>PyTypeObject</a> PyCFunction_Type = <font color='red'>{</font>
- <a name='L249'> <a href='../D/4042.html' title='Multiple defined in 3 places.'>PyVarObject_HEAD_INIT</a>(&PyType_Type, 0)
- <a name='L250'> "builtin_function_or_method",
- <a name='L251'> <b>sizeof</b>(PyCFunctionObject),
- <a name='L252'> 0,
- <a name='L253'> (<a href='../D/8095.html' title='Multiple defined in 2 places.'>destructor</a>)<a href='../S/2801.html#L122' title='Defined at 122 in Objects/methodobject.c.'>meth_dealloc</a>, <i><font color='green'>/* tp_dealloc */</font></i>
- <a name='L254'> 0, <i><font color='green'>/* tp_print */</font></i>
- <a name='L255'> 0, <i><font color='green'>/* tp_getattr */</font></i>
- <a name='L256'> 0, <i><font color='green'>/* tp_setattr */</font></i>
- <a name='L257'> 0, <i><font color='green'>/* tp_reserved */</font></i>
- <a name='L258'> (reprfunc)<a href='../S/2801.html#L189' title='Defined at 189 in Objects/methodobject.c.'>meth_repr</a>, <i><font color='green'>/* tp_repr */</font></i>
- <a name='L259'> 0, <i><font color='green'>/* tp_as_number */</font></i>
- <a name='L260'> 0, <i><font color='green'>/* tp_as_sequence */</font></i>
- <a name='L261'> 0, <i><font color='green'>/* tp_as_mapping */</font></i>
- <a name='L262'> (hashfunc)<a href='../S/2801.html#L228' title='Defined at 228 in Objects/methodobject.c.'>meth_hash</a>, <i><font color='green'>/* tp_hash */</font></i>
- <a name='L263'> <a href='../S/2801.html#L71' title='Defined at 71 in Objects/methodobject.c.'>PyCFunction_Call</a>, <i><font color='green'>/* tp_call */</font></i>
- <a name='L264'> 0, <i><font color='green'>/* tp_str */</font></i>
- <a name='L265'> <a href='../S/2803.html#L1046' title='Defined at 1046 in Objects/object.c.'>PyObject_GenericGetAttr</a>, <i><font color='green'>/* tp_getattro */</font></i>
- <a name='L266'> 0, <i><font color='green'>/* tp_setattro */</font></i>
- <a name='L267'> 0, <i><font color='green'>/* tp_as_buffer */</font></i>
- <a name='L268'> Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,<i><font color='green'>/* tp_flags */</font></i>
- <a name='L269'> 0, <i><font color='green'>/* tp_doc */</font></i>
- <a name='L270'> (traverseproc)<a href='../S/2801.html#L155' title='Defined at 155 in Objects/methodobject.c.'>meth_traverse</a>, <i><font color='green'>/* tp_traverse */</font></i>
- <a name='L271'> 0, <i><font color='green'>/* tp_clear */</font></i>
- <a name='L272'> <a href='../S/2801.html#L201' title='Defined at 201 in Objects/methodobject.c.'>meth_richcompare</a>, <i><font color='green'>/* tp_richcompare */</font></i>
- <a name='L273'> 0, <i><font color='green'>/* tp_weaklistoffset */</font></i>
- <a name='L274'> 0, <i><font color='green'>/* tp_iter */</font></i>
- <a name='L275'> 0, <i><font color='green'>/* tp_iternext */</font></i>
- <a name='L276'> 0, <i><font color='green'>/* tp_methods */</font></i>
- <a name='L277'> meth_members, <i><font color='green'>/* tp_members */</font></i>
- <a name='L278'> meth_getsets, <i><font color='green'>/* tp_getset */</font></i>
- <a name='L279'> 0, <i><font color='green'>/* tp_base */</font></i>
- <a name='L280'> 0, <i><font color='green'>/* tp_dict */</font></i>
- <a name='L281'><font color='red'>}</font>;
- <a name='L282'>
- <a name='L283'><i><font color='green'>/* Clear out the free list */</font></i>
- <a name='L284'>
- <a name='L285'><b>int</b>
- <a name='L286'><a href='../R/2601.html' title='Multiple refered from 2 places.'>PyCFunction_ClearFreeList</a>(<b>void</b>)
- <a name='L287'><font color='red'>{</font>
- <a name='L288'> <b>int</b> freelist_size = numfree;
- <a name='L289'>
- <a name='L290'> <b>while</b> (free_list) <font color='red'>{</font>
- <a name='L291'> PyCFunctionObject *v = free_list;
- <a name='L292'> free_list = (PyCFunctionObject *)(v->m_self);
- <a name='L293'> <a href='../D/3617.html' title='Multiple defined in 2 places.'>PyObject_GC_Del</a>(v);
- <a name='L294'> numfree--;
- <a name='L295'> <font color='red'>}</font>
- <a name='L296'> <a href='../D/6814.html' title='Multiple defined in 2 places.'>assert</a>(numfree == 0);
- <a name='L297'> <b>return</b> freelist_size;
- <a name='L298'><font color='red'>}</font>
- <a name='L299'>
- <a name='L300'><b>void</b>
- <a name='L301'><a href='../S/3138.html#L497' title='Refered from 497 in Python/pythonrun.c.'>PyCFunction_Fini</a>(<b>void</b>)
- <a name='L302'><font color='red'>{</font>
- <a name='L303'> (<b>void</b>)<a href='../S/2801.html#L286' title='Defined at 286 in Objects/methodobject.c.'>PyCFunction_ClearFreeList</a>();
- <a name='L304'><font color='red'>}</font>
- <a name='L305'>
- <a name='L306'><i><font color='green'>/* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(),</font></i>
- <a name='L307'><i><font color='green'> but it's part of the API so we need to keep a function around that</font></i>
- <a name='L308'><i><font color='green'> existing C extensions can call.</font></i>
- <a name='L309'><i><font color='green'>*/</font></i>
- <a name='L310'>
- <a name='L311'><font color='darkred'>#undef</font> <a href='../R/2605.html' title='Multiple refered from 13 places.'>PyCFunction_New</a>
- <a name='L312'><a href='../R/2475.html' title='Multiple refered from 87 places.'>PyAPI_FUNC</a>(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);
- <a name='L313'>
- <a name='L314'>PyObject *
- <a name='L315'>PyCFunction_New(PyMethodDef *ml, PyObject *self)
- <a name='L316'><font color='red'>{</font>
- <a name='L317'> <b>return</b> <a href='../S/2801.html#L17' title='Defined at 17 in Objects/methodobject.c.'>PyCFunction_NewEx</a>(ml, self, <a href='../S/2891.html#L5' title='Defined at 5 in PC/os2emx/dllentry.c.'>NULL</a>);
- <a name='L318'><font color='red'>}</font>
- </pre>
- <hr>
- <a name='BOTTOM'>
- <i><font color='green'>/* [<][>]<a href='#L17'>[^]</a><a href='#L312'>[v]</a><a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</font></i>
- </body>
- </html>