xcoll 0.4.0__py3-none-any.whl → 0.5.1__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.

Potentially problematic release.


This version of xcoll might be problematic. Click here for more details.

Files changed (324) hide show
  1. xcoll/__init__.py +2 -1
  2. xcoll/beam_elements/__init__.py +9 -2
  3. xcoll/beam_elements/absorber.py +2 -2
  4. xcoll/beam_elements/base.py +105 -67
  5. xcoll/beam_elements/blowup.py +198 -0
  6. xcoll/beam_elements/{collimators_src → elements_src}/black_absorber.h +21 -3
  7. xcoll/beam_elements/{collimators_src → elements_src}/black_crystal.h +20 -2
  8. xcoll/beam_elements/elements_src/blowup.h +42 -0
  9. xcoll/beam_elements/elements_src/emittance_monitor.h +109 -0
  10. xcoll/beam_elements/{collimators_src → elements_src}/everest_block.h +19 -2
  11. xcoll/beam_elements/{collimators_src → elements_src}/everest_collimator.h +19 -3
  12. xcoll/beam_elements/{collimators_src → elements_src}/everest_crystal.h +30 -9
  13. xcoll/beam_elements/everest.py +5 -6
  14. xcoll/beam_elements/monitor.py +428 -0
  15. xcoll/colldb.py +103 -74
  16. xcoll/general.py +4 -4
  17. xcoll/initial_distribution.py +18 -6
  18. xcoll/install.py +3 -1
  19. xcoll/interaction_record/interaction_record.py +127 -81
  20. xcoll/interaction_record/interaction_record_src/interaction_record.h +43 -43
  21. xcoll/line_tools.py +8 -9
  22. xcoll/lossmap.py +48 -38
  23. xcoll/scattering_routines/everest/amorphous.h +4 -11
  24. xcoll/scattering_routines/everest/channeling.h +3 -8
  25. xcoll/scattering_routines/everest/everest.h +4 -1
  26. xcoll/scattering_routines/everest/jaw.h +4 -3
  27. xcoll/scattering_routines/everest/materials.py +35 -15
  28. xcoll/scattering_routines/everest/multiple_coulomb_scattering.h +2 -2
  29. xcoll/scattering_routines/everest/nuclear_interaction.h +1 -1
  30. xcoll/scattering_routines/everest/properties.h +6 -1
  31. xcoll/scattering_routines/fluka/flukaio/lib/libFlukaIO64.a +0 -0
  32. xcoll/scattering_routines/geant4/collimasim/.git +1 -0
  33. xcoll/scattering_routines/geant4/collimasim/.gitignore +12 -0
  34. xcoll/scattering_routines/geant4/collimasim/.gitmodules +3 -0
  35. xcoll/scattering_routines/geant4/collimasim/CMakeLists.txt +26 -0
  36. xcoll/scattering_routines/geant4/collimasim/README.md +21 -0
  37. xcoll/scattering_routines/geant4/collimasim/docs/Makefile +20 -0
  38. xcoll/scattering_routines/geant4/collimasim/docs/make.bat +35 -0
  39. xcoll/scattering_routines/geant4/collimasim/docs/source/collimasim.rst +10 -0
  40. xcoll/scattering_routines/geant4/collimasim/docs/source/conf.py +59 -0
  41. xcoll/scattering_routines/geant4/collimasim/docs/source/index.rst +26 -0
  42. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.appveyor.yml +37 -0
  43. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-format +19 -0
  44. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.clang-tidy +65 -0
  45. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.cmake-format.yaml +73 -0
  46. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.git +1 -0
  47. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CODEOWNERS +9 -0
  48. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/CONTRIBUTING.md +386 -0
  49. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/bug-report.yml +45 -0
  50. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/ISSUE_TEMPLATE/config.yml +8 -0
  51. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/dependabot.yml +16 -0
  52. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler.yml +8 -0
  53. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/labeler_merged.yml +3 -0
  54. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/pull_request_template.md +19 -0
  55. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/ci.yml +969 -0
  56. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/configure.yml +84 -0
  57. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/format.yml +48 -0
  58. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/labeler.yml +16 -0
  59. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.github/workflows/pip.yml +103 -0
  60. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.gitignore +45 -0
  61. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.pre-commit-config.yaml +151 -0
  62. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/.readthedocs.yml +3 -0
  63. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/CMakeLists.txt +297 -0
  64. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/LICENSE +29 -0
  65. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/MANIFEST.in +6 -0
  66. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/README.rst +180 -0
  67. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Doxyfile +23 -0
  68. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/Makefile +192 -0
  69. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/_static/theme_overrides.css +11 -0
  70. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/chrono.rst +81 -0
  71. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/custom.rst +93 -0
  72. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/eigen.rst +310 -0
  73. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/functional.rst +109 -0
  74. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/index.rst +43 -0
  75. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/overview.rst +171 -0
  76. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/stl.rst +251 -0
  77. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/cast/strings.rst +305 -0
  78. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/classes.rst +1297 -0
  79. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/embedding.rst +262 -0
  80. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/exceptions.rst +396 -0
  81. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/functions.rst +568 -0
  82. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/misc.rst +337 -0
  83. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/index.rst +13 -0
  84. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/numpy.rst +463 -0
  85. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/object.rst +286 -0
  86. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/pycpp/utilities.rst +155 -0
  87. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/advanced/smart_ptrs.rst +174 -0
  88. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/basics.rst +308 -0
  89. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.py +91 -0
  90. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/benchmark.rst +95 -0
  91. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/changelog.rst +2050 -0
  92. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/classes.rst +542 -0
  93. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/cmake/index.rst +8 -0
  94. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/compiling.rst +648 -0
  95. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/conf.py +381 -0
  96. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/faq.rst +343 -0
  97. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/index.rst +48 -0
  98. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/installing.rst +105 -0
  99. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/limitations.rst +72 -0
  100. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11-logo.png +0 -0
  101. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.png +0 -0
  102. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python1.svg +427 -0
  103. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.png +0 -0
  104. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/pybind11_vs_boost_python2.svg +427 -0
  105. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/reference.rst +130 -0
  106. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/release.rst +96 -0
  107. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/requirements.txt +8 -0
  108. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/docs/upgrade.rst +548 -0
  109. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/attr.h +605 -0
  110. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/buffer_info.h +144 -0
  111. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/cast.h +1432 -0
  112. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/chrono.h +213 -0
  113. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/common.h +2 -0
  114. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/complex.h +65 -0
  115. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/class.h +709 -0
  116. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/common.h +1021 -0
  117. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/descr.h +104 -0
  118. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/init.h +346 -0
  119. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/internals.h +467 -0
  120. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/type_caster_base.h +978 -0
  121. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/detail/typeid.h +55 -0
  122. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eigen.h +606 -0
  123. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/embed.h +284 -0
  124. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/eval.h +163 -0
  125. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/functional.h +121 -0
  126. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/gil.h +193 -0
  127. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/iostream.h +275 -0
  128. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/numpy.h +1741 -0
  129. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/operators.h +163 -0
  130. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/options.h +65 -0
  131. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pybind11.h +2497 -0
  132. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/pytypes.h +1879 -0
  133. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl/filesystem.h +103 -0
  134. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl.h +375 -0
  135. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/include/pybind11/stl_bind.h +747 -0
  136. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/noxfile.py +88 -0
  137. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__init__.py +11 -0
  138. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/__main__.py +52 -0
  139. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.py +12 -0
  140. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/_version.pyi +6 -0
  141. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/commands.py +21 -0
  142. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/py.typed +0 -0
  143. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.py +482 -0
  144. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pybind11/setup_helpers.pyi +63 -0
  145. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/pyproject.toml +41 -0
  146. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.cfg +56 -0
  147. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/setup.py +155 -0
  148. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/CMakeLists.txt +503 -0
  149. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/conftest.py +208 -0
  150. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/constructor_stats.h +275 -0
  151. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/cross_module_gil_utils.cpp +73 -0
  152. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/env.py +33 -0
  153. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/pytest.ini +0 -0
  154. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_python_package/test_files.py +279 -0
  155. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/pytest.ini +0 -0
  156. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/extra_setuptools/test_setuphelper.py +143 -0
  157. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/local_bindings.h +85 -0
  158. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/object.h +179 -0
  159. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_cross_module_tests.cpp +151 -0
  160. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.cpp +91 -0
  161. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pybind11_tests.h +85 -0
  162. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/pytest.ini +19 -0
  163. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/requirements.txt +12 -0
  164. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.cpp +26 -0
  165. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_async.py +25 -0
  166. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.cpp +216 -0
  167. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_buffers.py +163 -0
  168. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.cpp +286 -0
  169. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_builtin_casters.py +536 -0
  170. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.cpp +107 -0
  171. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_call_policies.py +248 -0
  172. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.cpp +227 -0
  173. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_callbacks.py +202 -0
  174. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.cpp +84 -0
  175. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_chrono.py +210 -0
  176. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.cpp +550 -0
  177. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_class.py +473 -0
  178. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/CMakeLists.txt +84 -0
  179. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/embed.cpp +21 -0
  180. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_embed/CMakeLists.txt +28 -0
  181. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_function/CMakeLists.txt +39 -0
  182. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/installed_target/CMakeLists.txt +46 -0
  183. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/main.cpp +6 -0
  184. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_embed/CMakeLists.txt +41 -0
  185. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_function/CMakeLists.txt +35 -0
  186. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/subdirectory_target/CMakeLists.txt +41 -0
  187. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_cmake_build/test.py +10 -0
  188. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.cpp +165 -0
  189. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_constants_and_functions.py +53 -0
  190. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.cpp +238 -0
  191. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_copy_move.py +126 -0
  192. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.cpp +141 -0
  193. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_casters.py +117 -0
  194. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.cpp +41 -0
  195. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_custom_type_setup.py +50 -0
  196. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.cpp +69 -0
  197. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_docstring_options.py +42 -0
  198. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.cpp +348 -0
  199. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eigen.py +771 -0
  200. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/CMakeLists.txt +47 -0
  201. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/catch.cpp +22 -0
  202. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/external_module.cpp +23 -0
  203. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.cpp +326 -0
  204. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_embed/test_interpreter.py +15 -0
  205. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.cpp +148 -0
  206. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_enum.py +272 -0
  207. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.cpp +119 -0
  208. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval.py +51 -0
  209. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_eval_call.py +5 -0
  210. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.cpp +285 -0
  211. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.h +12 -0
  212. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_exceptions.py +265 -0
  213. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.cpp +397 -0
  214. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_factory_constructors.py +520 -0
  215. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.cpp +49 -0
  216. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_gil_scoped.py +94 -0
  217. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.cpp +125 -0
  218. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_iostream.py +331 -0
  219. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.cpp +153 -0
  220. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_kwargs_and_defaults.py +284 -0
  221. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.cpp +107 -0
  222. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_local_bindings.py +257 -0
  223. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.cpp +412 -0
  224. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_methods_and_attributes.py +517 -0
  225. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.cpp +102 -0
  226. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_modules.py +92 -0
  227. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.cpp +233 -0
  228. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_multiple_inheritance.py +360 -0
  229. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.cpp +472 -0
  230. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_array.py +593 -0
  231. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.cpp +524 -0
  232. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_dtypes.py +441 -0
  233. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.cpp +103 -0
  234. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_numpy_vectorize.py +267 -0
  235. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.cpp +73 -0
  236. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_opaque_types.py +59 -0
  237. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.cpp +235 -0
  238. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_operator_overloading.py +146 -0
  239. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.cpp +189 -0
  240. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pickling.py +82 -0
  241. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.cpp +560 -0
  242. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_pytypes.py +651 -0
  243. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.cpp +500 -0
  244. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_sequences_and_iterators.py +253 -0
  245. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.cpp +452 -0
  246. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_smart_ptr.py +318 -0
  247. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.cpp +342 -0
  248. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl.py +291 -0
  249. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.cpp +131 -0
  250. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_stl_binders.py +318 -0
  251. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.cpp +144 -0
  252. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_tagbased_polymorphic.py +29 -0
  253. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.cpp +66 -0
  254. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_thread.py +44 -0
  255. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.cpp +22 -0
  256. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_union.py +9 -0
  257. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.cpp +510 -0
  258. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/test_virtual_functions.py +408 -0
  259. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-numpy-scipy.supp +140 -0
  260. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tests/valgrind-python.supp +117 -0
  261. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindCatch.cmake +70 -0
  262. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindEigen3.cmake +86 -0
  263. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/FindPythonLibsNew.cmake +257 -0
  264. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/check-style.sh +44 -0
  265. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/cmake_uninstall.cmake.in +23 -0
  266. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/libsize.py +39 -0
  267. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/make_changelog.py +64 -0
  268. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Common.cmake +402 -0
  269. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Config.cmake.in +233 -0
  270. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11NewTools.cmake +276 -0
  271. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pybind11Tools.cmake +214 -0
  272. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/pyproject.toml +3 -0
  273. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_global.py.in +65 -0
  274. xcoll/scattering_routines/geant4/collimasim/lib/pybind11/tools/setup_main.py.in +41 -0
  275. xcoll/scattering_routines/geant4/collimasim/pyproject.toml +8 -0
  276. xcoll/scattering_routines/geant4/collimasim/setup.py +144 -0
  277. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.cpp +403 -0
  278. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSPyATInterface.hh +100 -0
  279. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.cpp +763 -0
  280. xcoll/scattering_routines/geant4/collimasim/src/collimasim/BDSXtrackInterface.hh +118 -0
  281. xcoll/scattering_routines/geant4/collimasim/src/collimasim/__init__.py +8 -0
  282. xcoll/scattering_routines/geant4/collimasim/src/collimasim/bindings.cpp +63 -0
  283. xcoll/scattering_routines/geant4/collimasim/src/collimasim/pyCollimatorPass.py +142 -0
  284. xcoll/scattering_routines/geant4/collimasim/src/collimasim/xtrack_collimator.py +556 -0
  285. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/PKG-INFO +6 -0
  286. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/SOURCES.txt +24 -0
  287. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/dependency_links.txt +1 -0
  288. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/not-zip-safe +1 -0
  289. xcoll/scattering_routines/geant4/collimasim/src/collimasim.egg-info/top_level.txt +1 -0
  290. xcoll/scattering_routines/geant4/collimasim/tests/README.md +25 -0
  291. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_forions.dat +25 -0
  292. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_new_example.dat +18 -0
  293. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_old_example.dat +68 -0
  294. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_testing.dat +15 -0
  295. xcoll/scattering_routines/geant4/collimasim/tests/resources/CollDB_yaml_example.yaml +110 -0
  296. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps.dat +7 -0
  297. xcoll/scattering_routines/geant4/collimasim/tests/resources/collgaps_pyat_test.dat +3 -0
  298. xcoll/scattering_routines/geant4/collimasim/tests/resources/collonly_twiss_file_example.tfs +54 -0
  299. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings.gmad +3 -0
  300. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_black_absorber.gmad +3 -0
  301. xcoll/scattering_routines/geant4/collimasim/tests/resources/settings_ions.gmad +5 -0
  302. xcoll/scattering_routines/geant4/collimasim/tests/resources/twiss_file_testing.tfs +51 -0
  303. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat.py +65 -0
  304. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_passmethod.py +59 -0
  305. xcoll/scattering_routines/geant4/collimasim/tests/test_pyat_tracking.py +102 -0
  306. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack.py +75 -0
  307. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_angle.py +74 -0
  308. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_colldb_load.py +84 -0
  309. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction.py +159 -0
  310. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_interaction_ion.py +99 -0
  311. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_ions.py +78 -0
  312. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_lost_energy.py +88 -0
  313. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tilt.py +80 -0
  314. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking.py +97 -0
  315. xcoll/scattering_routines/geant4/collimasim/tests/test_xtrack_tracking_ions.py +96 -0
  316. xcoll/scattering_routines/geometry/collimator_geometry.h +9 -10
  317. xcoll/scattering_routines/geometry/crystal_geometry.h +9 -6
  318. {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/METADATA +1 -1
  319. xcoll-0.5.1.dist-info/RECORD +413 -0
  320. xcoll/scattering_routines/fluka/build_fluka_input.py +0 -58
  321. xcoll-0.4.0.dist-info/RECORD +0 -126
  322. {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/LICENSE +0 -0
  323. {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/NOTICE +0 -0
  324. {xcoll-0.4.0.dist-info → xcoll-0.5.1.dist-info}/WHEEL +0 -0
@@ -0,0 +1,408 @@
1
+ # -*- coding: utf-8 -*-
2
+ import pytest
3
+
4
+ import env # noqa: F401
5
+
6
+ m = pytest.importorskip("pybind11_tests.virtual_functions")
7
+ from pybind11_tests import ConstructorStats # noqa: E402
8
+
9
+
10
+ def test_override(capture, msg):
11
+ class ExtendedExampleVirt(m.ExampleVirt):
12
+ def __init__(self, state):
13
+ super(ExtendedExampleVirt, self).__init__(state + 1)
14
+ self.data = "Hello world"
15
+
16
+ def run(self, value):
17
+ print("ExtendedExampleVirt::run(%i), calling parent.." % value)
18
+ return super(ExtendedExampleVirt, self).run(value + 1)
19
+
20
+ def run_bool(self):
21
+ print("ExtendedExampleVirt::run_bool()")
22
+ return False
23
+
24
+ def get_string1(self):
25
+ return "override1"
26
+
27
+ def pure_virtual(self):
28
+ print("ExtendedExampleVirt::pure_virtual(): %s" % self.data)
29
+
30
+ class ExtendedExampleVirt2(ExtendedExampleVirt):
31
+ def __init__(self, state):
32
+ super(ExtendedExampleVirt2, self).__init__(state + 1)
33
+
34
+ def get_string2(self):
35
+ return "override2"
36
+
37
+ ex12 = m.ExampleVirt(10)
38
+ with capture:
39
+ assert m.runExampleVirt(ex12, 20) == 30
40
+ assert (
41
+ capture
42
+ == """
43
+ Original implementation of ExampleVirt::run(state=10, value=20, str1=default1, str2=default2)
44
+ """ # noqa: E501 line too long
45
+ )
46
+
47
+ with pytest.raises(RuntimeError) as excinfo:
48
+ m.runExampleVirtVirtual(ex12)
49
+ assert (
50
+ msg(excinfo.value)
51
+ == 'Tried to call pure virtual function "ExampleVirt::pure_virtual"'
52
+ )
53
+
54
+ ex12p = ExtendedExampleVirt(10)
55
+ with capture:
56
+ assert m.runExampleVirt(ex12p, 20) == 32
57
+ assert (
58
+ capture
59
+ == """
60
+ ExtendedExampleVirt::run(20), calling parent..
61
+ Original implementation of ExampleVirt::run(state=11, value=21, str1=override1, str2=default2)
62
+ """ # noqa: E501 line too long
63
+ )
64
+ with capture:
65
+ assert m.runExampleVirtBool(ex12p) is False
66
+ assert capture == "ExtendedExampleVirt::run_bool()"
67
+ with capture:
68
+ m.runExampleVirtVirtual(ex12p)
69
+ assert capture == "ExtendedExampleVirt::pure_virtual(): Hello world"
70
+
71
+ ex12p2 = ExtendedExampleVirt2(15)
72
+ with capture:
73
+ assert m.runExampleVirt(ex12p2, 50) == 68
74
+ assert (
75
+ capture
76
+ == """
77
+ ExtendedExampleVirt::run(50), calling parent..
78
+ Original implementation of ExampleVirt::run(state=17, value=51, str1=override1, str2=override2)
79
+ """ # noqa: E501 line too long
80
+ )
81
+
82
+ cstats = ConstructorStats.get(m.ExampleVirt)
83
+ assert cstats.alive() == 3
84
+ del ex12, ex12p, ex12p2
85
+ assert cstats.alive() == 0
86
+ assert cstats.values() == ["10", "11", "17"]
87
+ assert cstats.copy_constructions == 0
88
+ assert cstats.move_constructions >= 0
89
+
90
+
91
+ def test_alias_delay_initialization1(capture):
92
+ """`A` only initializes its trampoline class when we inherit from it
93
+
94
+ If we just create and use an A instance directly, the trampoline initialization is
95
+ bypassed and we only initialize an A() instead (for performance reasons).
96
+ """
97
+
98
+ class B(m.A):
99
+ def __init__(self):
100
+ super(B, self).__init__()
101
+
102
+ def f(self):
103
+ print("In python f()")
104
+
105
+ # C++ version
106
+ with capture:
107
+ a = m.A()
108
+ m.call_f(a)
109
+ del a
110
+ pytest.gc_collect()
111
+ assert capture == "A.f()"
112
+
113
+ # Python version
114
+ with capture:
115
+ b = B()
116
+ m.call_f(b)
117
+ del b
118
+ pytest.gc_collect()
119
+ assert (
120
+ capture
121
+ == """
122
+ PyA.PyA()
123
+ PyA.f()
124
+ In python f()
125
+ PyA.~PyA()
126
+ """
127
+ )
128
+
129
+
130
+ def test_alias_delay_initialization2(capture):
131
+ """`A2`, unlike the above, is configured to always initialize the alias
132
+
133
+ While the extra initialization and extra class layer has small virtual dispatch
134
+ performance penalty, it also allows us to do more things with the trampoline
135
+ class such as defining local variables and performing construction/destruction.
136
+ """
137
+
138
+ class B2(m.A2):
139
+ def __init__(self):
140
+ super(B2, self).__init__()
141
+
142
+ def f(self):
143
+ print("In python B2.f()")
144
+
145
+ # No python subclass version
146
+ with capture:
147
+ a2 = m.A2()
148
+ m.call_f(a2)
149
+ del a2
150
+ pytest.gc_collect()
151
+ a3 = m.A2(1)
152
+ m.call_f(a3)
153
+ del a3
154
+ pytest.gc_collect()
155
+ assert (
156
+ capture
157
+ == """
158
+ PyA2.PyA2()
159
+ PyA2.f()
160
+ A2.f()
161
+ PyA2.~PyA2()
162
+ PyA2.PyA2()
163
+ PyA2.f()
164
+ A2.f()
165
+ PyA2.~PyA2()
166
+ """
167
+ )
168
+
169
+ # Python subclass version
170
+ with capture:
171
+ b2 = B2()
172
+ m.call_f(b2)
173
+ del b2
174
+ pytest.gc_collect()
175
+ assert (
176
+ capture
177
+ == """
178
+ PyA2.PyA2()
179
+ PyA2.f()
180
+ In python B2.f()
181
+ PyA2.~PyA2()
182
+ """
183
+ )
184
+
185
+
186
+ # PyPy: Reference count > 1 causes call with noncopyable instance
187
+ # to fail in ncv1.print_nc()
188
+ @pytest.mark.xfail("env.PYPY")
189
+ @pytest.mark.skipif(
190
+ not hasattr(m, "NCVirt"), reason="NCVirt does not work on Intel/PGI/NVCC compilers"
191
+ )
192
+ def test_move_support():
193
+ class NCVirtExt(m.NCVirt):
194
+ def get_noncopyable(self, a, b):
195
+ # Constructs and returns a new instance:
196
+ nc = m.NonCopyable(a * a, b * b)
197
+ return nc
198
+
199
+ def get_movable(self, a, b):
200
+ # Return a referenced copy
201
+ self.movable = m.Movable(a, b)
202
+ return self.movable
203
+
204
+ class NCVirtExt2(m.NCVirt):
205
+ def get_noncopyable(self, a, b):
206
+ # Keep a reference: this is going to throw an exception
207
+ self.nc = m.NonCopyable(a, b)
208
+ return self.nc
209
+
210
+ def get_movable(self, a, b):
211
+ # Return a new instance without storing it
212
+ return m.Movable(a, b)
213
+
214
+ ncv1 = NCVirtExt()
215
+ assert ncv1.print_nc(2, 3) == "36"
216
+ assert ncv1.print_movable(4, 5) == "9"
217
+ ncv2 = NCVirtExt2()
218
+ assert ncv2.print_movable(7, 7) == "14"
219
+ # Don't check the exception message here because it differs under debug/non-debug mode
220
+ with pytest.raises(RuntimeError):
221
+ ncv2.print_nc(9, 9)
222
+
223
+ nc_stats = ConstructorStats.get(m.NonCopyable)
224
+ mv_stats = ConstructorStats.get(m.Movable)
225
+ assert nc_stats.alive() == 1
226
+ assert mv_stats.alive() == 1
227
+ del ncv1, ncv2
228
+ assert nc_stats.alive() == 0
229
+ assert mv_stats.alive() == 0
230
+ assert nc_stats.values() == ["4", "9", "9", "9"]
231
+ assert mv_stats.values() == ["4", "5", "7", "7"]
232
+ assert nc_stats.copy_constructions == 0
233
+ assert mv_stats.copy_constructions == 1
234
+ assert nc_stats.move_constructions >= 0
235
+ assert mv_stats.move_constructions >= 0
236
+
237
+
238
+ def test_dispatch_issue(msg):
239
+ """#159: virtual function dispatch has problems with similar-named functions"""
240
+
241
+ class PyClass1(m.DispatchIssue):
242
+ def dispatch(self):
243
+ return "Yay.."
244
+
245
+ class PyClass2(m.DispatchIssue):
246
+ def dispatch(self):
247
+ with pytest.raises(RuntimeError) as excinfo:
248
+ super(PyClass2, self).dispatch()
249
+ assert (
250
+ msg(excinfo.value)
251
+ == 'Tried to call pure virtual function "Base::dispatch"'
252
+ )
253
+
254
+ return m.dispatch_issue_go(PyClass1())
255
+
256
+ b = PyClass2()
257
+ assert m.dispatch_issue_go(b) == "Yay.."
258
+
259
+
260
+ def test_override_ref():
261
+ """#392/397: overriding reference-returning functions"""
262
+ o = m.OverrideTest("asdf")
263
+
264
+ # Not allowed (see associated .cpp comment)
265
+ # i = o.str_ref()
266
+ # assert o.str_ref() == "asdf"
267
+ assert o.str_value() == "asdf"
268
+
269
+ assert o.A_value().value == "hi"
270
+ a = o.A_ref()
271
+ assert a.value == "hi"
272
+ a.value = "bye"
273
+ assert a.value == "bye"
274
+
275
+
276
+ def test_inherited_virtuals():
277
+ class AR(m.A_Repeat):
278
+ def unlucky_number(self):
279
+ return 99
280
+
281
+ class AT(m.A_Tpl):
282
+ def unlucky_number(self):
283
+ return 999
284
+
285
+ obj = AR()
286
+ assert obj.say_something(3) == "hihihi"
287
+ assert obj.unlucky_number() == 99
288
+ assert obj.say_everything() == "hi 99"
289
+
290
+ obj = AT()
291
+ assert obj.say_something(3) == "hihihi"
292
+ assert obj.unlucky_number() == 999
293
+ assert obj.say_everything() == "hi 999"
294
+
295
+ for obj in [m.B_Repeat(), m.B_Tpl()]:
296
+ assert obj.say_something(3) == "B says hi 3 times"
297
+ assert obj.unlucky_number() == 13
298
+ assert obj.lucky_number() == 7.0
299
+ assert obj.say_everything() == "B says hi 1 times 13"
300
+
301
+ for obj in [m.C_Repeat(), m.C_Tpl()]:
302
+ assert obj.say_something(3) == "B says hi 3 times"
303
+ assert obj.unlucky_number() == 4444
304
+ assert obj.lucky_number() == 888.0
305
+ assert obj.say_everything() == "B says hi 1 times 4444"
306
+
307
+ class CR(m.C_Repeat):
308
+ def lucky_number(self):
309
+ return m.C_Repeat.lucky_number(self) + 1.25
310
+
311
+ obj = CR()
312
+ assert obj.say_something(3) == "B says hi 3 times"
313
+ assert obj.unlucky_number() == 4444
314
+ assert obj.lucky_number() == 889.25
315
+ assert obj.say_everything() == "B says hi 1 times 4444"
316
+
317
+ class CT(m.C_Tpl):
318
+ pass
319
+
320
+ obj = CT()
321
+ assert obj.say_something(3) == "B says hi 3 times"
322
+ assert obj.unlucky_number() == 4444
323
+ assert obj.lucky_number() == 888.0
324
+ assert obj.say_everything() == "B says hi 1 times 4444"
325
+
326
+ class CCR(CR):
327
+ def lucky_number(self):
328
+ return CR.lucky_number(self) * 10
329
+
330
+ obj = CCR()
331
+ assert obj.say_something(3) == "B says hi 3 times"
332
+ assert obj.unlucky_number() == 4444
333
+ assert obj.lucky_number() == 8892.5
334
+ assert obj.say_everything() == "B says hi 1 times 4444"
335
+
336
+ class CCT(CT):
337
+ def lucky_number(self):
338
+ return CT.lucky_number(self) * 1000
339
+
340
+ obj = CCT()
341
+ assert obj.say_something(3) == "B says hi 3 times"
342
+ assert obj.unlucky_number() == 4444
343
+ assert obj.lucky_number() == 888000.0
344
+ assert obj.say_everything() == "B says hi 1 times 4444"
345
+
346
+ class DR(m.D_Repeat):
347
+ def unlucky_number(self):
348
+ return 123
349
+
350
+ def lucky_number(self):
351
+ return 42.0
352
+
353
+ for obj in [m.D_Repeat(), m.D_Tpl()]:
354
+ assert obj.say_something(3) == "B says hi 3 times"
355
+ assert obj.unlucky_number() == 4444
356
+ assert obj.lucky_number() == 888.0
357
+ assert obj.say_everything() == "B says hi 1 times 4444"
358
+
359
+ obj = DR()
360
+ assert obj.say_something(3) == "B says hi 3 times"
361
+ assert obj.unlucky_number() == 123
362
+ assert obj.lucky_number() == 42.0
363
+ assert obj.say_everything() == "B says hi 1 times 123"
364
+
365
+ class DT(m.D_Tpl):
366
+ def say_something(self, times):
367
+ return "DT says:" + (" quack" * times)
368
+
369
+ def unlucky_number(self):
370
+ return 1234
371
+
372
+ def lucky_number(self):
373
+ return -4.25
374
+
375
+ obj = DT()
376
+ assert obj.say_something(3) == "DT says: quack quack quack"
377
+ assert obj.unlucky_number() == 1234
378
+ assert obj.lucky_number() == -4.25
379
+ assert obj.say_everything() == "DT says: quack 1234"
380
+
381
+ class DT2(DT):
382
+ def say_something(self, times):
383
+ return "DT2: " + ("QUACK" * times)
384
+
385
+ def unlucky_number(self):
386
+ return -3
387
+
388
+ class BT(m.B_Tpl):
389
+ def say_something(self, times):
390
+ return "BT" * times
391
+
392
+ def unlucky_number(self):
393
+ return -7
394
+
395
+ def lucky_number(self):
396
+ return -1.375
397
+
398
+ obj = BT()
399
+ assert obj.say_something(3) == "BTBTBT"
400
+ assert obj.unlucky_number() == -7
401
+ assert obj.lucky_number() == -1.375
402
+ assert obj.say_everything() == "BT -7"
403
+
404
+
405
+ def test_issue_1454():
406
+ # Fix issue #1454 (crash when acquiring/releasing GIL on another thread in Python 2.7)
407
+ m.test_gil()
408
+ m.test_gil_from_thread()
@@ -0,0 +1,140 @@
1
+ # Valgrind suppression file for NumPy & SciPy errors and leaks in pybind11 tests
2
+ #
3
+ # On updating a dependency, to get a list of "default" leaks in e.g. NumPy, run
4
+ # `PYTHONMALLOC=malloc valgrind --leak-check=full --show-leak-kinds=definite,indirect python3.9-dbg -c "import numpy"`
5
+ # To use these suppression files, add e.g. `--suppressions=valgrind-numpy-scipy.supp`
6
+
7
+ {
8
+ Leaks when importing NumPy
9
+ Memcheck:Leak
10
+ fun:malloc
11
+ fun:_PyMem_RawMalloc
12
+ fun:PyObject_Malloc
13
+ fun:_PyObject_GC_Alloc
14
+ fun:_PyObject_GC_Malloc
15
+ fun:_PyObject_GC_NewVar
16
+ fun:tuple_alloc
17
+ fun:PyTuple_Pack
18
+ ...
19
+ fun:__pyx_pymod_exec_*
20
+ }
21
+
22
+ {
23
+ Leaks when importing NumPy (bis)
24
+ Memcheck:Leak
25
+ fun:malloc
26
+ fun:_PyMem_RawMalloc
27
+ fun:PyObject_Malloc
28
+ fun:_PyObject_New
29
+ fun:PyCode_NewWithPosOnlyArgs
30
+ fun:PyCode_New
31
+ ...
32
+ fun:__pyx_pymod_exec_*
33
+ }
34
+
35
+ {
36
+ Leaks when importing NumPy (ter)
37
+ Memcheck:Leak
38
+ fun:malloc
39
+ fun:_PyMem_RawMalloc
40
+ fun:PyObject_Malloc
41
+ fun:_PyObject_GC_Alloc
42
+ fun:_PyObject_GC_Malloc
43
+ fun:_PyObject_GC_NewVar
44
+ fun:tuple_alloc
45
+ fun:_PyTuple_FromArray
46
+ fun:_PyObject_MakeTpCall
47
+ fun:_PyObject_VectorcallTstate
48
+ fun:PyObject_Vectorcall
49
+ fun:call_function
50
+ fun:_PyEval_EvalFrameDefault
51
+ fun:_PyEval_EvalFrame
52
+ fun:function_code_fastcall
53
+ fun:_PyFunction_Vectorcall
54
+ }
55
+
56
+ {
57
+ Leaks when importing NumPy (quater)
58
+ Memcheck:Leak
59
+ fun:malloc
60
+ fun:_PyMem_RawMalloc
61
+ fun:PyObject_Malloc
62
+ fun:_PyObject_GC_Alloc
63
+ fun:_PyObject_GC_Malloc
64
+ fun:_PyObject_GC_NewVar
65
+ fun:tuple_alloc
66
+ fun:_PyTuple_FromArray
67
+ fun:_PyObject_MakeTpCall
68
+ fun:_PyObject_VectorcallTstate
69
+ fun:_PyObject_CallFunctionVa
70
+ fun:PyObject_CallFunction
71
+ fun:PyImport_Import
72
+ }
73
+
74
+ {
75
+ Leaks when importing NumPy (quinquies)
76
+ Memcheck:Leak
77
+ fun:malloc
78
+ fun:_PyMem_RawMalloc
79
+ fun:PyObject_Malloc
80
+ fun:_PyObject_GC_Alloc
81
+ fun:_PyObject_GC_Malloc
82
+ fun:_PyObject_GC_NewVar
83
+ fun:tuple_alloc
84
+ fun:PyTuple_New
85
+ fun:r_object
86
+ fun:r_object
87
+ fun:r_object
88
+ fun:r_object
89
+ }
90
+
91
+ {
92
+ Leaks when importing NumPy (sexies)
93
+ Memcheck:Leak
94
+ fun:malloc
95
+ fun:_PyMem_RawMalloc
96
+ fun:PyObject_Malloc
97
+ fun:_PyObject_GC_Alloc
98
+ fun:_PyObject_GC_Malloc
99
+ fun:_PyObject_GC_NewVar
100
+ fun:tuple_alloc
101
+ fun:PyTuple_New
102
+ fun:dictiter_iternextitem
103
+ fun:list_extend
104
+ fun:_PyList_Extend
105
+ fun:PySequence_List
106
+ }
107
+
108
+ {
109
+ Leak when importing scipy.fft
110
+ Memcheck:Leak
111
+ fun:_Znwm
112
+ fun:PyInit_pypocketfft
113
+ fun:_PyImport_LoadDynamicModuleWithSpec
114
+ fun:_imp_create_dynamic_impl*
115
+ fun:_imp_create_dynamic
116
+ fun:cfunction_vectorcall_FASTCALL
117
+ fun:PyVectorcall_Call
118
+ fun:_PyObject_Call
119
+ fun:PyObject_Call
120
+ fun:do_call_core
121
+ fun:_PyEval_EvalFrameDefault
122
+ fun:_PyEval_EvalFrame
123
+ fun:_PyEval_EvalCode
124
+ }
125
+
126
+ {
127
+ NumPy leaks when spawning a subprocess
128
+ Memcheck:Leak
129
+ fun:malloc
130
+ ...
131
+ fun:_buffer_get_info
132
+ fun:array_getbuffer
133
+ fun:PyObject_GetBuffer
134
+ fun:__Pyx__GetBufferAndValidate*
135
+ fun:__pyx_f_5numpy_6random_13bit_generator_12SeedSequence_mix_entropy
136
+ fun:__pyx_pw_5numpy_6random_13bit_generator_12SeedSequence_1__init__
137
+ fun:type_call
138
+ fun:__Pyx__PyObject_CallOneArg
139
+ fun:__pyx_pw_5numpy_6random_13bit_generator_12BitGenerator_1__init__
140
+ }
@@ -0,0 +1,117 @@
1
+ # Valgrind suppression file for CPython errors and leaks in pybind11 tests
2
+
3
+ # Taken verbatim from https://github.com/python/cpython/blob/3.9/Misc/valgrind-python.supp#L266-L272
4
+ {
5
+ Uninitialised byte(s) false alarm, see bpo-35561
6
+ Memcheck:Param
7
+ epoll_ctl(event)
8
+ fun:epoll_ctl
9
+ fun:pyepoll_internal_ctl
10
+ }
11
+
12
+ {
13
+ Python leaks when spawning a subprocess
14
+ Memcheck:Leak
15
+ fun:malloc
16
+ fun:_PyMem_RawMalloc
17
+ fun:PyMem_RawMalloc
18
+ fun:PyThread_allocate_lock
19
+ fun:_PyEval_InitState
20
+ fun:PyInterpreterState_New
21
+ ...
22
+ fun:pyinit_core*
23
+ fun:Py_InitializeFromConfig
24
+ fun:pymain_init
25
+ fun:pymain_main
26
+ }
27
+
28
+ {
29
+ Python leaks when spawning a subprocess
30
+ Memcheck:Leak
31
+ fun:malloc
32
+ fun:_PyMem_RawMalloc
33
+ fun:_PyMem_DebugRawAlloc
34
+ fun:_PyMem_DebugRawMalloc
35
+ fun:PyMem_RawMalloc
36
+ fun:PyThread_allocate_lock
37
+ fun:_PyRuntimeState_Init_impl
38
+ fun:_PyRuntimeState_Init
39
+ fun:_PyRuntime_Initialize
40
+ fun:pymain_init
41
+ fun:pymain_main
42
+ fun:Py_BytesMain
43
+ }
44
+
45
+ {
46
+ Python leaks when spawning a subprocess
47
+ Memcheck:Leak
48
+ fun:malloc
49
+ fun:_PyMem_RawMalloc
50
+ fun:PyMem_RawMalloc
51
+ fun:PyThread_allocate_lock
52
+ fun:_PyImport_AcquireLock
53
+ fun:_imp_acquire_lock_impl*
54
+ fun:_imp_acquire_lock
55
+ fun:cfunction_vectorcall_NOARGS
56
+ fun:_PyObject_VectorcallTstate
57
+ fun:PyObject_Vectorcall
58
+ fun:call_function
59
+ fun:_PyEval_EvalFrameDefault
60
+ fun:_PyEval_EvalFrame
61
+ fun:function_code_fastcall
62
+ }
63
+
64
+ {
65
+ Python leaks when spawning a subprocess
66
+ Memcheck:Leak
67
+ fun:malloc
68
+ fun:_PyMem_RawMalloc
69
+ fun:PyMem_RawMalloc
70
+ fun:PyThread_allocate_lock
71
+ fun:newlockobject
72
+ ...
73
+ fun:cfunction_vectorcall_NOARGS
74
+ fun:_PyObject_VectorcallTstate
75
+ fun:PyObject_Vectorcall
76
+ fun:call_function
77
+ fun:_PyEval_EvalFrameDefault
78
+ fun:_PyEval_EvalFrame
79
+ fun:function_code_fastcall
80
+ fun:_PyFunction_Vectorcall
81
+ }
82
+
83
+ {
84
+ Python leaks when spawning a subprocess
85
+ Memcheck:Leak
86
+ fun:malloc
87
+ fun:_PyMem_RawMalloc
88
+ fun:PyMem_RawMalloc
89
+ fun:PyThread_allocate_lock
90
+ fun:rlock_new
91
+ fun:type_call
92
+ fun:_PyObject_Call
93
+ fun:PyObject_Call
94
+ fun:do_call_core
95
+ fun:_PyEval_EvalFrameDefault
96
+ fun:_PyEval_EvalFrame
97
+ fun:_PyEval_EvalCode
98
+ fun:_PyFunction_Vectorcall
99
+ }
100
+
101
+ # Not really CPython-specific, see link
102
+ {
103
+ dlopen leak (https://stackoverflow.com/questions/1542457/memory-leak-reported-by-valgrind-in-dlopen)
104
+ Memcheck:Leak
105
+ fun:malloc
106
+ ...
107
+ fun:dl_open_worker
108
+ fun:_dl_catch_exception
109
+ fun:_dl_open
110
+ fun:dlopen_doit
111
+ fun:_dl_catch_exception
112
+ fun:_dl_catch_error
113
+ fun:_dlerror_run
114
+ fun:dlopen@@GLIBC_2.2.5
115
+ fun:_PyImport_FindSharedFuncptr
116
+ fun:_PyImport_LoadDynamicModuleWithSpec
117
+ }