ctpbee-opt-api 0.1.0__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. ctpbee_api/__init__.py +17 -0
  2. ctpbee_api/ctp/__init__.py +3 -0
  3. ctpbee_api/ctp/ctp_constant.py +1253 -0
  4. ctpbee_api/ctp/generator/concat.py +93 -0
  5. ctpbee_api/ctp/generator/const.py +325 -0
  6. ctpbee_api/ctp/generator/ctp_constant.py +1274 -0
  7. ctpbee_api/ctp/generator/ctp_md_header_define.h +13 -0
  8. ctpbee_api/ctp/generator/ctp_md_header_function.h +6 -0
  9. ctpbee_api/ctp/generator/ctp_md_header_on.h +26 -0
  10. ctpbee_api/ctp/generator/ctp_md_header_process.h +26 -0
  11. ctpbee_api/ctp/generator/ctp_md_source_function.cpp +42 -0
  12. ctpbee_api/ctp/generator/ctp_md_source_module.cpp +18 -0
  13. ctpbee_api/ctp/generator/ctp_md_source_on.cpp +156 -0
  14. ctpbee_api/ctp/generator/ctp_md_source_process.cpp +282 -0
  15. ctpbee_api/ctp/generator/ctp_md_source_switch.cpp +78 -0
  16. ctpbee_api/ctp/generator/ctp_md_source_task.cpp +211 -0
  17. ctpbee_api/ctp/generator/ctp_struct.py +5640 -0
  18. ctpbee_api/ctp/generator/ctp_td_header_define.h +130 -0
  19. ctpbee_api/ctp/generator/ctp_td_header_function.h +174 -0
  20. ctpbee_api/ctp/generator/ctp_td_header_on.h +260 -0
  21. ctpbee_api/ctp/generator/ctp_td_header_process.h +260 -0
  22. ctpbee_api/ctp/generator/ctp_td_source_function.cpp +1456 -0
  23. ctpbee_api/ctp/generator/ctp_td_source_module.cpp +222 -0
  24. ctpbee_api/ctp/generator/ctp_td_source_on.cpp +1572 -0
  25. ctpbee_api/ctp/generator/ctp_td_source_process.cpp +5472 -0
  26. ctpbee_api/ctp/generator/ctp_td_source_switch.cpp +780 -0
  27. ctpbee_api/ctp/generator/ctp_td_source_task.cpp +2444 -0
  28. ctpbee_api/ctp/generator/ctp_typedef.py +800 -0
  29. ctpbee_api/ctp/generator/generate_api_functions.py +345 -0
  30. ctpbee_api/ctp/generator/generate_data_type.py +76 -0
  31. ctpbee_api/ctp/generator/generate_struct.py +84 -0
  32. ctpbee_api/ctp/include/mac/ctp/ThostFtdcMdApi.h +168 -0
  33. ctpbee_api/ctp/include/mac/ctp/ThostFtdcTraderApi.h +770 -0
  34. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiDataType.h +6878 -0
  35. ctpbee_api/ctp/include/mac/ctp/ThostFtdcUserApiStruct.h +10915 -0
  36. ctpbee_api/ctp/include/mac/pybind11/attr.h +690 -0
  37. ctpbee_api/ctp/include/mac/pybind11/buffer_info.h +208 -0
  38. ctpbee_api/ctp/include/mac/pybind11/cast.h +1704 -0
  39. ctpbee_api/ctp/include/mac/pybind11/chrono.h +225 -0
  40. ctpbee_api/ctp/include/mac/pybind11/common.h +2 -0
  41. ctpbee_api/ctp/include/mac/pybind11/complex.h +74 -0
  42. ctpbee_api/ctp/include/mac/pybind11/detail/class.h +743 -0
  43. ctpbee_api/ctp/include/mac/pybind11/detail/common.h +1255 -0
  44. ctpbee_api/ctp/include/mac/pybind11/detail/descr.h +171 -0
  45. ctpbee_api/ctp/include/mac/pybind11/detail/init.h +434 -0
  46. ctpbee_api/ctp/include/mac/pybind11/detail/internals.h +656 -0
  47. ctpbee_api/ctp/include/mac/pybind11/detail/type_caster_base.h +1177 -0
  48. ctpbee_api/ctp/include/mac/pybind11/detail/typeid.h +65 -0
  49. ctpbee_api/ctp/include/mac/pybind11/eigen/common.h +9 -0
  50. ctpbee_api/ctp/include/mac/pybind11/eigen/matrix.h +714 -0
  51. ctpbee_api/ctp/include/mac/pybind11/eigen/tensor.h +516 -0
  52. ctpbee_api/ctp/include/mac/pybind11/eigen.h +12 -0
  53. ctpbee_api/ctp/include/mac/pybind11/embed.h +316 -0
  54. ctpbee_api/ctp/include/mac/pybind11/eval.h +156 -0
  55. ctpbee_api/ctp/include/mac/pybind11/functional.h +137 -0
  56. ctpbee_api/ctp/include/mac/pybind11/gil.h +239 -0
  57. ctpbee_api/ctp/include/mac/pybind11/iostream.h +265 -0
  58. ctpbee_api/ctp/include/mac/pybind11/numpy.h +1998 -0
  59. ctpbee_api/ctp/include/mac/pybind11/operators.h +202 -0
  60. ctpbee_api/ctp/include/mac/pybind11/options.h +92 -0
  61. ctpbee_api/ctp/include/mac/pybind11/pybind11.h +2890 -0
  62. ctpbee_api/ctp/include/mac/pybind11/pytypes.h +2557 -0
  63. ctpbee_api/ctp/include/mac/pybind11/stl/filesystem.h +116 -0
  64. ctpbee_api/ctp/include/mac/pybind11/stl.h +447 -0
  65. ctpbee_api/ctp/include/mac/pybind11/stl_bind.h +851 -0
  66. ctpbee_api/ctp/include/mac/pybind11/type_caster_pyobject_ptr.h +61 -0
  67. ctpbee_api/ctp/include/new/ctp/ThostFtdcMdApi.h +168 -0
  68. ctpbee_api/ctp/include/new/ctp/ThostFtdcTraderApi.h +770 -0
  69. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiDataType.h +6878 -0
  70. ctpbee_api/ctp/include/new/ctp/ThostFtdcUserApiStruct.h +10915 -0
  71. ctpbee_api/ctp/include/new/pybind11/attr.h +690 -0
  72. ctpbee_api/ctp/include/new/pybind11/buffer_info.h +208 -0
  73. ctpbee_api/ctp/include/new/pybind11/cast.h +1704 -0
  74. ctpbee_api/ctp/include/new/pybind11/chrono.h +225 -0
  75. ctpbee_api/ctp/include/new/pybind11/common.h +2 -0
  76. ctpbee_api/ctp/include/new/pybind11/complex.h +74 -0
  77. ctpbee_api/ctp/include/new/pybind11/detail/class.h +743 -0
  78. ctpbee_api/ctp/include/new/pybind11/detail/common.h +1255 -0
  79. ctpbee_api/ctp/include/new/pybind11/detail/descr.h +171 -0
  80. ctpbee_api/ctp/include/new/pybind11/detail/init.h +434 -0
  81. ctpbee_api/ctp/include/new/pybind11/detail/internals.h +656 -0
  82. ctpbee_api/ctp/include/new/pybind11/detail/type_caster_base.h +1177 -0
  83. ctpbee_api/ctp/include/new/pybind11/detail/typeid.h +65 -0
  84. ctpbee_api/ctp/include/new/pybind11/eigen/common.h +9 -0
  85. ctpbee_api/ctp/include/new/pybind11/eigen/matrix.h +714 -0
  86. ctpbee_api/ctp/include/new/pybind11/eigen/tensor.h +516 -0
  87. ctpbee_api/ctp/include/new/pybind11/eigen.h +12 -0
  88. ctpbee_api/ctp/include/new/pybind11/embed.h +316 -0
  89. ctpbee_api/ctp/include/new/pybind11/eval.h +156 -0
  90. ctpbee_api/ctp/include/new/pybind11/functional.h +137 -0
  91. ctpbee_api/ctp/include/new/pybind11/gil.h +239 -0
  92. ctpbee_api/ctp/include/new/pybind11/iostream.h +265 -0
  93. ctpbee_api/ctp/include/new/pybind11/numpy.h +1998 -0
  94. ctpbee_api/ctp/include/new/pybind11/operators.h +202 -0
  95. ctpbee_api/ctp/include/new/pybind11/options.h +92 -0
  96. ctpbee_api/ctp/include/new/pybind11/pybind11.h +2890 -0
  97. ctpbee_api/ctp/include/new/pybind11/pytypes.h +2557 -0
  98. ctpbee_api/ctp/include/new/pybind11/stl/filesystem.h +116 -0
  99. ctpbee_api/ctp/include/new/pybind11/stl.h +447 -0
  100. ctpbee_api/ctp/include/new/pybind11/stl_bind.h +851 -0
  101. ctpbee_api/ctp/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  102. ctpbee_api/ctp/include/previous/ctp/ThostFtdcMdApi.h +168 -0
  103. ctpbee_api/ctp/include/previous/ctp/ThostFtdcTraderApi.h +770 -0
  104. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiDataType.h +6878 -0
  105. ctpbee_api/ctp/include/previous/ctp/ThostFtdcUserApiStruct.h +10915 -0
  106. ctpbee_api/ctp/include/previous/pybind11/attr.h +489 -0
  107. ctpbee_api/ctp/include/previous/pybind11/buffer_info.h +108 -0
  108. ctpbee_api/ctp/include/previous/pybind11/cast.h +2067 -0
  109. ctpbee_api/ctp/include/previous/pybind11/chrono.h +162 -0
  110. ctpbee_api/ctp/include/previous/pybind11/common.h +2 -0
  111. ctpbee_api/ctp/include/previous/pybind11/complex.h +61 -0
  112. ctpbee_api/ctp/include/previous/pybind11/detail/class.h +626 -0
  113. ctpbee_api/ctp/include/previous/pybind11/detail/common.h +803 -0
  114. ctpbee_api/ctp/include/previous/pybind11/detail/descr.h +185 -0
  115. ctpbee_api/ctp/include/previous/pybind11/detail/init.h +335 -0
  116. ctpbee_api/ctp/include/previous/pybind11/detail/internals.h +285 -0
  117. ctpbee_api/ctp/include/previous/pybind11/detail/typeid.h +53 -0
  118. ctpbee_api/ctp/include/previous/pybind11/eigen.h +604 -0
  119. ctpbee_api/ctp/include/previous/pybind11/embed.h +194 -0
  120. ctpbee_api/ctp/include/previous/pybind11/eval.h +117 -0
  121. ctpbee_api/ctp/include/previous/pybind11/functional.h +85 -0
  122. ctpbee_api/ctp/include/previous/pybind11/iostream.h +200 -0
  123. ctpbee_api/ctp/include/previous/pybind11/numpy.h +1601 -0
  124. ctpbee_api/ctp/include/previous/pybind11/operators.h +168 -0
  125. ctpbee_api/ctp/include/previous/pybind11/options.h +65 -0
  126. ctpbee_api/ctp/include/previous/pybind11/pybind11.h +1965 -0
  127. ctpbee_api/ctp/include/previous/pybind11/pytypes.h +1332 -0
  128. ctpbee_api/ctp/include/previous/pybind11/stl.h +376 -0
  129. ctpbee_api/ctp/include/previous/pybind11/stl_bind.h +599 -0
  130. ctpbee_api/ctp/libs/libcomunicationkey.a +0 -0
  131. ctpbee_api/ctp/libs/libcrypto.a +0 -0
  132. ctpbee_api/ctp/libs/libssl.a +0 -0
  133. ctpbee_api/ctp/libs/thostmduserapi_se.lib +0 -0
  134. ctpbee_api/ctp/libs/thosttraderapi_se.lib +0 -0
  135. ctpbee_api/ctp/libthostmduserapi_se.so +0 -0
  136. ctpbee_api/ctp/libthosttraderapi_se.so +0 -0
  137. ctpbee_api/ctp/thostmduserapi_se.dll +0 -0
  138. ctpbee_api/ctp/thosttraderapi_se.dll +0 -0
  139. ctpbee_api/ctp/vnctp/vnctp.h +189 -0
  140. ctpbee_api/ctp/vnctp/vnctp.sln +41 -0
  141. ctpbee_api/ctp/vnctp/vnctpmd/dllmain.cpp +19 -0
  142. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.cpp +1 -0
  143. ctpbee_api/ctp/vnctp/vnctpmd/stdafx.h +17 -0
  144. ctpbee_api/ctp/vnctp/vnctpmd/targetver.h +8 -0
  145. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.cpp +953 -0
  146. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.h +209 -0
  147. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj +200 -0
  148. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.filters +54 -0
  149. ctpbee_api/ctp/vnctp/vnctpmd/vnctpmd.vcxproj.user +4 -0
  150. ctpbee_api/ctp/vnctp/vnctptd/dllmain.cpp +19 -0
  151. ctpbee_api/ctp/vnctp/vnctptd/stdafx.cpp +1 -0
  152. ctpbee_api/ctp/vnctp/vnctptd/stdafx.h +16 -0
  153. ctpbee_api/ctp/vnctp/vnctptd/targetver.h +8 -0
  154. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.cpp +12148 -0
  155. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.h +1329 -0
  156. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj +198 -0
  157. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.filters +54 -0
  158. ctpbee_api/ctp/vnctp/vnctptd/vnctptd.vcxproj.user +4 -0
  159. ctpbee_api/ctp/vnctpmd.cp312-win_amd64.pyd +0 -0
  160. ctpbee_api/ctp/vnctptd.cp312-win_amd64.pyd +0 -0
  161. ctpbee_api/ctp_mini/__init__.py +3 -0
  162. ctpbee_api/ctp_mini/generator/generate_api_functions.py +343 -0
  163. ctpbee_api/ctp_mini/generator/generate_data_type.py +76 -0
  164. ctpbee_api/ctp_mini/generator/generate_struct.py +85 -0
  165. ctpbee_api/ctp_mini/generator/mini_constant.py +1186 -0
  166. ctpbee_api/ctp_mini/generator/mini_md_header_define.h +13 -0
  167. ctpbee_api/ctp_mini/generator/mini_md_header_function.h +4 -0
  168. ctpbee_api/ctp_mini/generator/mini_md_header_on.h +26 -0
  169. ctpbee_api/ctp_mini/generator/mini_md_header_process.h +26 -0
  170. ctpbee_api/ctp_mini/generator/mini_md_source_function.cpp +29 -0
  171. ctpbee_api/ctp_mini/generator/mini_md_source_module.cpp +17 -0
  172. ctpbee_api/ctp_mini/generator/mini_md_source_on.cpp +156 -0
  173. ctpbee_api/ctp_mini/generator/mini_md_source_process.cpp +264 -0
  174. ctpbee_api/ctp_mini/generator/mini_md_source_switch.cpp +78 -0
  175. ctpbee_api/ctp_mini/generator/mini_md_source_task.cpp +203 -0
  176. ctpbee_api/ctp_mini/generator/mini_struct.py +4599 -0
  177. ctpbee_api/ctp_mini/generator/mini_td_header_define.h +63 -0
  178. ctpbee_api/ctp_mini/generator/mini_td_header_function.h +84 -0
  179. ctpbee_api/ctp_mini/generator/mini_td_header_on.h +126 -0
  180. ctpbee_api/ctp_mini/generator/mini_td_header_process.h +126 -0
  181. ctpbee_api/ctp_mini/generator/mini_td_source_function.cpp +663 -0
  182. ctpbee_api/ctp_mini/generator/mini_td_source_module.cpp +107 -0
  183. ctpbee_api/ctp_mini/generator/mini_td_source_on.cpp +756 -0
  184. ctpbee_api/ctp_mini/generator/mini_td_source_process.cpp +2492 -0
  185. ctpbee_api/ctp_mini/generator/mini_td_source_switch.cpp +378 -0
  186. ctpbee_api/ctp_mini/generator/mini_td_source_task.cpp +1193 -0
  187. ctpbee_api/ctp_mini/generator/mini_typedef.py +755 -0
  188. ctpbee_api/ctp_mini/generator/package/vnminimd.cpp +886 -0
  189. ctpbee_api/ctp_mini/generator/package/vnminimd.h +205 -0
  190. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcMdApi.h +148 -0
  191. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcTraderApi.h +419 -0
  192. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiDataType.h +6458 -0
  193. ctpbee_api/ctp_mini/include/new/mini/ThostFtdcUserApiStruct.h +8890 -0
  194. ctpbee_api/ctp_mini/include/new/pybind11/attr.h +690 -0
  195. ctpbee_api/ctp_mini/include/new/pybind11/buffer_info.h +208 -0
  196. ctpbee_api/ctp_mini/include/new/pybind11/cast.h +1704 -0
  197. ctpbee_api/ctp_mini/include/new/pybind11/chrono.h +225 -0
  198. ctpbee_api/ctp_mini/include/new/pybind11/common.h +2 -0
  199. ctpbee_api/ctp_mini/include/new/pybind11/complex.h +74 -0
  200. ctpbee_api/ctp_mini/include/new/pybind11/detail/class.h +743 -0
  201. ctpbee_api/ctp_mini/include/new/pybind11/detail/common.h +1255 -0
  202. ctpbee_api/ctp_mini/include/new/pybind11/detail/descr.h +171 -0
  203. ctpbee_api/ctp_mini/include/new/pybind11/detail/init.h +434 -0
  204. ctpbee_api/ctp_mini/include/new/pybind11/detail/internals.h +656 -0
  205. ctpbee_api/ctp_mini/include/new/pybind11/detail/type_caster_base.h +1177 -0
  206. ctpbee_api/ctp_mini/include/new/pybind11/detail/typeid.h +65 -0
  207. ctpbee_api/ctp_mini/include/new/pybind11/eigen/common.h +9 -0
  208. ctpbee_api/ctp_mini/include/new/pybind11/eigen/matrix.h +714 -0
  209. ctpbee_api/ctp_mini/include/new/pybind11/eigen/tensor.h +516 -0
  210. ctpbee_api/ctp_mini/include/new/pybind11/eigen.h +12 -0
  211. ctpbee_api/ctp_mini/include/new/pybind11/embed.h +316 -0
  212. ctpbee_api/ctp_mini/include/new/pybind11/eval.h +156 -0
  213. ctpbee_api/ctp_mini/include/new/pybind11/functional.h +137 -0
  214. ctpbee_api/ctp_mini/include/new/pybind11/gil.h +239 -0
  215. ctpbee_api/ctp_mini/include/new/pybind11/iostream.h +265 -0
  216. ctpbee_api/ctp_mini/include/new/pybind11/numpy.h +1998 -0
  217. ctpbee_api/ctp_mini/include/new/pybind11/operators.h +202 -0
  218. ctpbee_api/ctp_mini/include/new/pybind11/options.h +92 -0
  219. ctpbee_api/ctp_mini/include/new/pybind11/pybind11.h +2890 -0
  220. ctpbee_api/ctp_mini/include/new/pybind11/pytypes.h +2557 -0
  221. ctpbee_api/ctp_mini/include/new/pybind11/stl/filesystem.h +116 -0
  222. ctpbee_api/ctp_mini/include/new/pybind11/stl.h +447 -0
  223. ctpbee_api/ctp_mini/include/new/pybind11/stl_bind.h +851 -0
  224. ctpbee_api/ctp_mini/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  225. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcMdApi.h +148 -0
  226. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcTraderApi.h +419 -0
  227. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiDataType.h +6458 -0
  228. ctpbee_api/ctp_mini/include/previous/mini/ThostFtdcUserApiStruct.h +8890 -0
  229. ctpbee_api/ctp_mini/include/previous/pybind11/attr.h +489 -0
  230. ctpbee_api/ctp_mini/include/previous/pybind11/buffer_info.h +108 -0
  231. ctpbee_api/ctp_mini/include/previous/pybind11/cast.h +2067 -0
  232. ctpbee_api/ctp_mini/include/previous/pybind11/chrono.h +162 -0
  233. ctpbee_api/ctp_mini/include/previous/pybind11/common.h +2 -0
  234. ctpbee_api/ctp_mini/include/previous/pybind11/complex.h +61 -0
  235. ctpbee_api/ctp_mini/include/previous/pybind11/detail/class.h +626 -0
  236. ctpbee_api/ctp_mini/include/previous/pybind11/detail/common.h +803 -0
  237. ctpbee_api/ctp_mini/include/previous/pybind11/detail/descr.h +185 -0
  238. ctpbee_api/ctp_mini/include/previous/pybind11/detail/init.h +335 -0
  239. ctpbee_api/ctp_mini/include/previous/pybind11/detail/internals.h +285 -0
  240. ctpbee_api/ctp_mini/include/previous/pybind11/detail/typeid.h +53 -0
  241. ctpbee_api/ctp_mini/include/previous/pybind11/eigen.h +604 -0
  242. ctpbee_api/ctp_mini/include/previous/pybind11/embed.h +194 -0
  243. ctpbee_api/ctp_mini/include/previous/pybind11/eval.h +117 -0
  244. ctpbee_api/ctp_mini/include/previous/pybind11/functional.h +85 -0
  245. ctpbee_api/ctp_mini/include/previous/pybind11/iostream.h +200 -0
  246. ctpbee_api/ctp_mini/include/previous/pybind11/numpy.h +1601 -0
  247. ctpbee_api/ctp_mini/include/previous/pybind11/operators.h +168 -0
  248. ctpbee_api/ctp_mini/include/previous/pybind11/options.h +65 -0
  249. ctpbee_api/ctp_mini/include/previous/pybind11/pybind11.h +1965 -0
  250. ctpbee_api/ctp_mini/include/previous/pybind11/pytypes.h +1332 -0
  251. ctpbee_api/ctp_mini/include/previous/pybind11/stl.h +376 -0
  252. ctpbee_api/ctp_mini/include/previous/pybind11/stl_bind.h +599 -0
  253. ctpbee_api/ctp_mini/libs/thostmduserapi.lib +0 -0
  254. ctpbee_api/ctp_mini/libs/thosttraderapi.lib +0 -0
  255. ctpbee_api/ctp_mini/libthostmduserapi.so +0 -0
  256. ctpbee_api/ctp_mini/libthosttraderapi.so +0 -0
  257. ctpbee_api/ctp_mini/mini_constant.py +1186 -0
  258. ctpbee_api/ctp_mini/thostmduserapi.dll +0 -0
  259. ctpbee_api/ctp_mini/thosttraderapi.dll +0 -0
  260. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.h +146 -0
  261. ctpbee_api/ctp_mini/vnctp_mini/vnctp_mini.sln +41 -0
  262. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/dllmain.cpp +0 -0
  263. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.cpp +0 -0
  264. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/stdafx.h +0 -0
  265. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/targetver.h +0 -0
  266. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.cpp +886 -0
  267. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.h +203 -0
  268. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj +183 -0
  269. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.filters +54 -0
  270. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minimd/vnctp_minimd.vcxproj.user +4 -0
  271. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/dllmain.cpp +0 -0
  272. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.cpp +0 -0
  273. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/stdafx.h +0 -0
  274. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/targetver.h +0 -0
  275. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.cpp +5716 -0
  276. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.h +680 -0
  277. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj +180 -0
  278. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.filters +54 -0
  279. ctpbee_api/ctp_mini/vnctp_mini/vnctp_minitd/vnctp_minitd.vcxproj.user +4 -0
  280. ctpbee_api/ctp_mini/vnctp_minimd.cp312-win_amd64.pyd +0 -0
  281. ctpbee_api/ctp_mini/vnctp_minitd.cp312-win_amd64.pyd +0 -0
  282. ctpbee_api/ctp_mini/vnctp_minitd.lib +0 -0
  283. ctpbee_api/rohon/RohonBaseV64.dll +0 -0
  284. ctpbee_api/rohon/WinDataCollect.dll +0 -0
  285. ctpbee_api/rohon/__init__.py +3 -0
  286. ctpbee_api/rohon/generator/generate_api_functions.py +348 -0
  287. ctpbee_api/rohon/generator/generate_data_type.py +76 -0
  288. ctpbee_api/rohon/generator/generate_struct.py +84 -0
  289. ctpbee_api/rohon/generator/rohon_constant.py +1242 -0
  290. ctpbee_api/rohon/generator/rohon_md_header_define.h +13 -0
  291. ctpbee_api/rohon/generator/rohon_md_header_function.h +6 -0
  292. ctpbee_api/rohon/generator/rohon_md_header_on.h +26 -0
  293. ctpbee_api/rohon/generator/rohon_md_header_process.h +26 -0
  294. ctpbee_api/rohon/generator/rohon_md_source_function.cpp +40 -0
  295. ctpbee_api/rohon/generator/rohon_md_source_module.cpp +18 -0
  296. ctpbee_api/rohon/generator/rohon_md_source_on.cpp +156 -0
  297. ctpbee_api/rohon/generator/rohon_md_source_process.cpp +271 -0
  298. ctpbee_api/rohon/generator/rohon_md_source_switch.cpp +78 -0
  299. ctpbee_api/rohon/generator/rohon_md_source_task.cpp +211 -0
  300. ctpbee_api/rohon/generator/rohon_struct.py +4958 -0
  301. ctpbee_api/rohon/generator/rohon_td_header_define.h +125 -0
  302. ctpbee_api/rohon/generator/rohon_td_header_function.h +164 -0
  303. ctpbee_api/rohon/generator/rohon_td_header_on.h +250 -0
  304. ctpbee_api/rohon/generator/rohon_td_header_process.h +250 -0
  305. ctpbee_api/rohon/generator/rohon_td_source_function.cpp +1338 -0
  306. ctpbee_api/rohon/generator/rohon_td_source_module.cpp +209 -0
  307. ctpbee_api/rohon/generator/rohon_td_source_on.cpp +1500 -0
  308. ctpbee_api/rohon/generator/rohon_td_source_process.cpp +5125 -0
  309. ctpbee_api/rohon/generator/rohon_td_source_switch.cpp +750 -0
  310. ctpbee_api/rohon/generator/rohon_td_source_task.cpp +2339 -0
  311. ctpbee_api/rohon/generator/rohon_typedef.py +781 -0
  312. ctpbee_api/rohon/include/new/pybind11/attr.h +690 -0
  313. ctpbee_api/rohon/include/new/pybind11/buffer_info.h +208 -0
  314. ctpbee_api/rohon/include/new/pybind11/cast.h +1704 -0
  315. ctpbee_api/rohon/include/new/pybind11/chrono.h +225 -0
  316. ctpbee_api/rohon/include/new/pybind11/common.h +2 -0
  317. ctpbee_api/rohon/include/new/pybind11/complex.h +74 -0
  318. ctpbee_api/rohon/include/new/pybind11/detail/class.h +743 -0
  319. ctpbee_api/rohon/include/new/pybind11/detail/common.h +1255 -0
  320. ctpbee_api/rohon/include/new/pybind11/detail/descr.h +171 -0
  321. ctpbee_api/rohon/include/new/pybind11/detail/init.h +434 -0
  322. ctpbee_api/rohon/include/new/pybind11/detail/internals.h +656 -0
  323. ctpbee_api/rohon/include/new/pybind11/detail/type_caster_base.h +1177 -0
  324. ctpbee_api/rohon/include/new/pybind11/detail/typeid.h +65 -0
  325. ctpbee_api/rohon/include/new/pybind11/eigen/common.h +9 -0
  326. ctpbee_api/rohon/include/new/pybind11/eigen/matrix.h +714 -0
  327. ctpbee_api/rohon/include/new/pybind11/eigen/tensor.h +516 -0
  328. ctpbee_api/rohon/include/new/pybind11/eigen.h +12 -0
  329. ctpbee_api/rohon/include/new/pybind11/embed.h +316 -0
  330. ctpbee_api/rohon/include/new/pybind11/eval.h +156 -0
  331. ctpbee_api/rohon/include/new/pybind11/functional.h +137 -0
  332. ctpbee_api/rohon/include/new/pybind11/gil.h +239 -0
  333. ctpbee_api/rohon/include/new/pybind11/iostream.h +265 -0
  334. ctpbee_api/rohon/include/new/pybind11/numpy.h +1998 -0
  335. ctpbee_api/rohon/include/new/pybind11/operators.h +202 -0
  336. ctpbee_api/rohon/include/new/pybind11/options.h +92 -0
  337. ctpbee_api/rohon/include/new/pybind11/pybind11.h +2890 -0
  338. ctpbee_api/rohon/include/new/pybind11/pytypes.h +2557 -0
  339. ctpbee_api/rohon/include/new/pybind11/stl/filesystem.h +116 -0
  340. ctpbee_api/rohon/include/new/pybind11/stl.h +447 -0
  341. ctpbee_api/rohon/include/new/pybind11/stl_bind.h +851 -0
  342. ctpbee_api/rohon/include/new/pybind11/type_caster_pyobject_ptr.h +61 -0
  343. ctpbee_api/rohon/include/new/rohon/ThostFtdcMdApi.h +168 -0
  344. ctpbee_api/rohon/include/new/rohon/ThostFtdcTraderApi.h +739 -0
  345. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiDataType.h +6708 -0
  346. ctpbee_api/rohon/include/new/rohon/ThostFtdcUserApiStruct.h +9580 -0
  347. ctpbee_api/rohon/include/previous/pybind11/attr.h +489 -0
  348. ctpbee_api/rohon/include/previous/pybind11/buffer_info.h +108 -0
  349. ctpbee_api/rohon/include/previous/pybind11/cast.h +2067 -0
  350. ctpbee_api/rohon/include/previous/pybind11/chrono.h +162 -0
  351. ctpbee_api/rohon/include/previous/pybind11/common.h +2 -0
  352. ctpbee_api/rohon/include/previous/pybind11/complex.h +61 -0
  353. ctpbee_api/rohon/include/previous/pybind11/detail/class.h +626 -0
  354. ctpbee_api/rohon/include/previous/pybind11/detail/common.h +803 -0
  355. ctpbee_api/rohon/include/previous/pybind11/detail/descr.h +185 -0
  356. ctpbee_api/rohon/include/previous/pybind11/detail/init.h +335 -0
  357. ctpbee_api/rohon/include/previous/pybind11/detail/internals.h +285 -0
  358. ctpbee_api/rohon/include/previous/pybind11/detail/typeid.h +53 -0
  359. ctpbee_api/rohon/include/previous/pybind11/eigen.h +604 -0
  360. ctpbee_api/rohon/include/previous/pybind11/embed.h +194 -0
  361. ctpbee_api/rohon/include/previous/pybind11/eval.h +117 -0
  362. ctpbee_api/rohon/include/previous/pybind11/functional.h +85 -0
  363. ctpbee_api/rohon/include/previous/pybind11/iostream.h +200 -0
  364. ctpbee_api/rohon/include/previous/pybind11/numpy.h +1601 -0
  365. ctpbee_api/rohon/include/previous/pybind11/operators.h +168 -0
  366. ctpbee_api/rohon/include/previous/pybind11/options.h +65 -0
  367. ctpbee_api/rohon/include/previous/pybind11/pybind11.h +1965 -0
  368. ctpbee_api/rohon/include/previous/pybind11/pytypes.h +1332 -0
  369. ctpbee_api/rohon/include/previous/pybind11/stl.h +376 -0
  370. ctpbee_api/rohon/include/previous/pybind11/stl_bind.h +599 -0
  371. ctpbee_api/rohon/include/previous/rohon/ThostFtdcMdApi.h +168 -0
  372. ctpbee_api/rohon/include/previous/rohon/ThostFtdcTraderApi.h +739 -0
  373. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiDataType.h +6708 -0
  374. ctpbee_api/rohon/include/previous/rohon/ThostFtdcUserApiStruct.h +9580 -0
  375. ctpbee_api/rohon/libLinuxDataCollect.so +0 -0
  376. ctpbee_api/rohon/librohonbase.so +0 -0
  377. ctpbee_api/rohon/librohonbase.so.1.1 +0 -0
  378. ctpbee_api/rohon/librohonbase.so.1.1.0.1 +0 -0
  379. ctpbee_api/rohon/libs/thostmduserapi_se.lib +0 -0
  380. ctpbee_api/rohon/libs/thosttraderapi_se.lib +0 -0
  381. ctpbee_api/rohon/libthostmduserapi_se.so +0 -0
  382. ctpbee_api/rohon/libthosttraderapi_se.so +0 -0
  383. ctpbee_api/rohon/rohon_constant.py +1242 -0
  384. ctpbee_api/rohon/thostmduserapi_se.dll +0 -0
  385. ctpbee_api/rohon/thosttraderapi_se.dll +0 -0
  386. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/.suo +0 -0
  387. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Browse.VC.db +0 -0
  388. ctpbee_api/rohon/vnrohon/.vs/vnrohon/v15/Solution.VC.db +0 -0
  389. ctpbee_api/rohon/vnrohon/vnrohon.h +147 -0
  390. ctpbee_api/rohon/vnrohon/vnrohon.sln +41 -0
  391. ctpbee_api/rohon/vnrohon/vnrohonmd/dllmain.cpp +19 -0
  392. ctpbee_api/rohon/vnrohon/vnrohonmd/framework.h +5 -0
  393. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.cpp +5 -0
  394. ctpbee_api/rohon/vnrohon/vnrohonmd/pch.h +13 -0
  395. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.cpp +931 -0
  396. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.h +207 -0
  397. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj +188 -0
  398. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.filters +54 -0
  399. ctpbee_api/rohon/vnrohon/vnrohonmd/vnrohonmd.vcxproj.user +4 -0
  400. ctpbee_api/rohon/vnrohon/vnrohontd/dllmain.cpp +19 -0
  401. ctpbee_api/rohon/vnrohon/vnrohontd/framework.h +5 -0
  402. ctpbee_api/rohon/vnrohon/vnrohontd/pch.cpp +5 -0
  403. ctpbee_api/rohon/vnrohon/vnrohontd/pch.h +13 -0
  404. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.cpp +11395 -0
  405. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.h +1259 -0
  406. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj +188 -0
  407. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.filters +54 -0
  408. ctpbee_api/rohon/vnrohon/vnrohontd/vnrohontd.vcxproj.user +4 -0
  409. ctpbee_api/rohon/vnrohonmd.cp312-win_amd64.pyd +0 -0
  410. ctpbee_api/rohon/vnrohontd.cp312-win_amd64.pyd +0 -0
  411. ctpbee_opt_api-0.1.0.dist-info/METADATA +46 -0
  412. ctpbee_opt_api-0.1.0.dist-info/RECORD +414 -0
  413. ctpbee_opt_api-0.1.0.dist-info/WHEEL +5 -0
  414. ctpbee_opt_api-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1255 @@
