pforge 1.0.0__py3-none-any.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.
Files changed (1090) hide show
  1. pforge/Builtins.py +288 -0
  2. pforge/BytecodeCaching.py +209 -0
  3. pforge/Bytecodes.py +124 -0
  4. pforge/CacheCleanup.py +59 -0
  5. pforge/Constants.py +510 -0
  6. pforge/Errors.py +104 -0
  7. pforge/HardImportRegistry.py +591 -0
  8. pforge/MainControl.py +1535 -0
  9. pforge/ModuleRegistry.py +401 -0
  10. pforge/OutputDirectories.py +314 -0
  11. pforge/Policies.py +125 -0
  12. pforge/PostProcessing.py +621 -0
  13. pforge/Progress.py +930 -0
  14. pforge/PythonFlavors.py +556 -0
  15. pforge/PythonOperators.py +319 -0
  16. pforge/PythonPrefixes.py +285 -0
  17. pforge/PythonVersions.py +594 -0
  18. pforge/Serialization.py +359 -0
  19. pforge/SourceCodeReferences.py +181 -0
  20. pforge/States.py +59 -0
  21. pforge/Tracing.py +776 -0
  22. pforge/TreeXML.py +178 -0
  23. pforge/Variables.py +597 -0
  24. pforge/Version.py +91 -0
  25. pforge/VersionCheck.py +364 -0
  26. pforge/__init__.py +35 -0
  27. pforge/__main__.py +340 -0
  28. pforge/__past__.py +280 -0
  29. pforge/build/AIXObjGenerator.py +153 -0
  30. pforge/build/AdaptPythonHeaderFiles.py +505 -0
  31. pforge/build/Backend.scons +555 -0
  32. pforge/build/CCompilerVersion.scons +70 -0
  33. pforge/build/ConstantBlobFormat.py +440 -0
  34. pforge/build/DataComposerInterface.py +217 -0
  35. pforge/build/Offsets.scons +189 -0
  36. pforge/build/Onefile.scons +220 -0
  37. pforge/build/SconsCaching.py +586 -0
  38. pforge/build/SconsCompilerSettings.py +2419 -0
  39. pforge/build/SconsControl.py +170 -0
  40. pforge/build/SconsHacks.py +259 -0
  41. pforge/build/SconsInterface.py +996 -0
  42. pforge/build/SconsProgress.py +104 -0
  43. pforge/build/SconsPythonBuild.py +248 -0
  44. pforge/build/SconsSourceIndex.py +353 -0
  45. pforge/build/SconsSpawn.py +594 -0
  46. pforge/build/SconsStableIncludePaths.py +277 -0
  47. pforge/build/SconsUtils.py +1388 -0
  48. pforge/build/WindowsObjGenerator.py +175 -0
  49. pforge/build/__init__.py +22 -0
  50. pforge/build/include/pforge/allocator.h +1024 -0
  51. pforge/build/include/pforge/blobs.h +130 -0
  52. pforge/build/include/pforge/builtins.h +106 -0
  53. pforge/build/include/pforge/calling.h +140 -0
  54. pforge/build/include/pforge/checkers.h +63 -0
  55. pforge/build/include/pforge/checksum_tools.h +33 -0
  56. pforge/build/include/pforge/compiled_asyncgen.h +285 -0
  57. pforge/build/include/pforge/compiled_cell.h +89 -0
  58. pforge/build/include/pforge/compiled_coroutine.h +282 -0
  59. pforge/build/include/pforge/compiled_frame.h +896 -0
  60. pforge/build/include/pforge/compiled_function.h +176 -0
  61. pforge/build/include/pforge/compiled_generator.h +310 -0
  62. pforge/build/include/pforge/compiled_method.h +64 -0
  63. pforge/build/include/pforge/compiled_types_common.h +117 -0
  64. pforge/build/include/pforge/constants.h +202 -0
  65. pforge/build/include/pforge/constants_blob.h +62 -0
  66. pforge/build/include/pforge/constants_blob_spec.h +116 -0
  67. pforge/build/include/pforge/cpython_api_compat.h +46 -0
  68. pforge/build/include/pforge/debug_settings.h +63 -0
  69. pforge/build/include/pforge/defines.h +79 -0
  70. pforge/build/include/pforge/environment_variables.h +38 -0
  71. pforge/build/include/pforge/environment_variables_system.h +57 -0
  72. pforge/build/include/pforge/exception_groups.h +631 -0
  73. pforge/build/include/pforge/exceptions.h +1495 -0
  74. pforge/build/include/pforge/filesystem_paths.h +130 -0
  75. pforge/build/include/pforge/freelists.h +162 -0
  76. pforge/build/include/pforge/gc_runtime.h +170 -0
  77. pforge/build/include/pforge/hedley.h +1825 -0
  78. pforge/build/include/pforge/helper/attributes.h +98 -0
  79. pforge/build/include/pforge/helper/boolean.h +107 -0
  80. pforge/build/include/pforge/helper/bytearrays.h +44 -0
  81. pforge/build/include/pforge/helper/bytes.h +42 -0
  82. pforge/build/include/pforge/helper/calling_generated.h +139 -0
  83. pforge/build/include/pforge/helper/comparisons_dual_eq.h +58 -0
  84. pforge/build/include/pforge/helper/comparisons_dual_ge.h +50 -0
  85. pforge/build/include/pforge/helper/comparisons_dual_gt.h +50 -0
  86. pforge/build/include/pforge/helper/comparisons_dual_le.h +58 -0
  87. pforge/build/include/pforge/helper/comparisons_dual_lt.h +58 -0
  88. pforge/build/include/pforge/helper/comparisons_dual_ne.h +50 -0
  89. pforge/build/include/pforge/helper/comparisons_eq.h +263 -0
  90. pforge/build/include/pforge/helper/comparisons_ge.h +207 -0
  91. pforge/build/include/pforge/helper/comparisons_gt.h +207 -0
  92. pforge/build/include/pforge/helper/comparisons_le.h +263 -0
  93. pforge/build/include/pforge/helper/comparisons_lt.h +263 -0
  94. pforge/build/include/pforge/helper/comparisons_ne.h +207 -0
  95. pforge/build/include/pforge/helper/complex.h +57 -0
  96. pforge/build/include/pforge/helper/dict_internals.h +123 -0
  97. pforge/build/include/pforge/helper/dictionaries.h +568 -0
  98. pforge/build/include/pforge/helper/floats.h +41 -0
  99. pforge/build/include/pforge/helper/import_hard.h +153 -0
  100. pforge/build/include/pforge/helper/indexes.h +53 -0
  101. pforge/build/include/pforge/helper/ints.h +188 -0
  102. pforge/build/include/pforge/helper/iterators.h +467 -0
  103. pforge/build/include/pforge/helper/lists.h +113 -0
  104. pforge/build/include/pforge/helper/lists_generated.h +43 -0
  105. pforge/build/include/pforge/helper/long_helpers.h +78 -0
  106. pforge/build/include/pforge/helper/mappings.h +67 -0
  107. pforge/build/include/pforge/helper/operations.h +126 -0
  108. pforge/build/include/pforge/helper/operations_binary_add.h +268 -0
  109. pforge/build/include/pforge/helper/operations_binary_bitand.h +118 -0
  110. pforge/build/include/pforge/helper/operations_binary_bitor.h +118 -0
  111. pforge/build/include/pforge/helper/operations_binary_bitxor.h +118 -0
  112. pforge/build/include/pforge/helper/operations_binary_divmod.h +113 -0
  113. pforge/build/include/pforge/helper/operations_binary_dual_add.h +45 -0
  114. pforge/build/include/pforge/helper/operations_binary_dual_sub.h +49 -0
  115. pforge/build/include/pforge/helper/operations_binary_floordiv.h +113 -0
  116. pforge/build/include/pforge/helper/operations_binary_lshift.h +109 -0
  117. pforge/build/include/pforge/helper/operations_binary_matmult.h +70 -0
  118. pforge/build/include/pforge/helper/operations_binary_mod.h +314 -0
  119. pforge/build/include/pforge/helper/operations_binary_mult.h +275 -0
  120. pforge/build/include/pforge/helper/operations_binary_olddiv.h +135 -0
  121. pforge/build/include/pforge/helper/operations_binary_pow.h +100 -0
  122. pforge/build/include/pforge/helper/operations_binary_rshift.h +109 -0
  123. pforge/build/include/pforge/helper/operations_binary_sub.h +142 -0
  124. pforge/build/include/pforge/helper/operations_binary_truediv.h +113 -0
  125. pforge/build/include/pforge/helper/operations_builtin_types.h +268 -0
  126. pforge/build/include/pforge/helper/operations_inplace_add.h +181 -0
  127. pforge/build/include/pforge/helper/operations_inplace_bitand.h +84 -0
  128. pforge/build/include/pforge/helper/operations_inplace_bitor.h +84 -0
  129. pforge/build/include/pforge/helper/operations_inplace_bitxor.h +84 -0
  130. pforge/build/include/pforge/helper/operations_inplace_floordiv.h +103 -0
  131. pforge/build/include/pforge/helper/operations_inplace_lshift.h +70 -0
  132. pforge/build/include/pforge/helper/operations_inplace_matmult.h +68 -0
  133. pforge/build/include/pforge/helper/operations_inplace_mod.h +226 -0
  134. pforge/build/include/pforge/helper/operations_inplace_mult.h +192 -0
  135. pforge/build/include/pforge/helper/operations_inplace_olddiv.h +123 -0
  136. pforge/build/include/pforge/helper/operations_inplace_pow.h +95 -0
  137. pforge/build/include/pforge/helper/operations_inplace_rshift.h +70 -0
  138. pforge/build/include/pforge/helper/operations_inplace_sub.h +110 -0
  139. pforge/build/include/pforge/helper/operations_inplace_truediv.h +103 -0
  140. pforge/build/include/pforge/helper/pow_helpers.h +41 -0
  141. pforge/build/include/pforge/helper/raising.h +130 -0
  142. pforge/build/include/pforge/helper/rangeobjects.h +75 -0
  143. pforge/build/include/pforge/helper/repeat_helpers.h +41 -0
  144. pforge/build/include/pforge/helper/richcomparisons.h +39 -0
  145. pforge/build/include/pforge/helper/sequences.h +42 -0
  146. pforge/build/include/pforge/helper/sets.h +30 -0
  147. pforge/build/include/pforge/helper/slices.h +320 -0
  148. pforge/build/include/pforge/helper/strings.h +41 -0
  149. pforge/build/include/pforge/helper/subscripts.h +463 -0
  150. pforge/build/include/pforge/helper/tuples.h +220 -0
  151. pforge/build/include/pforge/helpers.h +512 -0
  152. pforge/build/include/pforge/importing.h +180 -0
  153. pforge/build/include/pforge/incbin.h +360 -0
  154. pforge/build/include/pforge/jit_sources.h +34 -0
  155. pforge/build/include/pforge/prelude.h +610 -0
  156. pforge/build/include/pforge/printing.h +92 -0
  157. pforge/build/include/pforge/python_internals_access.h +461 -0
  158. pforge/build/include/pforge/python_pgo.h +66 -0
  159. pforge/build/include/pforge/python_pgo_spec.h +69 -0
  160. pforge/build/include/pforge/safe_string_ops.h +78 -0
  161. pforge/build/include/pforge/string_functions.h +99 -0
  162. pforge/build/include/pforge/threading.h +158 -0
  163. pforge/build/include/pforge/tracing.h +86 -0
  164. pforge/build/include/pforge/type_aliases.h +42 -0
  165. pforge/build/include/pforge/unfreezing.h +200 -0
  166. pforge/build/inline_copy/appdirs/LICENSE.txt +23 -0
  167. pforge/build/inline_copy/appdirs/appdirs.py +611 -0
  168. pforge/build/inline_copy/bin/scons.py +68 -0
  169. pforge/build/inline_copy/jinja2/LICENSE.rst +28 -0
  170. pforge/build/inline_copy/jinja2/README.rst +2 -0
  171. pforge/build/inline_copy/jinja2/jinja2/__init__.py +72 -0
  172. pforge/build/inline_copy/jinja2/jinja2/_compat.py +105 -0
  173. pforge/build/inline_copy/jinja2/jinja2/_identifier.py +2 -0
  174. pforge/build/inline_copy/jinja2/jinja2/bccache.py +361 -0
  175. pforge/build/inline_copy/jinja2/jinja2/compiler.py +1721 -0
  176. pforge/build/inline_copy/jinja2/jinja2/constants.py +32 -0
  177. pforge/build/inline_copy/jinja2/jinja2/debug.py +378 -0
  178. pforge/build/inline_copy/jinja2/jinja2/defaults.py +56 -0
  179. pforge/build/inline_copy/jinja2/jinja2/environment.py +1276 -0
  180. pforge/build/inline_copy/jinja2/jinja2/exceptions.py +146 -0
  181. pforge/build/inline_copy/jinja2/jinja2/ext.py +627 -0
  182. pforge/build/inline_copy/jinja2/jinja2/filters.py +1190 -0
  183. pforge/build/inline_copy/jinja2/jinja2/idtracking.py +286 -0
  184. pforge/build/inline_copy/jinja2/jinja2/lexer.py +739 -0
  185. pforge/build/inline_copy/jinja2/jinja2/loaders.py +481 -0
  186. pforge/build/inline_copy/jinja2/jinja2/meta.py +106 -0
  187. pforge/build/inline_copy/jinja2/jinja2/nativetypes.py +220 -0
  188. pforge/build/inline_copy/jinja2/jinja2/nodes.py +999 -0
  189. pforge/build/inline_copy/jinja2/jinja2/optimizer.py +49 -0
  190. pforge/build/inline_copy/jinja2/jinja2/parser.py +903 -0
  191. pforge/build/inline_copy/jinja2/jinja2/runtime.py +808 -0
  192. pforge/build/inline_copy/jinja2/jinja2/sandbox.py +488 -0
  193. pforge/build/inline_copy/jinja2/jinja2/tests.py +174 -0
  194. pforge/build/inline_copy/jinja2/jinja2/utils.py +642 -0
  195. pforge/build/inline_copy/jinja2/jinja2/visitor.py +87 -0
  196. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Action.py +1619 -0
  197. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Builder.py +918 -0
  198. pforge/build/inline_copy/lib/scons-4.10.1/SCons/CacheDir.py +404 -0
  199. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Conftest.py +870 -0
  200. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Debug.py +254 -0
  201. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Defaults.py +760 -0
  202. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Environment.py +2910 -0
  203. pforge/build/inline_copy/lib/scons-4.10.1/SCons/EnvironmentValues.py +119 -0
  204. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Errors.py +222 -0
  205. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Executor.py +665 -0
  206. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Memoize.py +242 -0
  207. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Node/Alias.py +150 -0
  208. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Node/FS.py +3861 -0
  209. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Node/__init__.py +1807 -0
  210. pforge/build/inline_copy/lib/scons-4.10.1/SCons/PathList.py +227 -0
  211. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/__init__.py +381 -0
  212. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/aix.py +80 -0
  213. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/cygwin.py +62 -0
  214. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/darwin.py +71 -0
  215. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/hpux.py +45 -0
  216. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/irix.py +41 -0
  217. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/mingw.py +35 -0
  218. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/os2.py +56 -0
  219. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/posix.py +125 -0
  220. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/virtualenv.py +135 -0
  221. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Platform/win32.py +447 -0
  222. pforge/build/inline_copy/lib/scons-4.10.1/SCons/SConf.py +1174 -0
  223. pforge/build/inline_copy/lib/scons-4.10.1/SCons/SConsign.py +442 -0
  224. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Scanner/C.py +333 -0
  225. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Scanner/Dir.py +131 -0
  226. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Scanner/Prog.py +114 -0
  227. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Scanner/RC.py +57 -0
  228. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Scanner/__init__.py +438 -0
  229. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Script/Interactive.py +377 -0
  230. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Script/Main.py +1601 -0
  231. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Script/SConsOptions.py +1260 -0
  232. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Script/SConscript.py +713 -0
  233. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Script/__init__.py +498 -0
  234. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Subst.py +1003 -0
  235. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Taskmaster/Job.py +762 -0
  236. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Taskmaster/__init__.py +1137 -0
  237. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/386asm.py +61 -0
  238. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/GettextCommon.py +429 -0
  239. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Config.py +396 -0
  240. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Dispatcher.py +84 -0
  241. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Exceptions.py +56 -0
  242. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Kind.py +668 -0
  243. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Policy.py +330 -0
  244. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Registry.py +121 -0
  245. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/ScriptArguments.py +1103 -0
  246. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/SetupEnvDefault.py +236 -0
  247. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Util.py +494 -0
  248. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/Warnings.py +35 -0
  249. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/WinSDK.py +264 -0
  250. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/MSVC/__init__.py +56 -0
  251. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/__init__.py +101 -0
  252. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/arch.py +66 -0
  253. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/common.py +653 -0
  254. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/netframework.py +82 -0
  255. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/sdk.py +412 -0
  256. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/vc.py +2949 -0
  257. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/MSCommon/vs.py +647 -0
  258. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/PharLapCommon.py +116 -0
  259. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/__init__.py +893 -0
  260. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/aixc++.py +43 -0
  261. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/aixcc.py +74 -0
  262. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/aixcxx.py +77 -0
  263. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/aixlink.py +78 -0
  264. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/applelink.py +209 -0
  265. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/ar.py +63 -0
  266. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/as.py +49 -0
  267. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/asm.py +78 -0
  268. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/bcc32.py +81 -0
  269. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/c++.py +44 -0
  270. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/cc.py +105 -0
  271. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/clang.py +91 -0
  272. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/clangCommon/__init__.py +18 -0
  273. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/clangxx.py +99 -0
  274. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/cxx.py +95 -0
  275. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/cyglink.py +235 -0
  276. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/default.py +45 -0
  277. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/filesystem.py +94 -0
  278. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/g++.py +45 -0
  279. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/gas.py +56 -0
  280. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/gcc.py +108 -0
  281. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/gnulink.py +73 -0
  282. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/gxx.py +80 -0
  283. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/hpc++.py +45 -0
  284. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/hpcc.py +53 -0
  285. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/hpcxx.py +85 -0
  286. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/hplink.py +72 -0
  287. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/icc.py +59 -0
  288. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/icl.py +52 -0
  289. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/ilink32.py +60 -0
  290. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/install.py +510 -0
  291. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/intelc.py +617 -0
  292. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/link.py +72 -0
  293. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/linkCommon/LoadableModule.py +131 -0
  294. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/linkCommon/SharedLibrary.py +218 -0
  295. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/linkCommon/__init__.py +175 -0
  296. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/linkloc.py +112 -0
  297. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/m4.py +63 -0
  298. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/masm.py +77 -0
  299. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mingw.py +224 -0
  300. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/msgfmt.py +132 -0
  301. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/msginit.py +137 -0
  302. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/msgmerge.py +125 -0
  303. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mslib.py +78 -0
  304. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mslink.py +344 -0
  305. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mssdk.py +52 -0
  306. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/msvc.py +333 -0
  307. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/msvs.py +2197 -0
  308. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mwcc.py +207 -0
  309. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/mwld.py +108 -0
  310. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/nasm.py +72 -0
  311. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/rpcgen.py +70 -0
  312. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/tlib.py +53 -0
  313. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/wix.py +104 -0
  314. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Tool/xgettext.py +337 -0
  315. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/__init__.py +1423 -0
  316. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/envs.py +350 -0
  317. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/filelock.py +151 -0
  318. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/hashes.py +406 -0
  319. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/sctypes.py +383 -0
  320. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Util/stats.py +224 -0
  321. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Utilities/ConfigureCache.py +171 -0
  322. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Utilities/__init__.py +0 -0
  323. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Utilities/sconsign.py +492 -0
  324. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/BoolVariable.py +105 -0
  325. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/EnumVariable.py +148 -0
  326. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/ListVariable.py +237 -0
  327. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/PackageVariable.py +136 -0
  328. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/PathVariable.py +174 -0
  329. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Variables/__init__.py +468 -0
  330. pforge/build/inline_copy/lib/scons-4.10.1/SCons/Warnings.py +300 -0
  331. pforge/build/inline_copy/lib/scons-4.10.1/SCons/__init__.py +9 -0
  332. pforge/build/inline_copy/lib/scons-4.10.1/SCons/compat/__init__.py +104 -0
  333. pforge/build/inline_copy/lib/scons-4.10.1/SCons/compat/_scons_dbm.py +42 -0
  334. pforge/build/inline_copy/lib/scons-4.10.1/SCons/compat/win32.py +101 -0
  335. pforge/build/inline_copy/lib/scons-4.10.1/SCons/cpp.py +684 -0
  336. pforge/build/inline_copy/lib/scons-4.10.1/SCons/dblite.py +351 -0
  337. pforge/build/inline_copy/lib/scons-4.10.1/SCons/exitfuncs.py +59 -0
  338. pforge/build/inline_copy/markupsafe/LICENSE.rst +28 -0
  339. pforge/build/inline_copy/markupsafe/markupsafe/__init__.py +327 -0
  340. pforge/build/inline_copy/markupsafe/markupsafe/_compat.py +33 -0
  341. pforge/build/inline_copy/markupsafe/markupsafe/_constants.py +264 -0
  342. pforge/build/inline_copy/markupsafe/markupsafe/_native.py +69 -0
  343. pforge/build/inline_copy/pkg_resources/pkg_resources/__init__.py +3275 -0
  344. pforge/build/inline_copy/pkg_resources/pkg_resources/py31compat.py +21 -0
  345. pforge/build/inline_copy/python_hacl/LICENSE.txt +201 -0
  346. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.c +1430 -0
  347. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_MD5.h +66 -0
  348. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.c +463 -0
  349. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA1.h +66 -0
  350. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.c +1273 -0
  351. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA2.h +204 -0
  352. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.c +734 -0
  353. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Hash_SHA3.h +131 -0
  354. pforge/build/inline_copy/python_hacl/hacl_312/Hacl_Streaming_Types.h +83 -0
  355. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt128_Verified.h +346 -0
  356. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/FStar_UInt_8_16_32_64.h +107 -0
  357. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/fstar_uint128_struct_endianness.h +68 -0
  358. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/internal/target.h +293 -0
  359. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/lowstar_endianness.h +231 -0
  360. pforge/build/inline_copy/python_hacl/hacl_312/include/krml/types.h +14 -0
  361. pforge/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_MD5.h +56 -0
  362. pforge/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA1.h +56 -0
  363. pforge/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA2.h +164 -0
  364. pforge/build/inline_copy/python_hacl/hacl_312/internal/Hacl_Hash_SHA3.h +65 -0
  365. pforge/build/inline_copy/python_hacl/hacl_312/python_hacl_namespaces.h +89 -0
  366. pforge/build/inline_copy/stubgen/astunparse.py +938 -0
  367. pforge/build/inline_copy/stubgen/six.py +998 -0
  368. pforge/build/inline_copy/stubgen/stubgen.py +850 -0
  369. pforge/build/inline_copy/tqdm/tqdm/__init__.py +40 -0
  370. pforge/build/inline_copy/tqdm/tqdm/_main.py +9 -0
  371. pforge/build/inline_copy/tqdm/tqdm/_monitor.py +97 -0
  372. pforge/build/inline_copy/tqdm/tqdm/_tqdm.py +9 -0
  373. pforge/build/inline_copy/tqdm/tqdm/_tqdm_notebook.py +9 -0
  374. pforge/build/inline_copy/tqdm/tqdm/_tqdm_pandas.py +24 -0
  375. pforge/build/inline_copy/tqdm/tqdm/_utils.py +12 -0
  376. pforge/build/inline_copy/tqdm/tqdm/auto.py +44 -0
  377. pforge/build/inline_copy/tqdm/tqdm/autonotebook.py +28 -0
  378. pforge/build/inline_copy/tqdm/tqdm/dask.py +46 -0
  379. pforge/build/inline_copy/tqdm/tqdm/notebook.py +316 -0
  380. pforge/build/inline_copy/tqdm/tqdm/std.py +1527 -0
  381. pforge/build/inline_copy/tqdm/tqdm/tk.py +207 -0
  382. pforge/build/inline_copy/tqdm/tqdm/utils.py +351 -0
  383. pforge/build/inline_copy/tqdm/tqdm/version.py +2 -0
  384. pforge/build/inline_copy/yaml/LICENSE +20 -0
  385. pforge/build/inline_copy/yaml/yaml/__init__.py +427 -0
  386. pforge/build/inline_copy/yaml/yaml/composer.py +139 -0
  387. pforge/build/inline_copy/yaml/yaml/constructor.py +748 -0
  388. pforge/build/inline_copy/yaml/yaml/cyaml.py +101 -0
  389. pforge/build/inline_copy/yaml/yaml/dumper.py +62 -0
  390. pforge/build/inline_copy/yaml/yaml/emitter.py +1137 -0
  391. pforge/build/inline_copy/yaml/yaml/error.py +75 -0
  392. pforge/build/inline_copy/yaml/yaml/events.py +86 -0
  393. pforge/build/inline_copy/yaml/yaml/loader.py +63 -0
  394. pforge/build/inline_copy/yaml/yaml/nodes.py +49 -0
  395. pforge/build/inline_copy/yaml/yaml/parser.py +589 -0
  396. pforge/build/inline_copy/yaml/yaml/reader.py +185 -0
  397. pforge/build/inline_copy/yaml/yaml/representer.py +389 -0
  398. pforge/build/inline_copy/yaml/yaml/resolver.py +227 -0
  399. pforge/build/inline_copy/yaml/yaml/scanner.py +1435 -0
  400. pforge/build/inline_copy/yaml/yaml/serializer.py +111 -0
  401. pforge/build/inline_copy/yaml/yaml/tokens.py +104 -0
  402. pforge/build/inline_copy/zlib/LICENSE +22 -0
  403. pforge/build/inline_copy/zlib/crc32.c +991 -0
  404. pforge/build/inline_copy/zlib/crc32.h +9446 -0
  405. pforge/build/inline_copy/zlib/zconf.h +397 -0
  406. pforge/build/inline_copy/zlib/zutil.h +275 -0
  407. pforge/build/inline_copy/zstd/LICENSE.txt +30 -0
  408. pforge/build/inline_copy/zstd/common/bitstream.h +463 -0
  409. pforge/build/inline_copy/zstd/common/compiler.h +288 -0
  410. pforge/build/inline_copy/zstd/common/cpu.h +213 -0
  411. pforge/build/inline_copy/zstd/common/debug.h +107 -0
  412. pforge/build/inline_copy/zstd/common/entropy_common.c +360 -0
  413. pforge/build/inline_copy/zstd/common/error_private.c +56 -0
  414. pforge/build/inline_copy/zstd/common/error_private.h +80 -0
  415. pforge/build/inline_copy/zstd/common/fse.h +715 -0
  416. pforge/build/inline_copy/zstd/common/fse_decompress.c +393 -0
  417. pforge/build/inline_copy/zstd/common/huf.h +361 -0
  418. pforge/build/inline_copy/zstd/common/mem.h +426 -0
  419. pforge/build/inline_copy/zstd/common/xxhash.c +826 -0
  420. pforge/build/inline_copy/zstd/common/xxhash.h +285 -0
  421. pforge/build/inline_copy/zstd/common/zstd_common.c +83 -0
  422. pforge/build/inline_copy/zstd/common/zstd_deps.h +111 -0
  423. pforge/build/inline_copy/zstd/common/zstd_errors.h +95 -0
  424. pforge/build/inline_copy/zstd/common/zstd_internal.h +478 -0
  425. pforge/build/inline_copy/zstd/decompress/huf_decompress.c +1350 -0
  426. pforge/build/inline_copy/zstd/decompress/zstd_ddict.c +244 -0
  427. pforge/build/inline_copy/zstd/decompress/zstd_ddict.h +44 -0
  428. pforge/build/inline_copy/zstd/decompress/zstd_decompress.c +1930 -0
  429. pforge/build/inline_copy/zstd/decompress/zstd_decompress_block.c +1540 -0
  430. pforge/build/inline_copy/zstd/decompress/zstd_decompress_block.h +62 -0
  431. pforge/build/inline_copy/zstd/decompress/zstd_decompress_internal.h +190 -0
  432. pforge/build/inline_copy/zstd/zstd.h +2391 -0
  433. pforge/build/python_internal_offset/offsets_3.13-Windows-x86-gil-debug.json +6 -0
  434. pforge/build/python_internal_offset/offsets_3.13-Windows-x86-gil.json +6 -0
  435. pforge/build/python_internal_offset/offsets_3.13-Windows-x86_64-gil-debug.json +6 -0
  436. pforge/build/python_internal_offset/offsets_3.13-Windows-x86_64-gil.json +6 -0
  437. pforge/build/python_internal_offset/offsets_3.14-Windows-x86-gil-debug.json +7 -0
  438. pforge/build/python_internal_offset/offsets_3.14-Windows-x86-gil.json +7 -0
  439. pforge/build/python_internal_offset/offsets_3.14-Windows-x86_64-gil-debug.json +7 -0
  440. pforge/build/python_internal_offset/offsets_3.14-Windows-x86_64-gil.json +7 -0
  441. pforge/build/python_internal_offset/offsets_3.15-Windows-x86-gil-debug.json +7 -0
  442. pforge/build/python_internal_offset/offsets_3.15-Windows-x86-gil.json +7 -0
  443. pforge/build/python_internal_offset/offsets_3.15-Windows-x86_64-gil-debug.json +7 -0
  444. pforge/build/python_internal_offset/offsets_3.15-Windows-x86_64-gil.json +7 -0
  445. pforge/build/static_src/CompiledAsyncgenType.c +2393 -0
  446. pforge/build/static_src/CompiledCellType.c +324 -0
  447. pforge/build/static_src/CompiledCodeHelpers.c +2387 -0
  448. pforge/build/static_src/CompiledCoroutineType.c +2061 -0
  449. pforge/build/static_src/CompiledFrameLocalsProxyType.c +868 -0
  450. pforge/build/static_src/CompiledFrameType.c +1752 -0
  451. pforge/build/static_src/CompiledFunctionType.c +3608 -0
  452. pforge/build/static_src/CompiledGeneratorType.c +2064 -0
  453. pforge/build/static_src/CompiledGeneratorTypeUncompiledIntegration.c +2708 -0
  454. pforge/build/static_src/CompiledMethodType.c +701 -0
  455. pforge/build/static_src/HelpersAllocator.c +1132 -0
  456. pforge/build/static_src/HelpersAttributes.c +1261 -0
  457. pforge/build/static_src/HelpersBuiltin.c +1104 -0
  458. pforge/build/static_src/HelpersBuiltinTypeMethods.c +3678 -0
  459. pforge/build/static_src/HelpersBytes.c +148 -0
  460. pforge/build/static_src/HelpersCalling.c +400 -0
  461. pforge/build/static_src/HelpersCallingGenerated.c +14688 -0
  462. pforge/build/static_src/HelpersChecksumTools.c +72 -0
  463. pforge/build/static_src/HelpersClasses.c +94 -0
  464. pforge/build/static_src/HelpersComparisonDualEq.c +201 -0
  465. pforge/build/static_src/HelpersComparisonDualGe.c +139 -0
  466. pforge/build/static_src/HelpersComparisonDualGt.c +139 -0
  467. pforge/build/static_src/HelpersComparisonDualLe.c +201 -0
  468. pforge/build/static_src/HelpersComparisonDualLt.c +201 -0
  469. pforge/build/static_src/HelpersComparisonDualNe.c +139 -0
  470. pforge/build/static_src/HelpersComparisonEq.c +12140 -0
  471. pforge/build/static_src/HelpersComparisonEqUtils.c +174 -0
  472. pforge/build/static_src/HelpersComparisonGe.c +11910 -0
  473. pforge/build/static_src/HelpersComparisonGt.c +11894 -0
  474. pforge/build/static_src/HelpersComparisonLe.c +12032 -0
  475. pforge/build/static_src/HelpersComparisonLt.c +12016 -0
  476. pforge/build/static_src/HelpersComparisonNe.c +12014 -0
  477. pforge/build/static_src/HelpersConsole.c +233 -0
  478. pforge/build/static_src/HelpersConstantsBlob.c +1780 -0
  479. pforge/build/static_src/HelpersDeepcopy.c +810 -0
  480. pforge/build/static_src/HelpersDialogs.c +232 -0
  481. pforge/build/static_src/HelpersDictionaries.c +4383 -0
  482. pforge/build/static_src/HelpersDictionariesGenerated.c +476 -0
  483. pforge/build/static_src/HelpersDictionariesSetGenerated.c +1043 -0
  484. pforge/build/static_src/HelpersDumpBacktraces.c +157 -0
  485. pforge/build/static_src/HelpersEnvironmentVariables.c +68 -0
  486. pforge/build/static_src/HelpersEnvironmentVariablesSystem.c +125 -0
  487. pforge/build/static_src/HelpersExceptions.c +322 -0
  488. pforge/build/static_src/HelpersFiles.c +366 -0
  489. pforge/build/static_src/HelpersFilesystemPaths.c +1636 -0
  490. pforge/build/static_src/HelpersFloats.c +107 -0
  491. pforge/build/static_src/HelpersHeapStorage.c +99 -0
  492. pforge/build/static_src/HelpersImport.c +604 -0
  493. pforge/build/static_src/HelpersImportHard.c +644 -0
  494. pforge/build/static_src/HelpersJitSources.c +52 -0
  495. pforge/build/static_src/HelpersLists.c +1214 -0
  496. pforge/build/static_src/HelpersListsGenerated.c +568 -0
  497. pforge/build/static_src/HelpersMappings.c +49 -0
  498. pforge/build/static_src/HelpersMatching.c +212 -0
  499. pforge/build/static_src/HelpersOperationBinaryAdd.c +6751 -0
  500. pforge/build/static_src/HelpersOperationBinaryAddUtils.c +834 -0
  501. pforge/build/static_src/HelpersOperationBinaryBitand.c +2744 -0
  502. pforge/build/static_src/HelpersOperationBinaryBitor.c +2744 -0
  503. pforge/build/static_src/HelpersOperationBinaryBitxor.c +2744 -0
  504. pforge/build/static_src/HelpersOperationBinaryDivmod.c +2412 -0
  505. pforge/build/static_src/HelpersOperationBinaryDivmodUtils.c +36 -0
  506. pforge/build/static_src/HelpersOperationBinaryDualAdd.c +176 -0
  507. pforge/build/static_src/HelpersOperationBinaryDualSub.c +242 -0
  508. pforge/build/static_src/HelpersOperationBinaryFloordiv.c +2428 -0
  509. pforge/build/static_src/HelpersOperationBinaryLshift.c +2852 -0
  510. pforge/build/static_src/HelpersOperationBinaryMatmult.c +459 -0
  511. pforge/build/static_src/HelpersOperationBinaryMod.c +6555 -0
  512. pforge/build/static_src/HelpersOperationBinaryMult.c +6712 -0
  513. pforge/build/static_src/HelpersOperationBinaryMultUtils.c +142 -0
  514. pforge/build/static_src/HelpersOperationBinaryOlddiv.c +2361 -0
  515. pforge/build/static_src/HelpersOperationBinaryPow.c +2923 -0
  516. pforge/build/static_src/HelpersOperationBinaryPowUtils.c +29 -0
  517. pforge/build/static_src/HelpersOperationBinaryRshift.c +2712 -0
  518. pforge/build/static_src/HelpersOperationBinarySub.c +2880 -0
  519. pforge/build/static_src/HelpersOperationBinaryTruediv.c +2421 -0
  520. pforge/build/static_src/HelpersOperationInplaceAdd.c +5219 -0
  521. pforge/build/static_src/HelpersOperationInplaceAddUtils.c +151 -0
  522. pforge/build/static_src/HelpersOperationInplaceBitand.c +1830 -0
  523. pforge/build/static_src/HelpersOperationInplaceBitor.c +1830 -0
  524. pforge/build/static_src/HelpersOperationInplaceBitxor.c +1830 -0
  525. pforge/build/static_src/HelpersOperationInplaceFloordiv.c +2609 -0
  526. pforge/build/static_src/HelpersOperationInplaceLshift.c +1598 -0
  527. pforge/build/static_src/HelpersOperationInplaceMatmult.c +607 -0
  528. pforge/build/static_src/HelpersOperationInplaceMod.c +4766 -0
  529. pforge/build/static_src/HelpersOperationInplaceMult.c +4695 -0
  530. pforge/build/static_src/HelpersOperationInplaceOlddiv.c +2557 -0
  531. pforge/build/static_src/HelpersOperationInplacePow.c +3063 -0
  532. pforge/build/static_src/HelpersOperationInplaceRshift.c +1538 -0
  533. pforge/build/static_src/HelpersOperationInplaceSub.c +2900 -0
  534. pforge/build/static_src/HelpersOperationInplaceTruediv.c +2616 -0
  535. pforge/build/static_src/HelpersProfiling.c +107 -0
  536. pforge/build/static_src/HelpersPythonPgo.c +1137 -0
  537. pforge/build/static_src/HelpersRaising.c +473 -0
  538. pforge/build/static_src/HelpersSafeStrings.c +282 -0
  539. pforge/build/static_src/HelpersSequences.c +179 -0
  540. pforge/build/static_src/HelpersSlices.c +87 -0
  541. pforge/build/static_src/HelpersStrings.c +1260 -0
  542. pforge/build/static_src/HelpersTuples.c +180 -0
  543. pforge/build/static_src/HelpersTypes.c +1240 -0
  544. pforge/build/static_src/HelpersWarnings.c +86 -0
  545. pforge/build/static_src/InspectPatcher.c +700 -0
  546. pforge/build/static_src/MainProgram.c +2611 -0
  547. pforge/build/static_src/MetaPathBasedLoader.c +3817 -0
  548. pforge/build/static_src/MetaPathBasedLoaderImportlibMetadataDistribution.c +135 -0
  549. pforge/build/static_src/MetaPathBasedLoaderResourceReader.c +218 -0
  550. pforge/build/static_src/MetaPathBasedLoaderResourceReaderFiles.c +845 -0
  551. pforge/build/static_src/OnefileBootstrap.c +2098 -0
  552. pforge/build/static_src/OnefileSplashScreen.cpp +301 -0
  553. pforge/code_generation/AnnotateFunctionCodes.py +234 -0
  554. pforge/code_generation/AsyncgenCodes.py +199 -0
  555. pforge/code_generation/AttributeCodes.py +360 -0
  556. pforge/code_generation/BinaryOperationHelperDefinitions.py +740 -0
  557. pforge/code_generation/BranchCodes.py +68 -0
  558. pforge/code_generation/BuiltinCodes.py +642 -0
  559. pforge/code_generation/CallCodes.py +1280 -0
  560. pforge/code_generation/ClassCodes.py +288 -0
  561. pforge/code_generation/CodeGeneration.py +1228 -0
  562. pforge/code_generation/CodeHelperSelection.py +84 -0
  563. pforge/code_generation/CodeHelpers.py +459 -0
  564. pforge/code_generation/CodeObjectCodes.py +33 -0
  565. pforge/code_generation/ComparisonCodes.py +575 -0
  566. pforge/code_generation/ComparisonHelperDefinitions.py +158 -0
  567. pforge/code_generation/ConditionalCodes.py +236 -0
  568. pforge/code_generation/ConstantCodes.py +454 -0
  569. pforge/code_generation/Contexts.py +1275 -0
  570. pforge/code_generation/CoroutineCodes.py +265 -0
  571. pforge/code_generation/CtypesCodes.py +49 -0
  572. pforge/code_generation/DeferredReleaseCodes.py +68 -0
  573. pforge/code_generation/DictCodes.py +946 -0
  574. pforge/code_generation/Emission.py +69 -0
  575. pforge/code_generation/ErrorCodes.py +457 -0
  576. pforge/code_generation/EvalCodes.py +464 -0
  577. pforge/code_generation/ExceptionCodes.py +378 -0
  578. pforge/code_generation/ExpressionCTypeSelectionHelpers.py +230 -0
  579. pforge/code_generation/ExpressionCodes.py +64 -0
  580. pforge/code_generation/FrameCodes.py +669 -0
  581. pforge/code_generation/FunctionCodes.py +1064 -0
  582. pforge/code_generation/GeneratorCodes.py +230 -0
  583. pforge/code_generation/GlobalConstants.py +286 -0
  584. pforge/code_generation/GlobalsLocalsCodes.py +226 -0
  585. pforge/code_generation/IdCodes.py +54 -0
  586. pforge/code_generation/ImportCodes.py +789 -0
  587. pforge/code_generation/Indentation.py +34 -0
  588. pforge/code_generation/IndexCodes.py +53 -0
  589. pforge/code_generation/IntegerCodes.py +111 -0
  590. pforge/code_generation/IteratorCodes.py +588 -0
  591. pforge/code_generation/JitCodes.py +47 -0
  592. pforge/code_generation/LabelCodes.py +68 -0
  593. pforge/code_generation/LineNumberCodes.py +98 -0
  594. pforge/code_generation/ListCodes.py +506 -0
  595. pforge/code_generation/LoaderCodes.py +449 -0
  596. pforge/code_generation/LocalsDictCodes.py +370 -0
  597. pforge/code_generation/LoopCodes.py +111 -0
  598. pforge/code_generation/MatchCodes.py +68 -0
  599. pforge/code_generation/ModuleCodes.py +313 -0
  600. pforge/code_generation/Namify.py +292 -0
  601. pforge/code_generation/NetworkxCodes.py +54 -0
  602. pforge/code_generation/OperationCodes.py +404 -0
  603. pforge/code_generation/PackageResourceCodes.py +1129 -0
  604. pforge/code_generation/PgoCodes.py +217 -0
  605. pforge/code_generation/PrintCodes.py +96 -0
  606. pforge/code_generation/PythonAPICodes.py +279 -0
  607. pforge/code_generation/PythonSourceCodeGeneration.py +1247 -0
  608. pforge/code_generation/RaisingCodes.py +490 -0
  609. pforge/code_generation/Reports.py +118 -0
  610. pforge/code_generation/ReturnCodes.py +166 -0
  611. pforge/code_generation/SetCodes.py +199 -0
  612. pforge/code_generation/SliceCodes.py +468 -0
  613. pforge/code_generation/SpecialConstantData.py +76 -0
  614. pforge/code_generation/StringCodes.py +406 -0
  615. pforge/code_generation/SubscriptCodes.py +255 -0
  616. pforge/code_generation/TensorflowCodes.py +57 -0
  617. pforge/code_generation/TryCodes.py +360 -0
  618. pforge/code_generation/TupleCodes.py +116 -0
  619. pforge/code_generation/TypeAliasCodes.py +182 -0
  620. pforge/code_generation/VariableCodes.py +596 -0
  621. pforge/code_generation/VariableDeclarations.py +432 -0
  622. pforge/code_generation/YieldCodes.py +274 -0
  623. pforge/code_generation/__init__.py +22 -0
  624. pforge/code_generation/c_types/CTypeBases.py +191 -0
  625. pforge/code_generation/c_types/CTypeBooleans.py +105 -0
  626. pforge/code_generation/c_types/CTypeCFloats.py +62 -0
  627. pforge/code_generation/c_types/CTypeCLongs.py +46 -0
  628. pforge/code_generation/c_types/CTypeModuleDictVariables.py +114 -0
  629. pforge/code_generation/c_types/CTypePforgeBooleans.py +151 -0
  630. pforge/code_generation/c_types/CTypePforgeInts.py +201 -0
  631. pforge/code_generation/c_types/CTypePforgeVoids.py +110 -0
  632. pforge/code_generation/c_types/CTypePyObjectPointers.py +709 -0
  633. pforge/code_generation/c_types/CTypeVoids.py +93 -0
  634. pforge/code_generation/c_types/__init__.py +22 -0
  635. pforge/code_generation/templates/CodeTemplatesAsyncgens.py +108 -0
  636. pforge/code_generation/templates/CodeTemplatesConstants.py +323 -0
  637. pforge/code_generation/templates/CodeTemplatesCoroutines.py +111 -0
  638. pforge/code_generation/templates/CodeTemplatesExceptions.py +81 -0
  639. pforge/code_generation/templates/CodeTemplatesFrames.py +225 -0
  640. pforge/code_generation/templates/CodeTemplatesFunction.py +131 -0
  641. pforge/code_generation/templates/CodeTemplatesGeneratorFunction.py +131 -0
  642. pforge/code_generation/templates/CodeTemplatesIterators.py +40 -0
  643. pforge/code_generation/templates/CodeTemplatesLoader.py +183 -0
  644. pforge/code_generation/templates/CodeTemplatesModules.py +714 -0
  645. pforge/code_generation/templates/CodeTemplatesVariables.py +439 -0
  646. pforge/code_generation/templates/TemplateDebugWrapper.py +83 -0
  647. pforge/code_generation/templates/__init__.py +22 -0
  648. pforge/code_generation/templates_c/CodeTemplateCallsMethodPositional.c.j2 +324 -0
  649. pforge/code_generation/templates_c/CodeTemplateCallsMixed.c.j2 +146 -0
  650. pforge/code_generation/templates_c/CodeTemplateCallsPositional.c.j2 +694 -0
  651. pforge/code_generation/templates_c/CodeTemplateCallsPositionalMethodDescr.c.j2 +169 -0
  652. pforge/code_generation/templates_c/CodeTemplateMakeListHinted.c.j2 +41 -0
  653. pforge/code_generation/templates_c/CodeTemplateMakeListSmall.c.j2 +44 -0
  654. pforge/code_generation/templates_c/HelperBuiltinMethodOperation.c.j2 +56 -0
  655. pforge/code_generation/templates_c/HelperDictionaryCopy.c.j2 +334 -0
  656. pforge/code_generation/templates_c/HelperDictionarySet.c.j2 +613 -0
  657. pforge/code_generation/templates_c/HelperImportHard.c.j2 +40 -0
  658. pforge/code_generation/templates_c/HelperLongTools.c.j2 +56 -0
  659. pforge/code_generation/templates_c/HelperObjectTools.c.j2 +23 -0
  660. pforge/code_generation/templates_c/HelperOperationBinary.c.j2 +151 -0
  661. pforge/code_generation/templates_c/HelperOperationBinaryDual.c.j2 +118 -0
  662. pforge/code_generation/templates_c/HelperOperationComparison.c.j2 +355 -0
  663. pforge/code_generation/templates_c/HelperOperationComparisonBytes.c.j2 +118 -0
  664. pforge/code_generation/templates_c/HelperOperationComparisonDual.c.j2 +89 -0
  665. pforge/code_generation/templates_c/HelperOperationComparisonFloat.c.j2 +34 -0
  666. pforge/code_generation/templates_c/HelperOperationComparisonInt.c.j2 +35 -0
  667. pforge/code_generation/templates_c/HelperOperationComparisonList.c.j2 +131 -0
  668. pforge/code_generation/templates_c/HelperOperationComparisonLong.c.j2 +160 -0
  669. pforge/code_generation/templates_c/HelperOperationComparisonStr.c.j2 +118 -0
  670. pforge/code_generation/templates_c/HelperOperationComparisonTuple.c.j2 +102 -0
  671. pforge/code_generation/templates_c/HelperOperationComparisonUnicode.c.j2 +118 -0
  672. pforge/code_generation/templates_c/HelperOperationInplace.c.j2 +290 -0
  673. pforge/code_generation/templates_c/HelperSlotsBinary.c.j2 +441 -0
  674. pforge/code_generation/templates_c/HelperSlotsBytes.c.j2 +54 -0
  675. pforge/code_generation/templates_c/HelperSlotsCommon.c.j2 +74 -0
  676. pforge/code_generation/templates_c/HelperSlotsFloat.c.j2 +387 -0
  677. pforge/code_generation/templates_c/HelperSlotsInt.c.j2 +414 -0
  678. pforge/code_generation/templates_c/HelperSlotsList.c.j2 +62 -0
  679. pforge/code_generation/templates_c/HelperSlotsLong.c.j2 +232 -0
  680. pforge/code_generation/templates_c/HelperSlotsSet.c.j2 +50 -0
  681. pforge/code_generation/templates_c/HelperSlotsStr.c.j2 +58 -0
  682. pforge/code_generation/templates_c/HelperSlotsTuple.c.j2 +61 -0
  683. pforge/code_generation/templates_c/HelperSlotsUnicode.c.j2 +65 -0
  684. pforge/containers/Namedtuples.py +63 -0
  685. pforge/containers/OrderedDicts.py +191 -0
  686. pforge/containers/OrderedSets.py +43 -0
  687. pforge/containers/OrderedSetsFallback.py +142 -0
  688. pforge/containers/__init__.py +22 -0
  689. pforge/distutils/Build.py +79 -0
  690. pforge/distutils/DistutilsCommands.py +516 -0
  691. pforge/distutils/__init__.py +22 -0
  692. pforge/finalizations/Finalization.py +38 -0
  693. pforge/finalizations/FinalizeMarkups.py +124 -0
  694. pforge/finalizations/__init__.py +22 -0
  695. pforge/format/BiomeFormatter.py +147 -0
  696. pforge/format/FileFormatting.py +392 -0
  697. pforge/format/PythonFormatting.py +477 -0
  698. pforge/format/YamlChecker.py +239 -0
  699. pforge/format/YamlFormatter.py +476 -0
  700. pforge/format/__init__.py +28 -0
  701. pforge/format/biome.json +10 -0
  702. pforge/freezer/DllDependenciesCommon.py +221 -0
  703. pforge/freezer/DllDependenciesMacOS.py +642 -0
  704. pforge/freezer/DllDependenciesPosix.py +256 -0
  705. pforge/freezer/DllDependenciesWin32.py +683 -0
  706. pforge/freezer/DllDependenciesWin32DependsExe.py +331 -0
  707. pforge/freezer/DllDependenciesWin32PEFile.py +130 -0
  708. pforge/freezer/DllDependenciesWin32WinDepends.py +329 -0
  709. pforge/freezer/ImportDetection.py +367 -0
  710. pforge/freezer/IncludedDataFiles.py +1319 -0
  711. pforge/freezer/IncludedEntryPoints.py +568 -0
  712. pforge/freezer/LinuxApp.py +256 -0
  713. pforge/freezer/MacOSApp.py +270 -0
  714. pforge/freezer/Onefile.py +364 -0
  715. pforge/freezer/Standalone.py +845 -0
  716. pforge/freezer/__init__.py +22 -0
  717. pforge/importing/FakeModules.py +117 -0
  718. pforge/importing/IgnoreListing.py +449 -0
  719. pforge/importing/ImportCache.py +98 -0
  720. pforge/importing/ImportResolving.py +187 -0
  721. pforge/importing/Importing.py +1729 -0
  722. pforge/importing/ImportingResults.py +48 -0
  723. pforge/importing/PreloadedPackages.py +169 -0
  724. pforge/importing/Recursion.py +881 -0
  725. pforge/importing/StandardLibrary.py +459 -0
  726. pforge/importing/__init__.py +22 -0
  727. pforge/installer/Installer.py +147 -0
  728. pforge/installer/LinuxInstaller.py +137 -0
  729. pforge/installer/MacOSDmg.py +197 -0
  730. pforge/installer/WindowsInstaller.py +162 -0
  731. pforge/installer/__init__.py +22 -0
  732. pforge/installer/backends/AppImageBackend.py +261 -0
  733. pforge/installer/backends/NsisBackend.py +522 -0
  734. pforge/installer/backends/NsisTemplate.nsi +105 -0
  735. pforge/installer/backends/__init__.py +26 -0
  736. pforge/nodes/AsyncgenNodes.py +89 -0
  737. pforge/nodes/AttributeLookupNodes.py +127 -0
  738. pforge/nodes/AttributeNodes.py +400 -0
  739. pforge/nodes/AttributeNodesGenerated.py +10978 -0
  740. pforge/nodes/BuiltinAllNodes.py +116 -0
  741. pforge/nodes/BuiltinAnyNodes.py +125 -0
  742. pforge/nodes/BuiltinComplexNodes.py +92 -0
  743. pforge/nodes/BuiltinDecodingNodes.py +55 -0
  744. pforge/nodes/BuiltinDecoratorNodes.py +92 -0
  745. pforge/nodes/BuiltinDictNodes.py +231 -0
  746. pforge/nodes/BuiltinFormatNodes.py +165 -0
  747. pforge/nodes/BuiltinHashNodes.py +70 -0
  748. pforge/nodes/BuiltinInputNodes.py +46 -0
  749. pforge/nodes/BuiltinIntegerNodes.py +194 -0
  750. pforge/nodes/BuiltinIteratorNodes.py +743 -0
  751. pforge/nodes/BuiltinLenNodes.py +64 -0
  752. pforge/nodes/BuiltinNextNodes.py +118 -0
  753. pforge/nodes/BuiltinOpenNodes.py +103 -0
  754. pforge/nodes/BuiltinOperationNodeBasesGenerated.py +7382 -0
  755. pforge/nodes/BuiltinRangeNodes.py +701 -0
  756. pforge/nodes/BuiltinRefNodes.py +328 -0
  757. pforge/nodes/BuiltinSumNodes.py +111 -0
  758. pforge/nodes/BuiltinTemplateNodes.py +74 -0
  759. pforge/nodes/BuiltinTypeNodes.py +491 -0
  760. pforge/nodes/BuiltinVarsNodes.py +51 -0
  761. pforge/nodes/BytesNodes.py +830 -0
  762. pforge/nodes/CallNodes.py +220 -0
  763. pforge/nodes/Checkers.py +58 -0
  764. pforge/nodes/ChildrenHavingMixins.py +24956 -0
  765. pforge/nodes/ClassNodes.py +581 -0
  766. pforge/nodes/CodeObjectSpecs.py +518 -0
  767. pforge/nodes/ComparisonNodes.py +691 -0
  768. pforge/nodes/ConditionalNodes.py +946 -0
  769. pforge/nodes/ConstantRefNodes.py +1894 -0
  770. pforge/nodes/ContainerMakingNodes.py +412 -0
  771. pforge/nodes/ContainerOperationNodes.py +97 -0
  772. pforge/nodes/CoroutineNodes.py +126 -0
  773. pforge/nodes/CtypesNodes.py +52 -0
  774. pforge/nodes/DictionaryNodes.py +1571 -0
  775. pforge/nodes/ExceptionNodes.py +467 -0
  776. pforge/nodes/ExecEvalNodes.py +246 -0
  777. pforge/nodes/ExpressionBases.py +1356 -0
  778. pforge/nodes/ExpressionBasesGenerated.py +3183 -0
  779. pforge/nodes/ExpressionShapeMixins.py +965 -0
  780. pforge/nodes/FrameNodes.py +516 -0
  781. pforge/nodes/FunctionAttributeNodes.py +105 -0
  782. pforge/nodes/FunctionNodes.py +1347 -0
  783. pforge/nodes/FutureSpecs.py +227 -0
  784. pforge/nodes/GeneratorNodes.py +204 -0
  785. pforge/nodes/GlobalsLocalsNodes.py +226 -0
  786. pforge/nodes/HardImportNodes.py +52 -0
  787. pforge/nodes/HardImportNodesGenerated.py +5059 -0
  788. pforge/nodes/ImportHardNodes.py +193 -0
  789. pforge/nodes/ImportNodes.py +1542 -0
  790. pforge/nodes/IndicatorMixins.py +82 -0
  791. pforge/nodes/IterationHandles.py +412 -0
  792. pforge/nodes/KeyValuePairNodes.py +381 -0
  793. pforge/nodes/ListOperationNodes.py +534 -0
  794. pforge/nodes/LocalsDictNodes.py +778 -0
  795. pforge/nodes/LocalsScopes.py +539 -0
  796. pforge/nodes/LoopNodes.py +605 -0
  797. pforge/nodes/MatchNodes.py +63 -0
  798. pforge/nodes/ModuleAttributeNodes.py +209 -0
  799. pforge/nodes/ModuleNodes.py +1233 -0
  800. pforge/nodes/NetworkxNodes.py +46 -0
  801. pforge/nodes/NodeBases.py +957 -0
  802. pforge/nodes/NodeMakingHelpers.py +500 -0
  803. pforge/nodes/NodeMetaClasses.py +171 -0
  804. pforge/nodes/OperatorNodes.py +1094 -0
  805. pforge/nodes/OperatorNodesUnary.py +406 -0
  806. pforge/nodes/OsSysNodes.py +344 -0
  807. pforge/nodes/OutlineNodes.py +504 -0
  808. pforge/nodes/PackageMetadataNodes.py +999 -0
  809. pforge/nodes/PackageResourceNodes.py +566 -0
  810. pforge/nodes/PrintNodes.py +178 -0
  811. pforge/nodes/ReturnNodes.py +258 -0
  812. pforge/nodes/RuntimePathNodes.py +44 -0
  813. pforge/nodes/SideEffectNodes.py +142 -0
  814. pforge/nodes/SliceNodes.py +401 -0
  815. pforge/nodes/StatementBasesGenerated.py +3896 -0
  816. pforge/nodes/StatementNodes.py +299 -0
  817. pforge/nodes/StrNodes.py +989 -0
  818. pforge/nodes/StringConcatenationNodes.py +130 -0
  819. pforge/nodes/SubscriptNodes.py +248 -0
  820. pforge/nodes/TensorflowNodes.py +39 -0
  821. pforge/nodes/TryNodes.py +523 -0
  822. pforge/nodes/TypeMatchNodes.py +68 -0
  823. pforge/nodes/TypeNodes.py +450 -0
  824. pforge/nodes/VariableAssignNodes.py +1256 -0
  825. pforge/nodes/VariableDelNodes.py +364 -0
  826. pforge/nodes/VariableNameNodes.py +156 -0
  827. pforge/nodes/VariableRefNodes.py +886 -0
  828. pforge/nodes/VariableReleaseNodes.py +179 -0
  829. pforge/nodes/YieldNodes.py +124 -0
  830. pforge/nodes/__init__.py +22 -0
  831. pforge/nodes/shapes/BuiltinTypeShapes.py +4461 -0
  832. pforge/nodes/shapes/ControlFlowDescriptions.py +224 -0
  833. pforge/nodes/shapes/IteratorShapes.py +70 -0
  834. pforge/nodes/shapes/ShapeMixins.py +272 -0
  835. pforge/nodes/shapes/StandardShapes.py +1417 -0
  836. pforge/nodes/shapes/__init__.py +22 -0
  837. pforge/optimizations/BytecodeDemotion.py +103 -0
  838. pforge/optimizations/FunctionInlining.py +113 -0
  839. pforge/optimizations/Graphs.py +73 -0
  840. pforge/optimizations/Optimization.py +429 -0
  841. pforge/optimizations/OptimizeBuiltinCalls.py +1668 -0
  842. pforge/optimizations/Tags.py +86 -0
  843. pforge/optimizations/TraceCollections.py +1523 -0
  844. pforge/optimizations/__init__.py +22 -0
  845. pforge/optimizations/bench_startup.py +62 -0
  846. pforge/optimizations/bench_tags.py +55 -0
  847. pforge/optimizations/value_traces/ValueTraces.py +61 -0
  848. pforge/optimizations/value_traces/ValueTracesGenerated.py +1920 -0
  849. pforge/optimizations/value_traces/ValueTracesStatic.py +1596 -0
  850. pforge/optimizations/value_traces/__init__.py +22 -0
  851. pforge/options/BuildPackage.py +193 -0
  852. pforge/options/BuildPackageCommon.py +109 -0
  853. pforge/options/CommandLineOptionsTools.py +359 -0
  854. pforge/options/OptionParsing.py +3385 -0
  855. pforge/options/Options.py +3736 -0
  856. pforge/options/PathSpecs.py +246 -0
  857. pforge/options/Poetry.py +96 -0
  858. pforge/options/UvBuild.py +159 -0
  859. pforge/options/__init__.py +22 -0
  860. pforge/package_config/__init__.py +22 -0
  861. pforge/pgo/Pgo.py +865 -0
  862. pforge/pgo/PgoFormat.py +240 -0
  863. pforge/pgo/__init__.py +22 -0
  864. pforge/plugins/Hooks.py +437 -0
  865. pforge/plugins/PluginBase.py +2267 -0
  866. pforge/plugins/Plugins.py +2681 -0
  867. pforge/plugins/PluginsUsage.py +72 -0
  868. pforge/plugins/YamlPluginBase.py +132 -0
  869. pforge/plugins/__init__.py +22 -0
  870. pforge/plugins/standard/AntiBloatPlugin.py +1134 -0
  871. pforge/plugins/standard/ConsiderPyLintAnnotationsPlugin.py +97 -0
  872. pforge/plugins/standard/DataFilesPlugin.py +347 -0
  873. pforge/plugins/standard/DelvewheelPlugin.py +161 -0
  874. pforge/plugins/standard/DillPlugin/DillPlugin.c +40 -0
  875. pforge/plugins/standard/DillPlugin/cloudpickle-postLoad.py +69 -0
  876. pforge/plugins/standard/DillPlugin/dill-postLoad.py +228 -0
  877. pforge/plugins/standard/DillPlugin.py +152 -0
  878. pforge/plugins/standard/DllFilesPlugin.py +564 -0
  879. pforge/plugins/standard/EnumPlugin.py +67 -0
  880. pforge/plugins/standard/EventletPlugin.py +37 -0
  881. pforge/plugins/standard/GeventPlugin.py +66 -0
  882. pforge/plugins/standard/GiPlugin.py +278 -0
  883. pforge/plugins/standard/GlfwPlugin.py +179 -0
  884. pforge/plugins/standard/ImplicitImports.py +1023 -0
  885. pforge/plugins/standard/KivyPlugin.py +143 -0
  886. pforge/plugins/standard/MatplotlibPlugin.py +260 -0
  887. pforge/plugins/standard/MultiprocessingPlugin.py +372 -0
  888. pforge/plugins/standard/NumbaPlugin.py +110 -0
  889. pforge/plugins/standard/NumpyPlugin.py +37 -0
  890. pforge/plugins/standard/OptionsNannyPlugin.py +145 -0
  891. pforge/plugins/standard/PbrPlugin.py +65 -0
  892. pforge/plugins/standard/PkgResourcesPlugin.py +171 -0
  893. pforge/plugins/standard/PlaywrightPlugin.py +181 -0
  894. pforge/plugins/standard/PmwPlugin.py +249 -0
  895. pforge/plugins/standard/PySidePyQtPlugin.py +1830 -0
  896. pforge/plugins/standard/PywebViewPlugin.py +85 -0
  897. pforge/plugins/standard/SourceInclusionPlugin.py +671 -0
  898. pforge/plugins/standard/SpacyPlugin.py +138 -0
  899. pforge/plugins/standard/TensorflowPlugin.py +37 -0
  900. pforge/plugins/standard/TkinterPlugin.py +636 -0
  901. pforge/plugins/standard/TorchHubPlugin.py +521 -0
  902. pforge/plugins/standard/TorchJitPlugin.py +236 -0
  903. pforge/plugins/standard/TorchPlugin.py +37 -0
  904. pforge/plugins/standard/TransformersPlugin.py +333 -0
  905. pforge/plugins/standard/TrioPlugin.py +35 -0
  906. pforge/plugins/standard/UpxPlugin.py +191 -0
  907. pforge/plugins/standard/__init__.py +22 -0
  908. pforge/plugins/standard/standard.pforge-package.config.yml +10867 -0
  909. pforge/plugins/standard/stdlib.pforge-package.config.yml +410 -0
  910. pforge/plugins/standard/stdlib2.pforge-package.config.yml +72 -0
  911. pforge/plugins/standard/stdlib3.pforge-package.config.yml +100 -0
  912. pforge/reports/CompilationReportReader.py +134 -0
  913. pforge/reports/LicenseReport.rst.j2 +44 -0
  914. pforge/reports/Reports.py +1560 -0
  915. pforge/reports/__init__.py +22 -0
  916. pforge/specs/BuiltinBytesOperationSpecs.py +196 -0
  917. pforge/specs/BuiltinDictOperationSpecs.py +96 -0
  918. pforge/specs/BuiltinListOperationSpecs.py +83 -0
  919. pforge/specs/BuiltinParameterSpecs.py +953 -0
  920. pforge/specs/BuiltinStrOperationSpecs.py +215 -0
  921. pforge/specs/BuiltinTypeOperationSpecs.py +37 -0
  922. pforge/specs/BuiltinUnicodeOperationSpecs.py +132 -0
  923. pforge/specs/HardImportSpecs.py +275 -0
  924. pforge/specs/ParameterSpecs.py +683 -0
  925. pforge/specs/__init__.py +22 -0
  926. pforge/targets/TargetLinux.py +278 -0
  927. pforge/targets/TargetMatrix.py +415 -0
  928. pforge/targets/TargetNative.py +132 -0
  929. pforge/targets/TargetPython.py +914 -0
  930. pforge/targets/TargetWASI.py +124 -0
  931. pforge/targets/TargetWin32.py +304 -0
  932. pforge/targets/Targets.py +378 -0
  933. pforge/targets/__init__.py +22 -0
  934. pforge/tools/Basics.py +60 -0
  935. pforge/tools/__init__.py +22 -0
  936. pforge/tools/commercial/__init__.py +22 -0
  937. pforge/tools/data_composer/DataComposer.py +764 -0
  938. pforge/tools/data_composer/__init__.py +22 -0
  939. pforge/tools/data_composer/__main__.py +42 -0
  940. pforge/tools/environments/CreateEnvironment.py +72 -0
  941. pforge/tools/environments/Virtualenv.py +219 -0
  942. pforge/tools/environments/__init__.py +22 -0
  943. pforge/tools/general/__init__.py +22 -0
  944. pforge/tools/general/dll_report/__init__.py +22 -0
  945. pforge/tools/general/dll_report/__main__.py +87 -0
  946. pforge/tools/general/extract_poetry_config/__init__.py +22 -0
  947. pforge/tools/general/extract_poetry_config/__main__.py +144 -0
  948. pforge/tools/general/extract_uv_config/__init__.py +24 -0
  949. pforge/tools/general/extract_uv_config/__main__.py +202 -0
  950. pforge/tools/general/find_module/FindModuleCode.py +127 -0
  951. pforge/tools/general/find_module/__init__.py +22 -0
  952. pforge/tools/general/generate_header/GenerateHeader.py +168 -0
  953. pforge/tools/general/generate_header/GenerateOffsets.py +395 -0
  954. pforge/tools/general/generate_header/__init__.py +22 -0
  955. pforge/tools/onefile_compressor/OnefileCompressor.py +535 -0
  956. pforge/tools/onefile_compressor/__init__.py +22 -0
  957. pforge/tools/onefile_compressor/__main__.py +42 -0
  958. pforge/tools/podman/Container.py +850 -0
  959. pforge/tools/podman/Podman.py +58 -0
  960. pforge/tools/podman/__init__.py +22 -0
  961. pforge/tools/podman/__main__.py +173 -0
  962. pforge/tools/podman/containers/CI.containerfile +69 -0
  963. pforge/tools/podman/containers/Python-Minor-Versions.containerfile.j2 +39 -0
  964. pforge/tools/profiler/__init__.py +22 -0
  965. pforge/tools/profiler/__main__.py +96 -0
  966. pforge/tools/scanning/DisplayDistributions.py +60 -0
  967. pforge/tools/scanning/DisplayPackageDLLs.py +159 -0
  968. pforge/tools/scanning/DisplayPackageData.py +78 -0
  969. pforge/tools/scanning/__init__.py +22 -0
  970. pforge/tools/specialize/CTypeDescriptions.py +1931 -0
  971. pforge/tools/specialize/Common.py +454 -0
  972. pforge/tools/specialize/SpecializeC.py +1896 -0
  973. pforge/tools/specialize/SpecializePython.py +1356 -0
  974. pforge/tools/specialize/__init__.py +22 -0
  975. pforge/tools/testing/Common.py +2190 -0
  976. pforge/tools/testing/Constructs.py +54 -0
  977. pforge/tools/testing/Coverage.py +197 -0
  978. pforge/tools/testing/DocTests.py +159 -0
  979. pforge/tools/testing/OutputComparison.py +492 -0
  980. pforge/tools/testing/Pythons.py +37 -0
  981. pforge/tools/testing/RuntimeTracing.py +296 -0
  982. pforge/tools/testing/SearchModes.py +292 -0
  983. pforge/tools/testing/Valgrind.py +106 -0
  984. pforge/tools/testing/__init__.py +22 -0
  985. pforge/tools/testing/check_reference_counts/__init__.py +22 -0
  986. pforge/tools/testing/check_reference_counts/__main__.py +108 -0
  987. pforge/tools/testing/compare_with_cpython/__init__.py +22 -0
  988. pforge/tools/testing/compare_with_cpython/__main__.py +1107 -0
  989. pforge/tools/testing/find_sxs_modules/__init__.py +22 -0
  990. pforge/tools/testing/find_sxs_modules/__main__.py +74 -0
  991. pforge/tools/testing/measure_construct_performance/__init__.py +22 -0
  992. pforge/tools/testing/measure_construct_performance/__main__.py +291 -0
  993. pforge/tools/testing/run_pforge_tests/__init__.py +22 -0
  994. pforge/tools/testing/run_pforge_tests/__main__.py +1146 -0
  995. pforge/tools/watch/AutoStage.py +462 -0
  996. pforge/tools/watch/Common.py +54 -0
  997. pforge/tools/watch/Conda.py +128 -0
  998. pforge/tools/watch/GitHub.py +116 -0
  999. pforge/tools/watch/Pacman.py +76 -0
  1000. pforge/tools/watch/Pipenv.py +165 -0
  1001. pforge/tools/watch/__init__.py +22 -0
  1002. pforge/tools/watch/__main__.py +727 -0
  1003. pforge/tree/Building.py +1595 -0
  1004. pforge/tree/ComplexCallHelperFunctions.py +2279 -0
  1005. pforge/tree/Extractions.py +75 -0
  1006. pforge/tree/FutureSpecState.py +76 -0
  1007. pforge/tree/InternalModule.py +99 -0
  1008. pforge/tree/Operations.py +108 -0
  1009. pforge/tree/ReformulationAssertStatements.py +110 -0
  1010. pforge/tree/ReformulationAssignmentStatements.py +1513 -0
  1011. pforge/tree/ReformulationBooleanExpressions.py +100 -0
  1012. pforge/tree/ReformulationCallExpressions.py +336 -0
  1013. pforge/tree/ReformulationClasses.py +403 -0
  1014. pforge/tree/ReformulationClasses3.py +1519 -0
  1015. pforge/tree/ReformulationComparisonExpressions.py +177 -0
  1016. pforge/tree/ReformulationContractionExpressions.py +809 -0
  1017. pforge/tree/ReformulationDictionaryCreation.py +308 -0
  1018. pforge/tree/ReformulationExecStatements.py +387 -0
  1019. pforge/tree/ReformulationForLoopStatements.py +218 -0
  1020. pforge/tree/ReformulationFunctionStatements.py +1306 -0
  1021. pforge/tree/ReformulationImportStatements.py +350 -0
  1022. pforge/tree/ReformulationLambdaExpressions.py +196 -0
  1023. pforge/tree/ReformulationMatchStatements.py +902 -0
  1024. pforge/tree/ReformulationMultidist.py +83 -0
  1025. pforge/tree/ReformulationNamespacePackages.py +264 -0
  1026. pforge/tree/ReformulationPrintStatements.py +130 -0
  1027. pforge/tree/ReformulationSequenceCreation.py +443 -0
  1028. pforge/tree/ReformulationSubscriptExpressions.py +126 -0
  1029. pforge/tree/ReformulationTryExceptStatements.py +720 -0
  1030. pforge/tree/ReformulationTryFinallyStatements.py +244 -0
  1031. pforge/tree/ReformulationWhileLoopStatements.py +162 -0
  1032. pforge/tree/ReformulationWithStatements.py +394 -0
  1033. pforge/tree/ReformulationYieldExpressions.py +136 -0
  1034. pforge/tree/SourceHandling.py +522 -0
  1035. pforge/tree/SyntaxErrors.py +245 -0
  1036. pforge/tree/TreeHelpers.py +759 -0
  1037. pforge/tree/VariableClosure.py +554 -0
  1038. pforge/tree/__init__.py +22 -0
  1039. pforge/utils/AppDirs.py +148 -0
  1040. pforge/utils/CStrings.py +208 -0
  1041. pforge/utils/Diffs.py +192 -0
  1042. pforge/utils/Distributions.py +901 -0
  1043. pforge/utils/Download.py +466 -0
  1044. pforge/utils/Execution.py +1154 -0
  1045. pforge/utils/FileOperations.py +2481 -0
  1046. pforge/utils/Hashing.py +159 -0
  1047. pforge/utils/Images.py +75 -0
  1048. pforge/utils/Importing.py +392 -0
  1049. pforge/utils/InlineCopies.py +132 -0
  1050. pforge/utils/InstalledPythons.py +281 -0
  1051. pforge/utils/InstanceCounters.py +89 -0
  1052. pforge/utils/Jinja2.py +195 -0
  1053. pforge/utils/Json.py +96 -0
  1054. pforge/utils/LinuxPython.py +365 -0
  1055. pforge/utils/MemoryUsage.py +166 -0
  1056. pforge/utils/ModuleNames.py +384 -0
  1057. pforge/utils/PackageResources.py +67 -0
  1058. pforge/utils/PrivatePipSpace.py +1317 -0
  1059. pforge/utils/Profiling.py +243 -0
  1060. pforge/utils/PythonPrefetch.py +391 -0
  1061. pforge/utils/ReExecute.py +120 -0
  1062. pforge/utils/Rest.py +63 -0
  1063. pforge/utils/SharedLibraries.py +1623 -0
  1064. pforge/utils/Shebang.py +114 -0
  1065. pforge/utils/Signing.py +500 -0
  1066. pforge/utils/SlotMetaClasses.py +60 -0
  1067. pforge/utils/StaticLibraries.py +422 -0
  1068. pforge/utils/ThreadedExecutor.py +90 -0
  1069. pforge/utils/Timing.py +201 -0
  1070. pforge/utils/Toml.py +65 -0
  1071. pforge/utils/Utils.py +643 -0
  1072. pforge/utils/WasiPython.py +428 -0
  1073. pforge/utils/WasiSDK.py +226 -0
  1074. pforge/utils/Wasmtime.py +178 -0
  1075. pforge/utils/WindowsFileUsage.py +338 -0
  1076. pforge/utils/WindowsResources.py +659 -0
  1077. pforge/utils/Yaml.py +1143 -0
  1078. pforge/utils/Zipfiles.py +131 -0
  1079. pforge/utils/__init__.py +22 -0
  1080. pforge/utils/requirements-private.txt +26 -0
  1081. pforge-1.0.0.data/scripts/compile-python-for-pforge-linux.sh +232 -0
  1082. pforge-1.0.0.dist-info/METADATA +2228 -0
  1083. pforge-1.0.0.dist-info/RECORD +1090 -0
  1084. pforge-1.0.0.dist-info/WHEEL +5 -0
  1085. pforge-1.0.0.dist-info/entry_points.txt +11 -0
  1086. pforge-1.0.0.dist-info/licenses/LICENSE-RUNTIME.txt +57 -0
  1087. pforge-1.0.0.dist-info/licenses/LICENSE.txt +661 -0
  1088. pforge-1.0.0.dist-info/licenses/NOTICE.txt +11 -0
  1089. pforge-1.0.0.dist-info/top_level.txt +1 -0
  1090. pforge-1.0.0.dist-info/zip-safe +1 -0
