Nuitka
The Python compiler
Loading...
Searching...
No Matches
HelpersJitSources.c
1// Copyright 2026, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
3// This file is included from another C file, help IDEs to still parse it on
4// its own.
5#ifdef __IDE_ONLY__
6#include "nuitka/prelude.h"
7#endif
8
9#if _NUITKA_STANDALONE_MODE
10
11static char const *uncompiled_sources_dict_attribute_name = "_uncompiled_function_sources_dict";
12
13void SET_UNCOMPILED_FUNCTION_SOURCE_DICT(PyObject *name, PyObject *source) {
14 PyObject *uncompiled_function_sources_dict =
15 PyObject_GetAttrString((PyObject *)builtin_module, uncompiled_sources_dict_attribute_name);
16
17 if (uncompiled_function_sources_dict == NULL) {
18 PyThreadState *tstate = PyThreadState_GET();
19
20 DROP_ERROR_OCCURRED(tstate);
21
22 uncompiled_function_sources_dict = MAKE_DICT_EMPTY(tstate);
23
24 PyObject_SetAttrString((PyObject *)builtin_module, uncompiled_sources_dict_attribute_name,
25 uncompiled_function_sources_dict);
26 }
27
28 bool res = DICT_SET_ITEM(uncompiled_function_sources_dict, name, source);
29 if (unlikely(res == false)) {
30 NUITKA_CANNOT_GET_HERE("Failed to update uncompiled function sources");
31 }
32}
33
34#endif
35
36// Part of "Nuitka", an optimizing Python compiler that is compatible and
37// integrates with CPython, but also works on its own.
38//
39// Licensed under the GNU Affero General Public License, Version 3 (the "License");
40// you may not use this file except in compliance with the License.
41// You may obtain a copy of the License at
42//
43// http://www.gnu.org/licenses/agpl.txt
44//
45// Unless required by applicable law or agreed to in writing, software
46// distributed under the License is distributed on an "AS IS" BASIS,
47// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48// See the License for the specific language governing permissions and
49// limitations under the License.