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