@@ -0,0 +1,2557 @@
1
+ // Copyright 2026, Kay Hayen, mailto:kay.hayen@gmail.com find license text at end of file
2
+
3
+ /* WARNING, this code is GENERATED. Modify the template HelperOperationInplace.c.j2 instead! */
4
+ #pragma once
5
+
6
+ /* This file is included from another C file, help IDEs to still parse it on its own. */
7
+ #ifdef __IDE_ONLY__
8
+ #include "pforge/prelude.h"
9
+ #endif
10
+
11
+ /* C helpers for type in-place "/" (OLDDIV) operations */
12
+
13
+ #if PYTHON_VERSION < 0x300
14
+ /* Code referring to "INT" corresponds to Python2 'int' and "INT" to Python2 'int'. */
15
+ static inline bool _INPLACE_OPERATION_OLDDIV_INT_INT(PyObject **operand1, PyObject *operand2) {
16
+ assert(operand1); // Pointer must be non-null.
17
+
18
+ CHECK_OBJECT(*operand1);
19
+ assert(PyInt_CheckExact(*operand1));
20
+ CHECK_OBJECT(operand2);
21
+ assert(PyInt_CheckExact(operand2));
22
+
23
+ // Not every code path will make use of all possible results.
24
+ #if defined(_MSC_VER)
25
+ #pragma warning(push)
26
+ #pragma warning(disable : 4101)
27
+ #endif
28
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
29
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
30
+ PFORGE_MAY_BE_UNUSED long clong_result;
31
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
32
+ #if defined(_MSC_VER)
33
+ #pragma warning(pop)
34
+ #endif
35
+
36
+ CHECK_OBJECT(*operand1);
37
+ assert(PyInt_CheckExact(*operand1));
38
+ CHECK_OBJECT(operand2);
39
+ assert(PyInt_CheckExact(operand2));
40
+
41
+ const long a = PyInt_AS_LONG(*operand1);
42
+ const long b = PyInt_AS_LONG(operand2);
43
+
44
+ if (unlikely(b == 0)) {
45
+ PyThreadState *tstate = PyThreadState_GET();
46
+
47
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "integer division or modulo by zero");
48
+ goto exit_result_exception;
49
+ }
50
+
51
+ /* TODO: Isn't this a very specific value only, of which we could
52
+ * hardcode the constant result. Not sure how well the C compiler
53
+ * optimizes UNARY_NEG_WOULD_OVERFLOW to this, but dividing by
54
+ * -1 has to be rare anyway.
55
+ */
56
+
57
+ if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
58
+ long a_div_b = a / b;
59
+ long a_mod_b = (long)(a - (unsigned long)a_div_b * b);
60
+
61
+ if (a_mod_b && (b ^ a_mod_b) < 0) {
62
+ a_mod_b += b;
63
+ a_div_b -= 1;
64
+ }
65
+
66
+ clong_result = a_div_b;
67
+ goto exit_result_ok_clong;
68
+ }
69
+
70
+ {
71
+ PyObject *operand1_object = *operand1;
72
+ PyObject *operand2_object = operand2;
73
+
74
+ PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
75
+ assert(r != Py_NotImplemented);
76
+
77
+ obj_result = r;
78
+ goto exit_result_object;
79
+ }
80
+
81
+ exit_result_ok_clong:
82
+
83
+ // We got an object handed, that we have to release.
84
+ Py_DECREF(*operand1);
85
+
86
+ // That's our return value then. As we use a dedicated variable, it's
87
+ // OK that way.
88
+ *operand1 = Pforge_PyInt_FromLong(clong_result);
89
+ goto exit_result_ok;
90
+
91
+ exit_result_object:
92
+ if (unlikely(obj_result == NULL)) {
93
+ goto exit_result_exception;
94
+ }
95
+ // We got an object handed, that we have to release.
96
+ Py_DECREF(*operand1);
97
+
98
+ *operand1 = obj_result;
99
+ goto exit_result_ok;
100
+
101
+ exit_result_ok:
102
+ return true;
103
+
104
+ exit_result_exception:
105
+ return false;
106
+ }
107
+
108
+ bool INPLACE_OPERATION_OLDDIV_INT_INT(PyObject **operand1, PyObject *operand2) {
109
+ return _INPLACE_OPERATION_OLDDIV_INT_INT(operand1, operand2);
110
+ }
111
+ #endif
112
+
113
+ #if PYTHON_VERSION < 0x300
114
+ /* Code referring to "OBJECT" corresponds to any Python object and "INT" to Python2 'int'. */
115
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
116
+ PyTypeObject *type1 = Py_TYPE(*operand1);
117
+
118
+ #if defined(_MSC_VER)
119
+ #pragma warning(push)
120
+ #pragma warning(disable : 4101)
121
+ #endif
122
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
123
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
124
+ #if defined(_MSC_VER)
125
+ #pragma warning(pop)
126
+ #endif
127
+
128
+ binaryfunc islot =
129
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
130
+
131
+ if (islot != NULL) {
132
+ PyObject *x = islot(*operand1, operand2);
133
+
134
+ if (x != Py_NotImplemented) {
135
+ obj_result = x;
136
+ goto exit_inplace_result_object;
137
+ }
138
+
139
+ Py_DECREF_IMMORTAL(x);
140
+ }
141
+
142
+ {
143
+ binaryfunc slot1 =
144
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
145
+ binaryfunc slot2 = NULL;
146
+
147
+ if (!(type1 == &PyInt_Type)) {
148
+ // Different types, need to consider second value slot.
149
+
150
+ slot2 = PyInt_Type.tp_as_number->nb_divide;
151
+
152
+ if (slot1 == slot2) {
153
+ slot2 = NULL;
154
+ }
155
+ }
156
+
157
+ if (slot1 != NULL) {
158
+ PyObject *x = slot1(*operand1, operand2);
159
+
160
+ if (x != Py_NotImplemented) {
161
+ obj_result = x;
162
+ goto exit_inplace_result_object;
163
+ }
164
+
165
+ Py_DECREF_IMMORTAL(x);
166
+ }
167
+
168
+ if (slot2 != NULL) {
169
+ PyObject *x = slot2(*operand1, operand2);
170
+
171
+ if (x != Py_NotImplemented) {
172
+ obj_result = x;
173
+ goto exit_inplace_result_object;
174
+ }
175
+
176
+ Py_DECREF_IMMORTAL(x);
177
+ }
178
+
179
+ #if PYTHON_VERSION < 0x300
180
+ if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
181
+ coercion c1 =
182
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
183
+
184
+ if (c1 != NULL) {
185
+ PyObject *coerced1 = *operand1;
186
+ PyObject *coerced2 = operand2;
187
+
188
+ int err = c1(&coerced1, &coerced2);
189
+
190
+ if (unlikely(err < 0)) {
191
+ goto exit_inplace_exception;
192
+ }
193
+
194
+ if (err == 0) {
195
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
196
+
197
+ if (likely(mv == NULL)) {
198
+ binaryfunc slot = mv->nb_divide;
199
+
200
+ if (likely(slot != NULL)) {
201
+ PyObject *x = slot(coerced1, coerced2);
202
+
203
+ Py_DECREF(coerced1);
204
+ Py_DECREF(coerced2);
205
+
206
+ obj_result = x;
207
+ goto exit_inplace_result_object;
208
+ }
209
+ }
210
+
211
+ // nb_coerce took a reference.
212
+ Py_DECREF(coerced1);
213
+ Py_DECREF(coerced2);
214
+ }
215
+ }
216
+ coercion c2 = PyInt_Type.tp_as_number->nb_coerce;
217
+
218
+ if (c2 != NULL) {
219
+ PyObject *coerced1 = *operand1;
220
+ PyObject *coerced2 = operand2;
221
+
222
+ int err = c2(&coerced2, &coerced1);
223
+
224
+ if (unlikely(err < 0)) {
225
+ goto exit_inplace_exception;
226
+ }
227
+
228
+ if (err == 0) {
229
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
230
+
231
+ if (likely(mv == NULL)) {
232
+ binaryfunc slot = mv->nb_divide;
233
+
234
+ if (likely(slot != NULL)) {
235
+ PyObject *x = slot(coerced1, coerced2);
236
+
237
+ Py_DECREF(coerced1);
238
+ Py_DECREF(coerced2);
239
+
240
+ obj_result = x;
241
+ goto exit_inplace_result_object;
242
+ }
243
+ }
244
+
245
+ // nb_coerce took a reference.
246
+ Py_DECREF(coerced1);
247
+ Py_DECREF(coerced2);
248
+ }
249
+ }
250
+ }
251
+ #endif
252
+
253
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
254
+ goto exit_inplace_exception;
255
+ }
256
+
257
+ exit_inplace_result_object:
258
+ if (unlikely(obj_result == NULL)) {
259
+ return false;
260
+ }
261
+
262
+ // We got an object handed, that we have to release.
263
+ Py_DECREF(*operand1);
264
+
265
+ // That's our return value then. As we use a dedicated variable, it's
266
+ // OK that way.
267
+ *operand1 = obj_result;
268
+
269
+ return true;
270
+
271
+ exit_inplace_exception:
272
+ return false;
273
+ }
274
+ static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
275
+ assert(operand1); // Pointer must be non-null.
276
+
277
+ CHECK_OBJECT(*operand1);
278
+ CHECK_OBJECT(operand2);
279
+ assert(PyInt_CheckExact(operand2));
280
+
281
+ PyTypeObject *type1 = Py_TYPE(*operand1);
282
+
283
+ if (type1 == &PyInt_Type) {
284
+ // return _BINARY_OPERATION_OLDDIV_INT_INT_INPLACE(operand1, operand2);
285
+
286
+ // Not every code path will make use of all possible results.
287
+ #if defined(_MSC_VER)
288
+ #pragma warning(push)
289
+ #pragma warning(disable : 4101)
290
+ #endif
291
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
292
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
293
+ PFORGE_MAY_BE_UNUSED long clong_result;
294
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
295
+ #if defined(_MSC_VER)
296
+ #pragma warning(pop)
297
+ #endif
298
+
299
+ CHECK_OBJECT(*operand1);
300
+ assert(PyInt_CheckExact(*operand1));
301
+ CHECK_OBJECT(operand2);
302
+ assert(PyInt_CheckExact(operand2));
303
+
304
+ const long a = PyInt_AS_LONG(*operand1);
305
+ const long b = PyInt_AS_LONG(operand2);
306
+
307
+ if (unlikely(b == 0)) {
308
+ PyThreadState *tstate = PyThreadState_GET();
309
+
310
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "integer division or modulo by zero");
311
+ goto exit_result_exception;
312
+ }
313
+
314
+ /* TODO: Isn't this a very specific value only, of which we could
315
+ * hardcode the constant result. Not sure how well the C compiler
316
+ * optimizes UNARY_NEG_WOULD_OVERFLOW to this, but dividing by
317
+ * -1 has to be rare anyway.
318
+ */
319
+
320
+ if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
321
+ long a_div_b = a / b;
322
+ long a_mod_b = (long)(a - (unsigned long)a_div_b * b);
323
+
324
+ if (a_mod_b && (b ^ a_mod_b) < 0) {
325
+ a_mod_b += b;
326
+ a_div_b -= 1;
327
+ }
328
+
329
+ clong_result = a_div_b;
330
+ goto exit_result_ok_clong;
331
+ }
332
+
333
+ {
334
+ PyObject *operand1_object = *operand1;
335
+ PyObject *operand2_object = operand2;
336
+
337
+ PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
338
+ assert(r != Py_NotImplemented);
339
+
340
+ obj_result = r;
341
+ goto exit_result_object;
342
+ }
343
+
344
+ exit_result_ok_clong:
345
+
346
+ // We got an object handed, that we have to release.
347
+ Py_DECREF(*operand1);
348
+
349
+ // That's our return value then. As we use a dedicated variable, it's
350
+ // OK that way.
351
+ *operand1 = Pforge_PyInt_FromLong(clong_result);
352
+ goto exit_result_ok;
353
+
354
+ exit_result_object:
355
+ if (unlikely(obj_result == NULL)) {
356
+ goto exit_result_exception;
357
+ }
358
+ // We got an object handed, that we have to release.
359
+ Py_DECREF(*operand1);
360
+
361
+ *operand1 = obj_result;
362
+ goto exit_result_ok;
363
+
364
+ exit_result_ok:
365
+ return true;
366
+
367
+ exit_result_exception:
368
+ return false;
369
+ }
370
+
371
+ return __INPLACE_OPERATION_OLDDIV_OBJECT_INT(operand1, operand2);
372
+ }
373
+
374
+ bool INPLACE_OPERATION_OLDDIV_OBJECT_INT(PyObject **operand1, PyObject *operand2) {
375
+ return _INPLACE_OPERATION_OLDDIV_OBJECT_INT(operand1, operand2);
376
+ }
377
+ #endif
378
+
379
+ #if PYTHON_VERSION < 0x300
380
+ /* Code referring to "INT" corresponds to Python2 'int' and "OBJECT" to any Python object. */
381
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
382
+ PyTypeObject *type2 = Py_TYPE(operand2);
383
+
384
+ #if defined(_MSC_VER)
385
+ #pragma warning(push)
386
+ #pragma warning(disable : 4101)
387
+ #endif
388
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
389
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
390
+ #if defined(_MSC_VER)
391
+ #pragma warning(pop)
392
+ #endif
393
+
394
+ // No inplace number slot nb_inplace_divide available for this type.
395
+
396
+ {
397
+ binaryfunc slot1 = PyInt_Type.tp_as_number->nb_divide;
398
+ binaryfunc slot2 = NULL;
399
+
400
+ if (!(&PyInt_Type == type2)) {
401
+ // Different types, need to consider second value slot.
402
+
403
+ slot2 =
404
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
405
+
406
+ if (slot1 == slot2) {
407
+ slot2 = NULL;
408
+ }
409
+ }
410
+
411
+ if (slot1 != NULL) {
412
+ if (slot2 != NULL) {
413
+ if (Pforge_Type_IsSubtype(type2, &PyInt_Type)) {
414
+ PyObject *x = slot2(*operand1, operand2);
415
+
416
+ if (x != Py_NotImplemented) {
417
+ obj_result = x;
418
+ goto exit_inplace_result_object;
419
+ }
420
+
421
+ Py_DECREF_IMMORTAL(x);
422
+ slot2 = NULL;
423
+ }
424
+ }
425
+
426
+ PyObject *x = slot1(*operand1, operand2);
427
+
428
+ if (x != Py_NotImplemented) {
429
+ obj_result = x;
430
+ goto exit_inplace_result_object;
431
+ }
432
+
433
+ Py_DECREF_IMMORTAL(x);
434
+ }
435
+
436
+ if (slot2 != NULL) {
437
+ PyObject *x = slot2(*operand1, operand2);
438
+
439
+ if (x != Py_NotImplemented) {
440
+ obj_result = x;
441
+ goto exit_inplace_result_object;
442
+ }
443
+
444
+ Py_DECREF_IMMORTAL(x);
445
+ }
446
+
447
+ #if PYTHON_VERSION < 0x300
448
+ if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
449
+ coercion c1 = PyInt_Type.tp_as_number->nb_coerce;
450
+
451
+ if (c1 != NULL) {
452
+ PyObject *coerced1 = *operand1;
453
+ PyObject *coerced2 = operand2;
454
+
455
+ int err = c1(&coerced1, &coerced2);
456
+
457
+ if (unlikely(err < 0)) {
458
+ goto exit_inplace_exception;
459
+ }
460
+
461
+ if (err == 0) {
462
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
463
+
464
+ if (likely(mv == NULL)) {
465
+ binaryfunc slot = mv->nb_divide;
466
+
467
+ if (likely(slot != NULL)) {
468
+ PyObject *x = slot(coerced1, coerced2);
469
+
470
+ Py_DECREF(coerced1);
471
+ Py_DECREF(coerced2);
472
+
473
+ obj_result = x;
474
+ goto exit_inplace_result_object;
475
+ }
476
+ }
477
+
478
+ // nb_coerce took a reference.
479
+ Py_DECREF(coerced1);
480
+ Py_DECREF(coerced2);
481
+ }
482
+ }
483
+ coercion c2 =
484
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
485
+
486
+ if (c2 != NULL) {
487
+ PyObject *coerced1 = *operand1;
488
+ PyObject *coerced2 = operand2;
489
+
490
+ int err = c2(&coerced2, &coerced1);
491
+
492
+ if (unlikely(err < 0)) {
493
+ goto exit_inplace_exception;
494
+ }
495
+
496
+ if (err == 0) {
497
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
498
+
499
+ if (likely(mv == NULL)) {
500
+ binaryfunc slot = mv->nb_divide;
501
+
502
+ if (likely(slot != NULL)) {
503
+ PyObject *x = slot(coerced1, coerced2);
504
+
505
+ Py_DECREF(coerced1);
506
+ Py_DECREF(coerced2);
507
+
508
+ obj_result = x;
509
+ goto exit_inplace_result_object;
510
+ }
511
+ }
512
+
513
+ // nb_coerce took a reference.
514
+ Py_DECREF(coerced1);
515
+ Py_DECREF(coerced2);
516
+ }
517
+ }
518
+ }
519
+ #endif
520
+
521
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
522
+ goto exit_inplace_exception;
523
+ }
524
+
525
+ exit_inplace_result_object:
526
+ if (unlikely(obj_result == NULL)) {
527
+ return false;
528
+ }
529
+
530
+ // We got an object handed, that we have to release.
531
+ Py_DECREF(*operand1);
532
+
533
+ // That's our return value then. As we use a dedicated variable, it's
534
+ // OK that way.
535
+ *operand1 = obj_result;
536
+
537
+ return true;
538
+
539
+ exit_inplace_exception:
540
+ return false;
541
+ }
542
+ static inline bool _INPLACE_OPERATION_OLDDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
543
+ assert(operand1); // Pointer must be non-null.
544
+
545
+ CHECK_OBJECT(*operand1);
546
+ assert(PyInt_CheckExact(*operand1));
547
+ CHECK_OBJECT(operand2);
548
+
549
+ PyTypeObject *type2 = Py_TYPE(operand2);
550
+
551
+ if (&PyInt_Type == type2) {
552
+ // return _BINARY_OPERATION_OLDDIV_INT_INT_INPLACE(operand1, operand2);
553
+
554
+ // Not every code path will make use of all possible results.
555
+ #if defined(_MSC_VER)
556
+ #pragma warning(push)
557
+ #pragma warning(disable : 4101)
558
+ #endif
559
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
560
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
561
+ PFORGE_MAY_BE_UNUSED long clong_result;
562
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
563
+ #if defined(_MSC_VER)
564
+ #pragma warning(pop)
565
+ #endif
566
+
567
+ CHECK_OBJECT(*operand1);
568
+ assert(PyInt_CheckExact(*operand1));
569
+ CHECK_OBJECT(operand2);
570
+ assert(PyInt_CheckExact(operand2));
571
+
572
+ const long a = PyInt_AS_LONG(*operand1);
573
+ const long b = PyInt_AS_LONG(operand2);
574
+
575
+ if (unlikely(b == 0)) {
576
+ PyThreadState *tstate = PyThreadState_GET();
577
+
578
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "integer division or modulo by zero");
579
+ goto exit_result_exception;
580
+ }
581
+
582
+ /* TODO: Isn't this a very specific value only, of which we could
583
+ * hardcode the constant result. Not sure how well the C compiler
584
+ * optimizes UNARY_NEG_WOULD_OVERFLOW to this, but dividing by
585
+ * -1 has to be rare anyway.
586
+ */
587
+
588
+ if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
589
+ long a_div_b = a / b;
590
+ long a_mod_b = (long)(a - (unsigned long)a_div_b * b);
591
+
592
+ if (a_mod_b && (b ^ a_mod_b) < 0) {
593
+ a_mod_b += b;
594
+ a_div_b -= 1;
595
+ }
596
+
597
+ clong_result = a_div_b;
598
+ goto exit_result_ok_clong;
599
+ }
600
+
601
+ {
602
+ PyObject *operand1_object = *operand1;
603
+ PyObject *operand2_object = operand2;
604
+
605
+ PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
606
+ assert(r != Py_NotImplemented);
607
+
608
+ obj_result = r;
609
+ goto exit_result_object;
610
+ }
611
+
612
+ exit_result_ok_clong:
613
+
614
+ // We got an object handed, that we have to release.
615
+ Py_DECREF(*operand1);
616
+
617
+ // That's our return value then. As we use a dedicated variable, it's
618
+ // OK that way.
619
+ *operand1 = Pforge_PyInt_FromLong(clong_result);
620
+ goto exit_result_ok;
621
+
622
+ exit_result_object:
623
+ if (unlikely(obj_result == NULL)) {
624
+ goto exit_result_exception;
625
+ }
626
+ // We got an object handed, that we have to release.
627
+ Py_DECREF(*operand1);
628
+
629
+ *operand1 = obj_result;
630
+ goto exit_result_ok;
631
+
632
+ exit_result_ok:
633
+ return true;
634
+
635
+ exit_result_exception:
636
+ return false;
637
+ }
638
+
639
+ return __INPLACE_OPERATION_OLDDIV_INT_OBJECT(operand1, operand2);
640
+ }
641
+
642
+ bool INPLACE_OPERATION_OLDDIV_INT_OBJECT(PyObject **operand1, PyObject *operand2) {
643
+ return _INPLACE_OPERATION_OLDDIV_INT_OBJECT(operand1, operand2);
644
+ }
645
+ #endif
646
+
647
+ #if PYTHON_VERSION < 0x300
648
+ /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "LONG" to Python2 'long', Python3 'int'. */
649
+ static inline bool _INPLACE_OPERATION_OLDDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
650
+ assert(operand1); // Pointer must be non-null.
651
+
652
+ CHECK_OBJECT(*operand1);
653
+ assert(PyLong_CheckExact(*operand1));
654
+ CHECK_OBJECT(operand2);
655
+ assert(PyLong_CheckExact(operand2));
656
+
657
+ // Not every code path will make use of all possible results.
658
+ #if defined(_MSC_VER)
659
+ #pragma warning(push)
660
+ #pragma warning(disable : 4101)
661
+ #endif
662
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
663
+ PFORGE_MAY_BE_UNUSED long clong_result;
664
+ #if defined(_MSC_VER)
665
+ #pragma warning(pop)
666
+ #endif
667
+
668
+ PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
669
+ assert(x != Py_NotImplemented);
670
+
671
+ obj_result = x;
672
+ goto exit_result_object;
673
+
674
+ exit_result_object:
675
+ if (unlikely(obj_result == NULL)) {
676
+ goto exit_result_exception;
677
+ }
678
+ // We got an object handed, that we have to release.
679
+ Py_DECREF(*operand1);
680
+ *operand1 = obj_result;
681
+ goto exit_result_ok;
682
+
683
+ exit_result_ok:
684
+ return true;
685
+
686
+ exit_result_exception:
687
+ return false;
688
+ }
689
+
690
+ bool INPLACE_OPERATION_OLDDIV_LONG_LONG(PyObject **operand1, PyObject *operand2) {
691
+ return _INPLACE_OPERATION_OLDDIV_LONG_LONG(operand1, operand2);
692
+ }
693
+ #endif
694
+
695
+ #if PYTHON_VERSION < 0x300
696
+ /* Code referring to "OBJECT" corresponds to any Python object and "LONG" to Python2 'long', Python3 'int'. */
697
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
698
+ PyTypeObject *type1 = Py_TYPE(*operand1);
699
+
700
+ #if defined(_MSC_VER)
701
+ #pragma warning(push)
702
+ #pragma warning(disable : 4101)
703
+ #endif
704
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
705
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
706
+ #if defined(_MSC_VER)
707
+ #pragma warning(pop)
708
+ #endif
709
+
710
+ binaryfunc islot =
711
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
712
+
713
+ if (islot != NULL) {
714
+ PyObject *x = islot(*operand1, operand2);
715
+
716
+ if (x != Py_NotImplemented) {
717
+ obj_result = x;
718
+ goto exit_inplace_result_object;
719
+ }
720
+
721
+ Py_DECREF_IMMORTAL(x);
722
+ }
723
+
724
+ {
725
+ binaryfunc slot1 =
726
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
727
+ binaryfunc slot2 = NULL;
728
+
729
+ if (!(type1 == &PyLong_Type)) {
730
+ // Different types, need to consider second value slot.
731
+
732
+ slot2 = PyLong_Type.tp_as_number->nb_divide;
733
+
734
+ if (slot1 == slot2) {
735
+ slot2 = NULL;
736
+ }
737
+ }
738
+
739
+ if (slot1 != NULL) {
740
+ PyObject *x = slot1(*operand1, operand2);
741
+
742
+ if (x != Py_NotImplemented) {
743
+ obj_result = x;
744
+ goto exit_inplace_result_object;
745
+ }
746
+
747
+ Py_DECREF_IMMORTAL(x);
748
+ }
749
+
750
+ if (slot2 != NULL) {
751
+ PyObject *x = slot2(*operand1, operand2);
752
+
753
+ if (x != Py_NotImplemented) {
754
+ obj_result = x;
755
+ goto exit_inplace_result_object;
756
+ }
757
+
758
+ Py_DECREF_IMMORTAL(x);
759
+ }
760
+
761
+ #if PYTHON_VERSION < 0x300
762
+ if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
763
+ coercion c1 =
764
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
765
+
766
+ if (c1 != NULL) {
767
+ PyObject *coerced1 = *operand1;
768
+ PyObject *coerced2 = operand2;
769
+
770
+ int err = c1(&coerced1, &coerced2);
771
+
772
+ if (unlikely(err < 0)) {
773
+ goto exit_inplace_exception;
774
+ }
775
+
776
+ if (err == 0) {
777
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
778
+
779
+ if (likely(mv == NULL)) {
780
+ binaryfunc slot = mv->nb_divide;
781
+
782
+ if (likely(slot != NULL)) {
783
+ PyObject *x = slot(coerced1, coerced2);
784
+
785
+ Py_DECREF(coerced1);
786
+ Py_DECREF(coerced2);
787
+
788
+ obj_result = x;
789
+ goto exit_inplace_result_object;
790
+ }
791
+ }
792
+
793
+ // nb_coerce took a reference.
794
+ Py_DECREF(coerced1);
795
+ Py_DECREF(coerced2);
796
+ }
797
+ }
798
+ coercion c2 = PyLong_Type.tp_as_number->nb_coerce;
799
+
800
+ if (c2 != NULL) {
801
+ PyObject *coerced1 = *operand1;
802
+ PyObject *coerced2 = operand2;
803
+
804
+ int err = c2(&coerced2, &coerced1);
805
+
806
+ if (unlikely(err < 0)) {
807
+ goto exit_inplace_exception;
808
+ }
809
+
810
+ if (err == 0) {
811
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
812
+
813
+ if (likely(mv == NULL)) {
814
+ binaryfunc slot = mv->nb_divide;
815
+
816
+ if (likely(slot != NULL)) {
817
+ PyObject *x = slot(coerced1, coerced2);
818
+
819
+ Py_DECREF(coerced1);
820
+ Py_DECREF(coerced2);
821
+
822
+ obj_result = x;
823
+ goto exit_inplace_result_object;
824
+ }
825
+ }
826
+
827
+ // nb_coerce took a reference.
828
+ Py_DECREF(coerced1);
829
+ Py_DECREF(coerced2);
830
+ }
831
+ }
832
+ }
833
+ #endif
834
+
835
+ #if PYTHON_VERSION < 0x300
836
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: '%s' and 'long'", type1->tp_name);
837
+ #else
838
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: '%s' and 'int'", type1->tp_name);
839
+ #endif
840
+ goto exit_inplace_exception;
841
+ }
842
+
843
+ exit_inplace_result_object:
844
+ if (unlikely(obj_result == NULL)) {
845
+ return false;
846
+ }
847
+
848
+ // We got an object handed, that we have to release.
849
+ Py_DECREF(*operand1);
850
+
851
+ // That's our return value then. As we use a dedicated variable, it's
852
+ // OK that way.
853
+ *operand1 = obj_result;
854
+
855
+ return true;
856
+
857
+ exit_inplace_exception:
858
+ return false;
859
+ }
860
+ static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
861
+ assert(operand1); // Pointer must be non-null.
862
+
863
+ CHECK_OBJECT(*operand1);
864
+ CHECK_OBJECT(operand2);
865
+ assert(PyLong_CheckExact(operand2));
866
+
867
+ PyTypeObject *type1 = Py_TYPE(*operand1);
868
+
869
+ if (type1 == &PyLong_Type) {
870
+ // return _BINARY_OPERATION_OLDDIV_LONG_LONG_INPLACE(operand1, operand2);
871
+
872
+ // Not every code path will make use of all possible results.
873
+ #if defined(_MSC_VER)
874
+ #pragma warning(push)
875
+ #pragma warning(disable : 4101)
876
+ #endif
877
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
878
+ PFORGE_MAY_BE_UNUSED long clong_result;
879
+ #if defined(_MSC_VER)
880
+ #pragma warning(pop)
881
+ #endif
882
+
883
+ PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
884
+ assert(x != Py_NotImplemented);
885
+
886
+ obj_result = x;
887
+ goto exit_result_object;
888
+
889
+ exit_result_object:
890
+ if (unlikely(obj_result == NULL)) {
891
+ goto exit_result_exception;
892
+ }
893
+ // We got an object handed, that we have to release.
894
+ Py_DECREF(*operand1);
895
+ *operand1 = obj_result;
896
+ goto exit_result_ok;
897
+
898
+ exit_result_ok:
899
+ return true;
900
+
901
+ exit_result_exception:
902
+ return false;
903
+ }
904
+
905
+ return __INPLACE_OPERATION_OLDDIV_OBJECT_LONG(operand1, operand2);
906
+ }
907
+
908
+ bool INPLACE_OPERATION_OLDDIV_OBJECT_LONG(PyObject **operand1, PyObject *operand2) {
909
+ return _INPLACE_OPERATION_OLDDIV_OBJECT_LONG(operand1, operand2);
910
+ }
911
+ #endif
912
+
913
+ #if PYTHON_VERSION < 0x300
914
+ /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "OBJECT" to any Python object. */
915
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
916
+ PyTypeObject *type2 = Py_TYPE(operand2);
917
+
918
+ #if defined(_MSC_VER)
919
+ #pragma warning(push)
920
+ #pragma warning(disable : 4101)
921
+ #endif
922
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
923
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
924
+ #if defined(_MSC_VER)
925
+ #pragma warning(pop)
926
+ #endif
927
+
928
+ // No inplace number slot nb_inplace_divide available for this type.
929
+
930
+ {
931
+ binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
932
+ binaryfunc slot2 = NULL;
933
+
934
+ if (!(&PyLong_Type == type2)) {
935
+ // Different types, need to consider second value slot.
936
+
937
+ slot2 =
938
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
939
+
940
+ if (slot1 == slot2) {
941
+ slot2 = NULL;
942
+ }
943
+ }
944
+
945
+ if (slot1 != NULL) {
946
+ if (slot2 != NULL) {
947
+ if (Pforge_Type_IsSubtype(type2, &PyLong_Type)) {
948
+ PyObject *x = slot2(*operand1, operand2);
949
+
950
+ if (x != Py_NotImplemented) {
951
+ obj_result = x;
952
+ goto exit_inplace_result_object;
953
+ }
954
+
955
+ Py_DECREF_IMMORTAL(x);
956
+ slot2 = NULL;
957
+ }
958
+ }
959
+
960
+ PyObject *x = slot1(*operand1, operand2);
961
+
962
+ if (x != Py_NotImplemented) {
963
+ obj_result = x;
964
+ goto exit_inplace_result_object;
965
+ }
966
+
967
+ Py_DECREF_IMMORTAL(x);
968
+ }
969
+
970
+ if (slot2 != NULL) {
971
+ PyObject *x = slot2(*operand1, operand2);
972
+
973
+ if (x != Py_NotImplemented) {
974
+ obj_result = x;
975
+ goto exit_inplace_result_object;
976
+ }
977
+
978
+ Py_DECREF_IMMORTAL(x);
979
+ }
980
+
981
+ #if PYTHON_VERSION < 0x300
982
+ if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
983
+ coercion c1 = PyLong_Type.tp_as_number->nb_coerce;
984
+
985
+ if (c1 != NULL) {
986
+ PyObject *coerced1 = *operand1;
987
+ PyObject *coerced2 = operand2;
988
+
989
+ int err = c1(&coerced1, &coerced2);
990
+
991
+ if (unlikely(err < 0)) {
992
+ goto exit_inplace_exception;
993
+ }
994
+
995
+ if (err == 0) {
996
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
997
+
998
+ if (likely(mv == NULL)) {
999
+ binaryfunc slot = mv->nb_divide;
1000
+
1001
+ if (likely(slot != NULL)) {
1002
+ PyObject *x = slot(coerced1, coerced2);
1003
+
1004
+ Py_DECREF(coerced1);
1005
+ Py_DECREF(coerced2);
1006
+
1007
+ obj_result = x;
1008
+ goto exit_inplace_result_object;
1009
+ }
1010
+ }
1011
+
1012
+ // nb_coerce took a reference.
1013
+ Py_DECREF(coerced1);
1014
+ Py_DECREF(coerced2);
1015
+ }
1016
+ }
1017
+ coercion c2 =
1018
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1019
+
1020
+ if (c2 != NULL) {
1021
+ PyObject *coerced1 = *operand1;
1022
+ PyObject *coerced2 = operand2;
1023
+
1024
+ int err = c2(&coerced2, &coerced1);
1025
+
1026
+ if (unlikely(err < 0)) {
1027
+ goto exit_inplace_exception;
1028
+ }
1029
+
1030
+ if (err == 0) {
1031
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1032
+
1033
+ if (likely(mv == NULL)) {
1034
+ binaryfunc slot = mv->nb_divide;
1035
+
1036
+ if (likely(slot != NULL)) {
1037
+ PyObject *x = slot(coerced1, coerced2);
1038
+
1039
+ Py_DECREF(coerced1);
1040
+ Py_DECREF(coerced2);
1041
+
1042
+ obj_result = x;
1043
+ goto exit_inplace_result_object;
1044
+ }
1045
+ }
1046
+
1047
+ // nb_coerce took a reference.
1048
+ Py_DECREF(coerced1);
1049
+ Py_DECREF(coerced2);
1050
+ }
1051
+ }
1052
+ }
1053
+ #endif
1054
+
1055
+ #if PYTHON_VERSION < 0x300
1056
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'long' and '%s'", type2->tp_name);
1057
+ #else
1058
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'int' and '%s'", type2->tp_name);
1059
+ #endif
1060
+ goto exit_inplace_exception;
1061
+ }
1062
+
1063
+ exit_inplace_result_object:
1064
+ if (unlikely(obj_result == NULL)) {
1065
+ return false;
1066
+ }
1067
+
1068
+ // We got an object handed, that we have to release.
1069
+ Py_DECREF(*operand1);
1070
+
1071
+ // That's our return value then. As we use a dedicated variable, it's
1072
+ // OK that way.
1073
+ *operand1 = obj_result;
1074
+
1075
+ return true;
1076
+
1077
+ exit_inplace_exception:
1078
+ return false;
1079
+ }
1080
+ static inline bool _INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1081
+ assert(operand1); // Pointer must be non-null.
1082
+
1083
+ CHECK_OBJECT(*operand1);
1084
+ assert(PyLong_CheckExact(*operand1));
1085
+ CHECK_OBJECT(operand2);
1086
+
1087
+ PyTypeObject *type2 = Py_TYPE(operand2);
1088
+
1089
+ if (&PyLong_Type == type2) {
1090
+ // return _BINARY_OPERATION_OLDDIV_LONG_LONG_INPLACE(operand1, operand2);
1091
+
1092
+ // Not every code path will make use of all possible results.
1093
+ #if defined(_MSC_VER)
1094
+ #pragma warning(push)
1095
+ #pragma warning(disable : 4101)
1096
+ #endif
1097
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1098
+ PFORGE_MAY_BE_UNUSED long clong_result;
1099
+ #if defined(_MSC_VER)
1100
+ #pragma warning(pop)
1101
+ #endif
1102
+
1103
+ PyObject *x = PyLong_Type.tp_as_number->nb_divide(*operand1, operand2);
1104
+ assert(x != Py_NotImplemented);
1105
+
1106
+ obj_result = x;
1107
+ goto exit_result_object;
1108
+
1109
+ exit_result_object:
1110
+ if (unlikely(obj_result == NULL)) {
1111
+ goto exit_result_exception;
1112
+ }
1113
+ // We got an object handed, that we have to release.
1114
+ Py_DECREF(*operand1);
1115
+ *operand1 = obj_result;
1116
+ goto exit_result_ok;
1117
+
1118
+ exit_result_ok:
1119
+ return true;
1120
+
1121
+ exit_result_exception:
1122
+ return false;
1123
+ }
1124
+
1125
+ return __INPLACE_OPERATION_OLDDIV_LONG_OBJECT(operand1, operand2);
1126
+ }
1127
+
1128
+ bool INPLACE_OPERATION_OLDDIV_LONG_OBJECT(PyObject **operand1, PyObject *operand2) {
1129
+ return _INPLACE_OPERATION_OLDDIV_LONG_OBJECT(operand1, operand2);
1130
+ }
1131
+ #endif
1132
+
1133
+ #if PYTHON_VERSION < 0x300
1134
+ /* Code referring to "FLOAT" corresponds to Python 'float' and "FLOAT" to Python 'float'. */
1135
+ static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1136
+ assert(operand1); // Pointer must be non-null.
1137
+
1138
+ CHECK_OBJECT(*operand1);
1139
+ assert(PyFloat_CheckExact(*operand1));
1140
+ CHECK_OBJECT(operand2);
1141
+ assert(PyFloat_CheckExact(operand2));
1142
+
1143
+ #if defined(_MSC_VER)
1144
+ #pragma warning(push)
1145
+ #pragma warning(disable : 4101)
1146
+ #endif
1147
+ // Not every code path will make use of all possible results.
1148
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1149
+ PFORGE_MAY_BE_UNUSED long clong_result;
1150
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
1151
+ #if defined(_MSC_VER)
1152
+ #pragma warning(pop)
1153
+ #endif
1154
+
1155
+ CHECK_OBJECT(*operand1);
1156
+ assert(PyFloat_CheckExact(*operand1));
1157
+ CHECK_OBJECT(operand2);
1158
+ assert(PyFloat_CheckExact(operand2));
1159
+
1160
+ const double a = PyFloat_AS_DOUBLE(*operand1);
1161
+ const double b = PyFloat_AS_DOUBLE(operand2);
1162
+
1163
+ if (unlikely(b == 0.0)) {
1164
+ PyThreadState *tstate = PyThreadState_GET();
1165
+
1166
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "float division by zero");
1167
+ goto exit_result_exception;
1168
+ }
1169
+
1170
+ {
1171
+ double r = a / b;
1172
+
1173
+ cfloat_result = r;
1174
+ goto exit_result_ok_cfloat;
1175
+ }
1176
+
1177
+ exit_result_ok_cfloat:
1178
+ if (Py_REFCNT(*operand1) == 1) {
1179
+ PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1180
+ } else {
1181
+ // We got an object handed, that we have to release.
1182
+ Py_DECREF(*operand1);
1183
+
1184
+ *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1185
+ }
1186
+ goto exit_result_ok;
1187
+
1188
+ exit_result_ok:
1189
+ return true;
1190
+
1191
+ exit_result_exception:
1192
+ return false;
1193
+ }
1194
+
1195
+ bool INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(PyObject **operand1, PyObject *operand2) {
1196
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(operand1, operand2);
1197
+ }
1198
+ #endif
1199
+
1200
+ #if PYTHON_VERSION < 0x300
1201
+ /* Code referring to "OBJECT" corresponds to any Python object and "FLOAT" to Python 'float'. */
1202
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1203
+ PyTypeObject *type1 = Py_TYPE(*operand1);
1204
+
1205
+ #if defined(_MSC_VER)
1206
+ #pragma warning(push)
1207
+ #pragma warning(disable : 4101)
1208
+ #endif
1209
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1210
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1211
+ #if defined(_MSC_VER)
1212
+ #pragma warning(pop)
1213
+ #endif
1214
+
1215
+ binaryfunc islot =
1216
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
1217
+
1218
+ if (islot != NULL) {
1219
+ PyObject *x = islot(*operand1, operand2);
1220
+
1221
+ if (x != Py_NotImplemented) {
1222
+ obj_result = x;
1223
+ goto exit_inplace_result_object;
1224
+ }
1225
+
1226
+ Py_DECREF_IMMORTAL(x);
1227
+ }
1228
+
1229
+ {
1230
+ binaryfunc slot1 =
1231
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
1232
+ binaryfunc slot2 = NULL;
1233
+
1234
+ if (!(type1 == &PyFloat_Type)) {
1235
+ // Different types, need to consider second value slot.
1236
+
1237
+ slot2 = PyFloat_Type.tp_as_number->nb_divide;
1238
+
1239
+ if (slot1 == slot2) {
1240
+ slot2 = NULL;
1241
+ }
1242
+ }
1243
+
1244
+ if (slot1 != NULL) {
1245
+ PyObject *x = slot1(*operand1, operand2);
1246
+
1247
+ if (x != Py_NotImplemented) {
1248
+ obj_result = x;
1249
+ goto exit_inplace_result_object;
1250
+ }
1251
+
1252
+ Py_DECREF_IMMORTAL(x);
1253
+ }
1254
+
1255
+ if (slot2 != NULL) {
1256
+ PyObject *x = slot2(*operand1, operand2);
1257
+
1258
+ if (x != Py_NotImplemented) {
1259
+ obj_result = x;
1260
+ goto exit_inplace_result_object;
1261
+ }
1262
+
1263
+ Py_DECREF_IMMORTAL(x);
1264
+ }
1265
+
1266
+ #if PYTHON_VERSION < 0x300
1267
+ if (!NEW_STYLE_NUMBER_TYPE(type1) || !1) {
1268
+ coercion c1 =
1269
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
1270
+
1271
+ if (c1 != NULL) {
1272
+ PyObject *coerced1 = *operand1;
1273
+ PyObject *coerced2 = operand2;
1274
+
1275
+ int err = c1(&coerced1, &coerced2);
1276
+
1277
+ if (unlikely(err < 0)) {
1278
+ goto exit_inplace_exception;
1279
+ }
1280
+
1281
+ if (err == 0) {
1282
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1283
+
1284
+ if (likely(mv == NULL)) {
1285
+ binaryfunc slot = mv->nb_divide;
1286
+
1287
+ if (likely(slot != NULL)) {
1288
+ PyObject *x = slot(coerced1, coerced2);
1289
+
1290
+ Py_DECREF(coerced1);
1291
+ Py_DECREF(coerced2);
1292
+
1293
+ obj_result = x;
1294
+ goto exit_inplace_result_object;
1295
+ }
1296
+ }
1297
+
1298
+ // nb_coerce took a reference.
1299
+ Py_DECREF(coerced1);
1300
+ Py_DECREF(coerced2);
1301
+ }
1302
+ }
1303
+ coercion c2 = PyFloat_Type.tp_as_number->nb_coerce;
1304
+
1305
+ if (c2 != NULL) {
1306
+ PyObject *coerced1 = *operand1;
1307
+ PyObject *coerced2 = operand2;
1308
+
1309
+ int err = c2(&coerced2, &coerced1);
1310
+
1311
+ if (unlikely(err < 0)) {
1312
+ goto exit_inplace_exception;
1313
+ }
1314
+
1315
+ if (err == 0) {
1316
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1317
+
1318
+ if (likely(mv == NULL)) {
1319
+ binaryfunc slot = mv->nb_divide;
1320
+
1321
+ if (likely(slot != NULL)) {
1322
+ PyObject *x = slot(coerced1, coerced2);
1323
+
1324
+ Py_DECREF(coerced1);
1325
+ Py_DECREF(coerced2);
1326
+
1327
+ obj_result = x;
1328
+ goto exit_inplace_result_object;
1329
+ }
1330
+ }
1331
+
1332
+ // nb_coerce took a reference.
1333
+ Py_DECREF(coerced1);
1334
+ Py_DECREF(coerced2);
1335
+ }
1336
+ }
1337
+ }
1338
+ #endif
1339
+
1340
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: '%s' and 'float'", type1->tp_name);
1341
+ goto exit_inplace_exception;
1342
+ }
1343
+
1344
+ exit_inplace_result_object:
1345
+ if (unlikely(obj_result == NULL)) {
1346
+ return false;
1347
+ }
1348
+
1349
+ // We got an object handed, that we have to release.
1350
+ Py_DECREF(*operand1);
1351
+
1352
+ // That's our return value then. As we use a dedicated variable, it's
1353
+ // OK that way.
1354
+ *operand1 = obj_result;
1355
+
1356
+ return true;
1357
+
1358
+ exit_inplace_exception:
1359
+ return false;
1360
+ }
1361
+ static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1362
+ assert(operand1); // Pointer must be non-null.
1363
+
1364
+ CHECK_OBJECT(*operand1);
1365
+ CHECK_OBJECT(operand2);
1366
+ assert(PyFloat_CheckExact(operand2));
1367
+
1368
+ PyTypeObject *type1 = Py_TYPE(*operand1);
1369
+
1370
+ if (type1 == &PyFloat_Type) {
1371
+ // return _BINARY_OPERATION_OLDDIV_FLOAT_FLOAT_INPLACE(operand1, operand2);
1372
+
1373
+ #if defined(_MSC_VER)
1374
+ #pragma warning(push)
1375
+ #pragma warning(disable : 4101)
1376
+ #endif
1377
+ // Not every code path will make use of all possible results.
1378
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1379
+ PFORGE_MAY_BE_UNUSED long clong_result;
1380
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
1381
+ #if defined(_MSC_VER)
1382
+ #pragma warning(pop)
1383
+ #endif
1384
+
1385
+ CHECK_OBJECT(*operand1);
1386
+ assert(PyFloat_CheckExact(*operand1));
1387
+ CHECK_OBJECT(operand2);
1388
+ assert(PyFloat_CheckExact(operand2));
1389
+
1390
+ const double a = PyFloat_AS_DOUBLE(*operand1);
1391
+ const double b = PyFloat_AS_DOUBLE(operand2);
1392
+
1393
+ if (unlikely(b == 0.0)) {
1394
+ PyThreadState *tstate = PyThreadState_GET();
1395
+
1396
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "float division by zero");
1397
+ goto exit_result_exception;
1398
+ }
1399
+
1400
+ {
1401
+ double r = a / b;
1402
+
1403
+ cfloat_result = r;
1404
+ goto exit_result_ok_cfloat;
1405
+ }
1406
+
1407
+ exit_result_ok_cfloat:
1408
+ if (Py_REFCNT(*operand1) == 1) {
1409
+ PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1410
+ } else {
1411
+ // We got an object handed, that we have to release.
1412
+ Py_DECREF(*operand1);
1413
+
1414
+ *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1415
+ }
1416
+ goto exit_result_ok;
1417
+
1418
+ exit_result_ok:
1419
+ return true;
1420
+
1421
+ exit_result_exception:
1422
+ return false;
1423
+ }
1424
+
1425
+ return __INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(operand1, operand2);
1426
+ }
1427
+
1428
+ bool INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(PyObject **operand1, PyObject *operand2) {
1429
+ return _INPLACE_OPERATION_OLDDIV_OBJECT_FLOAT(operand1, operand2);
1430
+ }
1431
+ #endif
1432
+
1433
+ #if PYTHON_VERSION < 0x300
1434
+ /* Code referring to "FLOAT" corresponds to Python 'float' and "OBJECT" to any Python object. */
1435
+ static HEDLEY_NEVER_INLINE bool __INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1436
+ PyTypeObject *type2 = Py_TYPE(operand2);
1437
+
1438
+ #if defined(_MSC_VER)
1439
+ #pragma warning(push)
1440
+ #pragma warning(disable : 4101)
1441
+ #endif
1442
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1443
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1444
+ #if defined(_MSC_VER)
1445
+ #pragma warning(pop)
1446
+ #endif
1447
+
1448
+ // No inplace number slot nb_inplace_divide available for this type.
1449
+
1450
+ {
1451
+ binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1452
+ binaryfunc slot2 = NULL;
1453
+
1454
+ if (!(&PyFloat_Type == type2)) {
1455
+ // Different types, need to consider second value slot.
1456
+
1457
+ slot2 =
1458
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
1459
+
1460
+ if (slot1 == slot2) {
1461
+ slot2 = NULL;
1462
+ }
1463
+ }
1464
+
1465
+ if (slot1 != NULL) {
1466
+ if (slot2 != NULL) {
1467
+ if (Pforge_Type_IsSubtype(type2, &PyFloat_Type)) {
1468
+ PyObject *x = slot2(*operand1, operand2);
1469
+
1470
+ if (x != Py_NotImplemented) {
1471
+ obj_result = x;
1472
+ goto exit_inplace_result_object;
1473
+ }
1474
+
1475
+ Py_DECREF_IMMORTAL(x);
1476
+ slot2 = NULL;
1477
+ }
1478
+ }
1479
+
1480
+ PyObject *x = slot1(*operand1, operand2);
1481
+
1482
+ if (x != Py_NotImplemented) {
1483
+ obj_result = x;
1484
+ goto exit_inplace_result_object;
1485
+ }
1486
+
1487
+ Py_DECREF_IMMORTAL(x);
1488
+ }
1489
+
1490
+ if (slot2 != NULL) {
1491
+ PyObject *x = slot2(*operand1, operand2);
1492
+
1493
+ if (x != Py_NotImplemented) {
1494
+ obj_result = x;
1495
+ goto exit_inplace_result_object;
1496
+ }
1497
+
1498
+ Py_DECREF_IMMORTAL(x);
1499
+ }
1500
+
1501
+ #if PYTHON_VERSION < 0x300
1502
+ if (!1 || !NEW_STYLE_NUMBER_TYPE(type2)) {
1503
+ coercion c1 = PyFloat_Type.tp_as_number->nb_coerce;
1504
+
1505
+ if (c1 != NULL) {
1506
+ PyObject *coerced1 = *operand1;
1507
+ PyObject *coerced2 = operand2;
1508
+
1509
+ int err = c1(&coerced1, &coerced2);
1510
+
1511
+ if (unlikely(err < 0)) {
1512
+ goto exit_inplace_exception;
1513
+ }
1514
+
1515
+ if (err == 0) {
1516
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1517
+
1518
+ if (likely(mv == NULL)) {
1519
+ binaryfunc slot = mv->nb_divide;
1520
+
1521
+ if (likely(slot != NULL)) {
1522
+ PyObject *x = slot(coerced1, coerced2);
1523
+
1524
+ Py_DECREF(coerced1);
1525
+ Py_DECREF(coerced2);
1526
+
1527
+ obj_result = x;
1528
+ goto exit_inplace_result_object;
1529
+ }
1530
+ }
1531
+
1532
+ // nb_coerce took a reference.
1533
+ Py_DECREF(coerced1);
1534
+ Py_DECREF(coerced2);
1535
+ }
1536
+ }
1537
+ coercion c2 =
1538
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
1539
+
1540
+ if (c2 != NULL) {
1541
+ PyObject *coerced1 = *operand1;
1542
+ PyObject *coerced2 = operand2;
1543
+
1544
+ int err = c2(&coerced2, &coerced1);
1545
+
1546
+ if (unlikely(err < 0)) {
1547
+ goto exit_inplace_exception;
1548
+ }
1549
+
1550
+ if (err == 0) {
1551
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
1552
+
1553
+ if (likely(mv == NULL)) {
1554
+ binaryfunc slot = mv->nb_divide;
1555
+
1556
+ if (likely(slot != NULL)) {
1557
+ PyObject *x = slot(coerced1, coerced2);
1558
+
1559
+ Py_DECREF(coerced1);
1560
+ Py_DECREF(coerced2);
1561
+
1562
+ obj_result = x;
1563
+ goto exit_inplace_result_object;
1564
+ }
1565
+ }
1566
+
1567
+ // nb_coerce took a reference.
1568
+ Py_DECREF(coerced1);
1569
+ Py_DECREF(coerced2);
1570
+ }
1571
+ }
1572
+ }
1573
+ #endif
1574
+
1575
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'float' and '%s'", type2->tp_name);
1576
+ goto exit_inplace_exception;
1577
+ }
1578
+
1579
+ exit_inplace_result_object:
1580
+ if (unlikely(obj_result == NULL)) {
1581
+ return false;
1582
+ }
1583
+
1584
+ // We got an object handed, that we have to release.
1585
+ Py_DECREF(*operand1);
1586
+
1587
+ // That's our return value then. As we use a dedicated variable, it's
1588
+ // OK that way.
1589
+ *operand1 = obj_result;
1590
+
1591
+ return true;
1592
+
1593
+ exit_inplace_exception:
1594
+ return false;
1595
+ }
1596
+ static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1597
+ assert(operand1); // Pointer must be non-null.
1598
+
1599
+ CHECK_OBJECT(*operand1);
1600
+ assert(PyFloat_CheckExact(*operand1));
1601
+ CHECK_OBJECT(operand2);
1602
+
1603
+ PyTypeObject *type2 = Py_TYPE(operand2);
1604
+
1605
+ if (&PyFloat_Type == type2) {
1606
+ // return _BINARY_OPERATION_OLDDIV_FLOAT_FLOAT_INPLACE(operand1, operand2);
1607
+
1608
+ #if defined(_MSC_VER)
1609
+ #pragma warning(push)
1610
+ #pragma warning(disable : 4101)
1611
+ #endif
1612
+ // Not every code path will make use of all possible results.
1613
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1614
+ PFORGE_MAY_BE_UNUSED long clong_result;
1615
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
1616
+ #if defined(_MSC_VER)
1617
+ #pragma warning(pop)
1618
+ #endif
1619
+
1620
+ CHECK_OBJECT(*operand1);
1621
+ assert(PyFloat_CheckExact(*operand1));
1622
+ CHECK_OBJECT(operand2);
1623
+ assert(PyFloat_CheckExact(operand2));
1624
+
1625
+ const double a = PyFloat_AS_DOUBLE(*operand1);
1626
+ const double b = PyFloat_AS_DOUBLE(operand2);
1627
+
1628
+ if (unlikely(b == 0.0)) {
1629
+ PyThreadState *tstate = PyThreadState_GET();
1630
+
1631
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "float division by zero");
1632
+ goto exit_result_exception;
1633
+ }
1634
+
1635
+ {
1636
+ double r = a / b;
1637
+
1638
+ cfloat_result = r;
1639
+ goto exit_result_ok_cfloat;
1640
+ }
1641
+
1642
+ exit_result_ok_cfloat:
1643
+ if (Py_REFCNT(*operand1) == 1) {
1644
+ PyFloat_SET_DOUBLE(*operand1, cfloat_result);
1645
+ } else {
1646
+ // We got an object handed, that we have to release.
1647
+ Py_DECREF(*operand1);
1648
+
1649
+ *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
1650
+ }
1651
+ goto exit_result_ok;
1652
+
1653
+ exit_result_ok:
1654
+ return true;
1655
+
1656
+ exit_result_exception:
1657
+ return false;
1658
+ }
1659
+
1660
+ return __INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(operand1, operand2);
1661
+ }
1662
+
1663
+ bool INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(PyObject **operand1, PyObject *operand2) {
1664
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_OBJECT(operand1, operand2);
1665
+ }
1666
+ #endif
1667
+
1668
+ #if PYTHON_VERSION < 0x300
1669
+ /* Code referring to "FLOAT" corresponds to Python 'float' and "LONG" to Python2 'long', Python3 'int'. */
1670
+ static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1671
+ assert(operand1); // Pointer must be non-null.
1672
+
1673
+ CHECK_OBJECT(*operand1);
1674
+ assert(PyFloat_CheckExact(*operand1));
1675
+ CHECK_OBJECT(operand2);
1676
+ assert(PyLong_CheckExact(operand2));
1677
+
1678
+ #if defined(_MSC_VER)
1679
+ #pragma warning(push)
1680
+ #pragma warning(disable : 4101)
1681
+ #endif
1682
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1683
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1684
+ #if defined(_MSC_VER)
1685
+ #pragma warning(pop)
1686
+ #endif
1687
+
1688
+ // No inplace number slot nb_inplace_divide available for this type.
1689
+
1690
+ {
1691
+ binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1692
+ // Slot2 ignored on purpose, type1 takes precedence.
1693
+
1694
+ if (slot1 != NULL) {
1695
+ PyObject *x = slot1(*operand1, operand2);
1696
+
1697
+ if (x != Py_NotImplemented) {
1698
+ obj_result = x;
1699
+ goto exit_inplace_result_object;
1700
+ }
1701
+
1702
+ Py_DECREF_IMMORTAL(x);
1703
+ }
1704
+
1705
+ // Statically recognized that coercion is not possible with these types
1706
+
1707
+ #if PYTHON_VERSION < 0x300
1708
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'float' and 'long'");
1709
+ #else
1710
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'float' and 'int'");
1711
+ #endif
1712
+ goto exit_inplace_exception;
1713
+ }
1714
+
1715
+ exit_inplace_result_object:
1716
+ if (unlikely(obj_result == NULL)) {
1717
+ return false;
1718
+ }
1719
+
1720
+ // We got an object handed, that we have to release.
1721
+ Py_DECREF(*operand1);
1722
+
1723
+ // That's our return value then. As we use a dedicated variable, it's
1724
+ // OK that way.
1725
+ *operand1 = obj_result;
1726
+
1727
+ return true;
1728
+
1729
+ exit_inplace_exception:
1730
+ return false;
1731
+ }
1732
+
1733
+ bool INPLACE_OPERATION_OLDDIV_FLOAT_LONG(PyObject **operand1, PyObject *operand2) {
1734
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_LONG(operand1, operand2);
1735
+ }
1736
+ #endif
1737
+
1738
+ #if PYTHON_VERSION < 0x300
1739
+ /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "FLOAT" to Python 'float'. */
1740
+ static inline bool _INPLACE_OPERATION_OLDDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1741
+ assert(operand1); // Pointer must be non-null.
1742
+
1743
+ CHECK_OBJECT(*operand1);
1744
+ assert(PyLong_CheckExact(*operand1));
1745
+ CHECK_OBJECT(operand2);
1746
+ assert(PyFloat_CheckExact(operand2));
1747
+
1748
+ #if defined(_MSC_VER)
1749
+ #pragma warning(push)
1750
+ #pragma warning(disable : 4101)
1751
+ #endif
1752
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1753
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1754
+ #if defined(_MSC_VER)
1755
+ #pragma warning(pop)
1756
+ #endif
1757
+
1758
+ // No inplace number slot nb_inplace_divide available for this type.
1759
+
1760
+ {
1761
+ // Slot1 ignored on purpose, type2 takes precedence.
1762
+ binaryfunc slot2 = NULL;
1763
+
1764
+ if (!(0)) {
1765
+ // Different types, need to consider second value slot.
1766
+
1767
+ slot2 = PyFloat_Type.tp_as_number->nb_divide;
1768
+ }
1769
+
1770
+ if (slot2 != NULL) {
1771
+ PyObject *x = slot2(*operand1, operand2);
1772
+
1773
+ if (x != Py_NotImplemented) {
1774
+ obj_result = x;
1775
+ goto exit_inplace_result_object;
1776
+ }
1777
+
1778
+ Py_DECREF_IMMORTAL(x);
1779
+ }
1780
+
1781
+ // Statically recognized that coercion is not possible with these types
1782
+
1783
+ #if PYTHON_VERSION < 0x300
1784
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'long' and 'float'");
1785
+ #else
1786
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'int' and 'float'");
1787
+ #endif
1788
+ goto exit_inplace_exception;
1789
+ }
1790
+
1791
+ exit_inplace_result_object:
1792
+ if (unlikely(obj_result == NULL)) {
1793
+ return false;
1794
+ }
1795
+
1796
+ // We got an object handed, that we have to release.
1797
+ Py_DECREF(*operand1);
1798
+
1799
+ // That's our return value then. As we use a dedicated variable, it's
1800
+ // OK that way.
1801
+ *operand1 = obj_result;
1802
+
1803
+ return true;
1804
+
1805
+ exit_inplace_exception:
1806
+ return false;
1807
+ }
1808
+
1809
+ bool INPLACE_OPERATION_OLDDIV_LONG_FLOAT(PyObject **operand1, PyObject *operand2) {
1810
+ return _INPLACE_OPERATION_OLDDIV_LONG_FLOAT(operand1, operand2);
1811
+ }
1812
+ #endif
1813
+
1814
+ #if PYTHON_VERSION < 0x300
1815
+ /* Code referring to "FLOAT" corresponds to Python 'float' and "INT" to Python2 'int'. */
1816
+ static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1817
+ assert(operand1); // Pointer must be non-null.
1818
+
1819
+ CHECK_OBJECT(*operand1);
1820
+ assert(PyFloat_CheckExact(*operand1));
1821
+ CHECK_OBJECT(operand2);
1822
+ assert(PyInt_CheckExact(operand2));
1823
+
1824
+ #if defined(_MSC_VER)
1825
+ #pragma warning(push)
1826
+ #pragma warning(disable : 4101)
1827
+ #endif
1828
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1829
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1830
+ #if defined(_MSC_VER)
1831
+ #pragma warning(pop)
1832
+ #endif
1833
+
1834
+ // No inplace number slot nb_inplace_divide available for this type.
1835
+
1836
+ {
1837
+ binaryfunc slot1 = PyFloat_Type.tp_as_number->nb_divide;
1838
+ // Slot2 ignored on purpose, type1 takes precedence.
1839
+
1840
+ if (slot1 != NULL) {
1841
+ PyObject *x = slot1(*operand1, operand2);
1842
+
1843
+ if (x != Py_NotImplemented) {
1844
+ obj_result = x;
1845
+ goto exit_inplace_result_object;
1846
+ }
1847
+
1848
+ Py_DECREF_IMMORTAL(x);
1849
+ }
1850
+
1851
+ // Statically recognized that coercion is not possible with these types
1852
+
1853
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'float' and 'int'");
1854
+ goto exit_inplace_exception;
1855
+ }
1856
+
1857
+ exit_inplace_result_object:
1858
+ if (unlikely(obj_result == NULL)) {
1859
+ return false;
1860
+ }
1861
+
1862
+ // We got an object handed, that we have to release.
1863
+ Py_DECREF(*operand1);
1864
+
1865
+ // That's our return value then. As we use a dedicated variable, it's
1866
+ // OK that way.
1867
+ *operand1 = obj_result;
1868
+
1869
+ return true;
1870
+
1871
+ exit_inplace_exception:
1872
+ return false;
1873
+ }
1874
+
1875
+ bool INPLACE_OPERATION_OLDDIV_FLOAT_INT(PyObject **operand1, PyObject *operand2) {
1876
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_INT(operand1, operand2);
1877
+ }
1878
+ #endif
1879
+
1880
+ #if PYTHON_VERSION < 0x300
1881
+ /* Code referring to "INT" corresponds to Python2 'int' and "FLOAT" to Python 'float'. */
1882
+ static inline bool _INPLACE_OPERATION_OLDDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1883
+ assert(operand1); // Pointer must be non-null.
1884
+
1885
+ CHECK_OBJECT(*operand1);
1886
+ assert(PyInt_CheckExact(*operand1));
1887
+ CHECK_OBJECT(operand2);
1888
+ assert(PyFloat_CheckExact(operand2));
1889
+
1890
+ #if defined(_MSC_VER)
1891
+ #pragma warning(push)
1892
+ #pragma warning(disable : 4101)
1893
+ #endif
1894
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1895
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1896
+ #if defined(_MSC_VER)
1897
+ #pragma warning(pop)
1898
+ #endif
1899
+
1900
+ // No inplace number slot nb_inplace_divide available for this type.
1901
+
1902
+ {
1903
+ // Slot1 ignored on purpose, type2 takes precedence.
1904
+ binaryfunc slot2 = NULL;
1905
+
1906
+ if (!(0)) {
1907
+ // Different types, need to consider second value slot.
1908
+
1909
+ slot2 = PyFloat_Type.tp_as_number->nb_divide;
1910
+ }
1911
+
1912
+ if (slot2 != NULL) {
1913
+ PyObject *x = slot2(*operand1, operand2);
1914
+
1915
+ if (x != Py_NotImplemented) {
1916
+ obj_result = x;
1917
+ goto exit_inplace_result_object;
1918
+ }
1919
+
1920
+ Py_DECREF_IMMORTAL(x);
1921
+ }
1922
+
1923
+ // Statically recognized that coercion is not possible with these types
1924
+
1925
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'int' and 'float'");
1926
+ goto exit_inplace_exception;
1927
+ }
1928
+
1929
+ exit_inplace_result_object:
1930
+ if (unlikely(obj_result == NULL)) {
1931
+ return false;
1932
+ }
1933
+
1934
+ // We got an object handed, that we have to release.
1935
+ Py_DECREF(*operand1);
1936
+
1937
+ // That's our return value then. As we use a dedicated variable, it's
1938
+ // OK that way.
1939
+ *operand1 = obj_result;
1940
+
1941
+ return true;
1942
+
1943
+ exit_inplace_exception:
1944
+ return false;
1945
+ }
1946
+
1947
+ bool INPLACE_OPERATION_OLDDIV_INT_FLOAT(PyObject **operand1, PyObject *operand2) {
1948
+ return _INPLACE_OPERATION_OLDDIV_INT_FLOAT(operand1, operand2);
1949
+ }
1950
+ #endif
1951
+
1952
+ #if PYTHON_VERSION < 0x300
1953
+ /* Code referring to "LONG" corresponds to Python2 'long', Python3 'int' and "INT" to Python2 'int'. */
1954
+ static inline bool _INPLACE_OPERATION_OLDDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
1955
+ assert(operand1); // Pointer must be non-null.
1956
+
1957
+ CHECK_OBJECT(*operand1);
1958
+ assert(PyLong_CheckExact(*operand1));
1959
+ CHECK_OBJECT(operand2);
1960
+ assert(PyInt_CheckExact(operand2));
1961
+
1962
+ #if defined(_MSC_VER)
1963
+ #pragma warning(push)
1964
+ #pragma warning(disable : 4101)
1965
+ #endif
1966
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
1967
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
1968
+ #if defined(_MSC_VER)
1969
+ #pragma warning(pop)
1970
+ #endif
1971
+
1972
+ // No inplace number slot nb_inplace_divide available for this type.
1973
+
1974
+ {
1975
+ binaryfunc slot1 = PyLong_Type.tp_as_number->nb_divide;
1976
+ // Slot2 ignored on purpose, type1 takes precedence.
1977
+
1978
+ if (slot1 != NULL) {
1979
+ PyObject *x = slot1(*operand1, operand2);
1980
+
1981
+ if (x != Py_NotImplemented) {
1982
+ obj_result = x;
1983
+ goto exit_inplace_result_object;
1984
+ }
1985
+
1986
+ Py_DECREF_IMMORTAL(x);
1987
+ }
1988
+
1989
+ // Statically recognized that coercion is not possible with these types
1990
+
1991
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'long' and 'int'");
1992
+ goto exit_inplace_exception;
1993
+ }
1994
+
1995
+ exit_inplace_result_object:
1996
+ if (unlikely(obj_result == NULL)) {
1997
+ return false;
1998
+ }
1999
+
2000
+ // We got an object handed, that we have to release.
2001
+ Py_DECREF(*operand1);
2002
+
2003
+ // That's our return value then. As we use a dedicated variable, it's
2004
+ // OK that way.
2005
+ *operand1 = obj_result;
2006
+
2007
+ return true;
2008
+
2009
+ exit_inplace_exception:
2010
+ return false;
2011
+ }
2012
+
2013
+ bool INPLACE_OPERATION_OLDDIV_LONG_INT(PyObject **operand1, PyObject *operand2) {
2014
+ return _INPLACE_OPERATION_OLDDIV_LONG_INT(operand1, operand2);
2015
+ }
2016
+ #endif
2017
+
2018
+ #if PYTHON_VERSION < 0x300
2019
+ /* Code referring to "INT" corresponds to Python2 'int' and "LONG" to Python2 'long', Python3 'int'. */
2020
+ static inline bool _INPLACE_OPERATION_OLDDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2021
+ assert(operand1); // Pointer must be non-null.
2022
+
2023
+ CHECK_OBJECT(*operand1);
2024
+ assert(PyInt_CheckExact(*operand1));
2025
+ CHECK_OBJECT(operand2);
2026
+ assert(PyLong_CheckExact(operand2));
2027
+
2028
+ #if defined(_MSC_VER)
2029
+ #pragma warning(push)
2030
+ #pragma warning(disable : 4101)
2031
+ #endif
2032
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
2033
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
2034
+ #if defined(_MSC_VER)
2035
+ #pragma warning(pop)
2036
+ #endif
2037
+
2038
+ // No inplace number slot nb_inplace_divide available for this type.
2039
+
2040
+ {
2041
+ // Slot1 ignored on purpose, type2 takes precedence.
2042
+ binaryfunc slot2 = NULL;
2043
+
2044
+ if (!(0)) {
2045
+ // Different types, need to consider second value slot.
2046
+
2047
+ slot2 = PyLong_Type.tp_as_number->nb_divide;
2048
+ }
2049
+
2050
+ if (slot2 != NULL) {
2051
+ PyObject *x = slot2(*operand1, operand2);
2052
+
2053
+ if (x != Py_NotImplemented) {
2054
+ obj_result = x;
2055
+ goto exit_inplace_result_object;
2056
+ }
2057
+
2058
+ Py_DECREF_IMMORTAL(x);
2059
+ }
2060
+
2061
+ // Statically recognized that coercion is not possible with these types
2062
+
2063
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: 'int' and 'long'");
2064
+ goto exit_inplace_exception;
2065
+ }
2066
+
2067
+ exit_inplace_result_object:
2068
+ if (unlikely(obj_result == NULL)) {
2069
+ return false;
2070
+ }
2071
+
2072
+ // We got an object handed, that we have to release.
2073
+ Py_DECREF(*operand1);
2074
+
2075
+ // That's our return value then. As we use a dedicated variable, it's
2076
+ // OK that way.
2077
+ *operand1 = obj_result;
2078
+
2079
+ return true;
2080
+
2081
+ exit_inplace_exception:
2082
+ return false;
2083
+ }
2084
+
2085
+ bool INPLACE_OPERATION_OLDDIV_INT_LONG(PyObject **operand1, PyObject *operand2) {
2086
+ return _INPLACE_OPERATION_OLDDIV_INT_LONG(operand1, operand2);
2087
+ }
2088
+ #endif
2089
+
2090
+ #if PYTHON_VERSION < 0x300
2091
+ /* Code referring to "INT" corresponds to Python2 'int' and "CLONG" to C platform long value. */
2092
+ static inline bool _INPLACE_OPERATION_OLDDIV_INT_CLONG(PyObject **operand1, long operand2) {
2093
+ assert(operand1); // Pointer must be non-null.
2094
+
2095
+ CHECK_OBJECT(*operand1);
2096
+ assert(PyInt_CheckExact(*operand1));
2097
+
2098
+ // Not every code path will make use of all possible results.
2099
+ #if defined(_MSC_VER)
2100
+ #pragma warning(push)
2101
+ #pragma warning(disable : 4101)
2102
+ #endif
2103
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
2104
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
2105
+ PFORGE_MAY_BE_UNUSED long clong_result;
2106
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
2107
+ #if defined(_MSC_VER)
2108
+ #pragma warning(pop)
2109
+ #endif
2110
+
2111
+ CHECK_OBJECT(*operand1);
2112
+ assert(PyInt_CheckExact(*operand1));
2113
+
2114
+ const long a = PyInt_AS_LONG(*operand1);
2115
+ const long b = operand2;
2116
+
2117
+ if (unlikely(b == 0)) {
2118
+ PyThreadState *tstate = PyThreadState_GET();
2119
+
2120
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "integer division or modulo by zero");
2121
+ goto exit_result_exception;
2122
+ }
2123
+
2124
+ /* TODO: Isn't this a very specific value only, of which we could
2125
+ * hardcode the constant result. Not sure how well the C compiler
2126
+ * optimizes UNARY_NEG_WOULD_OVERFLOW to this, but dividing by
2127
+ * -1 has to be rare anyway.
2128
+ */
2129
+
2130
+ if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2131
+ long a_div_b = a / b;
2132
+ long a_mod_b = (long)(a - (unsigned long)a_div_b * b);
2133
+
2134
+ if (a_mod_b && (b ^ a_mod_b) < 0) {
2135
+ a_mod_b += b;
2136
+ a_div_b -= 1;
2137
+ }
2138
+
2139
+ clong_result = a_div_b;
2140
+ goto exit_result_ok_clong;
2141
+ }
2142
+
2143
+ {
2144
+ PyObject *operand1_object = *operand1;
2145
+ PyObject *operand2_object = Pforge_PyLong_FromLong(operand2);
2146
+
2147
+ PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
2148
+ assert(r != Py_NotImplemented);
2149
+
2150
+ Py_DECREF(operand2_object);
2151
+
2152
+ obj_result = r;
2153
+ goto exit_result_object;
2154
+ }
2155
+
2156
+ exit_result_ok_clong:
2157
+
2158
+ // We got an object handed, that we have to release.
2159
+ Py_DECREF(*operand1);
2160
+
2161
+ // That's our return value then. As we use a dedicated variable, it's
2162
+ // OK that way.
2163
+ *operand1 = Pforge_PyInt_FromLong(clong_result);
2164
+ goto exit_result_ok;
2165
+
2166
+ exit_result_object:
2167
+ if (unlikely(obj_result == NULL)) {
2168
+ goto exit_result_exception;
2169
+ }
2170
+ // We got an object handed, that we have to release.
2171
+ Py_DECREF(*operand1);
2172
+
2173
+ *operand1 = obj_result;
2174
+ goto exit_result_ok;
2175
+
2176
+ exit_result_ok:
2177
+ return true;
2178
+
2179
+ exit_result_exception:
2180
+ return false;
2181
+ }
2182
+
2183
+ bool INPLACE_OPERATION_OLDDIV_INT_CLONG(PyObject **operand1, long operand2) {
2184
+ return _INPLACE_OPERATION_OLDDIV_INT_CLONG(operand1, operand2);
2185
+ }
2186
+ #endif
2187
+
2188
+ #if PYTHON_VERSION < 0x300
2189
+ /* Code referring to "FLOAT" corresponds to Python 'float' and "CFLOAT" to C platform float value. */
2190
+ static inline bool _INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(PyObject **operand1, double operand2) {
2191
+ assert(operand1); // Pointer must be non-null.
2192
+
2193
+ CHECK_OBJECT(*operand1);
2194
+ assert(PyFloat_CheckExact(*operand1));
2195
+
2196
+ #if defined(_MSC_VER)
2197
+ #pragma warning(push)
2198
+ #pragma warning(disable : 4101)
2199
+ #endif
2200
+ // Not every code path will make use of all possible results.
2201
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
2202
+ PFORGE_MAY_BE_UNUSED long clong_result;
2203
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
2204
+ #if defined(_MSC_VER)
2205
+ #pragma warning(pop)
2206
+ #endif
2207
+
2208
+ CHECK_OBJECT(*operand1);
2209
+ assert(PyFloat_CheckExact(*operand1));
2210
+
2211
+ const double a = PyFloat_AS_DOUBLE(*operand1);
2212
+ const double b = operand2;
2213
+
2214
+ if (unlikely(b == 0.0)) {
2215
+ PyThreadState *tstate = PyThreadState_GET();
2216
+
2217
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "float division by zero");
2218
+ goto exit_result_exception;
2219
+ }
2220
+
2221
+ {
2222
+ double r = a / b;
2223
+
2224
+ cfloat_result = r;
2225
+ goto exit_result_ok_cfloat;
2226
+ }
2227
+
2228
+ exit_result_ok_cfloat:
2229
+ if (Py_REFCNT(*operand1) == 1) {
2230
+ PyFloat_SET_DOUBLE(*operand1, cfloat_result);
2231
+ } else {
2232
+ // We got an object handed, that we have to release.
2233
+ Py_DECREF(*operand1);
2234
+
2235
+ *operand1 = MAKE_FLOAT_FROM_DOUBLE(cfloat_result);
2236
+ }
2237
+ goto exit_result_ok;
2238
+
2239
+ exit_result_ok:
2240
+ return true;
2241
+
2242
+ exit_result_exception:
2243
+ return false;
2244
+ }
2245
+
2246
+ bool INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(PyObject **operand1, double operand2) {
2247
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_CFLOAT(operand1, operand2);
2248
+ }
2249
+ #endif
2250
+
2251
+ #if PYTHON_VERSION < 0x300
2252
+ /* Code referring to "OBJECT" corresponds to any Python object and "OBJECT" to any Python object. */
2253
+ static inline bool _INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2254
+ assert(operand1); // Pointer must be non-null.
2255
+
2256
+ CHECK_OBJECT(*operand1);
2257
+ CHECK_OBJECT(operand2);
2258
+
2259
+ #if PYTHON_VERSION < 0x300
2260
+ if (PyInt_CheckExact(*operand1) && PyInt_CheckExact(operand2)) {
2261
+
2262
+ // Not every code path will make use of all possible results.
2263
+ #if defined(_MSC_VER)
2264
+ #pragma warning(push)
2265
+ #pragma warning(disable : 4101)
2266
+ #endif
2267
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
2268
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
2269
+ PFORGE_MAY_BE_UNUSED long clong_result;
2270
+ PFORGE_MAY_BE_UNUSED double cfloat_result;
2271
+ #if defined(_MSC_VER)
2272
+ #pragma warning(pop)
2273
+ #endif
2274
+
2275
+ CHECK_OBJECT(*operand1);
2276
+ assert(PyInt_CheckExact(*operand1));
2277
+ CHECK_OBJECT(operand2);
2278
+ assert(PyInt_CheckExact(operand2));
2279
+
2280
+ const long a = PyInt_AS_LONG(*operand1);
2281
+ const long b = PyInt_AS_LONG(operand2);
2282
+
2283
+ if (unlikely(b == 0)) {
2284
+ PyThreadState *tstate = PyThreadState_GET();
2285
+
2286
+ SET_CURRENT_EXCEPTION_TYPE0_STR(tstate, PyExc_ZeroDivisionError, "integer division or modulo by zero");
2287
+ goto exit_result_exception;
2288
+ }
2289
+
2290
+ /* TODO: Isn't this a very specific value only, of which we could
2291
+ * hardcode the constant result. Not sure how well the C compiler
2292
+ * optimizes UNARY_NEG_WOULD_OVERFLOW to this, but dividing by
2293
+ * -1 has to be rare anyway.
2294
+ */
2295
+
2296
+ if (likely(b != -1 || !UNARY_NEG_WOULD_OVERFLOW(a))) {
2297
+ long a_div_b = a / b;
2298
+ long a_mod_b = (long)(a - (unsigned long)a_div_b * b);
2299
+
2300
+ if (a_mod_b && (b ^ a_mod_b) < 0) {
2301
+ a_mod_b += b;
2302
+ a_div_b -= 1;
2303
+ }
2304
+
2305
+ clong_result = a_div_b;
2306
+ goto exit_result_ok_clong;
2307
+ }
2308
+
2309
+ {
2310
+ PyObject *operand1_object = *operand1;
2311
+ PyObject *operand2_object = operand2;
2312
+
2313
+ PyObject *r = PyLong_Type.tp_as_number->nb_divide(operand1_object, operand2_object);
2314
+ assert(r != Py_NotImplemented);
2315
+
2316
+ obj_result = r;
2317
+ goto exit_result_object;
2318
+ }
2319
+
2320
+ exit_result_ok_clong:
2321
+
2322
+ // We got an object handed, that we have to release.
2323
+ Py_DECREF(*operand1);
2324
+
2325
+ // That's our return value then. As we use a dedicated variable, it's
2326
+ // OK that way.
2327
+ *operand1 = Pforge_PyInt_FromLong(clong_result);
2328
+ goto exit_result_ok;
2329
+
2330
+ exit_result_object:
2331
+ if (unlikely(obj_result == NULL)) {
2332
+ goto exit_result_exception;
2333
+ }
2334
+ // We got an object handed, that we have to release.
2335
+ Py_DECREF(*operand1);
2336
+
2337
+ *operand1 = obj_result;
2338
+ goto exit_result_ok;
2339
+
2340
+ exit_result_ok:
2341
+ return true;
2342
+
2343
+ exit_result_exception:
2344
+ return false;
2345
+ }
2346
+ #endif
2347
+
2348
+ if (Py_TYPE(*operand1) == Py_TYPE(operand2)) {
2349
+ if (PyFloat_CheckExact(operand2)) {
2350
+ return _INPLACE_OPERATION_OLDDIV_FLOAT_FLOAT(operand1, operand2);
2351
+ }
2352
+ #if PYTHON_VERSION >= 0x300
2353
+ if (PyLong_CheckExact(operand2)) {
2354
+ return _INPLACE_OPERATION_OLDDIV_LONG_LONG(operand1, operand2);
2355
+ }
2356
+ #endif
2357
+ }
2358
+
2359
+ PyTypeObject *type1 = Py_TYPE(*operand1);
2360
+ PyTypeObject *type2 = Py_TYPE(operand2);
2361
+
2362
+ #if defined(_MSC_VER)
2363
+ #pragma warning(push)
2364
+ #pragma warning(disable : 4101)
2365
+ #endif
2366
+ PFORGE_MAY_BE_UNUSED bool cbool_result;
2367
+ PFORGE_MAY_BE_UNUSED PyObject *obj_result;
2368
+ #if defined(_MSC_VER)
2369
+ #pragma warning(pop)
2370
+ #endif
2371
+
2372
+ binaryfunc islot =
2373
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_inplace_divide : NULL;
2374
+
2375
+ if (islot != NULL) {
2376
+ PyObject *x = islot(*operand1, operand2);
2377
+
2378
+ if (x != Py_NotImplemented) {
2379
+ obj_result = x;
2380
+ goto exit_inplace_result_object;
2381
+ }
2382
+
2383
+ Py_DECREF_IMMORTAL(x);
2384
+ }
2385
+
2386
+ {
2387
+ binaryfunc slot1 =
2388
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_divide : NULL;
2389
+ binaryfunc slot2 = NULL;
2390
+
2391
+ if (!(type1 == type2)) {
2392
+ // Different types, need to consider second value slot.
2393
+
2394
+ slot2 =
2395
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_divide : NULL;
2396
+
2397
+ if (slot1 == slot2) {
2398
+ slot2 = NULL;
2399
+ }
2400
+ }
2401
+
2402
+ if (slot1 != NULL) {
2403
+ if (slot2 != NULL) {
2404
+ if (Pforge_Type_IsSubtype(type2, type1)) {
2405
+ PyObject *x = slot2(*operand1, operand2);
2406
+
2407
+ if (x != Py_NotImplemented) {
2408
+ obj_result = x;
2409
+ goto exit_inplace_result_object;
2410
+ }
2411
+
2412
+ Py_DECREF_IMMORTAL(x);
2413
+ slot2 = NULL;
2414
+ }
2415
+ }
2416
+
2417
+ PyObject *x = slot1(*operand1, operand2);
2418
+
2419
+ if (x != Py_NotImplemented) {
2420
+ obj_result = x;
2421
+ goto exit_inplace_result_object;
2422
+ }
2423
+
2424
+ Py_DECREF_IMMORTAL(x);
2425
+ }
2426
+
2427
+ if (slot2 != NULL) {
2428
+ PyObject *x = slot2(*operand1, operand2);
2429
+
2430
+ if (x != Py_NotImplemented) {
2431
+ obj_result = x;
2432
+ goto exit_inplace_result_object;
2433
+ }
2434
+
2435
+ Py_DECREF_IMMORTAL(x);
2436
+ }
2437
+
2438
+ #if PYTHON_VERSION < 0x300
2439
+ if (!NEW_STYLE_NUMBER_TYPE(type1) || !NEW_STYLE_NUMBER_TYPE(type2)) {
2440
+ coercion c1 =
2441
+ (type1->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type1)) ? type1->tp_as_number->nb_coerce : NULL;
2442
+
2443
+ if (c1 != NULL) {
2444
+ PyObject *coerced1 = *operand1;
2445
+ PyObject *coerced2 = operand2;
2446
+
2447
+ int err = c1(&coerced1, &coerced2);
2448
+
2449
+ if (unlikely(err < 0)) {
2450
+ goto exit_inplace_exception;
2451
+ }
2452
+
2453
+ if (err == 0) {
2454
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2455
+
2456
+ if (likely(mv == NULL)) {
2457
+ binaryfunc slot = mv->nb_divide;
2458
+
2459
+ if (likely(slot != NULL)) {
2460
+ PyObject *x = slot(coerced1, coerced2);
2461
+
2462
+ Py_DECREF(coerced1);
2463
+ Py_DECREF(coerced2);
2464
+
2465
+ obj_result = x;
2466
+ goto exit_inplace_result_object;
2467
+ }
2468
+ }
2469
+
2470
+ // nb_coerce took a reference.
2471
+ Py_DECREF(coerced1);
2472
+ Py_DECREF(coerced2);
2473
+ }
2474
+ }
2475
+ coercion c2 =
2476
+ (type2->tp_as_number != NULL && NEW_STYLE_NUMBER_TYPE(type2)) ? type2->tp_as_number->nb_coerce : NULL;
2477
+
2478
+ if (c2 != NULL) {
2479
+ PyObject *coerced1 = *operand1;
2480
+ PyObject *coerced2 = operand2;
2481
+
2482
+ int err = c2(&coerced2, &coerced1);
2483
+
2484
+ if (unlikely(err < 0)) {
2485
+ goto exit_inplace_exception;
2486
+ }
2487
+
2488
+ if (err == 0) {
2489
+ PyNumberMethods *mv = Py_TYPE(coerced1)->tp_as_number;
2490
+
2491
+ if (likely(mv == NULL)) {
2492
+ binaryfunc slot = mv->nb_divide;
2493
+
2494
+ if (likely(slot != NULL)) {
2495
+ PyObject *x = slot(coerced1, coerced2);
2496
+
2497
+ Py_DECREF(coerced1);
2498
+ Py_DECREF(coerced2);
2499
+
2500
+ obj_result = x;
2501
+ goto exit_inplace_result_object;
2502
+ }
2503
+ }
2504
+
2505
+ // nb_coerce took a reference.
2506
+ Py_DECREF(coerced1);
2507
+ Py_DECREF(coerced2);
2508
+ }
2509
+ }
2510
+ }
2511
+ #endif
2512
+
2513
+ PyErr_Format(PyExc_TypeError, "unsupported operand type(s) for /=: '%s' and '%s'", type1->tp_name,
2514
+ type2->tp_name);
2515
+ goto exit_inplace_exception;
2516
+ }
2517
+
2518
+ exit_inplace_result_object:
2519
+ if (unlikely(obj_result == NULL)) {
2520
+ return false;
2521
+ }
2522
+
2523
+ // We got an object handed, that we have to release.
2524
+ Py_DECREF(*operand1);
2525
+
2526
+ // That's our return value then. As we use a dedicated variable, it's
2527
+ // OK that way.
2528
+ *operand1 = obj_result;
2529
+
2530
+ return true;
2531
+
2532
+ exit_inplace_exception:
2533
+ return false;
2534
+ }
2535
+
2536
+ bool INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(PyObject **operand1, PyObject *operand2) {
2537
+ return _INPLACE_OPERATION_OLDDIV_OBJECT_OBJECT(operand1, operand2);
2538
+ }
2539
+ #endif
2540
+
2541
+ // Part of "Pforge", an optimizing Python compiler that is compatible and
2542
+ // integrates with CPython, but also works on its own.
2543
+ //
2544
+ // Licensed under the GNU Affero General Public License, Version 3 (the "License");
2545
+ // you may not use this file except in compliance with the License.
2546
+ // You may obtain a copy of the License at
2547
+ //
2548
+ // https://www.gnu.org/licenses/agpl-3.0.txt
2549
+ //
2550
+ // See also: "Pforge Runtime Library Exception, Version 1.0" in file
2551
+ // "LICENSE-RUNTIME.txt" for additional permissions granted under Section 7.
2552
+ //
2553
+ // Unless required by applicable law or agreed to in writing, software
2554
+ // distributed under the License is distributed on an "AS IS" BASIS,
2555
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2556
+ // See the License for the specific language governing permissions and
2557
+ // limitations under the License.