Nuitka-winsvc 1.9.3__cp312-cp312-win_amd64.whl → 1.9.6__cp312-cp312-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of Nuitka-winsvc might be problematic. Click here for more details.
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/RECORD +48 -46
- nuitka/MainControl.py +4 -4
- nuitka/Options.py +6 -1
- nuitka/PythonFlavors.py +13 -0
- nuitka/PythonVersions.py +6 -1
- nuitka/Version.py +1 -1
- nuitka/build/Backend.scons +2 -0
- nuitka/build/SconsCompilerSettings.py +3 -0
- nuitka/build/SconsUtils.py +21 -11
- nuitka/build/include/nuitka/safe_string_ops.h +2 -0
- nuitka/build/static_src/CompiledFunctionType.c +0 -5
- nuitka/build/static_src/CompiledMethodType.c +0 -5
- nuitka/build/static_src/HelpersComparisonEq.c +2 -2
- nuitka/build/static_src/HelpersComparisonGe.c +2 -2
- nuitka/build/static_src/HelpersComparisonGt.c +2 -2
- nuitka/build/static_src/HelpersComparisonLe.c +2 -2
- nuitka/build/static_src/HelpersComparisonLt.c +2 -2
- nuitka/build/static_src/HelpersComparisonNe.c +2 -2
- nuitka/build/static_src/HelpersDictionariesGenerated.c +1 -1
- nuitka/build/static_src/HelpersFilesystemPaths.c +1 -1
- nuitka/build/static_src/HelpersSafeStrings.c +1 -1
- nuitka/build/static_src/MainProgram.c +0 -1
- nuitka/build/static_src/MetaPathBasedLoader.c +1 -1
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +11 -0
- nuitka/code_generation/templates/CodeTemplatesModules.py +18 -1
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +1 -1
- nuitka/code_generation/templates_c/HelperLongTools.c.j2 +1 -1
- nuitka/distutils/DistutilCommands.py +3 -1
- nuitka/nodes/PackageMetadataNodes.py +2 -3
- nuitka/plugins/PluginBase.py +8 -10
- nuitka/plugins/standard/DillPlugin/DillPlugin.c +37 -0
- nuitka/plugins/standard/DillPlugin/dill-postLoad.py +249 -0
- nuitka/plugins/standard/DillPlugin.py +11 -23
- nuitka/plugins/standard/ImplicitImports.py +1 -0
- nuitka/plugins/standard/OptionsNannyPlugin.py +1 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +45 -8
- nuitka/reports/Reports.py +12 -0
- nuitka/utils/Distributions.py +7 -14
- nuitka/utils/FileOperations.py +15 -0
- nuitka/utils/Utils.py +8 -0
- nuitka/utils/WindowsResources.py +6 -1
- {Nuitka_winsvc-1.9.3.data → Nuitka_winsvc-1.9.6.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.9.3.data → Nuitka_winsvc-1.9.6.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/WHEEL +0 -0
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.9.3.dist-info → Nuitka_winsvc-1.9.6.dist-info}/top_level.txt +0 -0
|
@@ -749,7 +749,7 @@ bool expandTemplatePathW(wchar_t *target, wchar_t const *source, size_t buffer_s
|
|
|
749
749
|
}
|
|
750
750
|
} else if (wcsicmp(var_name, L"PID") == 0) {
|
|
751
751
|
char pid_buffer[128];
|
|
752
|
-
snprintf(pid_buffer, sizeof(pid_buffer), "%
|
|
752
|
+
snprintf(pid_buffer, sizeof(pid_buffer), "%ld", GetCurrentProcessId());
|
|
753
753
|
|
|
754
754
|
appendStringSafeW(target, pid_buffer, buffer_size);
|
|
755
755
|
} else if (wcsicmp(var_name, L"HOME") == 0) {
|
|
@@ -133,7 +133,7 @@ void printOSErrorMessage(char const *message, error_code_t error_code) {
|
|
|
133
133
|
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
|
|
134
134
|
error_code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (LPTSTR)&err_buffer, 0, NULL);
|
|
135
135
|
|
|
136
|
-
fprintf(stderr, "%s ([Error
|
|
136
|
+
fprintf(stderr, "%s ([Error " ERROR_CODE_FORMAT_STR "] %s)\n", message, error_code, err_buffer);
|
|
137
137
|
#else
|
|
138
138
|
fprintf(stderr, "%s: %s\n", message, strerror(error_code));
|
|
139
139
|
#endif
|
|
@@ -64,7 +64,7 @@ static inline bool isVerbose(void) { return false; }
|
|
|
64
64
|
static struct Nuitka_MetaPathBasedLoaderEntry *loader_entries = NULL;
|
|
65
65
|
|
|
66
66
|
static bool hasFrozenModule(char const *name) {
|
|
67
|
-
for (struct _frozen const *p = PyImport_FrozenModules
|
|
67
|
+
for (struct _frozen const *p = PyImport_FrozenModules; p != NULL; p++) {
|
|
68
68
|
if (p->name == NULL) {
|
|
69
69
|
return false;
|
|
70
70
|
}
|
|
@@ -221,6 +221,16 @@ static PyObject *Nuitka_ResourceReaderFiles_read_text(struct Nuitka_ResourceRead
|
|
|
221
221
|
return result;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
+
static PyObject *Nuitka_ResourceReaderFiles_exists(struct Nuitka_ResourceReaderFilesObject *files, PyObject *args,
|
|
225
|
+
PyObject *kwds) {
|
|
226
|
+
|
|
227
|
+
PyThreadState *tstate = PyThreadState_GET();
|
|
228
|
+
PyObject *file_name = _Nuitka_ResourceReaderFiles_GetPath(tstate, files);
|
|
229
|
+
PyObject *result = OS_PATH_FILE_EXISTS(tstate, file_name);
|
|
230
|
+
Py_DECREF(file_name);
|
|
231
|
+
return result;
|
|
232
|
+
}
|
|
233
|
+
|
|
224
234
|
// @abc.abstractmethod
|
|
225
235
|
// def is_dir(self) -> bool:
|
|
226
236
|
// """
|
|
@@ -451,6 +461,7 @@ static PyMethodDef Nuitka_ResourceReaderFiles_methods[] = {
|
|
|
451
461
|
{"iterdir", (PyCFunction)Nuitka_ResourceReaderFiles_iterdir, METH_NOARGS, NULL},
|
|
452
462
|
{"read_bytes", (PyCFunction)Nuitka_ResourceReaderFiles_read_bytes, METH_NOARGS, NULL},
|
|
453
463
|
{"read_text", (PyCFunction)Nuitka_ResourceReaderFiles_read_text, METH_VARARGS | METH_KEYWORDS, NULL},
|
|
464
|
+
{"exists", (PyCFunction)Nuitka_ResourceReaderFiles_exists, METH_NOARGS, NULL},
|
|
454
465
|
{"is_dir", (PyCFunction)Nuitka_ResourceReaderFiles_is_dir, METH_NOARGS, NULL},
|
|
455
466
|
{"is_file", (PyCFunction)Nuitka_ResourceReaderFiles_is_file, METH_NOARGS, NULL},
|
|
456
467
|
{"joinpath", (PyCFunction)Nuitka_ResourceReaderFiles_joinpath, METH_VARARGS | METH_KEYWORDS, NULL},
|
|
@@ -308,12 +308,29 @@ PyObject *modulecode_%(module_identifier)s(PyThreadState *tstate, PyObject *modu
|
|
|
308
308
|
init_done = true;
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
+
#if defined(_NUITKA_MODULE) && %(is_top)d
|
|
312
|
+
PyObject *pre_load = IMPORT_EMBEDDED_MODULE(tstate, %(module_name_cstr)s "-preLoad");
|
|
313
|
+
if (pre_load == NULL) {
|
|
314
|
+
return NULL;
|
|
315
|
+
}
|
|
316
|
+
#endif
|
|
317
|
+
|
|
311
318
|
// PRINT_STRING("in init%(module_identifier)s\n");
|
|
312
319
|
|
|
313
320
|
moduledict_%(module_identifier)s = MODULE_DICT(module_%(module_identifier)s);
|
|
314
321
|
|
|
315
322
|
#ifdef _NUITKA_PLUGIN_DILL_ENABLED
|
|
316
|
-
|
|
323
|
+
{
|
|
324
|
+
char const *module_name_c;
|
|
325
|
+
if (loader_entry != NULL) {
|
|
326
|
+
module_name_c = loader_entry->name;
|
|
327
|
+
} else {
|
|
328
|
+
PyObject *module_name = GET_STRING_DICT_VALUE(moduledict_%(module_identifier)s, (Nuitka_StringObject *)const_str_plain___name__);
|
|
329
|
+
module_name_c = Nuitka_String_AsString(module_name);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
registerDillPluginTables(tstate, module_name_c, &_method_def_reduce_compiled_function, &_method_def_create_compiled_function);
|
|
333
|
+
}
|
|
317
334
|
#endif
|
|
318
335
|
|
|
319
336
|
// Set "__compiled__" to what version information we have.
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
Py_ssize_t {{operand}}_digit_count = 0;
|
|
34
|
-
digit {{operand}}_digits[5]; // Could be more minimal and depend on sizeof(digit)
|
|
34
|
+
digit {{operand}}_digits[5] = {0}; // Could be more minimal and depend on sizeof(digit)
|
|
35
35
|
{
|
|
36
36
|
unsigned long t = {{operand}}_abs_ival;
|
|
37
37
|
|
|
@@ -323,7 +323,9 @@ class build(distutils.command.build.build):
|
|
|
323
323
|
for option, value in toml_options.get("nuitka", {}).items():
|
|
324
324
|
command.extend(self._parseOptionsEntry(option, value))
|
|
325
325
|
|
|
326
|
-
for option, value in
|
|
326
|
+
for option, value in (
|
|
327
|
+
toml_options.get("tool", {}).get("nuitka", {}).items()
|
|
328
|
+
):
|
|
327
329
|
command.extend(self._parseOptionsEntry(option, value))
|
|
328
330
|
|
|
329
331
|
# Process any extra options from setuptools
|
|
@@ -85,9 +85,8 @@ class ExpressionPkgResourcesRequireCall(ExpressionPkgResourcesRequireCallBase):
|
|
|
85
85
|
resources_module.extern.packaging.requirements.InvalidRequirement
|
|
86
86
|
)
|
|
87
87
|
except AttributeError:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
)
|
|
88
|
+
# Very old versions of pkg_resources do not have it
|
|
89
|
+
InvalidRequirement = TypeError
|
|
91
90
|
|
|
92
91
|
args = tuple(
|
|
93
92
|
element.getCompileTimeConstant() for element in self.subnode_requirements
|
nuitka/plugins/PluginBase.py
CHANGED
|
@@ -1087,8 +1087,11 @@ except ImportError:
|
|
|
1087
1087
|
if shallShowExecutedCommands():
|
|
1088
1088
|
self.info("Executing query command:\n%s" % cmd)
|
|
1089
1089
|
|
|
1090
|
+
env = dict(os.environ)
|
|
1091
|
+
env["PYTHONIOENCODING"] = "utf8"
|
|
1092
|
+
|
|
1090
1093
|
try:
|
|
1091
|
-
feedback = check_output([sys.executable, "-c", cmd])
|
|
1094
|
+
feedback = check_output([sys.executable, "-c", cmd], env=env)
|
|
1092
1095
|
except NuitkaCalledProcessError as e:
|
|
1093
1096
|
if e.returncode == 38:
|
|
1094
1097
|
return None
|
|
@@ -1211,18 +1214,13 @@ except ImportError:
|
|
|
1211
1214
|
"no_annotations": hasPythonFlagNoAnnotations(),
|
|
1212
1215
|
# Querying package properties
|
|
1213
1216
|
"has_builtin_module": isBuiltinModuleName,
|
|
1217
|
+
# Architectures
|
|
1218
|
+
"arch_x86": getArchitecture() == "x86",
|
|
1219
|
+
"arch_amd64": getArchitecture() == "x86_64",
|
|
1220
|
+
"arch_arm64": getArchitecture() == "arm64",
|
|
1214
1221
|
}
|
|
1215
1222
|
)
|
|
1216
1223
|
|
|
1217
|
-
if isWin32Windows() or isMacOS():
|
|
1218
|
-
context.update(
|
|
1219
|
-
{
|
|
1220
|
-
"arch_x86": getArchitecture() == "x86",
|
|
1221
|
-
"arch_amd64": getArchitecture() == "x86_64",
|
|
1222
|
-
"arch_arm64": getArchitecture() == "arm64",
|
|
1223
|
-
}
|
|
1224
|
-
)
|
|
1225
|
-
|
|
1226
1224
|
versions = getTestExecutionPythonVersions()
|
|
1227
1225
|
|
|
1228
1226
|
for version in versions:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
|
|
2
|
+
//
|
|
3
|
+
// Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
4
|
+
// integrates with CPython, but also works on its own.
|
|
5
|
+
//
|
|
6
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
// you may not use this file except in compliance with the License.
|
|
8
|
+
// You may obtain a copy of the License at
|
|
9
|
+
//
|
|
10
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
//
|
|
12
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
// See the License for the specific language governing permissions and
|
|
16
|
+
// limitations under the License.
|
|
17
|
+
//
|
|
18
|
+
// C code for use when the dill-plugin is active
|
|
19
|
+
|
|
20
|
+
#include "nuitka/prelude.h"
|
|
21
|
+
|
|
22
|
+
void registerDillPluginTables(PyThreadState *tstate, char const *module_name, PyMethodDef *reduce_compiled_function,
|
|
23
|
+
PyMethodDef *create_compiled_function) {
|
|
24
|
+
PyObject *function_tables = PyObject_GetAttrString((PyObject *)builtin_module, "compiled_function_tables");
|
|
25
|
+
|
|
26
|
+
if (function_tables == NULL) {
|
|
27
|
+
CLEAR_ERROR_OCCURRED(tstate);
|
|
28
|
+
|
|
29
|
+
function_tables = MAKE_DICT_EMPTY();
|
|
30
|
+
PyObject_SetAttrString((PyObject *)builtin_module, "compiled_function_tables", function_tables);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
PyObject *funcs =
|
|
34
|
+
MAKE_TUPLE2_0(PyCFunction_New(reduce_compiled_function, NULL), PyCFunction_New(create_compiled_function, NULL));
|
|
35
|
+
|
|
36
|
+
PyDict_SetItemString(function_tables, module_name, funcs);
|
|
37
|
+
}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# Copyright 2023, Kay Hayen, mailto:kay.hayen@gmail.com
|
|
2
|
+
#
|
|
3
|
+
# Part of "Nuitka", an optimizing Python compiler that is compatible and
|
|
4
|
+
# integrates with CPython, but also works on its own.
|
|
5
|
+
#
|
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
|
+
# you may not use this file except in compliance with the License.
|
|
8
|
+
# You may obtain a copy of the License at
|
|
9
|
+
#
|
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
#
|
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
|
+
# See the License for the specific language governing permissions and
|
|
16
|
+
# limitations under the License.
|
|
17
|
+
#
|
|
18
|
+
# Plugin dill-compat has this as post load code for the "dill" package.
|
|
19
|
+
# Not supposed to be good code,
|
|
20
|
+
# pylint: disable=invalid-name,missing-module-docstring,protected-access,too-many-branches,too-many-statements
|
|
21
|
+
from types import CodeType
|
|
22
|
+
|
|
23
|
+
# spell-checker: ignore kwdefaults,globalvars
|
|
24
|
+
# Nuitka will optimize this away, but VS code will warn about them otherwise.
|
|
25
|
+
from typing import TYPE_CHECKING
|
|
26
|
+
|
|
27
|
+
import dill._dill
|
|
28
|
+
|
|
29
|
+
if str is bytes:
|
|
30
|
+
import __builtin__ as builtins # Python2 code, pylint: disable=import-error
|
|
31
|
+
else:
|
|
32
|
+
import builtins
|
|
33
|
+
|
|
34
|
+
if TYPE_CHECKING:
|
|
35
|
+
compiled_function_tables = {}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class ForCompiledTypeLookups:
|
|
39
|
+
def for_compiled_type(self):
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
compiled_function = type(ForCompiledTypeLookups.for_compiled_type)
|
|
44
|
+
compiled_method = type(ForCompiledTypeLookups().for_compiled_type)
|
|
45
|
+
assert "__compiled__" in globals()
|
|
46
|
+
|
|
47
|
+
dill_version = tuple(int(d) for d in dill.__version__.split("."))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
# Compiled methods need to be created.
|
|
51
|
+
@dill.register(compiled_method)
|
|
52
|
+
def save_compiled_method(pickler, obj):
|
|
53
|
+
if str is not bytes:
|
|
54
|
+
pickler.save_reduce(compiled_method, (obj.__func__, obj.__self__), obj=obj)
|
|
55
|
+
else:
|
|
56
|
+
pickler.save_reduce(
|
|
57
|
+
compiled_method, (obj.im_func, obj.im_self, obj.im_class), obj=obj
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if str is bytes:
|
|
62
|
+
|
|
63
|
+
def _create_compiled_function2(module_name, func_values, func_dict, func_defaults):
|
|
64
|
+
if module_name not in compiled_function_tables:
|
|
65
|
+
__import__(module_name)
|
|
66
|
+
|
|
67
|
+
# This gets the "_create_compiled_function" of the module and calls it.
|
|
68
|
+
func = compiled_function_tables[module_name][1](*func_values)
|
|
69
|
+
if func_dict:
|
|
70
|
+
for key, value in func_dict.items():
|
|
71
|
+
func[key] = value
|
|
72
|
+
|
|
73
|
+
func.__defaults__ = func_defaults
|
|
74
|
+
|
|
75
|
+
return func
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
if str is not bytes:
|
|
79
|
+
|
|
80
|
+
def _create_compiled_function3(
|
|
81
|
+
module_name, func_values, func_dict, func_defaults, func_kwdefaults
|
|
82
|
+
):
|
|
83
|
+
if module_name not in compiled_function_tables:
|
|
84
|
+
__import__(module_name)
|
|
85
|
+
|
|
86
|
+
func = compiled_function_tables[module_name][1](*func_values)
|
|
87
|
+
if func_dict:
|
|
88
|
+
for key, value in func_dict.items():
|
|
89
|
+
func[key] = value
|
|
90
|
+
|
|
91
|
+
func.__defaults__ = func_defaults
|
|
92
|
+
func.__kwdefaults__ = func_kwdefaults
|
|
93
|
+
|
|
94
|
+
return func
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
# Compiled methods might have to be created as well. This is very closely following
|
|
98
|
+
# the code of "dill._dill.save_function" that is intended to do things for the
|
|
99
|
+
# uncompiled function.
|
|
100
|
+
@dill.register(compiled_function)
|
|
101
|
+
def save_compiled_function(pickler, obj):
|
|
102
|
+
# Complex beast, pylint: disable=too-many-locals
|
|
103
|
+
|
|
104
|
+
if dill_version >= (0, 3):
|
|
105
|
+
if not dill._dill._locate_function(obj, pickler):
|
|
106
|
+
if type(obj.__code__) is not CodeType:
|
|
107
|
+
# Some PyPy builtin functions have no module name, and thus are not
|
|
108
|
+
# able to be located
|
|
109
|
+
module_name = getattr(obj, "__module__", None)
|
|
110
|
+
if module_name is None:
|
|
111
|
+
module_name = builtins.__name__
|
|
112
|
+
|
|
113
|
+
_module = dill._dill._import_module(module_name, safe=True)
|
|
114
|
+
|
|
115
|
+
_recurse = getattr(pickler, "_recurse", None)
|
|
116
|
+
_postproc = getattr(pickler, "_postproc", None)
|
|
117
|
+
_main_modified = getattr(pickler, "_main_modified", None)
|
|
118
|
+
_original_main = getattr(pickler, "_original_main", builtins)
|
|
119
|
+
|
|
120
|
+
postproc_list = []
|
|
121
|
+
if _recurse:
|
|
122
|
+
# recurse to get all globals referred to by obj
|
|
123
|
+
from dill.detect import globalvars
|
|
124
|
+
|
|
125
|
+
globs_copy = globalvars(obj, recurse=True, builtin=True)
|
|
126
|
+
|
|
127
|
+
# Add the name of the module to the globs dictionary to prevent
|
|
128
|
+
# the duplication of the dictionary. Pickle the unpopulated
|
|
129
|
+
# globals dictionary and set the remaining items after the function
|
|
130
|
+
# is created to correctly handle recursion.
|
|
131
|
+
globs = {"__name__": obj.__module__}
|
|
132
|
+
else:
|
|
133
|
+
globs_copy = obj.__globals__
|
|
134
|
+
|
|
135
|
+
# If the globals is the __dict__ from the module being saved as a
|
|
136
|
+
# session, substitute it by the dictionary being actually saved.
|
|
137
|
+
if _main_modified and globs_copy is _original_main.__dict__:
|
|
138
|
+
globs_copy = getattr(pickler, "_main", _original_main).__dict__
|
|
139
|
+
globs = globs_copy
|
|
140
|
+
# If the globals is a module __dict__, do not save it in the pickle.
|
|
141
|
+
elif (
|
|
142
|
+
globs_copy is not None
|
|
143
|
+
and obj.__module__ is not None
|
|
144
|
+
and getattr(
|
|
145
|
+
dill._dill._import_module(obj.__module__, True),
|
|
146
|
+
"__dict__",
|
|
147
|
+
None,
|
|
148
|
+
)
|
|
149
|
+
is globs_copy
|
|
150
|
+
):
|
|
151
|
+
globs = globs_copy
|
|
152
|
+
else:
|
|
153
|
+
globs = {"__name__": obj.__module__}
|
|
154
|
+
|
|
155
|
+
if globs_copy is not None and globs is not globs_copy:
|
|
156
|
+
# In the case that the globals are copied, we need to ensure that
|
|
157
|
+
# the globals dictionary is updated when all objects in the
|
|
158
|
+
# dictionary are already created.
|
|
159
|
+
glob_ids = {id(g) for g in globs_copy.values()}
|
|
160
|
+
for stack_element in _postproc:
|
|
161
|
+
if stack_element in glob_ids:
|
|
162
|
+
_postproc[stack_element].append(
|
|
163
|
+
(dill._dill._setitems, (globs, globs_copy))
|
|
164
|
+
)
|
|
165
|
+
break
|
|
166
|
+
else:
|
|
167
|
+
postproc_list.append((dill._dill._setitems, (globs, globs_copy)))
|
|
168
|
+
|
|
169
|
+
state_dict = {}
|
|
170
|
+
for fattrname in ("__doc__", "__kwdefaults__", "__annotations__"):
|
|
171
|
+
fattr = getattr(obj, fattrname, None)
|
|
172
|
+
if fattr is not None:
|
|
173
|
+
state_dict[fattrname] = fattr
|
|
174
|
+
if obj.__qualname__ != obj.__name__:
|
|
175
|
+
state_dict["__qualname__"] = obj.__qualname__
|
|
176
|
+
if "__name__" not in globs or obj.__module__ != globs["__name__"]:
|
|
177
|
+
state_dict["__module__"] = obj.__module__
|
|
178
|
+
|
|
179
|
+
pickler.save_reduce(
|
|
180
|
+
_create_compiled_function3,
|
|
181
|
+
(
|
|
182
|
+
obj.__module__,
|
|
183
|
+
# This gets the "_reduce_compiled_function" of the module and calls it.
|
|
184
|
+
compiled_function_tables[obj.__module__][0](obj),
|
|
185
|
+
obj.__dict__,
|
|
186
|
+
obj.__defaults__,
|
|
187
|
+
obj.__kwdefaults__,
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
else:
|
|
191
|
+
name = getattr(obj, "__qualname__", getattr(obj, "__name__", None))
|
|
192
|
+
dill._dill.StockPickler.save_global(pickler, obj, name=name)
|
|
193
|
+
else:
|
|
194
|
+
if not dill._dill._locate_function(obj):
|
|
195
|
+
stack = dill._dill.stack
|
|
196
|
+
|
|
197
|
+
_byref = getattr(pickler, "_byref", None)
|
|
198
|
+
_recurse = getattr(pickler, "_recurse", None)
|
|
199
|
+
_memo = (id(obj) in stack) and (_recurse is not None)
|
|
200
|
+
stack[id(obj)] = len(stack), obj
|
|
201
|
+
|
|
202
|
+
if str is not bytes:
|
|
203
|
+
# Python3
|
|
204
|
+
_super = ("super" in getattr(obj.__code__, "co_names", ())) and (
|
|
205
|
+
_byref is not None
|
|
206
|
+
)
|
|
207
|
+
if _super:
|
|
208
|
+
pickler._byref = True
|
|
209
|
+
if _memo:
|
|
210
|
+
pickler._recurse = False
|
|
211
|
+
|
|
212
|
+
pickler.save_reduce(
|
|
213
|
+
_create_compiled_function3,
|
|
214
|
+
(
|
|
215
|
+
obj.__module__,
|
|
216
|
+
compiled_function_tables[obj.__module__][0](obj),
|
|
217
|
+
obj.__dict__,
|
|
218
|
+
obj.__defaults__,
|
|
219
|
+
obj.__kwdefaults__,
|
|
220
|
+
),
|
|
221
|
+
)
|
|
222
|
+
else:
|
|
223
|
+
# Python2
|
|
224
|
+
_super = (
|
|
225
|
+
("super" in getattr(obj.__code__, "co_names", ()))
|
|
226
|
+
and (_byref is not None)
|
|
227
|
+
and getattr(pickler, "_recurse", False)
|
|
228
|
+
)
|
|
229
|
+
if _super:
|
|
230
|
+
pickler._byref = True
|
|
231
|
+
if _memo:
|
|
232
|
+
pickler._recurse = False
|
|
233
|
+
|
|
234
|
+
pickler.save_reduce(
|
|
235
|
+
_create_compiled_function2,
|
|
236
|
+
(
|
|
237
|
+
obj.__module__,
|
|
238
|
+
compiled_function_tables[obj.__module__][0](obj),
|
|
239
|
+
obj.__dict__,
|
|
240
|
+
obj.__defaults__,
|
|
241
|
+
),
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
if _super:
|
|
245
|
+
pickler._byref = _byref
|
|
246
|
+
if _memo:
|
|
247
|
+
pickler._recurse = _recurse
|
|
248
|
+
else:
|
|
249
|
+
dill._dill.StockPickler.save_global(pickler, obj)
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
+
from nuitka.Options import shallMakeModule
|
|
22
23
|
from nuitka.plugins.PluginBase import NuitkaPluginBase
|
|
23
24
|
|
|
24
25
|
|
|
@@ -36,7 +37,15 @@ class NuitkaPluginDillWorkarounds(NuitkaPluginBase):
|
|
|
36
37
|
def createPostModuleLoadCode(self, module):
|
|
37
38
|
full_name = module.getFullName()
|
|
38
39
|
|
|
39
|
-
if full_name == "dill":
|
|
40
|
+
if full_name == "dill" and not shallMakeModule():
|
|
41
|
+
return (
|
|
42
|
+
self.getPluginDataFileContents("dill-postLoad.py"),
|
|
43
|
+
"""\
|
|
44
|
+
Extending "dill" for compiled types to be pickle-able as well.""",
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def createPreModuleLoadCode(self, module):
|
|
48
|
+
if shallMakeModule() and module.isTopModule():
|
|
40
49
|
return (
|
|
41
50
|
self.getPluginDataFileContents("dill-postLoad.py"),
|
|
42
51
|
"""\
|
|
@@ -48,25 +57,4 @@ Extending "dill" for compiled types to be pickle-able as well.""",
|
|
|
48
57
|
return {"_NUITKA_PLUGIN_DILL_ENABLED": "1"}
|
|
49
58
|
|
|
50
59
|
def getExtraCodeFiles(self):
|
|
51
|
-
return {"DillPlugin.c":
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
extra_code = r"""
|
|
55
|
-
#include "nuitka/prelude.h"
|
|
56
|
-
|
|
57
|
-
void registerDillPluginTables(PyThreadState *tstate, char const *module_name, PyMethodDef *reduce_compiled_function, PyMethodDef *create_compiled_function) {
|
|
58
|
-
PyObject *function_tables = PyObject_GetAttrString((PyObject *)builtin_module, "compiled_function_tables");
|
|
59
|
-
|
|
60
|
-
if (function_tables == NULL) {
|
|
61
|
-
CLEAR_ERROR_OCCURRED(tstate);
|
|
62
|
-
|
|
63
|
-
function_tables = MAKE_DICT_EMPTY();
|
|
64
|
-
PyObject_SetAttrString((PyObject *)builtin_module, "compiled_function_tables", function_tables);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
PyObject *funcs = MAKE_TUPLE2_0(PyCFunction_New(reduce_compiled_function, NULL), PyCFunction_New(create_compiled_function, NULL));
|
|
68
|
-
|
|
69
|
-
PyDict_SetItemString(function_tables, module_name, funcs);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
"""
|
|
60
|
+
return {"DillPlugin.c": self.getPluginDataFileContents("DillPlugin.c")}
|
|
@@ -597,6 +597,7 @@ __file__ = (__nuitka_binary_dir + '%ssite.py') if '__nuitka_binary_dir' in dict(
|
|
|
597
597
|
"transformers.utils.dummy_pt_objects", # Not performance relevant.
|
|
598
598
|
"transformers.utils.dummy_flax_objects", # Not performance relevant.
|
|
599
599
|
"transformers.utils.dummy_tf_objects", # Not performance relevant.
|
|
600
|
+
"rich", # # Not performance relevant and memory leaking due to empty compiled cell leaks
|
|
600
601
|
)
|
|
601
602
|
|
|
602
603
|
def decideCompilation(self, module_name):
|
|
@@ -103,7 +103,7 @@ Otherwise a terminal window will open"""
|
|
|
103
103
|
|
|
104
104
|
self.info(
|
|
105
105
|
"""\
|
|
106
|
-
Note, when using '%s', consider using '--disable-console' option. %s. However\
|
|
106
|
+
Note, when using '%s', consider using '--disable-console' option. %s. However \
|
|
107
107
|
for debugging, terminal output is the easiest way to see informative traceback \
|
|
108
108
|
and error information, so delay this until your program working and remove \
|
|
109
109
|
once you find it non-working, and use '--enable-console' to make it explicit \
|
|
@@ -640,6 +640,10 @@
|
|
|
640
640
|
'comtypes': 'ignore'
|
|
641
641
|
|
|
642
642
|
- module-name: 'curl_cffi'
|
|
643
|
+
data-files:
|
|
644
|
+
patterns:
|
|
645
|
+
- 'cacert.pem'
|
|
646
|
+
|
|
643
647
|
implicit-imports:
|
|
644
648
|
- depends:
|
|
645
649
|
- '_cffi_backend'
|
|
@@ -1622,6 +1626,12 @@
|
|
|
1622
1626
|
patterns:
|
|
1623
1627
|
- 'intervals.msgpack'
|
|
1624
1628
|
|
|
1629
|
+
- module-name: 'libusb_package'
|
|
1630
|
+
dlls:
|
|
1631
|
+
- from_filenames:
|
|
1632
|
+
prefixes:
|
|
1633
|
+
- 'libusb'
|
|
1634
|
+
|
|
1625
1635
|
- module-name: 'lightgbm.libpath'
|
|
1626
1636
|
dlls:
|
|
1627
1637
|
- from_filenames:
|
|
@@ -2863,6 +2873,14 @@
|
|
|
2863
2873
|
- description: 'workaround __new__ decorator issue'
|
|
2864
2874
|
append_plain: 'SharedRegistryObject.__new__ = staticmethod(SharedRegistryObject.__new__)'
|
|
2865
2875
|
|
|
2876
|
+
- module-name: 'pip._vendor.rich.jupyter'
|
|
2877
|
+
# See rich.jupyter
|
|
2878
|
+
anti-bloat:
|
|
2879
|
+
- description: 'remove IPython reference'
|
|
2880
|
+
change_function:
|
|
2881
|
+
'display': 'un-callable'
|
|
2882
|
+
when: 'not use_ipython'
|
|
2883
|
+
|
|
2866
2884
|
- module-name: 'pkg_resources'
|
|
2867
2885
|
anti-bloat:
|
|
2868
2886
|
- description: 'avoid using plistlib dependency on non-macOS'
|
|
@@ -3217,6 +3235,10 @@
|
|
|
3217
3235
|
macos_bundle_as_onefile: 'yes'
|
|
3218
3236
|
when: 'macos and use_pyqt5'
|
|
3219
3237
|
|
|
3238
|
+
import-hacks:
|
|
3239
|
+
- acceptable-missing-dlls:
|
|
3240
|
+
- 'libqpdf'
|
|
3241
|
+
|
|
3220
3242
|
- module-name: 'PyQt6'
|
|
3221
3243
|
options:
|
|
3222
3244
|
checks:
|
|
@@ -3411,7 +3433,19 @@
|
|
|
3411
3433
|
from PySide6 import QtCore
|
|
3412
3434
|
orig_disconnect = QtCore.SignalInstance.disconnect
|
|
3413
3435
|
QtCore.SignalInstance.disconnect = patched_disconnect
|
|
3414
|
-
|
|
3436
|
+
|
|
3437
|
+
def patched_connect(self, receiver, type=None):
|
|
3438
|
+
type = type or QtCore.Qt.ConnectionType.AutoConnection
|
|
3439
|
+
if hasattr(receiver, "im_func"):
|
|
3440
|
+
if hasattr(receiver.im_func, "__compiled__"):
|
|
3441
|
+
patched_connect._protected = getattr(patched_connect, "_protected", [])
|
|
3442
|
+
patched_connect._protected.append(receiver)
|
|
3443
|
+
|
|
3444
|
+
return orig_connect(self, receiver, type)
|
|
3445
|
+
|
|
3446
|
+
from PySide6 import QtCore
|
|
3447
|
+
orig_connect = QtCore.SignalInstance.connect
|
|
3448
|
+
QtCore.SignalInstance.connect = patched_connect
|
|
3415
3449
|
|
|
3416
3450
|
options:
|
|
3417
3451
|
checks:
|
|
@@ -4941,15 +4975,11 @@
|
|
|
4941
4975
|
dirs:
|
|
4942
4976
|
- 'static'
|
|
4943
4977
|
|
|
4944
|
-
- module-name: 'streamlit.
|
|
4978
|
+
- module-name: 'streamlit.runtime.caching.cache_utils'
|
|
4945
4979
|
anti-bloat:
|
|
4946
|
-
- description: 'remove
|
|
4980
|
+
- description: 'remove warning for compiled functions'
|
|
4947
4981
|
replacements_plain:
|
|
4948
|
-
'
|
|
4949
|
-
'LegacyAltairMixin,': ''
|
|
4950
|
-
'from streamlit.elements.arrow_altair import ArrowAltairMixin': ''
|
|
4951
|
-
'ArrowAltairMixin,': ''
|
|
4952
|
-
when: 'not use_ipython'
|
|
4982
|
+
'_LOGGER.debug(': '('
|
|
4953
4983
|
|
|
4954
4984
|
- module-name: 'sv_ttk'
|
|
4955
4985
|
data-files:
|
|
@@ -5508,6 +5538,13 @@
|
|
|
5508
5538
|
- depends:
|
|
5509
5539
|
- '._*'
|
|
5510
5540
|
|
|
5541
|
+
- module-name: 'tf_keras.src.utils.vis_utils'
|
|
5542
|
+
anti-bloat:
|
|
5543
|
+
- description: 'remove IPython reference'
|
|
5544
|
+
no-auto-follow:
|
|
5545
|
+
'IPython': 'ignore'
|
|
5546
|
+
when: 'not use_ipython'
|
|
5547
|
+
|
|
5511
5548
|
- module-name: 'thinc.backends.cblas'
|
|
5512
5549
|
implicit-imports:
|
|
5513
5550
|
- depends:
|
nuitka/reports/Reports.py
CHANGED
|
@@ -44,8 +44,10 @@ from nuitka.Options import (
|
|
|
44
44
|
getCompilationReportFilename,
|
|
45
45
|
getCompilationReportTemplates,
|
|
46
46
|
getCompilationReportUserData,
|
|
47
|
+
isOnefileMode,
|
|
47
48
|
shallCreateDiffableCompilationReport,
|
|
48
49
|
)
|
|
50
|
+
from nuitka.OutputDirectories import getResultRunFilename
|
|
49
51
|
from nuitka.plugins.Plugins import getActivePlugins
|
|
50
52
|
from nuitka.PythonFlavors import getPythonFlavorName
|
|
51
53
|
from nuitka.PythonVersions import getSystemPrefixPath, python_version_full_str
|
|
@@ -194,6 +196,8 @@ def _getReportInputData(aborted):
|
|
|
194
196
|
|
|
195
197
|
data_composer = getDataComposerReportValues()
|
|
196
198
|
|
|
199
|
+
output_run_filename = os.path.abspath(getResultRunFilename(onefile=isOnefileMode()))
|
|
200
|
+
|
|
197
201
|
return dict(
|
|
198
202
|
(var_name, var_value)
|
|
199
203
|
for var_name, var_value in locals().items()
|
|
@@ -569,6 +573,14 @@ def writeCompilationReport(report_filename, report_input_data, diffable):
|
|
|
569
573
|
|
|
570
574
|
_addUserDataToReport(root=root, user_data=report_input_data["user_data"])
|
|
571
575
|
|
|
576
|
+
python_xml_node = TreeXML.appendTreeElement(
|
|
577
|
+
root,
|
|
578
|
+
"output",
|
|
579
|
+
run_filename=_getCompilationReportPath(
|
|
580
|
+
report_input_data["output_run_filename"]
|
|
581
|
+
),
|
|
582
|
+
)
|
|
583
|
+
|
|
572
584
|
try:
|
|
573
585
|
putTextFileContents(
|
|
574
586
|
filename=report_filename, contents=TreeXML.toString(root), encoding="utf8"
|