Nuitka
The Python compiler
Loading...
Searching...
No Matches
compiled_method.h
1// Copyright 2026, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
3#ifndef __NUITKA_COMPILED_METHOD_H__
4#define __NUITKA_COMPILED_METHOD_H__
5
6// Compiled function and compile generator types may be referenced.
7#include "compiled_function.h"
8#include "compiled_generator.h"
9
10// The backbone of the integration into CPython. Try to behave as well as normal
11// method objects, or even better.
12
13// The Nuitka_MethodObject is the storage associated with a compiled method
14// instance of which there can be many for each code.
15
17 /* Python object folklore: */
18 PyObject_HEAD
19
20 struct Nuitka_FunctionObject *m_function;
21
22 PyObject *m_weakrefs;
23
24 PyObject *m_object;
25 PyObject *m_class;
26
27#if PYTHON_VERSION >= 0x380
28 vectorcallfunc m_vectorcall;
29#endif
30};
31
32extern PyTypeObject Nuitka_Method_Type;
33
34// Make a method out of a function.
35extern PyObject *Nuitka_Method_New(struct Nuitka_FunctionObject *function, PyObject *object, PyObject *class_object);
36
37static inline bool Nuitka_Method_Check(PyObject *object) { return Py_TYPE(object) == &Nuitka_Method_Type; }
38
39#if _DEBUG_REFCOUNTS
40extern int count_active_Nuitka_Method_Type;
41extern int count_allocated_Nuitka_Method_Type;
42extern int count_released_Nuitka_Method_Type;
43#endif
44
45#endif
46
47// Part of "Nuitka", an optimizing Python compiler that is compatible and
48// integrates with CPython, but also works on its own.
49//
50// Licensed under the GNU Affero General Public License, Version 3 (the "License");
51// you may not use this file except in compliance with the License.
52// You may obtain a copy of the License at
53//
54// http://www.gnu.org/licenses/agpl.txt
55//
56// Unless required by applicable law or agreed to in writing, software
57// distributed under the License is distributed on an "AS IS" BASIS,
58// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
59// See the License for the specific language governing permissions and
60// limitations under the License.
Definition compiled_function.h:22
Definition compiled_method.h:16