1
+ /*
2
+ pybind11/detail/common.h -- Basic macros
3
+
4
+ Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>
5
+
6
+ All rights reserved. Use of this source code is governed by a
7
+ BSD-style license that can be found in the LICENSE file.
8
+ */
9
+
10
+ #pragma once
11
+
12
+ #define PYBIND11_VERSION_MAJOR 2
13
+ #define PYBIND11_VERSION_MINOR 11
14
+ #define PYBIND11_VERSION_PATCH 1
15
+
16
+ // Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
17
+ // Additional convention: 0xD = dev
18
+ #define PYBIND11_VERSION_HEX 0x020B0100
19
+
20
+ // Define some generic pybind11 helper macros for warning management.
21
+ //
22
+ // Note that compiler-specific push/pop pairs are baked into the
23
+ // PYBIND11_NAMESPACE_BEGIN/PYBIND11_NAMESPACE_END pair of macros. Therefore manual
24
+ // PYBIND11_WARNING_PUSH/PYBIND11_WARNING_POP are usually only needed in `#include` sections.
25
+ //
26
+ // If you find you need to suppress a warning, please try to make the suppression as local as
27
+ // possible using these macros. Please also be sure to push/pop with the pybind11 macros. Please
28
+ // only use compiler specifics if you need to check specific versions, e.g. Apple Clang vs. vanilla
29
+ // Clang.
30
+ #if defined(_MSC_VER)
31
+ # define PYBIND11_COMPILER_MSVC
32
+ # define PYBIND11_PRAGMA(...) __pragma(__VA_ARGS__)
33
+ # define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning(push))
34
+ # define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning(pop))
35
+ #elif defined(__INTEL_COMPILER)
36
+ # define PYBIND11_COMPILER_INTEL
37
+ # define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
38
+ # define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(warning push)
39
+ # define PYBIND11_WARNING_POP PYBIND11_PRAGMA(warning pop)
40
+ #elif defined(__clang__)
41
+ # define PYBIND11_COMPILER_CLANG
42
+ # define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
43
+ # define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(clang diagnostic push)
44
+ # define PYBIND11_WARNING_POP PYBIND11_PRAGMA(clang diagnostic push)
45
+ #elif defined(__GNUC__)
46
+ # define PYBIND11_COMPILER_GCC
47
+ # define PYBIND11_PRAGMA(...) _Pragma(#__VA_ARGS__)
48
+ # define PYBIND11_WARNING_PUSH PYBIND11_PRAGMA(GCC diagnostic push)
49
+ # define PYBIND11_WARNING_POP PYBIND11_PRAGMA(GCC diagnostic pop)
50
+ #endif
51
+
52
+ #ifdef PYBIND11_COMPILER_MSVC
53
+ # define PYBIND11_WARNING_DISABLE_MSVC(name) PYBIND11_PRAGMA(warning(disable : name))
54
+ #else
55
+ # define PYBIND11_WARNING_DISABLE_MSVC(name)
56
+ #endif
57
+
58
+ #ifdef PYBIND11_COMPILER_CLANG
59
+ # define PYBIND11_WARNING_DISABLE_CLANG(name) PYBIND11_PRAGMA(clang diagnostic ignored name)
60
+ #else
61
+ # define PYBIND11_WARNING_DISABLE_CLANG(name)
62
+ #endif
63
+
64
+ #ifdef PYBIND11_COMPILER_GCC
65
+ # define PYBIND11_WARNING_DISABLE_GCC(name) PYBIND11_PRAGMA(GCC diagnostic ignored name)
66
+ #else
67
+ # define PYBIND11_WARNING_DISABLE_GCC(name)
68
+ #endif
69
+
70
+ #ifdef PYBIND11_COMPILER_INTEL
71
+ # define PYBIND11_WARNING_DISABLE_INTEL(name) PYBIND11_PRAGMA(warning disable name)
72
+ #else
73
+ # define PYBIND11_WARNING_DISABLE_INTEL(name)
74
+ #endif
75
+
76
+ #define PYBIND11_NAMESPACE_BEGIN(name) \
77
+ namespace name { \
78
+ PYBIND11_WARNING_PUSH
79
+
80
+ #define PYBIND11_NAMESPACE_END(name) \
81
+ PYBIND11_WARNING_POP \
82
+ }
83
+
84
+ // Robust support for some features and loading modules compiled against different pybind versions
85
+ // requires forcing hidden visibility on pybind code, so we enforce this by setting the attribute
86
+ // on the main `pybind11` namespace.
87
+ #if !defined(PYBIND11_NAMESPACE)
88
+ # ifdef __GNUG__
89
+ # define PYBIND11_NAMESPACE pybind11 __attribute__((visibility("hidden")))
90
+ # else
91
+ # define PYBIND11_NAMESPACE pybind11
92
+ # endif
93
+ #endif
94
+
95
+ #if !(defined(_MSC_VER) && __cplusplus == 199711L)
96
+ # if __cplusplus >= 201402L
97
+ # define PYBIND11_CPP14
98
+ # if __cplusplus >= 201703L
99
+ # define PYBIND11_CPP17
100
+ # if __cplusplus >= 202002L
101
+ # define PYBIND11_CPP20
102
+ // Please update tests/pybind11_tests.cpp `cpp_std()` when adding a macro here.
103
+ # endif
104
+ # endif
105
+ # endif
106
+ #elif defined(_MSC_VER) && __cplusplus == 199711L
107
+ // MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully
108
+ // implemented). Unless you use the /Zc:__cplusplus flag on Visual Studio 2017 15.7 Preview 3
109
+ // or newer.
110
+ # if _MSVC_LANG >= 201402L
111
+ # define PYBIND11_CPP14
112
+ # if _MSVC_LANG > 201402L
113
+ # define PYBIND11_CPP17
114
+ # if _MSVC_LANG >= 202002L
115
+ # define PYBIND11_CPP20
116
+ # endif
117
+ # endif
118
+ # endif
119
+ #endif
120
+
121
+ // Compiler version assertions
122
+ #if defined(__INTEL_COMPILER)
123
+ # if __INTEL_COMPILER < 1800
124
+ # error pybind11 requires Intel C++ compiler v18 or newer
125
+ # elif __INTEL_COMPILER < 1900 && defined(PYBIND11_CPP14)
126
+ # error pybind11 supports only C++11 with Intel C++ compiler v18. Use v19 or newer for C++14.
127
+ # endif
128
+ /* The following pragma cannot be pop'ed:
129
+ https://community.intel.com/t5/Intel-C-Compiler/Inline-and-no-inline-warning/td-p/1216764 */
130
+ # pragma warning disable 2196 // warning #2196: routine is both "inline" and "noinline"
131
+ #elif defined(__clang__) && !defined(__apple_build_version__)
132
+ # if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 3)
133
+ # error pybind11 requires clang 3.3 or newer
134
+ # endif
135
+ #elif defined(__clang__)
136
+ // Apple changes clang version macros to its Xcode version; the first Xcode release based on
137
+ // (upstream) clang 3.3 was Xcode 5:
138
+ # if __clang_major__ < 5
139
+ # error pybind11 requires Xcode/clang 5.0 or newer
140
+ # endif
141
+ #elif defined(__GNUG__)
142
+ # if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
143
+ # error pybind11 requires gcc 4.8 or newer
144
+ # endif
145
+ #elif defined(_MSC_VER)
146
+ # if _MSC_VER < 1910
147
+ # error pybind11 2.10+ requires MSVC 2017 or newer
148
+ # endif
149
+ #endif
150
+
151
+ #if !defined(PYBIND11_EXPORT)
152
+ # if defined(WIN32) || defined(_WIN32)
153
+ # define PYBIND11_EXPORT __declspec(dllexport)
154
+ # else
155
+ # define PYBIND11_EXPORT __attribute__((visibility("default")))
156
+ # endif
157
+ #endif
158
+
159
+ #if !defined(PYBIND11_EXPORT_EXCEPTION)
160
+ # if defined(__apple_build_version__)
161
+ # define PYBIND11_EXPORT_EXCEPTION PYBIND11_EXPORT
162
+ # else
163
+ # define PYBIND11_EXPORT_EXCEPTION
164
+ # endif
165
+ #endif
166
+
167
+ // For CUDA, GCC7, GCC8:
168
+ // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
169
+ // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`.
170
+ // However, the measured shared-library size saving when using noinline are only
171
+ // 1.7% for CUDA, -0.2% for GCC7, and 0.0% for GCC8 (using -DCMAKE_BUILD_TYPE=MinSizeRel,
172
+ // the default under pybind11/tests).
173
+ #if !defined(PYBIND11_NOINLINE_FORCED) \
174
+ && (defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)))
175
+ # define PYBIND11_NOINLINE_DISABLED
176
+ #endif
177
+
178
+ // The PYBIND11_NOINLINE macro is for function DEFINITIONS.
179
+ // In contrast, FORWARD DECLARATIONS should never use this macro:
180
+ // https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
181
+ #if defined(PYBIND11_NOINLINE_DISABLED) // Option for maximum portability and experimentation.
182
+ # define PYBIND11_NOINLINE inline
183
+ #elif defined(_MSC_VER)
184
+ # define PYBIND11_NOINLINE __declspec(noinline) inline
185
+ #else
186
+ # define PYBIND11_NOINLINE __attribute__((noinline)) inline
187
+ #endif
188
+
189
+ #if defined(__MINGW32__)
190
+ // For unknown reasons all PYBIND11_DEPRECATED member trigger a warning when declared
191
+ // whether it is used or not
192
+ # define PYBIND11_DEPRECATED(reason)
193
+ #elif defined(PYBIND11_CPP14)
194
+ # define PYBIND11_DEPRECATED(reason) [[deprecated(reason)]]
195
+ #else
196
+ # define PYBIND11_DEPRECATED(reason) __attribute__((deprecated(reason)))
197
+ #endif
198
+
199
+ #if defined(PYBIND11_CPP17)
200
+ # define PYBIND11_MAYBE_UNUSED [[maybe_unused]]
201
+ #elif defined(_MSC_VER) && !defined(__clang__)
202
+ # define PYBIND11_MAYBE_UNUSED
203
+ #else
204
+ # define PYBIND11_MAYBE_UNUSED __attribute__((__unused__))
205
+ #endif
206
+
207
+ /* Don't let Python.h #define (v)snprintf as macro because they are implemented
208
+ properly in Visual Studio since 2015. */
209
+ #if defined(_MSC_VER)
210
+ # define HAVE_SNPRINTF 1
211
+ #endif
212
+
213
+ /// Include Python header, disable linking to pythonX_d.lib on Windows in debug mode
214
+ #if defined(_MSC_VER)
215
+ PYBIND11_WARNING_PUSH
216
+ PYBIND11_WARNING_DISABLE_MSVC(4505)
217
+ // C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed (PyPy only)
218
+ # if defined(_DEBUG) && !defined(Py_DEBUG)
219
+ // Workaround for a VS 2022 issue.
220
+ // NOTE: This workaround knowingly violates the Python.h include order requirement:
221
+ // https://docs.python.org/3/c-api/intro.html#include-files
222
+ // See https://github.com/pybind/pybind11/pull/3497 for full context.
223
+ # include <yvals.h>
224
+ # if _MSVC_STL_VERSION >= 143
225
+ # include <crtdefs.h>
226
+ # endif
227
+ # define PYBIND11_DEBUG_MARKER
228
+ # undef _DEBUG
229
+ # endif
230
+ #endif
231
+
232
+ // https://en.cppreference.com/w/c/chrono/localtime
233
+ #if defined(__STDC_LIB_EXT1__) && !defined(__STDC_WANT_LIB_EXT1__)
234
+ # define __STDC_WANT_LIB_EXT1__
235
+ #endif
236
+
237
+ #ifdef __has_include
238
+ // std::optional (but including it in c++14 mode isn't allowed)
239
+ # if defined(PYBIND11_CPP17) && __has_include(<optional>)
240
+ # define PYBIND11_HAS_OPTIONAL 1
241
+ # endif
242
+ // std::experimental::optional (but not allowed in c++11 mode)
243
+ # if defined(PYBIND11_CPP14) && (__has_include(<experimental/optional>) && \
244
+ !__has_include(<optional>))
245
+ # define PYBIND11_HAS_EXP_OPTIONAL 1
246
+ # endif
247
+ // std::variant
248
+ # if defined(PYBIND11_CPP17) && __has_include(<variant>)
249
+ # define PYBIND11_HAS_VARIANT 1
250
+ # endif
251
+ #elif defined(_MSC_VER) && defined(PYBIND11_CPP17)
252
+ # define PYBIND11_HAS_OPTIONAL 1
253
+ # define PYBIND11_HAS_VARIANT 1
254
+ #endif
255
+
256
+ #if defined(PYBIND11_CPP17)
257
+ # if defined(__has_include)
258
+ # if __has_include(<string_view>)
259
+ # define PYBIND11_HAS_STRING_VIEW
260
+ # endif
261
+ # elif defined(_MSC_VER)
262
+ # define PYBIND11_HAS_STRING_VIEW
263
+ # endif
264
+ #endif
265
+
266
+ #include <Python.h>
267
+ // Reminder: WITH_THREAD is always defined if PY_VERSION_HEX >= 0x03070000
268
+ #if PY_VERSION_HEX < 0x03060000
269
+ # error "PYTHON < 3.6 IS UNSUPPORTED. pybind11 v2.9 was the last to support Python 2 and 3.5."
270
+ #endif
271
+ #include <frameobject.h>
272
+ #include <pythread.h>
273
+
274
+ /* Python #defines overrides on all sorts of core functions, which
275
+ tends to weak havok in C++ codebases that expect these to work
276
+ like regular functions (potentially with several overloads) */
277
+ #if defined(isalnum)
278
+ # undef isalnum
279
+ # undef isalpha
280
+ # undef islower
281
+ # undef isspace
282
+ # undef isupper
283
+ # undef tolower
284
+ # undef toupper
285
+ #endif
286
+
287
+ #if defined(copysign)
288
+ # undef copysign
289
+ #endif
290
+
291
+ #if defined(PYPY_VERSION) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT)
292
+ # define PYBIND11_SIMPLE_GIL_MANAGEMENT
293
+ #endif
294
+
295
+ #if defined(_MSC_VER)
296
+ # if defined(PYBIND11_DEBUG_MARKER)
297
+ # define _DEBUG
298
+ # undef PYBIND11_DEBUG_MARKER
299
+ # endif
300
+ PYBIND11_WARNING_POP
301
+ #endif
302
+
303
+ #include <cstddef>
304
+ #include <cstring>
305
+ #include <exception>
306
+ #include <forward_list>
307
+ #include <memory>
308
+ #include <stdexcept>
309
+ #include <string>
310
+ #include <type_traits>
311
+ #include <typeindex>
312
+ #include <unordered_map>
313
+ #include <unordered_set>
314
+ #include <vector>
315
+ #if defined(__has_include)
316
+ # if __has_include(<version>)
317
+ # include <version>
318
+ # endif
319
+ #endif
320
+
321
+ // Must be after including <version> or one of the other headers specified by the standard
322
+ #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
323
+ # define PYBIND11_HAS_U8STRING
324
+ #endif
325
+
326
+ // See description of PR #4246:
327
+ #if !defined(PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREF) && !defined(NDEBUG) \
328
+ && !defined(PYPY_VERSION) && !defined(PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF)
329
+ # define PYBIND11_ASSERT_GIL_HELD_INCREF_DECREF
330
+ #endif
331
+
332
+ // #define PYBIND11_STR_LEGACY_PERMISSIVE
333
+ // If DEFINED, pybind11::str can hold PyUnicodeObject or PyBytesObject
334
+ // (probably surprising and never documented, but this was the
335
+ // legacy behavior until and including v2.6.x). As a side-effect,
336
+ // pybind11::isinstance<str>() is true for both pybind11::str and
337
+ // pybind11::bytes.
338
+ // If UNDEFINED, pybind11::str can only hold PyUnicodeObject, and
339
+ // pybind11::isinstance<str>() is true only for pybind11::str.
340
+ // However, for Python 2 only (!), the pybind11::str caster
341
+ // implicitly decoded bytes to PyUnicodeObject. This was to ease
342
+ // the transition from the legacy behavior to the non-permissive
343
+ // behavior.
344
+
345
+ /// Compatibility macros for Python 2 / Python 3 versions TODO: remove
346
+ #define PYBIND11_INSTANCE_METHOD_NEW(ptr, class_) PyInstanceMethod_New(ptr)
347
+ #define PYBIND11_INSTANCE_METHOD_CHECK PyInstanceMethod_Check
348
+ #define PYBIND11_INSTANCE_METHOD_GET_FUNCTION PyInstanceMethod_GET_FUNCTION
349
+ #define PYBIND11_BYTES_CHECK PyBytes_Check
350
+ #define PYBIND11_BYTES_FROM_STRING PyBytes_FromString
351
+ #define PYBIND11_BYTES_FROM_STRING_AND_SIZE PyBytes_FromStringAndSize
352
+ #define PYBIND11_BYTES_AS_STRING_AND_SIZE PyBytes_AsStringAndSize
353
+ #define PYBIND11_BYTES_AS_STRING PyBytes_AsString
354
+ #define PYBIND11_BYTES_SIZE PyBytes_Size
355
+ #define PYBIND11_LONG_CHECK(o) PyLong_Check(o)
356
+ #define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o)
357
+ #define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) (o))
358
+ #define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) (o))
359
+ #define PYBIND11_BYTES_NAME "bytes"
360
+ #define PYBIND11_STRING_NAME "str"
361
+ #define PYBIND11_SLICE_OBJECT PyObject
362
+ #define PYBIND11_FROM_STRING PyUnicode_FromString
363
+ #define PYBIND11_STR_TYPE ::pybind11::str
364
+ #define PYBIND11_BOOL_ATTR "__bool__"
365
+ #define PYBIND11_NB_BOOL(ptr) ((ptr)->nb_bool)
366
+ #define PYBIND11_BUILTINS_MODULE "builtins"
367
+ // Providing a separate declaration to make Clang's -Wmissing-prototypes happy.
368
+ // See comment for PYBIND11_MODULE below for why this is marked "maybe unused".
369
+ #define PYBIND11_PLUGIN_IMPL(name) \
370
+ extern "C" PYBIND11_MAYBE_UNUSED PYBIND11_EXPORT PyObject *PyInit_##name(); \
371
+ extern "C" PYBIND11_EXPORT PyObject *PyInit_##name()
372
+
373
+ #define PYBIND11_TRY_NEXT_OVERLOAD ((PyObject *) 1) // special failure return code
374
+ #define PYBIND11_STRINGIFY(x) #x
375
+ #define PYBIND11_TOSTRING(x) PYBIND11_STRINGIFY(x)
376
+ #define PYBIND11_CONCAT(first, second) first##second
377
+ #define PYBIND11_ENSURE_INTERNALS_READY pybind11::detail::get_internals();
378
+
379
+ #define PYBIND11_CHECK_PYTHON_VERSION \
380
+ { \
381
+ const char *compiled_ver \
382
+ = PYBIND11_TOSTRING(PY_MAJOR_VERSION) "." PYBIND11_TOSTRING(PY_MINOR_VERSION); \
383
+ const char *runtime_ver = Py_GetVersion(); \
384
+ size_t len = std::strlen(compiled_ver); \
385
+ if (std::strncmp(runtime_ver, compiled_ver, len) != 0 \
386
+ || (runtime_ver[len] >= '0' && runtime_ver[len] <= '9')) { \
387
+ PyErr_Format(PyExc_ImportError, \
388
+ "Python version mismatch: module was compiled for Python %s, " \
389
+ "but the interpreter version is incompatible: %s.", \
390
+ compiled_ver, \
391
+ runtime_ver); \
392
+ return nullptr; \
393
+ } \
394
+ }
395
+
396
+ #define PYBIND11_CATCH_INIT_EXCEPTIONS \
397
+ catch (pybind11::error_already_set & e) { \
398
+ pybind11::raise_from(e, PyExc_ImportError, "initialization failed"); \
399
+ return nullptr; \
400
+ } \
401
+ catch (const std::exception &e) { \
402
+ PyErr_SetString(PyExc_ImportError, e.what()); \
403
+ return nullptr; \
404
+ }
405
+
406
+ /** \rst
407
+ ***Deprecated in favor of PYBIND11_MODULE***
408
+
409
+ This macro creates the entry point that will be invoked when the Python interpreter
410
+ imports a plugin library. Please create a `module_` in the function body and return
411
+ the pointer to its underlying Python object at the end.
412
+
413
+ .. code-block:: cpp
414
+
415
+ PYBIND11_PLUGIN(example) {
416
+ pybind11::module_ m("example", "pybind11 example plugin");
417
+ /// Set up bindings here
418
+ return m.ptr();
419
+ }
420
+ \endrst */
421
+ #define PYBIND11_PLUGIN(name) \
422
+ PYBIND11_DEPRECATED("PYBIND11_PLUGIN is deprecated, use PYBIND11_MODULE") \
423
+ static PyObject *pybind11_init(); \
424
+ PYBIND11_PLUGIN_IMPL(name) { \
425
+ PYBIND11_CHECK_PYTHON_VERSION \
426
+ PYBIND11_ENSURE_INTERNALS_READY \
427
+ try { \
428
+ return pybind11_init(); \
429
+ } \
430
+ PYBIND11_CATCH_INIT_EXCEPTIONS \
431
+ } \
432
+ PyObject *pybind11_init()
433
+
434
+ /** \rst
435
+ This macro creates the entry point that will be invoked when the Python interpreter
436
+ imports an extension module. The module name is given as the first argument and it
437
+ should not be in quotes. The second macro argument defines a variable of type
438
+ `py::module_` which can be used to initialize the module.
439
+
440
+ The entry point is marked as "maybe unused" to aid dead-code detection analysis:
441
+ since the entry point is typically only looked up at runtime and not referenced
442
+ during translation, it would otherwise appear as unused ("dead") code.
443
+
444
+ .. code-block:: cpp
445
+
446
+ PYBIND11_MODULE(example, m) {
447
+ m.doc() = "pybind11 example module";
448
+
449
+ // Add bindings here
450
+ m.def("foo", []() {
451
+ return "Hello, World!";
452
+ });
453
+ }
454
+ \endrst */
455
+ #define PYBIND11_MODULE(name, variable) \
456
+ static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \
457
+ PYBIND11_MAYBE_UNUSED; \
458
+ PYBIND11_MAYBE_UNUSED \
459
+ static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
460
+ PYBIND11_PLUGIN_IMPL(name) { \
461
+ PYBIND11_CHECK_PYTHON_VERSION \
462
+ PYBIND11_ENSURE_INTERNALS_READY \
463
+ auto m = ::pybind11::module_::create_extension_module( \
464
+ PYBIND11_TOSTRING(name), nullptr, &PYBIND11_CONCAT(pybind11_module_def_, name)); \
465
+ try { \
466
+ PYBIND11_CONCAT(pybind11_init_, name)(m); \
467
+ return m.ptr(); \
468
+ } \
469
+ PYBIND11_CATCH_INIT_EXCEPTIONS \
470
+ } \
471
+ void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ & (variable))
472
+
473
+ PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
474
+
475
+ using ssize_t = Py_ssize_t;
476
+ using size_t = std::size_t;
477
+
478
+ template <typename IntType>
479
+ inline ssize_t ssize_t_cast(const IntType &val) {
480
+ static_assert(sizeof(IntType) <= sizeof(ssize_t), "Implicit narrowing is not permitted.");
481
+ return static_cast<ssize_t>(val);
482
+ }
483
+
484
+ /// Approach used to cast a previously unknown C++ instance into a Python object
485
+ enum class return_value_policy : uint8_t {
486
+ /** This is the default return value policy, which falls back to the policy
487
+ return_value_policy::take_ownership when the return value is a pointer.
488
+ Otherwise, it uses return_value::move or return_value::copy for rvalue
489
+ and lvalue references, respectively. See below for a description of what
490
+ all of these different policies do. */
491
+ automatic = 0,
492
+
493
+ /** As above, but use policy return_value_policy::reference when the return
494
+ value is a pointer. This is the default conversion policy for function
495
+ arguments when calling Python functions manually from C++ code (i.e. via
496
+ handle::operator()). You probably won't need to use this. */
497
+ automatic_reference,
498
+
499
+ /** Reference an existing object (i.e. do not create a new copy) and take
500
+ ownership. Python will call the destructor and delete operator when the
501
+ object's reference count reaches zero. Undefined behavior ensues when
502
+ the C++ side does the same.. */
503
+ take_ownership,
504
+
505
+ /** Create a new copy of the returned object, which will be owned by
506
+ Python. This policy is comparably safe because the lifetimes of the two
507
+ instances are decoupled. */
508
+ copy,
509
+
510
+ /** Use std::move to move the return value contents into a new instance
511
+ that will be owned by Python. This policy is comparably safe because the
512
+ lifetimes of the two instances (move source and destination) are
513
+ decoupled. */
514
+ move,
515
+
516
+ /** Reference an existing object, but do not take ownership. The C++ side
517
+ is responsible for managing the object's lifetime and deallocating it
518
+ when it is no longer used. Warning: undefined behavior will ensue when
519
+ the C++ side deletes an object that is still referenced and used by
520
+ Python. */
521
+ reference,
522
+
523
+ /** This policy only applies to methods and properties. It references the
524
+ object without taking ownership similar to the above
525
+ return_value_policy::reference policy. In contrast to that policy, the
526
+ function or property's implicit this argument (called the parent) is
527
+ considered to be the the owner of the return value (the child).
528
+ pybind11 then couples the lifetime of the parent to the child via a
529
+ reference relationship that ensures that the parent cannot be garbage
530
+ collected while Python is still using the child. More advanced
531
+ variations of this scheme are also possible using combinations of
532
+ return_value_policy::reference and the keep_alive call policy */
533
+ reference_internal
534
+ };
535
+
536
+ PYBIND11_NAMESPACE_BEGIN(detail)
537
+
538
+ inline static constexpr int log2(size_t n, int k = 0) {
539
+ return (n <= 1) ? k : log2(n >> 1, k + 1);
540
+ }
541
+
542
+ // Returns the size as a multiple of sizeof(void *), rounded up.
543
+ inline static constexpr size_t size_in_ptrs(size_t s) {
544
+ return 1 + ((s - 1) >> log2(sizeof(void *)));
545
+ }
546
+
547
+ /**
548
+ * The space to allocate for simple layout instance holders (see below) in multiple of the size of
549
+ * a pointer (e.g. 2 means 16 bytes on 64-bit architectures). The default is the minimum required
550
+ * to holder either a std::unique_ptr or std::shared_ptr (which is almost always
551
+ * sizeof(std::shared_ptr<T>)).
552
+ */
553
+ constexpr size_t instance_simple_holder_in_ptrs() {
554
+ static_assert(sizeof(std::shared_ptr<int>) >= sizeof(std::unique_ptr<int>),
555
+ "pybind assumes std::shared_ptrs are at least as big as std::unique_ptrs");
556
+ return size_in_ptrs(sizeof(std::shared_ptr<int>));
557
+ }
558
+
559
+ // Forward declarations
560
+ struct type_info;
561
+ struct value_and_holder;
562
+
563
+ struct nonsimple_values_and_holders {
564
+ void **values_and_holders;
565
+ uint8_t *status;
566
+ };
567
+
568
+ /// The 'instance' type which needs to be standard layout (need to be able to use 'offsetof')
569
+ struct instance {
570
+ PyObject_HEAD
571
+ /// Storage for pointers and holder; see simple_layout, below, for a description
572
+ union {
573
+ void *simple_value_holder[1 + instance_simple_holder_in_ptrs()];
574
+ nonsimple_values_and_holders nonsimple;
575
+ };
576
+ /// Weak references
577
+ PyObject *weakrefs;
578
+ /// If true, the pointer is owned which means we're free to manage it with a holder.
579
+ bool owned : 1;
580
+ /**
581
+ * An instance has two possible value/holder layouts.
582
+ *
583
+ * Simple layout (when this flag is true), means the `simple_value_holder` is set with a
584
+ * pointer and the holder object governing that pointer, i.e. [val1*][holder]. This layout is
585
+ * applied whenever there is no python-side multiple inheritance of bound C++ types *and* the
586
+ * type's holder will fit in the default space (which is large enough to hold either a
587
+ * std::unique_ptr or std::shared_ptr).
588
+ *
589
+ * Non-simple layout applies when using custom holders that require more space than
590
+ * `shared_ptr` (which is typically the size of two pointers), or when multiple inheritance is
591
+ * used on the python side. Non-simple layout allocates the required amount of memory to have
592
+ * multiple bound C++ classes as parents. Under this layout, `nonsimple.values_and_holders` is
593
+ * set to a pointer to allocated space of the required space to hold a sequence of value
594
+ * pointers and holders followed `status`, a set of bit flags (1 byte each), i.e.
595
+ * [val1*][holder1][val2*][holder2]...[bb...] where each [block] is rounded up to a multiple
596
+ * of `sizeof(void *)`. `nonsimple.status` is, for convenience, a pointer to the beginning of
597
+ * the [bb...] block (but not independently allocated).
598
+ *
599
+ * Status bits indicate whether the associated holder is constructed (&
600
+ * status_holder_constructed) and whether the value pointer is registered (&
601
+ * status_instance_registered) in `registered_instances`.
602
+ */
603
+ bool simple_layout : 1;
604
+ /// For simple layout, tracks whether the holder has been constructed
605
+ bool simple_holder_constructed : 1;
606
+ /// For simple layout, tracks whether the instance is registered in `registered_instances`
607
+ bool simple_instance_registered : 1;
608
+ /// If true, get_internals().patients has an entry for this object
609
+ bool has_patients : 1;
610
+
611
+ /// Initializes all of the above type/values/holders data (but not the instance values
612
+ /// themselves)
613
+ void allocate_layout();
614
+
615
+ /// Destroys/deallocates all of the above
616
+ void deallocate_layout();
617
+
618
+ /// Returns the value_and_holder wrapper for the given type (or the first, if `find_type`
619
+ /// omitted). Returns a default-constructed (with `.inst = nullptr`) object on failure if
620
+ /// `throw_if_missing` is false.
621
+ value_and_holder get_value_and_holder(const type_info *find_type = nullptr,
622
+ bool throw_if_missing = true);
623
+
624
+ /// Bit values for the non-simple status flags
625
+ static constexpr uint8_t status_holder_constructed = 1;
626
+ static constexpr uint8_t status_instance_registered = 2;
627
+ };
628
+
629
+ static_assert(std::is_standard_layout<instance>::value,
630
+ "Internal error: `pybind11::detail::instance` is not standard layout!");
631
+
632
+ /// from __cpp_future__ import (convenient aliases from C++14/17)
633
+ #if defined(PYBIND11_CPP14)
634
+ using std::conditional_t;
635
+ using std::enable_if_t;
636
+ using std::remove_cv_t;
637
+ using std::remove_reference_t;
638
+ #else
639
+ template <bool B, typename T = void>
640
+ using enable_if_t = typename std::enable_if<B, T>::type;
641
+ template <bool B, typename T, typename F>
642
+ using conditional_t = typename std::conditional<B, T, F>::type;
643
+ template <typename T>
644
+ using remove_cv_t = typename std::remove_cv<T>::type;
645
+ template <typename T>
646
+ using remove_reference_t = typename std::remove_reference<T>::type;
647
+ #endif
648
+
649
+ #if defined(PYBIND11_CPP20)
650
+ using std::remove_cvref;
651
+ using std::remove_cvref_t;
652
+ #else
653
+ template <class T>
654
+ struct remove_cvref {
655
+ using type = remove_cv_t<remove_reference_t<T>>;
656
+ };
657
+ template <class T>
658
+ using remove_cvref_t = typename remove_cvref<T>::type;
659
+ #endif
660
+
661
+ /// Example usage: is_same_ignoring_cvref<T, PyObject *>::value
662
+ template <typename T, typename U>
663
+ using is_same_ignoring_cvref = std::is_same<detail::remove_cvref_t<T>, U>;
664
+
665
+ /// Index sequences
666
+ #if defined(PYBIND11_CPP14)
667
+ using std::index_sequence;
668
+ using std::make_index_sequence;
669
+ #else
670
+ template <size_t...>
671
+ struct index_sequence {};
672
+ template <size_t N, size_t... S>
673
+ struct make_index_sequence_impl : make_index_sequence_impl<N - 1, N - 1, S...> {};
674
+ template <size_t... S>
675
+ struct make_index_sequence_impl<0, S...> {
676
+ using type = index_sequence<S...>;
677
+ };
678
+ template <size_t N>
679
+ using make_index_sequence = typename make_index_sequence_impl<N>::type;
680
+ #endif
681
+
682
+ /// Make an index sequence of the indices of true arguments
683
+ template <typename ISeq, size_t, bool...>
684
+ struct select_indices_impl {
685
+ using type = ISeq;
686
+ };
687
+ template <size_t... IPrev, size_t I, bool B, bool... Bs>
688
+ struct select_indices_impl<index_sequence<IPrev...>, I, B, Bs...>
689
+ : select_indices_impl<conditional_t<B, index_sequence<IPrev..., I>, index_sequence<IPrev...>>,
690
+ I + 1,
691
+ Bs...> {};
692
+ template <bool... Bs>
693
+ using select_indices = typename select_indices_impl<index_sequence<>, 0, Bs...>::type;
694
+
695
+ /// Backports of std::bool_constant and std::negation to accommodate older compilers
696
+ template <bool B>
697
+ using bool_constant = std::integral_constant<bool, B>;
698
+ template <typename T>
699
+ struct negation : bool_constant<!T::value> {};
700
+
701
+ // PGI/Intel cannot detect operator delete with the "compatible" void_t impl, so
702
+ // using the new one (C++14 defect, so generally works on newer compilers, even
703
+ // if not in C++17 mode)
704
+ #if defined(__PGIC__) || defined(__INTEL_COMPILER)
705
+ template <typename...>
706
+ using void_t = void;
707
+ #else
708
+ template <typename...>
709
+ struct void_t_impl {
710
+ using type = void;
711
+ };
712
+ template <typename... Ts>
713
+ using void_t = typename void_t_impl<Ts...>::type;
714
+ #endif
715
+
716
+ /// Compile-time all/any/none of that check the boolean value of all template types
717
+ #if defined(__cpp_fold_expressions) && !(defined(_MSC_VER) && (_MSC_VER < 1916))
718
+ template <class... Ts>
719
+ using all_of = bool_constant<(Ts::value && ...)>;
720
+ template <class... Ts>
721
+ using any_of = bool_constant<(Ts::value || ...)>;
722
+ #elif !defined(_MSC_VER)
723
+ template <bool...>
724
+ struct bools {};
725
+ template <class... Ts>
726
+ using all_of = std::is_same<bools<Ts::value..., true>, bools<true, Ts::value...>>;
727
+ template <class... Ts>
728
+ using any_of = negation<all_of<negation<Ts>...>>;
729
+ #else
730
+ // MSVC has trouble with the above, but supports std::conjunction, which we can use instead (albeit
731
+ // at a slight loss of compilation efficiency).
732
+ template <class... Ts>
733
+ using all_of = std::conjunction<Ts...>;
734
+ template <class... Ts>
735
+ using any_of = std::disjunction<Ts...>;
736
+ #endif
737
+ template <class... Ts>
738
+ using none_of = negation<any_of<Ts...>>;
739
+
740
+ template <class T, template <class> class... Predicates>
741
+ using satisfies_all_of = all_of<Predicates<T>...>;
742
+ template <class T, template <class> class... Predicates>
743
+ using satisfies_any_of = any_of<Predicates<T>...>;
744
+ template <class T, template <class> class... Predicates>
745
+ using satisfies_none_of = none_of<Predicates<T>...>;
746
+
747
+ /// Strip the class from a method type
748
+ template <typename T>
749
+ struct remove_class {};
750
+ template <typename C, typename R, typename... A>
751
+ struct remove_class<R (C::*)(A...)> {
752
+ using type = R(A...);
753
+ };
754
+ template <typename C, typename R, typename... A>
755
+ struct remove_class<R (C::*)(A...) const> {
756
+ using type = R(A...);
757
+ };
758
+ #ifdef __cpp_noexcept_function_type
759
+ template <typename C, typename R, typename... A>
760
+ struct remove_class<R (C::*)(A...) noexcept> {
761
+ using type = R(A...);
762
+ };
763
+ template <typename C, typename R, typename... A>
764
+ struct remove_class<R (C::*)(A...) const noexcept> {
765
+ using type = R(A...);
766
+ };
767
+ #endif
768
+ /// Helper template to strip away type modifiers
769
+ template <typename T>
770
+ struct intrinsic_type {
771
+ using type = T;
772
+ };
773
+ template <typename T>
774
+ struct intrinsic_type<const T> {
775
+ using type = typename intrinsic_type<T>::type;
776
+ };
777
+ template <typename T>
778
+ struct intrinsic_type<T *> {
779
+ using type = typename intrinsic_type<T>::type;
780
+ };
781
+ template <typename T>
782
+ struct intrinsic_type<T &> {
783
+ using type = typename intrinsic_type<T>::type;
784
+ };
785
+ template <typename T>
786
+ struct intrinsic_type<T &&> {
787
+ using type = typename intrinsic_type<T>::type;
788
+ };
789
+ template <typename T, size_t N>
790
+ struct intrinsic_type<const T[N]> {
791
+ using type = typename intrinsic_type<T>::type;
792
+ };
793
+ template <typename T, size_t N>
794
+ struct intrinsic_type<T[N]> {
795
+ using type = typename intrinsic_type<T>::type;
796
+ };
797
+ template <typename T>
798
+ using intrinsic_t = typename intrinsic_type<T>::type;
799
+
800
+ /// Helper type to replace 'void' in some expressions
801
+ struct void_type {};
802
+
803
+ /// Helper template which holds a list of types
804
+ template <typename...>
805
+ struct type_list {};
806
+
807
+ /// Compile-time integer sum
808
+ #ifdef __cpp_fold_expressions
809
+ template <typename... Ts>
810
+ constexpr size_t constexpr_sum(Ts... ns) {
811
+ return (0 + ... + size_t{ns});
812
+ }
813
+ #else
814
+ constexpr size_t constexpr_sum() { return 0; }
815
+ template <typename T, typename... Ts>
816
+ constexpr size_t constexpr_sum(T n, Ts... ns) {
817
+ return size_t{n} + constexpr_sum(ns...);
818
+ }
819
+ #endif
820
+
821
+ PYBIND11_NAMESPACE_BEGIN(constexpr_impl)
822
+ /// Implementation details for constexpr functions
823
+ constexpr int first(int i) { return i; }
824
+ template <typename T, typename... Ts>
825
+ constexpr int first(int i, T v, Ts... vs) {
826
+ return v ? i : first(i + 1, vs...);
827
+ }
828
+
829
+ constexpr int last(int /*i*/, int result) { return result; }
830
+ template <typename T, typename... Ts>
831
+ constexpr int last(int i, int result, T v, Ts... vs) {
832
+ return last(i + 1, v ? i : result, vs...);
833
+ }
834
+ PYBIND11_NAMESPACE_END(constexpr_impl)
835
+
836
+ /// Return the index of the first type in Ts which satisfies Predicate<T>.
837
+ /// Returns sizeof...(Ts) if none match.
838
+ template <template <typename> class Predicate, typename... Ts>
839
+ constexpr int constexpr_first() {
840
+ return constexpr_impl::first(0, Predicate<Ts>::value...);
841
+ }
842
+
843
+ /// Return the index of the last type in Ts which satisfies Predicate<T>, or -1 if none match.
844
+ template <template <typename> class Predicate, typename... Ts>
845
+ constexpr int constexpr_last() {
846
+ return constexpr_impl::last(0, -1, Predicate<Ts>::value...);
847
+ }
848
+
849
+ /// Return the Nth element from the parameter pack
850
+ template <size_t N, typename T, typename... Ts>
851
+ struct pack_element {
852
+ using type = typename pack_element<N - 1, Ts...>::type;
853
+ };
854
+ template <typename T, typename... Ts>
855
+ struct pack_element<0, T, Ts...> {
856
+ using type = T;
857
+ };
858
+
859
+ /// Return the one and only type which matches the predicate, or Default if none match.
860
+ /// If more than one type matches the predicate, fail at compile-time.
861
+ template <template <typename> class Predicate, typename Default, typename... Ts>
862
+ struct exactly_one {
863
+ static constexpr auto found = constexpr_sum(Predicate<Ts>::value...);
864
+ static_assert(found <= 1, "Found more than one type matching the predicate");
865
+
866
+ static constexpr auto index = found ? constexpr_first<Predicate, Ts...>() : 0;
867
+ using type = conditional_t<found, typename pack_element<index, Ts...>::type, Default>;
868
+ };
869
+ template <template <typename> class P, typename Default>
870
+ struct exactly_one<P, Default> {
871
+ using type = Default;
872
+ };
873
+
874
+ template <template <typename> class Predicate, typename Default, typename... Ts>
875
+ using exactly_one_t = typename exactly_one<Predicate, Default, Ts...>::type;
876
+
877
+ /// Defer the evaluation of type T until types Us are instantiated
878
+ template <typename T, typename... /*Us*/>
879
+ struct deferred_type {
880
+ using type = T;
881
+ };
882
+ template <typename T, typename... Us>
883
+ using deferred_t = typename deferred_type<T, Us...>::type;
884
+
885
+ /// Like is_base_of, but requires a strict base (i.e. `is_strict_base_of<T, T>::value == false`,
886
+ /// unlike `std::is_base_of`)
887
+ template <typename Base, typename Derived>
888
+ using is_strict_base_of
889
+ = bool_constant<std::is_base_of<Base, Derived>::value && !std::is_same<Base, Derived>::value>;
890
+
891
+ /// Like is_base_of, but also requires that the base type is accessible (i.e. that a Derived
892
+ /// pointer can be converted to a Base pointer) For unions, `is_base_of<T, T>::value` is False, so
893
+ /// we need to check `is_same` as well.
894
+ template <typename Base, typename Derived>
895
+ using is_accessible_base_of
896
+ = bool_constant<(std::is_same<Base, Derived>::value || std::is_base_of<Base, Derived>::value)
897
+ && std::is_convertible<Derived *, Base *>::value>;
898
+
899
+ template <template <typename...> class Base>
900
+ struct is_template_base_of_impl {
901
+ template <typename... Us>
902
+ static std::true_type check(Base<Us...> *);
903
+ static std::false_type check(...);
904
+ };
905
+
906
+ /// Check if a template is the base of a type. For example:
907
+ /// `is_template_base_of<Base, T>` is true if `struct T : Base<U> {}` where U can be anything
908
+ template <template <typename...> class Base, typename T>
909
+ // Sadly, all MSVC versions incl. 2022 need the workaround, even in C++20 mode.
910
+ // See also: https://github.com/pybind/pybind11/pull/3741
911
+ #if !defined(_MSC_VER)
912
+ using is_template_base_of
913
+ = decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr));
914
+ #else
915
+ struct is_template_base_of
916
+ : decltype(is_template_base_of_impl<Base>::check((intrinsic_t<T> *) nullptr)) {
917
+ };
918
+ #endif
919
+
920
+ /// Check if T is an instantiation of the template `Class`. For example:
921
+ /// `is_instantiation<shared_ptr, T>` is true if `T == shared_ptr<U>` where U can be anything.
922
+ template <template <typename...> class Class, typename T>
923
+ struct is_instantiation : std::false_type {};
924
+ template <template <typename...> class Class, typename... Us>
925
+ struct is_instantiation<Class, Class<Us...>> : std::true_type {};
926
+
927
+ /// Check if T is std::shared_ptr<U> where U can be anything
928
+ template <typename T>
929
+ using is_shared_ptr = is_instantiation<std::shared_ptr, T>;
930
+
931
+ /// Check if T looks like an input iterator
932
+ template <typename T, typename = void>
933
+ struct is_input_iterator : std::false_type {};
934
+ template <typename T>
935
+ struct is_input_iterator<T,
936
+ void_t<decltype(*std::declval<T &>()), decltype(++std::declval<T &>())>>
937
+ : std::true_type {};
938
+
939
+ template <typename T>
940
+ using is_function_pointer
941
+ = bool_constant<std::is_pointer<T>::value
942
+ && std::is_function<typename std::remove_pointer<T>::type>::value>;
943
+
944
+ template <typename F>
945
+ struct strip_function_object {
946
+ // If you are encountering an
947
+ // 'error: name followed by "::" must be a class or namespace name'
948
+ // with the Intel compiler and a noexcept function here,
949
+ // try to use noexcept(true) instead of plain noexcept.
950
+ using type = typename remove_class<decltype(&F::operator())>::type;
951
+ };
952
+
953
+ // Extracts the function signature from a function, function pointer or lambda.
954
+ template <typename Function, typename F = remove_reference_t<Function>>
955
+ using function_signature_t = conditional_t<
956
+ std::is_function<F>::value,
957
+ F,
958
+ typename conditional_t<std::is_pointer<F>::value || std::is_member_pointer<F>::value,
959
+ std::remove_pointer<F>,
960
+ strip_function_object<F>>::type>;
961
+
962
+ /// Returns true if the type looks like a lambda: that is, isn't a function, pointer or member
963
+ /// pointer. Note that this can catch all sorts of other things, too; this is intended to be used
964
+ /// in a place where passing a lambda makes sense.
965
+ template <typename T>
966
+ using is_lambda = satisfies_none_of<remove_reference_t<T>,
967
+ std::is_function,
968
+ std::is_pointer,
969
+ std::is_member_pointer>;
970
+
971
+ // [workaround(intel)] Internal error on fold expression
972
+ /// Apply a function over each element of a parameter pack
973
+ #if defined(__cpp_fold_expressions) && !defined(__INTEL_COMPILER)
974
+ // Intel compiler produces an internal error on this fold expression (tested with ICC 19.0.2)
975
+ # define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) (((PATTERN), void()), ...)
976
+ #else
977
+ using expand_side_effects = bool[];
978
+ # define PYBIND11_EXPAND_SIDE_EFFECTS(PATTERN) \
979
+ (void) pybind11::detail::expand_side_effects { ((PATTERN), void(), false)..., false }
980
+ #endif
981
+
982
+ PYBIND11_NAMESPACE_END(detail)
983
+
984
+ /// C++ bindings of builtin Python exceptions
985
+ class PYBIND11_EXPORT_EXCEPTION builtin_exception : public std::runtime_error {
986
+ public:
987
+ using std::runtime_error::runtime_error;
988
+ /// Set the error using the Python C API
989
+ virtual void set_error() const = 0;
990
+ };
991
+
992
+ #define PYBIND11_RUNTIME_EXCEPTION(name, type) \
993
+ class PYBIND11_EXPORT_EXCEPTION name : public builtin_exception { \
994
+ public: \
995
+ using builtin_exception::builtin_exception; \
996
+ name() : name("") {} \
997
+ void set_error() const override { PyErr_SetString(type, what()); } \
998
+ };
999
+
1000
+ PYBIND11_RUNTIME_EXCEPTION(stop_iteration, PyExc_StopIteration)
1001
+ PYBIND11_RUNTIME_EXCEPTION(index_error, PyExc_IndexError)
1002
+ PYBIND11_RUNTIME_EXCEPTION(key_error, PyExc_KeyError)
1003
+ PYBIND11_RUNTIME_EXCEPTION(value_error, PyExc_ValueError)
1004
+ PYBIND11_RUNTIME_EXCEPTION(type_error, PyExc_TypeError)
1005
+ PYBIND11_RUNTIME_EXCEPTION(buffer_error, PyExc_BufferError)
1006
+ PYBIND11_RUNTIME_EXCEPTION(import_error, PyExc_ImportError)
1007
+ PYBIND11_RUNTIME_EXCEPTION(attribute_error, PyExc_AttributeError)
1008
+ PYBIND11_RUNTIME_EXCEPTION(cast_error, PyExc_RuntimeError) /// Thrown when pybind11::cast or
1009
+ /// handle::call fail due to a type
1010
+ /// casting error
1011
+ PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used internally
1012
+
1013
+ [[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const char *reason) {
1014
+ assert(!PyErr_Occurred());
1015
+ throw std::runtime_error(reason);
1016
+ }
1017
+ [[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const std::string &reason) {
1018
+ assert(!PyErr_Occurred());
1019
+ throw std::runtime_error(reason);
1020
+ }
1021
+
1022
+ template <typename T, typename SFINAE = void>
1023
+ struct format_descriptor {};
1024
+
1025
+ template <typename T>
1026
+ struct format_descriptor<
1027
+ T,
1028
+ detail::enable_if_t<detail::is_same_ignoring_cvref<T, PyObject *>::value>> {
1029
+ static constexpr const char c = 'O';
1030
+ static constexpr const char value[2] = {c, '\0'};
1031
+ static std::string format() { return std::string(1, c); }
1032
+ };
1033
+
1034
+ PYBIND11_NAMESPACE_BEGIN(detail)
1035
+ // Returns the index of the given type in the type char array below, and in the list in numpy.h
1036
+ // The order here is: bool; 8 ints ((signed,unsigned)x(8,16,32,64)bits); float,double,long double;
1037
+ // complex float,double,long double. Note that the long double types only participate when long
1038
+ // double is actually longer than double (it isn't under MSVC).
1039
+ // NB: not only the string below but also complex.h and numpy.h rely on this order.
1040
+ template <typename T, typename SFINAE = void>
1041
+ struct is_fmt_numeric {
1042
+ static constexpr bool value = false;
1043
+ };
1044
+ template <typename T>
1045
+ struct is_fmt_numeric<T, enable_if_t<std::is_arithmetic<T>::value>> {
1046
+ static constexpr bool value = true;
1047
+ static constexpr int index
1048
+ = std::is_same<T, bool>::value
1049
+ ? 0
1050
+ : 1
1051
+ + (std::is_integral<T>::value
1052
+ ? detail::log2(sizeof(T)) * 2 + std::is_unsigned<T>::value
1053
+ : 8
1054
+ + (std::is_same<T, double>::value ? 1
1055
+ : std::is_same<T, long double>::value ? 2
1056
+ : 0));
1057
+ };
1058
+ PYBIND11_NAMESPACE_END(detail)
1059
+
1060
+ template <typename T>
1061
+ struct format_descriptor<T, detail::enable_if_t<std::is_arithmetic<T>::value>> {
1062
+ static constexpr const char c = "?bBhHiIqQfdg"[detail::is_fmt_numeric<T>::index];
1063
+ static constexpr const char value[2] = {c, '\0'};
1064
+ static std::string format() { return std::string(1, c); }
1065
+ };
1066
+
1067
+ #if !defined(PYBIND11_CPP17)
1068
+
1069
+ template <typename T>
1070
+ constexpr const char
1071
+ format_descriptor<T, detail::enable_if_t<std::is_arithmetic<T>::value>>::value[2];
1072
+
1073
+ #endif
1074
+
1075
+ /// RAII wrapper that temporarily clears any Python error state
1076
+ struct error_scope {
1077
+ PyObject *type, *value, *trace;
1078
+ error_scope() { PyErr_Fetch(&type, &value, &trace); }
1079
+ error_scope(const error_scope &) = delete;
1080
+ error_scope &operator=(const error_scope &) = delete;
1081
+ ~error_scope() { PyErr_Restore(type, value, trace); }
1082
+ };
1083
+
1084
+ /// Dummy destructor wrapper that can be used to expose classes with a private destructor
1085
+ struct nodelete {
1086
+ template <typename T>
1087
+ void operator()(T *) {}
1088
+ };
1089
+
1090
+ PYBIND11_NAMESPACE_BEGIN(detail)
1091
+ template <typename... Args>
1092
+ struct overload_cast_impl {
1093
+ template <typename Return>
1094
+ constexpr auto operator()(Return (*pf)(Args...)) const noexcept -> decltype(pf) {
1095
+ return pf;
1096
+ }
1097
+
1098
+ template <typename Return, typename Class>
1099
+ constexpr auto operator()(Return (Class::*pmf)(Args...), std::false_type = {}) const noexcept
1100
+ -> decltype(pmf) {
1101
+ return pmf;
1102
+ }
1103
+
1104
+ template <typename Return, typename Class>
1105
+ constexpr auto operator()(Return (Class::*pmf)(Args...) const, std::true_type) const noexcept
1106
+ -> decltype(pmf) {
1107
+ return pmf;
1108
+ }
1109
+ };
1110
+ PYBIND11_NAMESPACE_END(detail)
1111
+
1112
+ // overload_cast requires variable templates: C++14
1113
+ #if defined(PYBIND11_CPP14)
1114
+ # define PYBIND11_OVERLOAD_CAST 1
1115
+ /// Syntax sugar for resolving overloaded function pointers:
1116
+ /// - regular: static_cast<Return (Class::*)(Arg0, Arg1, Arg2)>(&Class::func)
1117
+ /// - sweet: overload_cast<Arg0, Arg1, Arg2>(&Class::func)
1118
+ template <typename... Args>
1119
+ static constexpr detail::overload_cast_impl<Args...> overload_cast{};
1120
+ #endif
1121
+
1122
+ /// Const member function selector for overload_cast
1123
+ /// - regular: static_cast<Return (Class::*)(Arg) const>(&Class::func)
1124
+ /// - sweet: overload_cast<Arg>(&Class::func, const_)
1125
+ static constexpr auto const_ = std::true_type{};
1126
+
1127
+ #if !defined(PYBIND11_CPP14) // no overload_cast: providing something that static_assert-fails:
1128
+ template <typename... Args>
1129
+ struct overload_cast {
1130
+ static_assert(detail::deferred_t<std::false_type, Args...>::value,
1131
+ "pybind11::overload_cast<...> requires compiling in C++14 mode");
1132
+ };
1133
+ #endif // overload_cast
1134
+
1135
+ PYBIND11_NAMESPACE_BEGIN(detail)
1136
+
1137
+ // Adaptor for converting arbitrary container arguments into a vector; implicitly convertible from
1138
+ // any standard container (or C-style array) supporting std::begin/std::end, any singleton
1139
+ // arithmetic type (if T is arithmetic), or explicitly constructible from an iterator pair.
1140
+ template <typename T>
1141
+ class any_container {
1142
+ std::vector<T> v;
1143
+
1144
+ public:
1145
+ any_container() = default;
1146
+
1147
+ // Can construct from a pair of iterators
1148
+ template <typename It, typename = enable_if_t<is_input_iterator<It>::value>>
1149
+ any_container(It first, It last) : v(first, last) {}
1150
+
1151
+ // Implicit conversion constructor from any arbitrary container type
1152
+ // with values convertible to T
1153
+ template <typename Container,
1154
+ typename = enable_if_t<
1155
+ std::is_convertible<decltype(*std::begin(std::declval<const Container &>())),
1156
+ T>::value>>
1157
+ // NOLINTNEXTLINE(google-explicit-constructor)
1158
+ any_container(const Container &c) : any_container(std::begin(c), std::end(c)) {}
1159
+
1160
+ // initializer_list's aren't deducible, so don't get matched by the above template;
1161
+ // we need this to explicitly allow implicit conversion from one:
1162
+ template <typename TIn, typename = enable_if_t<std::is_convertible<TIn, T>::value>>
1163
+ any_container(const std::initializer_list<TIn> &c) : any_container(c.begin(), c.end()) {}
1164
+
1165
+ // Avoid copying if given an rvalue vector of the correct type.
1166
+ // NOLINTNEXTLINE(google-explicit-constructor)
1167
+ any_container(std::vector<T> &&v) : v(std::move(v)) {}
1168
+
1169
+ // Moves the vector out of an rvalue any_container
1170
+ // NOLINTNEXTLINE(google-explicit-constructor)
1171
+ operator std::vector<T> &&() && { return std::move(v); }
1172
+
1173
+ // Dereferencing obtains a reference to the underlying vector
1174
+ std::vector<T> &operator*() { return v; }
1175
+ const std::vector<T> &operator*() const { return v; }
1176
+
1177
+ // -> lets you call methods on the underlying vector
1178
+ std::vector<T> *operator->() { return &v; }
1179
+ const std::vector<T> *operator->() const { return &v; }
1180
+ };
1181
+
1182
+ // Forward-declaration; see detail/class.h
1183
+ std::string get_fully_qualified_tp_name(PyTypeObject *);
1184
+
1185
+ template <typename T>
1186
+ inline static std::shared_ptr<T>
1187
+ try_get_shared_from_this(std::enable_shared_from_this<T> *holder_value_ptr) {
1188
+ // Pre C++17, this code path exploits undefined behavior, but is known to work on many platforms.
1189
+ // Use at your own risk!
1190
+ // See also https://en.cppreference.com/w/cpp/memory/enable_shared_from_this, and in particular
1191
+ // the `std::shared_ptr<Good> gp1 = not_so_good.getptr();` and `try`-`catch` parts of the example.
1192
+ #if defined(__cpp_lib_enable_shared_from_this) && (!defined(_MSC_VER) || _MSC_VER >= 1912)
1193
+ return holder_value_ptr->weak_from_this().lock();
1194
+ #else
1195
+ try {
1196
+ return holder_value_ptr->shared_from_this();
1197
+ } catch (const std::bad_weak_ptr &) {
1198
+ return nullptr;
1199
+ }
1200
+ #endif
1201
+ }
1202
+
1203
+ // For silencing "unused" compiler warnings in special situations.
1204
+ template <typename... Args>
1205
+ #if defined(_MSC_VER) && _MSC_VER < 1920 // MSVC 2017
1206
+ constexpr
1207
+ #endif
1208
+ inline void
1209
+ silence_unused_warnings(Args &&...) {
1210
+ }
1211
+
1212
+ // MSVC warning C4100: Unreferenced formal parameter
1213
+ #if defined(_MSC_VER) && _MSC_VER <= 1916
1214
+ # define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...) \
1215
+ detail::silence_unused_warnings(__VA_ARGS__)
1216
+ #else
1217
+ # define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...)
1218
+ #endif
1219
+
1220
+ // GCC -Wunused-but-set-parameter All GCC versions (as of July 2021).
1221
+ #if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
1222
+ # define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...) \
1223
+ detail::silence_unused_warnings(__VA_ARGS__)
1224
+ #else
1225
+ # define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...)
1226
+ #endif
1227
+
1228
+ #if defined(__clang__) \
1229
+ && (defined(__apple_build_version__) /* AppleClang 13.0.0.13000029 was the only data point \
1230
+ available. */ \
1231
+ || (__clang_major__ >= 7 \
1232
+ && __clang_major__ <= 12) /* Clang 3, 5, 13, 14, 15 do not generate the warning. */ \
1233
+ )
1234
+ # define PYBIND11_DETECTED_CLANG_WITH_MISLEADING_CALL_STD_MOVE_EXPLICITLY_WARNING
1235
+ // Example:
1236
+ // tests/test_kwargs_and_defaults.cpp:46:68: error: local variable 'args' will be copied despite
1237
+ // being returned by name [-Werror,-Wreturn-std-move]
1238
+ // m.def("args_function", [](py::args args) -> py::tuple { return args; });
1239
+ // ^~~~
1240
+ // test_kwargs_and_defaults.cpp:46:68: note: call 'std::move' explicitly to avoid copying
1241
+ // m.def("args_function", [](py::args args) -> py::tuple { return args; });
1242
+ // ^~~~
1243
+ // std::move(args)
1244
+ #endif
1245
+
1246
+ // Pybind offers detailed error messages by default for all builts that are debug (through the
1247
+ // negation of NDEBUG). This can also be manually enabled by users, for any builds, through
1248
+ // defining PYBIND11_DETAILED_ERROR_MESSAGES. This information is primarily useful for those
1249
+ // who are writing (as opposed to merely using) libraries that use pybind11.
1250
+ #if !defined(PYBIND11_DETAILED_ERROR_MESSAGES) && !defined(NDEBUG)
1251
+ # define PYBIND11_DETAILED_ERROR_MESSAGES
1252
+ #endif
1253
+
1254
+ PYBIND11_NAMESPACE_END(detail)
1255
+ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)