Nuitka
The Python compiler
Loading...
Searching...
No Matches
compiled_method.h
1// Copyright 2025, 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#endif
40
41// Part of "Nuitka", an optimizing Python compiler that is compatible and
42// integrates with CPython, but also works on its own.
43//
44// Licensed under the Apache License, Version 2.0 (the "License");
45// you may not use this file except in compliance with the License.
46// You may obtain a copy of the License at
47//
48// http://www.apache.org/licenses/LICENSE-2.0
49//
50// Unless required by applicable law or agreed to in writing, software
51// distributed under the License is distributed on an "AS IS" BASIS,
52// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
53// See the License for the specific language governing permissions and
54// limitations under the License.
Definition compiled_function.h:22
Definition compiled_method.h:16