Nuitka-winsvc 1.8.6__cp312-cp312-win_amd64.whl → 1.9.3__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.
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/METADATA +1 -1
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/RECORD +212 -203
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/WHEEL +1 -1
- nuitka/BytecodeCaching.py +4 -1
- nuitka/HardImportRegistry.py +348 -0
- nuitka/MainControl.py +45 -25
- nuitka/OptionParsing.py +31 -20
- nuitka/Options.py +47 -16
- nuitka/Progress.py +32 -2
- nuitka/PythonFlavors.py +1 -1
- nuitka/PythonVersions.py +61 -0
- nuitka/Tracing.py +25 -12
- nuitka/TreeXML.py +5 -5
- nuitka/Variables.py +15 -24
- nuitka/Version.py +16 -6
- nuitka/__main__.py +15 -0
- nuitka/__past__.py +15 -17
- nuitka/build/Backend.scons +44 -35
- nuitka/build/CCompilerVersion.scons +10 -9
- nuitka/build/Onefile.scons +11 -26
- nuitka/build/SconsCaching.py +2 -0
- nuitka/build/SconsCompilerSettings.py +72 -22
- nuitka/build/SconsHacks.py +1 -0
- nuitka/build/SconsInterface.py +5 -0
- nuitka/build/SconsSpawn.py +16 -3
- nuitka/build/SconsUtils.py +11 -12
- nuitka/build/include/nuitka/checksum_tools.h +0 -4
- nuitka/build/include/nuitka/compiled_asyncgen.h +1 -1
- nuitka/build/include/nuitka/compiled_coroutine.h +1 -1
- nuitka/build/include/nuitka/compiled_frame.h +7 -4
- nuitka/build/include/nuitka/compiled_function.h +13 -3
- nuitka/build/include/nuitka/compiled_generator.h +1 -1
- nuitka/build/include/nuitka/constants.h +2 -0
- nuitka/build/include/nuitka/environment_variables.h +45 -0
- nuitka/build/include/nuitka/exceptions.h +32 -4
- nuitka/build/include/nuitka/filesystem_paths.h +6 -1
- nuitka/build/include/nuitka/freelists.h +11 -1
- nuitka/build/include/nuitka/helper/dictionaries.h +1 -1
- nuitka/build/include/nuitka/helper/import_hard.h +3 -0
- nuitka/build/include/nuitka/helpers.h +2 -0
- nuitka/build/include/nuitka/importing.h +3 -0
- nuitka/build/include/nuitka/prelude.h +17 -6
- nuitka/build/include/nuitka/unfreezing.h +1 -1
- nuitka/build/inline_copy/bin/scons.py +14 -0
- nuitka/build/inline_copy/tqdm/tqdm/__init__.py +2 -2
- nuitka/build/inline_copy/tqdm/tqdm/utils.py +14 -8
- nuitka/build/inline_copy/zlib/LICENSE +22 -0
- nuitka/build/inline_copy/zlib/crc32.c +1049 -0
- nuitka/build/inline_copy/zlib/crc32.h +9446 -0
- nuitka/build/inline_copy/zlib/zconf.h +551 -0
- nuitka/build/inline_copy/zlib/zlib.h +1938 -0
- nuitka/build/inline_copy/zlib/zutil.h +275 -0
- nuitka/build/static_src/CompiledAsyncgenType.c +41 -41
- nuitka/build/static_src/CompiledCodeHelpers.c +14 -7
- nuitka/build/static_src/CompiledCoroutineType.c +60 -51
- nuitka/build/static_src/CompiledFrameType.c +12 -12
- nuitka/build/static_src/CompiledFunctionType.c +149 -28
- nuitka/build/static_src/CompiledGeneratorType.c +64 -65
- nuitka/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +1 -1
- nuitka/build/static_src/CompiledMethodType.c +5 -3
- nuitka/build/static_src/HelperEnvironmentVariables.c +120 -0
- nuitka/build/static_src/HelpersAttributes.c +1 -1
- nuitka/build/static_src/HelpersBuiltin.c +1 -1
- nuitka/build/static_src/HelpersChecksumTools.c +19 -4
- nuitka/build/static_src/HelpersComparisonEq.c +4 -4
- nuitka/build/static_src/HelpersComparisonNe.c +4 -4
- nuitka/build/static_src/HelpersConstantsBlob.c +40 -23
- nuitka/build/static_src/HelpersDictionaries.c +3 -1
- nuitka/build/static_src/HelpersDictionariesGenerated.c +9 -9
- nuitka/build/static_src/HelpersFilesystemPaths.c +12 -2
- nuitka/build/static_src/HelpersImport.c +29 -1
- nuitka/build/static_src/HelpersImportHard.c +19 -0
- nuitka/build/static_src/HelpersOperationInplaceAddUtils.c +5 -4
- nuitka/build/static_src/HelpersPythonPgo.c +5 -5
- nuitka/build/static_src/HelpersSafeStrings.c +2 -1
- nuitka/build/static_src/HelpersStrings.c +12 -10
- nuitka/build/static_src/HelpersTypes.c +1 -1
- nuitka/build/static_src/InspectPatcher.c +3 -2
- nuitka/build/static_src/MainProgram.c +182 -214
- nuitka/build/static_src/MetaPathBasedLoader.c +36 -23
- nuitka/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +4 -2
- nuitka/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +38 -2
- nuitka/build/static_src/OnefileBootstrap.c +124 -93
- nuitka/code_generation/CodeGeneration.py +4 -2
- nuitka/code_generation/CodeObjectCodes.py +5 -1
- nuitka/code_generation/ConstantCodes.py +4 -0
- nuitka/code_generation/Contexts.py +111 -3
- nuitka/code_generation/DictCodes.py +5 -5
- nuitka/code_generation/FunctionCodes.py +4 -2
- nuitka/code_generation/GlobalConstants.py +10 -0
- nuitka/code_generation/ImportCodes.py +69 -33
- nuitka/code_generation/ModuleCodes.py +4 -1
- nuitka/code_generation/Namify.py +6 -5
- nuitka/code_generation/YieldCodes.py +3 -3
- nuitka/code_generation/templates/CodeTemplatesModules.py +61 -95
- nuitka/code_generation/templates_c/HelperDictionaryCopy.c.j2 +3 -3
- nuitka/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +2 -2
- nuitka/distutils/DistutilCommands.py +3 -0
- nuitka/finalizations/FinalizeMarkups.py +1 -1
- nuitka/freezer/DependsExe.py +2 -1
- nuitka/freezer/DllDependenciesPosix.py +11 -1
- nuitka/freezer/IncludedEntryPoints.py +54 -16
- nuitka/freezer/Onefile.py +7 -3
- nuitka/freezer/Standalone.py +39 -17
- nuitka/importing/Importing.py +195 -62
- nuitka/importing/PreloadedPackages.py +2 -1
- nuitka/importing/Recursion.py +98 -27
- nuitka/importing/StandardLibrary.py +7 -4
- nuitka/nodes/BuiltinOpenNodes.py +28 -1
- nuitka/nodes/BuiltinRangeNodes.py +2 -2
- nuitka/nodes/BuiltinSumNodes.py +1 -1
- nuitka/nodes/ChildrenHavingMixins.py +326 -2
- nuitka/nodes/HardImportNodesGenerated.py +141 -38
- nuitka/nodes/ImportHardNodes.py +0 -8
- nuitka/nodes/ImportNodes.py +267 -361
- nuitka/nodes/IterationHandles.py +36 -17
- nuitka/nodes/LocalsScopes.py +3 -1
- nuitka/nodes/NodeBases.py +8 -14
- nuitka/nodes/OperatorNodes.py +9 -9
- nuitka/nodes/OutlineNodes.py +3 -3
- nuitka/nodes/PackageMetadataNodes.py +19 -9
- nuitka/nodes/SliceNodes.py +1 -1
- nuitka/nodes/VariableAssignNodes.py +25 -15
- nuitka/nodes/VariableRefNodes.py +7 -7
- nuitka/nodes/YieldNodes.py +2 -2
- nuitka/nodes/shapes/BuiltinTypeShapes.py +81 -6
- nuitka/nodes/shapes/ShapeMixins.py +21 -0
- nuitka/nodes/shapes/StandardShapes.py +9 -3
- nuitka/optimizations/OptimizeBuiltinCalls.py +1 -1
- nuitka/optimizations/TraceCollections.py +75 -0
- nuitka/pgo/PGO.py +14 -6
- nuitka/plugins/PluginBase.py +83 -11
- nuitka/plugins/Plugins.py +78 -35
- nuitka/plugins/standard/AntiBloatPlugin.py +46 -1
- nuitka/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +1 -1
- nuitka/plugins/standard/DelvewheelPlugin.py +2 -1
- nuitka/plugins/standard/DillPlugin.py +3 -99
- nuitka/plugins/standard/DllFilesPlugin.py +45 -0
- nuitka/plugins/standard/GiPlugin.py +23 -10
- nuitka/plugins/standard/GlfwPlugin.py +1 -0
- nuitka/plugins/standard/ImplicitImports.py +267 -15
- nuitka/plugins/standard/KivyPlugin.py +1 -0
- nuitka/plugins/standard/MatplotlibPlugin.py +43 -25
- nuitka/plugins/standard/OptionsNannyPlugin.py +5 -6
- nuitka/plugins/standard/PkgResourcesPlugin.py +1 -1
- nuitka/plugins/standard/PmwPlugin.py +1 -1
- nuitka/plugins/standard/PySidePyQtPlugin.py +37 -20
- nuitka/plugins/standard/TkinterPlugin.py +44 -30
- nuitka/plugins/standard/TransformersPlugin.py +3 -1
- nuitka/plugins/standard/standard.nuitka-package.config.yml +522 -86
- nuitka/plugins/standard/stdlib3.nuitka-package.config.yml +8 -1
- nuitka/reports/CompilationReportReader.py +53 -0
- nuitka/reports/LicenseReport.rst.j2 +4 -4
- nuitka/reports/Reports.py +129 -47
- nuitka/specs/HardImportSpecs.py +6 -0
- nuitka/tools/data_composer/DataComposer.py +29 -17
- nuitka/tools/onefile_compressor/OnefileCompressor.py +173 -110
- nuitka/tools/podman/__main__.py +17 -2
- nuitka/tools/scanning/DisplayPackageDLLs.py +11 -2
- nuitka/tools/scanning/DisplayPackageData.py +1 -1
- nuitka/tools/specialize/CTypeDescriptions.py +36 -27
- nuitka/tools/specialize/SpecializeC.py +1 -1
- nuitka/tools/specialize/SpecializePython.py +16 -0
- nuitka/tools/testing/Common.py +3 -4
- nuitka/tools/testing/OutputComparison.py +23 -0
- nuitka/tools/testing/SearchModes.py +2 -2
- nuitka/tools/testing/compare_with_cpython/__main__.py +13 -4
- nuitka/tools/testing/measure_construct_performance/__main__.py +2 -5
- nuitka/tools/watch/__main__.py +194 -56
- nuitka/tree/Building.py +8 -2
- nuitka/tree/ComplexCallHelperFunctions.py +45 -15
- nuitka/tree/ReformulationAssignmentStatements.py +18 -12
- nuitka/tree/ReformulationCallExpressions.py +1 -1
- nuitka/tree/ReformulationClasses.py +11 -5
- nuitka/tree/ReformulationClasses3.py +30 -12
- nuitka/tree/ReformulationComparisonExpressions.py +4 -2
- nuitka/tree/ReformulationContractionExpressions.py +19 -11
- nuitka/tree/ReformulationDictionaryCreation.py +9 -3
- nuitka/tree/ReformulationExecStatements.py +6 -6
- nuitka/tree/ReformulationForLoopStatements.py +5 -5
- nuitka/tree/ReformulationFunctionStatements.py +6 -2
- nuitka/tree/ReformulationImportStatements.py +7 -2
- nuitka/tree/ReformulationLambdaExpressions.py +1 -1
- nuitka/tree/ReformulationMatchStatements.py +3 -1
- nuitka/tree/ReformulationNamespacePackages.py +7 -3
- nuitka/tree/ReformulationPrintStatements.py +1 -1
- nuitka/tree/ReformulationSequenceCreation.py +18 -6
- nuitka/tree/ReformulationWithStatements.py +8 -8
- nuitka/tree/ReformulationYieldExpressions.py +2 -2
- nuitka/tree/SourceHandling.py +27 -5
- nuitka/tree/VariableClosure.py +11 -1
- nuitka/utils/AppDirs.py +2 -2
- nuitka/utils/CStrings.py +39 -3
- nuitka/utils/CommandLineOptions.py +42 -1
- nuitka/utils/Distributions.py +305 -38
- nuitka/utils/Download.py +27 -8
- nuitka/utils/FileOperations.py +103 -20
- nuitka/utils/Hashing.py +2 -3
- nuitka/utils/Importing.py +60 -3
- nuitka/utils/InstalledPythons.py +31 -36
- nuitka/utils/Jinja2.py +11 -5
- nuitka/utils/ModuleNames.py +11 -3
- nuitka/utils/ReExecute.py +7 -0
- nuitka/utils/SharedLibraries.py +38 -14
- nuitka/utils/SlotMetaClasses.py +55 -0
- nuitka/utils/Utils.py +10 -0
- nuitka/utils/Yaml.py +9 -1
- nuitka/build/inline_copy/tqdm/tqdm/_tqdm_gui.py +0 -9
- nuitka/build/inline_copy/tqdm/tqdm/gui.py +0 -191
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka-run.bat +0 -0
- {Nuitka_winsvc-1.8.6.data → Nuitka_winsvc-1.9.3.data}/scripts/nuitka.bat +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/LICENSE.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/entry_points.txt +0 -0
- {Nuitka_winsvc-1.8.6.dist-info → Nuitka_winsvc-1.9.3.dist-info}/top_level.txt +0 -0
nuitka/build/SconsInterface.py
CHANGED
|
@@ -42,6 +42,7 @@ from nuitka.PythonVersions import (
|
|
|
42
42
|
getSystemPrefixPath,
|
|
43
43
|
getTargetPythonDLLPath,
|
|
44
44
|
python_version,
|
|
45
|
+
python_version_str,
|
|
45
46
|
)
|
|
46
47
|
from nuitka.utils.Execution import (
|
|
47
48
|
getExecutablePath,
|
|
@@ -334,6 +335,7 @@ def asBoolStr(value):
|
|
|
334
335
|
def cleanSconsDirectory(source_dir):
|
|
335
336
|
"""Clean scons build directory."""
|
|
336
337
|
|
|
338
|
+
# spell-checker: ignore gcda
|
|
337
339
|
extensions = (
|
|
338
340
|
".bin",
|
|
339
341
|
".c",
|
|
@@ -380,6 +382,9 @@ def setCommonSconsOptions(options):
|
|
|
380
382
|
# Scons gets transported many details, that we express as variables, and
|
|
381
383
|
# have checks for them, leading to many branches and statements,
|
|
382
384
|
# pylint: disable=too-many-branches,too-many-statements
|
|
385
|
+
options["nuitka_src"] = getSconsDataPath()
|
|
386
|
+
|
|
387
|
+
options["python_version"] = python_version_str
|
|
383
388
|
|
|
384
389
|
options["python_prefix"] = getDirectoryRealPath(getSystemPrefixPath())
|
|
385
390
|
|
nuitka/build/SconsSpawn.py
CHANGED
|
@@ -128,6 +128,12 @@ surely happen again."""
|
|
|
128
128
|
)
|
|
129
129
|
|
|
130
130
|
|
|
131
|
+
def _getNoSuchCommandErrorMessage():
|
|
132
|
+
import ctypes
|
|
133
|
+
|
|
134
|
+
return ctypes.WinError(3).args[1]
|
|
135
|
+
|
|
136
|
+
|
|
131
137
|
# To work around Windows not supporting command lines of greater than 10K by
|
|
132
138
|
# default:
|
|
133
139
|
def _getWindowsSpawnFunction(env, module_mode, source_files):
|
|
@@ -202,7 +208,14 @@ def _getWindowsSpawnFunction(env, module_mode, source_files):
|
|
|
202
208
|
err = decodeData(err)
|
|
203
209
|
|
|
204
210
|
err = "\r\n".join(
|
|
205
|
-
line
|
|
211
|
+
line
|
|
212
|
+
for line in err.split("\r\n")
|
|
213
|
+
if not isIgnoredError(line)
|
|
214
|
+
if not (
|
|
215
|
+
env.mingw_mode
|
|
216
|
+
and env.lto_mode
|
|
217
|
+
and line == _getNoSuchCommandErrorMessage()
|
|
218
|
+
)
|
|
206
219
|
)
|
|
207
220
|
|
|
208
221
|
if err:
|
|
@@ -402,8 +415,8 @@ it or using '--clang' option."""
|
|
|
402
415
|
return spawnCommand
|
|
403
416
|
|
|
404
417
|
|
|
405
|
-
def enableSpawnMonitoring(env,
|
|
406
|
-
if
|
|
418
|
+
def enableSpawnMonitoring(env, module_mode, source_files):
|
|
419
|
+
if os.name == "nt":
|
|
407
420
|
env["SPAWN"] = _getWindowsSpawnFunction(
|
|
408
421
|
env=env, module_mode=module_mode, source_files=source_files
|
|
409
422
|
)
|
nuitka/build/SconsUtils.py
CHANGED
|
@@ -160,7 +160,7 @@ def prepareEnvironment(mingw_mode):
|
|
|
160
160
|
if os.path.isdir(cc_dirname):
|
|
161
161
|
addToPATH(None, cc_dirname, prefix=True)
|
|
162
162
|
|
|
163
|
-
if
|
|
163
|
+
if os.name == "nt" and isGccName(os.path.basename(os.environ["CC"])):
|
|
164
164
|
scons_details_logger.info(
|
|
165
165
|
"Environment CC seems to be a gcc, enabling mingw_mode."
|
|
166
166
|
)
|
|
@@ -286,11 +286,6 @@ def decodeData(data):
|
|
|
286
286
|
return data.decode("utf8", "backslashreplace")
|
|
287
287
|
|
|
288
288
|
|
|
289
|
-
# Windows target mode: Compile for Windows. Used to be an option, but we
|
|
290
|
-
# no longer cross compile this way.
|
|
291
|
-
win_target = os.name == "nt"
|
|
292
|
-
|
|
293
|
-
|
|
294
289
|
def getExecutablePath(filename, env):
|
|
295
290
|
"""Find an execute in either normal PATH, or Scons detected PATH."""
|
|
296
291
|
|
|
@@ -303,7 +298,7 @@ def getExecutablePath(filename, env):
|
|
|
303
298
|
filename = env[filename[1:]]
|
|
304
299
|
|
|
305
300
|
# Append ".exe" suffix on Windows if not already present.
|
|
306
|
-
if
|
|
301
|
+
if os.name == "nt" and not filename.lower().endswith(".exe"):
|
|
307
302
|
filename += ".exe"
|
|
308
303
|
|
|
309
304
|
# Either look at the initial "PATH" as given from the outside or look at the
|
|
@@ -491,7 +486,7 @@ def cheapCopyFile(src, dst):
|
|
|
491
486
|
if not os.path.exists(dirname):
|
|
492
487
|
os.makedirs(dirname)
|
|
493
488
|
|
|
494
|
-
if
|
|
489
|
+
if os.name == "nt":
|
|
495
490
|
# Windows has symlinks these days, but they do not integrate well
|
|
496
491
|
# with Python2 at least. So make a copy in any case.
|
|
497
492
|
if os.path.exists(dst):
|
|
@@ -524,9 +519,11 @@ def cheapCopyFile(src, dst):
|
|
|
524
519
|
shutil.copy(src, dst)
|
|
525
520
|
|
|
526
521
|
|
|
527
|
-
def provideStaticSourceFile(
|
|
528
|
-
source_filename = os.path.join(nuitka_src, "static_src", sub_path)
|
|
529
|
-
target_filename = os.path.join(
|
|
522
|
+
def provideStaticSourceFile(env, sub_path, c11_mode):
|
|
523
|
+
source_filename = os.path.join(env.nuitka_src, "static_src", sub_path)
|
|
524
|
+
target_filename = os.path.join(
|
|
525
|
+
env.source_dir, "static_src", os.path.basename(sub_path)
|
|
526
|
+
)
|
|
530
527
|
|
|
531
528
|
if target_filename.endswith(".c") and not c11_mode:
|
|
532
529
|
target_filename += "pp" # .cpp suffix then.
|
|
@@ -592,6 +589,8 @@ def createDefinitionsFile(source_dir, filename, definitions):
|
|
|
592
589
|
continue
|
|
593
590
|
|
|
594
591
|
if type(value) is int or key.endswith(("_BOOL", "_INT")):
|
|
592
|
+
if type(value) is bool:
|
|
593
|
+
value = int(value)
|
|
595
594
|
f.write("#define %s %s\n" % (key, value))
|
|
596
595
|
elif type(value) in (str, unicode) and key.endswith("_WIDE_STRING"):
|
|
597
596
|
f.write("#define %s L%s\n" % (key, makeCLiteral(value)))
|
|
@@ -665,7 +664,7 @@ def getLinkerArch(target_arch, mingw_mode):
|
|
|
665
664
|
global _linker_arch_determined, _linker_arch
|
|
666
665
|
|
|
667
666
|
if not _linker_arch_determined:
|
|
668
|
-
if
|
|
667
|
+
if os.name == "nt":
|
|
669
668
|
if target_arch == "x86_64":
|
|
670
669
|
_linker_arch = "pei-x86-64"
|
|
671
670
|
elif target_arch == "arm64":
|
|
@@ -24,10 +24,6 @@
|
|
|
24
24
|
#include "nuitka/prelude.h"
|
|
25
25
|
#endif
|
|
26
26
|
|
|
27
|
-
extern uint32_t initCRC32(void);
|
|
28
|
-
extern uint32_t updateCRC32(uint32_t crc, unsigned char const *message, uint32_t size);
|
|
29
|
-
extern uint32_t finalizeCRC32(uint32_t crc);
|
|
30
|
-
|
|
31
27
|
extern uint32_t calcCRC32(unsigned char const *message, uint32_t size);
|
|
32
28
|
|
|
33
29
|
#endif
|
|
@@ -93,10 +93,13 @@ extern PyCodeObject *makeCodeObject(PyObject *filename, int line, int flags, PyO
|
|
|
93
93
|
NUITKA_MAY_BE_UNUSED static inline bool isFakeCodeObject(PyCodeObject *code) {
|
|
94
94
|
#if PYTHON_VERSION < 0x300
|
|
95
95
|
return code->co_code == const_str_empty;
|
|
96
|
-
#elif PYTHON_VERSION <
|
|
96
|
+
#elif PYTHON_VERSION < 0x3b0
|
|
97
97
|
return code->co_code == const_str_empty;
|
|
98
|
-
#
|
|
98
|
+
#elif PYTHON_VERSION < 0x3c0
|
|
99
99
|
return _PyCode_CODE(code)[0] == 0;
|
|
100
|
+
#else
|
|
101
|
+
_Py_CODEUNIT *code_unit = _PyCode_CODE(code);
|
|
102
|
+
return code_unit->op.code == 0;
|
|
100
103
|
#endif
|
|
101
104
|
}
|
|
102
105
|
|
|
@@ -195,7 +198,7 @@ inline static void assertFrameObject(struct Nuitka_FrameObject *frame_object) {
|
|
|
195
198
|
}
|
|
196
199
|
|
|
197
200
|
inline static void assertThreadFrameObject(Nuitka_ThreadStateFrameType *frame) {
|
|
198
|
-
#if PYTHON_VERSION <
|
|
201
|
+
#if PYTHON_VERSION < 0x3b0
|
|
199
202
|
assertPythonFrameObject(frame);
|
|
200
203
|
#else
|
|
201
204
|
// For uncompiled frames of Python 3.11 these often do not exist. TODO: Figure
|
|
@@ -267,7 +270,7 @@ static inline bool Nuitka_Frame_IsExecuting(struct Nuitka_FrameObject *frame) {
|
|
|
267
270
|
}
|
|
268
271
|
#endif
|
|
269
272
|
|
|
270
|
-
#if PYTHON_VERSION >=
|
|
273
|
+
#if PYTHON_VERSION >= 0x3b0
|
|
271
274
|
NUITKA_MAY_BE_UNUSED inline static void pushFrameStackInterpreterFrame(PyThreadState *tstate,
|
|
272
275
|
_PyInterpreterFrame *interpreter_frame) {
|
|
273
276
|
_PyInterpreterFrame *old = tstate->cframe->current_frame;
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
#define __NUITKA_COMPILED_FUNCTION_H__
|
|
20
20
|
|
|
21
21
|
#ifdef __IDE_ONLY__
|
|
22
|
-
#include
|
|
23
|
-
#include
|
|
22
|
+
#include <Python.h>
|
|
23
|
+
#include <frameobject.h>
|
|
24
24
|
#endif
|
|
25
25
|
|
|
26
26
|
// Compiled function type.
|
|
@@ -108,7 +108,7 @@ extern struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_co
|
|
|
108
108
|
#else
|
|
109
109
|
extern struct Nuitka_FunctionObject *Nuitka_Function_New(function_impl_code c_code, PyObject *name, PyObject *qualname,
|
|
110
110
|
PyCodeObject *code_object, PyObject *defaults,
|
|
111
|
-
PyObject *
|
|
111
|
+
PyObject *kw_defaults, PyObject *annotations, PyObject *module,
|
|
112
112
|
PyObject *doc, struct Nuitka_CellObject **closure,
|
|
113
113
|
Py_ssize_t closure_given);
|
|
114
114
|
#endif
|
|
@@ -119,6 +119,16 @@ extern void Nuitka_Function_EnableConstReturnFalse(struct Nuitka_FunctionObject
|
|
|
119
119
|
|
|
120
120
|
extern void Nuitka_Function_EnableConstReturnGeneric(struct Nuitka_FunctionObject *function, PyObject *value);
|
|
121
121
|
|
|
122
|
+
#ifdef _NUITKA_PLUGIN_DILL_ENABLED
|
|
123
|
+
extern int Nuitka_Function_GetFunctionCodeIndex(struct Nuitka_FunctionObject *function,
|
|
124
|
+
function_impl_code const *function_table);
|
|
125
|
+
extern struct Nuitka_FunctionObject *
|
|
126
|
+
Nuitka_Function_CreateFunctionViaCodeIndex(PyObject *module, PyObject *function_qualname, PyObject *function_index,
|
|
127
|
+
PyObject *code_object_desc, PyObject *constant_return_value,
|
|
128
|
+
PyObject *defaults, PyObject *kw_defaults, PyObject *doc,
|
|
129
|
+
function_impl_code const *function_table, int function_table_size);
|
|
130
|
+
#endif
|
|
131
|
+
|
|
122
132
|
static inline bool Nuitka_Function_Check(PyObject *object) { return Py_TYPE(object) == &Nuitka_Function_Type; }
|
|
123
133
|
|
|
124
134
|
static inline PyObject *Nuitka_Function_GetName(PyObject *object) {
|
|
@@ -160,6 +160,8 @@ extern PyObject **global_constants;
|
|
|
160
160
|
#define const_str_plain___newobj__ global_constants[44]
|
|
161
161
|
// '.'
|
|
162
162
|
#define const_str_dot global_constants[45]
|
|
163
|
+
// '_'
|
|
164
|
+
#define const_str_underscore global_constants[45]
|
|
163
165
|
// '__getattr__'
|
|
164
166
|
#define const_str_plain___getattr__ global_constants[46]
|
|
165
167
|
// '__setattr__'
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
#ifndef __NUITKA_ENVIRONMENT_VARIABLES_H__
|
|
19
|
+
#define __NUITKA_ENVIRONMENT_VARIABLES_H__
|
|
20
|
+
|
|
21
|
+
#ifdef __IDE_ONLY__
|
|
22
|
+
#include "nuitka/prelude.h"
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
// Helpers for working with environment variables in a portable way. This mainly
|
|
26
|
+
// abstracts the string type differences between Win32 and non-Win32 environment
|
|
27
|
+
// variables.
|
|
28
|
+
#if defined(_WIN32)
|
|
29
|
+
#define environment_char_t wchar_t
|
|
30
|
+
#define compareEnvironmentString(a, b) wcscmp(a, b)
|
|
31
|
+
#define makeEnvironmentLiteral(x) L##x
|
|
32
|
+
#else
|
|
33
|
+
#define environment_char_t char
|
|
34
|
+
#define compareEnvironmentString(a, b) strcmp(a, b)
|
|
35
|
+
#define makeEnvironmentLiteral(x) x
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
extern environment_char_t const *getEnvironmentVariable(char const *name);
|
|
39
|
+
extern void setEnvironmentVariable(char const *name, environment_char_t const *value);
|
|
40
|
+
extern void unsetEnvironmentVariable(char const *name);
|
|
41
|
+
|
|
42
|
+
extern void undoEnvironmentVariable(PyThreadState *tstate, char const *variable_name,
|
|
43
|
+
environment_char_t const *old_value);
|
|
44
|
+
|
|
45
|
+
#endif
|
|
@@ -376,9 +376,9 @@ NUITKA_MAY_BE_UNUSED inline static void SET_CURRENT_EXCEPTION_TYPE0(PyThreadStat
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
// Same as "PyErr_SetObject" CPython API, use this instead.
|
|
379
|
-
#if PYTHON_VERSION < 0x3c0
|
|
380
379
|
NUITKA_MAY_BE_UNUSED inline static void
|
|
381
380
|
SET_CURRENT_EXCEPTION_TYPE0_VALUE0(PyThreadState *tstate, PyObject *exception_type, PyObject *exception_value) {
|
|
381
|
+
#if PYTHON_VERSION < 0x3c0
|
|
382
382
|
PyObject *old_exception_type = tstate->curexc_type;
|
|
383
383
|
PyObject *old_exception_value = tstate->curexc_value;
|
|
384
384
|
PyObject *old_exception_traceback = tstate->curexc_traceback;
|
|
@@ -397,10 +397,24 @@ SET_CURRENT_EXCEPTION_TYPE0_VALUE0(PyThreadState *tstate, PyObject *exception_ty
|
|
|
397
397
|
Py_XDECREF(old_exception_type);
|
|
398
398
|
Py_XDECREF(old_exception_value);
|
|
399
399
|
Py_XDECREF(old_exception_traceback);
|
|
400
|
+
#else
|
|
401
|
+
PyObject *old_exception = tstate->current_exception;
|
|
402
|
+
|
|
403
|
+
tstate->current_exception = exception_value;
|
|
404
|
+
Py_INCREF(exception_value);
|
|
405
|
+
|
|
406
|
+
#if _DEBUG_EXCEPTIONS
|
|
407
|
+
PRINT_STRING("SET_CURRENT_EXCEPTION_TYPE_0VALUE0:\n");
|
|
408
|
+
PRINT_CURRENT_EXCEPTION();
|
|
409
|
+
#endif
|
|
410
|
+
|
|
411
|
+
Py_XDECREF(old_exception);
|
|
412
|
+
#endif
|
|
400
413
|
}
|
|
401
414
|
|
|
402
415
|
NUITKA_MAY_BE_UNUSED inline static void
|
|
403
416
|
SET_CURRENT_EXCEPTION_TYPE0_VALUE1(PyThreadState *tstate, PyObject *exception_type, PyObject *exception_value) {
|
|
417
|
+
#if PYTHON_VERSION < 0x3c0
|
|
404
418
|
PyObject *old_exception_type = tstate->curexc_type;
|
|
405
419
|
PyObject *old_exception_value = tstate->curexc_value;
|
|
406
420
|
PyObject *old_exception_traceback = tstate->curexc_traceback;
|
|
@@ -418,10 +432,20 @@ SET_CURRENT_EXCEPTION_TYPE0_VALUE1(PyThreadState *tstate, PyObject *exception_ty
|
|
|
418
432
|
Py_XDECREF(old_exception_type);
|
|
419
433
|
Py_XDECREF(old_exception_value);
|
|
420
434
|
Py_XDECREF(old_exception_traceback);
|
|
421
|
-
|
|
435
|
+
#else
|
|
436
|
+
PyObject *old_exception = tstate->current_exception;
|
|
437
|
+
|
|
438
|
+
tstate->current_exception = exception_value;
|
|
422
439
|
|
|
440
|
+
#if _DEBUG_EXCEPTIONS
|
|
441
|
+
PRINT_STRING("SET_CURRENT_EXCEPTION_TYPE0_VALUE1:\n");
|
|
442
|
+
PRINT_CURRENT_EXCEPTION();
|
|
423
443
|
#endif
|
|
424
444
|
|
|
445
|
+
Py_XDECREF(old_exception);
|
|
446
|
+
#endif
|
|
447
|
+
}
|
|
448
|
+
|
|
425
449
|
// Helper that sets the current thread exception, and has no reference passed.
|
|
426
450
|
// Same as CPython API PyErr_SetString
|
|
427
451
|
|
|
@@ -889,10 +913,14 @@ extern void FORMAT_UNBOUND_CLOSURE_ERROR(PyObject **exception_type, PyObject **e
|
|
|
889
913
|
#endif
|
|
890
914
|
|
|
891
915
|
#if PYTHON_VERSION >= 0x3c0
|
|
892
|
-
static PyObject *
|
|
916
|
+
NUITKA_MAY_BE_UNUSED static PyObject *MAKE_TUPLE1(PyObject *element1);
|
|
917
|
+
|
|
918
|
+
static PyObject *_MAKE_EXCEPTION_FROM_TYPE_ARG0(PyObject *type, PyObject *arg) {
|
|
893
919
|
PyBaseExceptionObject *self;
|
|
894
920
|
|
|
895
|
-
|
|
921
|
+
PyTypeObject *type_object = (PyTypeObject *)type;
|
|
922
|
+
|
|
923
|
+
self = (PyBaseExceptionObject *)(type_object->tp_alloc(type_object, 0));
|
|
896
924
|
|
|
897
925
|
self->dict = NULL;
|
|
898
926
|
self->notes = NULL;
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
#ifndef __NUITKA_FILESYSTEM_PATH_OPS_H__
|
|
19
19
|
#define __NUITKA_FILESYSTEM_PATH_OPS_H__
|
|
20
20
|
|
|
21
|
+
#include "nuitka/safe_string_ops.h"
|
|
22
|
+
|
|
21
23
|
// Have a type for filename type different on Linux and Win32.
|
|
22
24
|
#if defined(_WIN32)
|
|
23
25
|
#define filename_char_t wchar_t
|
|
@@ -33,6 +35,7 @@
|
|
|
33
35
|
#define strlenFilename wcslen
|
|
34
36
|
#define strcmpFilename wcscmp
|
|
35
37
|
#define strdupFilename wcsdup
|
|
38
|
+
#define scanFilename swscanf
|
|
36
39
|
#else
|
|
37
40
|
#define filename_char_t char
|
|
38
41
|
#define FILENAME_EMPTY_STR ""
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
#define strlenFilename strlen
|
|
48
51
|
#define strcmpFilename strcmp
|
|
49
52
|
#define strdupFilename strdup
|
|
53
|
+
#define scanFilename sscanf
|
|
50
54
|
#endif
|
|
51
55
|
|
|
52
56
|
#if defined(_WIN32)
|
|
@@ -79,8 +83,9 @@ extern FILE_HANDLE openFileForReading(filename_char_t const *filename);
|
|
|
79
83
|
extern FILE_HANDLE createFileForWriting(filename_char_t const *filename);
|
|
80
84
|
extern int64_t getFileSize(FILE_HANDLE file_handle);
|
|
81
85
|
extern bool readFileChunk(FILE_HANDLE file_handle, void *buffer, size_t size);
|
|
82
|
-
extern bool writeFileChunk(FILE_HANDLE file_handle, void *buffer, size_t size);
|
|
86
|
+
extern bool writeFileChunk(FILE_HANDLE file_handle, void const *buffer, size_t size);
|
|
83
87
|
extern bool closeFile(FILE_HANDLE target_file);
|
|
88
|
+
extern error_code_t getLastErrorCode(void);
|
|
84
89
|
|
|
85
90
|
extern int getFileMode(filename_char_t const *filename);
|
|
86
91
|
extern bool copyFile(filename_char_t const *source, filename_char_t const *dest, int mode);
|
|
@@ -19,6 +19,16 @@
|
|
|
19
19
|
#ifndef __NUITKA_FREELISTS_H__
|
|
20
20
|
#define __NUITKA_FREELISTS_H__
|
|
21
21
|
|
|
22
|
+
#ifndef __cplusplus
|
|
23
|
+
#include "stdbool.h"
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
#ifdef _NUITKA_EXPERIMENTAL_DISABLE_FREELIST_ALL
|
|
27
|
+
static const bool use_freelists = false;
|
|
28
|
+
#else
|
|
29
|
+
static const bool use_freelists = true;
|
|
30
|
+
#endif
|
|
31
|
+
|
|
22
32
|
#define allocateFromFreeList(free_list, object_type, type_type, size) \
|
|
23
33
|
if (free_list != NULL) { \
|
|
24
34
|
result = free_list; \
|
|
@@ -51,7 +61,7 @@
|
|
|
51
61
|
CHECK_OBJECT(result);
|
|
52
62
|
|
|
53
63
|
#define releaseToFreeList(free_list, object, max_free_list_count) \
|
|
54
|
-
if (free_list != NULL || max_free_list_count == 0) {
|
|
64
|
+
if (free_list != NULL || max_free_list_count == 0 || use_freelists == false) { \
|
|
55
65
|
if (free_list##_count >= max_free_list_count) { \
|
|
56
66
|
PyObject_GC_Del(object); \
|
|
57
67
|
} else { \
|
|
@@ -214,7 +214,7 @@ static Nuitka_DictEntryHandle GET_STRING_DICT_ENTRY(PyDictObject *dict, Nuitka_S
|
|
|
214
214
|
#else
|
|
215
215
|
// Will be written by Nuitka_PyDictLookupStr in all cases.
|
|
216
216
|
PyObject **value;
|
|
217
|
-
Py_ssize_t found = Nuitka_PyDictLookupStr(dict, (PyObject *)key, hash, &value);
|
|
217
|
+
NUITKA_MAY_BE_UNUSED Py_ssize_t found = Nuitka_PyDictLookupStr(dict, (PyObject *)key, hash, &value);
|
|
218
218
|
assert(found != DKIX_ERROR);
|
|
219
219
|
|
|
220
220
|
return value;
|
|
@@ -38,6 +38,9 @@ extern PyObject *IMPORT_HARD__FROZEN_IMPORTLIB_EXTERNAL(void);
|
|
|
38
38
|
/* C helper for hard import of module "_io" import. */
|
|
39
39
|
extern PyObject *IMPORT_HARD__IO(void);
|
|
40
40
|
|
|
41
|
+
/* C helper for hard import of module "builtins" import. */
|
|
42
|
+
extern PyObject *IMPORT_HARD_BUILTINS(void);
|
|
43
|
+
|
|
41
44
|
/* C helper for hard import of module "ctypes" import. */
|
|
42
45
|
extern PyObject *IMPORT_HARD_CTYPES(void);
|
|
43
46
|
|
|
@@ -63,12 +63,14 @@
|
|
|
63
63
|
// From CPython, to allow us quick access to the dictionary of an module, the
|
|
64
64
|
// structure is normally private, but we need it for quick access to the module
|
|
65
65
|
// dictionary.
|
|
66
|
+
#if PYTHON_VERSION < 0x3c0
|
|
66
67
|
typedef struct {
|
|
67
68
|
/* Python object folklore: */
|
|
68
69
|
PyObject_HEAD
|
|
69
70
|
|
|
70
71
|
PyObject *md_dict;
|
|
71
72
|
} PyModuleObject;
|
|
73
|
+
#endif
|
|
72
74
|
|
|
73
75
|
// Generated code helpers, used in static helper codes:
|
|
74
76
|
extern PyObject *CALL_FUNCTION_WITH_ARGS2(PyThreadState *tstate, PyObject *called, PyObject *const *args);
|
|
@@ -37,6 +37,9 @@ extern PyObject *IMPORT_MODULE_KW(PyThreadState *tstate, PyObject *module_name,
|
|
|
37
37
|
|
|
38
38
|
extern bool IMPORT_MODULE_STAR(PyThreadState *tstate, PyObject *target, bool is_module, PyObject *module);
|
|
39
39
|
|
|
40
|
+
// Fixed import name to be imported and used by value name.
|
|
41
|
+
extern PyObject *IMPORT_MODULE_FIXED(PyThreadState *tstate, PyObject *module_name, PyObject *value_name);
|
|
42
|
+
|
|
40
43
|
// Import an embedded module directly.
|
|
41
44
|
extern PyObject *IMPORT_EMBEDDED_MODULE(PyThreadState *tstate, char const *name);
|
|
42
45
|
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
#endif
|
|
56
56
|
|
|
57
57
|
/* Include the relevant Python C-API header files. */
|
|
58
|
-
#include
|
|
59
|
-
#include
|
|
60
|
-
#include
|
|
61
|
-
#include
|
|
62
|
-
#include
|
|
63
|
-
#include
|
|
58
|
+
#include <Python.h>
|
|
59
|
+
#include <frameobject.h>
|
|
60
|
+
#include <marshal.h>
|
|
61
|
+
#include <methodobject.h>
|
|
62
|
+
#include <osdefs.h>
|
|
63
|
+
#include <structseq.h>
|
|
64
64
|
|
|
65
65
|
#if PYTHON_VERSION < 0x3a0
|
|
66
66
|
#include "pydebug.h"
|
|
@@ -126,6 +126,7 @@ extern _PyRuntimeState _PyRuntime;
|
|
|
126
126
|
#endif
|
|
127
127
|
|
|
128
128
|
#if PYTHON_VERSION >= 0x3b0
|
|
129
|
+
#include <internal/pycore_dict.h>
|
|
129
130
|
#include <internal/pycore_frame.h>
|
|
130
131
|
#include <internal/pycore_gc.h>
|
|
131
132
|
#endif
|
|
@@ -137,6 +138,10 @@ extern _PyRuntimeState _PyRuntime;
|
|
|
137
138
|
#undef CALL_FUNCTION
|
|
138
139
|
#endif
|
|
139
140
|
|
|
141
|
+
#if PYTHON_VERSION >= 0x3c0
|
|
142
|
+
#include <cpython/code.h>
|
|
143
|
+
#endif
|
|
144
|
+
|
|
140
145
|
#if !defined(PY_NOGIL) && PYTHON_VERSION < 0x3c0
|
|
141
146
|
#undef PyThreadState_GET
|
|
142
147
|
#define _PyThreadState_Current _PyRuntime.gilstate.tstate_current
|
|
@@ -485,6 +490,12 @@ extern PyObject *Nuitka_dunder_compiled_value;
|
|
|
485
490
|
#define NUITKA_INIT_PROGRAM_LATE(module_name)
|
|
486
491
|
#endif
|
|
487
492
|
|
|
493
|
+
#if _NUITKA_EXPERIMENTAL_EXIT_PROGRAM
|
|
494
|
+
#include "nuitka_exit_program.h"
|
|
495
|
+
#else
|
|
496
|
+
#define NUITKA_FINALIZE_PROGRAM(tstate)
|
|
497
|
+
#endif
|
|
498
|
+
|
|
488
499
|
// Only Python3.9+ has a more precise check, while making the old one slow.
|
|
489
500
|
#ifndef PyCFunction_CheckExact
|
|
490
501
|
#define PyCFunction_CheckExact PyCFunction_Check
|
|
@@ -37,7 +37,7 @@ typedef PyObject *(*module_initfunc)(PyThreadState *tstate, PyObject *module,
|
|
|
37
37
|
struct Nuitka_MetaPathBasedLoaderEntry const *loader_entry);
|
|
38
38
|
|
|
39
39
|
#if PYTHON_VERSION >= 0x370 && defined(_NUITKA_EXE) && !defined(_NUITKA_STANDALONE) && \
|
|
40
|
-
defined(
|
|
40
|
+
defined(_NUITKA_FILE_REFERENCE_ORIGINAL_MODE)
|
|
41
41
|
#define _NUITKA_FREEZER_HAS_FILE_PATH
|
|
42
42
|
#endif
|
|
43
43
|
|
|
@@ -9,6 +9,7 @@ to add another one.
|
|
|
9
9
|
"""
|
|
10
10
|
|
|
11
11
|
if __name__ == "__main__":
|
|
12
|
+
import hashlib
|
|
12
13
|
import os
|
|
13
14
|
import sys
|
|
14
15
|
|
|
@@ -37,6 +38,19 @@ if __name__ == "__main__":
|
|
|
37
38
|
# On Windows this Scons variable must be set by us.
|
|
38
39
|
os.environ["SCONS_LIB_DIR"] = sys.path[0]
|
|
39
40
|
|
|
41
|
+
# Workaround for FIPS enabled systems.
|
|
42
|
+
try:
|
|
43
|
+
hashlib.md5()
|
|
44
|
+
except ValueError:
|
|
45
|
+
# On FIPS compliant systems, checks might be enabled that require this
|
|
46
|
+
# parameter to be set.
|
|
47
|
+
_md5 = hashlib.md5
|
|
48
|
+
|
|
49
|
+
def md5(value=b""):
|
|
50
|
+
return _md5(value, usedforsecurity=False)
|
|
51
|
+
|
|
52
|
+
hashlib.md5 = md5
|
|
53
|
+
|
|
40
54
|
import SCons.Script # pylint: disable=import-error
|
|
41
55
|
|
|
42
56
|
# this does all the work, and calls sys.exit
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from ._monitor import TMonitor, TqdmSynchronisationWarning
|
|
2
2
|
from ._tqdm_pandas import tqdm_pandas
|
|
3
|
-
from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0
|
|
4
|
-
from .gui import trange as tgrange # TODO: remove in v5.0.0
|
|
3
|
+
# from .gui import tqdm as tqdm_gui # TODO: remove in v5.0.0
|
|
4
|
+
# from .gui import trange as tgrange # TODO: remove in v5.0.0
|
|
5
5
|
from .std import (
|
|
6
6
|
TqdmDeprecationWarning, TqdmExperimentalWarning, TqdmKeyError, TqdmMonitorWarning,
|
|
7
7
|
TqdmTypeError, TqdmWarning, tqdm, trange)
|
|
@@ -5,7 +5,7 @@ import os
|
|
|
5
5
|
import re
|
|
6
6
|
import sys
|
|
7
7
|
from functools import wraps
|
|
8
|
-
|
|
8
|
+
import warnings
|
|
9
9
|
|
|
10
10
|
# py2/3 compat
|
|
11
11
|
try:
|
|
@@ -236,9 +236,12 @@ def _screen_shape_wrapper(): # pragma: no cover
|
|
|
236
236
|
|
|
237
237
|
def _screen_shape_windows(fp): # pragma: no cover
|
|
238
238
|
try:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
with warnings.catch_warnings():
|
|
240
|
+
warnings.simplefilter("ignore")
|
|
241
|
+
|
|
242
|
+
import struct
|
|
243
|
+
from ctypes import create_string_buffer, windll
|
|
244
|
+
from sys import stdin, stdout
|
|
242
245
|
|
|
243
246
|
io_handle = -12 # assume stderr
|
|
244
247
|
if fp == stdin:
|
|
@@ -273,9 +276,12 @@ def _screen_shape_tput(*_): # pragma: no cover
|
|
|
273
276
|
def _screen_shape_linux(fp): # pragma: no cover
|
|
274
277
|
|
|
275
278
|
try:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
+
with warnings.catch_warnings():
|
|
280
|
+
warnings.simplefilter("ignore")
|
|
281
|
+
|
|
282
|
+
from array import array
|
|
283
|
+
from fcntl import ioctl
|
|
284
|
+
from termios import TIOCGWINSZ
|
|
279
285
|
except ImportError:
|
|
280
286
|
return None
|
|
281
287
|
else:
|
|
@@ -294,7 +300,7 @@ def _environ_cols_wrapper(): # pragma: no cover
|
|
|
294
300
|
Return a function which returns console width.
|
|
295
301
|
Supported: linux, osx, windows, cygwin.
|
|
296
302
|
"""
|
|
297
|
-
warn("Use `_screen_shape_wrapper()(file)[0]` instead of"
|
|
303
|
+
warnings.warn("Use `_screen_shape_wrapper()(file)[0]` instead of"
|
|
298
304
|
" `_environ_cols_wrapper()(file)`", DeprecationWarning, stacklevel=2)
|
|
299
305
|
shape = _screen_shape_wrapper()
|
|
300
306
|
if not shape:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Copyright notice:
|
|
2
|
+
|
|
3
|
+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
|
4
|
+
|
|
5
|
+
This software is provided 'as-is', without any express or implied
|
|
6
|
+
warranty. In no event will the authors be held liable for any damages
|
|
7
|
+
arising from the use of this software.
|
|
8
|
+
|
|
9
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
10
|
+
including commercial applications, and to alter it and redistribute it
|
|
11
|
+
freely, subject to the following restrictions:
|
|
12
|
+
|
|
13
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
14
|
+
claim that you wrote the original software. If you use this software
|
|
15
|
+
in a product, an acknowledgment in the product documentation would be
|
|
16
|
+
appreciated but is not required.
|
|
17
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
18
|
+
misrepresented as being the original software.
|
|
19
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
20
|
+
|
|
21
|
+
Jean-loup Gailly Mark Adler
|
|
22
|
+
jloup@gzip.org madler@alumni.caltech.edu
|