netgen-mesher 6.2.2504.post11.dev0__cp313-cp313-win_amd64.whl → 6.2.2506.post48.dev0__cp313-cp313-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.
- netgen/__init__.pyi +3 -3
- netgen/cmake/NetgenConfig.cmake +10 -9
- netgen/config/__init__.pyi +8 -8
- netgen/config/config.py +7 -7
- netgen/config/config.pyi +8 -8
- netgen/include/core/archive.hpp +18 -3
- netgen/include/core/array.hpp +20 -4
- netgen/include/core/autodiff.hpp +9 -11
- netgen/include/core/autodiffdiff.hpp +0 -2
- netgen/include/core/bitarray.hpp +1 -1
- netgen/include/core/flags.hpp +1 -1
- netgen/include/core/hashtable.hpp +1 -1
- netgen/include/core/memtracer.hpp +7 -7
- netgen/include/core/ngcore.hpp +5 -0
- netgen/include/core/ngcore_api.hpp +11 -0
- netgen/include/core/paje_trace.hpp +9 -8
- netgen/include/core/profiler.hpp +5 -5
- netgen/include/core/register_archive.hpp +8 -0
- netgen/include/core/simd.hpp +69 -1
- netgen/include/core/simd_arm64.hpp +205 -1
- netgen/include/core/simd_avx.hpp +72 -4
- netgen/include/core/simd_avx512.hpp +9 -0
- netgen/include/core/simd_generic.hpp +274 -8
- netgen/include/core/simd_math.hpp +178 -0
- netgen/include/core/simd_sse.hpp +11 -1
- netgen/include/core/statushandler.hpp +37 -0
- netgen/include/core/table.hpp +3 -2
- netgen/include/core/taskmanager.hpp +34 -1
- netgen/include/core/utils.hpp +3 -8
- netgen/include/include/netgen_version.hpp +4 -4
- netgen/include/meshing/basegeom.hpp +1 -4
- netgen/include/meshing/global.hpp +0 -17
- netgen/include/meshing/hpref_tet.hpp +41 -0
- netgen/include/meshing/hprefinement.hpp +2 -0
- netgen/include/meshing/meshtype.hpp +2 -1
- netgen/include/meshing/msghandler.hpp +9 -6
- netgen/include/meshing/topology.hpp +2 -2
- netgen/include/nginterface.h +3 -2
- netgen/include/occ/occ_utils.hpp +26 -0
- netgen/include/occ/occgeom.hpp +8 -0
- netgen/include/pybind11/attr.h +40 -8
- netgen/include/pybind11/buffer_info.h +14 -14
- netgen/include/pybind11/cast.h +553 -29
- netgen/include/pybind11/chrono.h +4 -1
- netgen/include/pybind11/conduit/README.txt +15 -0
- netgen/include/pybind11/conduit/pybind11_conduit_v1.h +116 -0
- netgen/include/pybind11/conduit/pybind11_platform_abi_id.h +87 -0
- netgen/include/pybind11/conduit/wrap_include_python_h.h +72 -0
- netgen/include/pybind11/critical_section.h +56 -0
- netgen/include/pybind11/detail/class.h +172 -97
- netgen/include/pybind11/detail/common.h +270 -189
- netgen/include/pybind11/detail/cpp_conduit.h +75 -0
- netgen/include/pybind11/detail/descr.h +55 -0
- netgen/include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h +39 -0
- netgen/include/pybind11/detail/exception_translation.h +71 -0
- netgen/include/pybind11/detail/function_record_pyobject.h +191 -0
- netgen/include/pybind11/detail/init.h +113 -9
- netgen/include/pybind11/detail/internals.h +479 -344
- netgen/include/pybind11/detail/native_enum_data.h +209 -0
- netgen/include/pybind11/detail/pybind11_namespace_macros.h +82 -0
- netgen/include/pybind11/detail/struct_smart_holder.h +378 -0
- netgen/include/pybind11/detail/type_caster_base.h +506 -133
- netgen/include/pybind11/detail/using_smart_holder.h +22 -0
- netgen/include/pybind11/detail/value_and_holder.h +90 -0
- netgen/include/pybind11/eigen/matrix.h +19 -10
- netgen/include/pybind11/eigen/tensor.h +15 -11
- netgen/include/pybind11/embed.h +50 -46
- netgen/include/pybind11/eval.h +11 -6
- netgen/include/pybind11/functional.h +58 -49
- netgen/include/pybind11/gil.h +34 -82
- netgen/include/pybind11/gil_safe_call_once.h +12 -1
- netgen/include/pybind11/gil_simple.h +37 -0
- netgen/include/pybind11/native_enum.h +67 -0
- netgen/include/pybind11/numpy.h +272 -93
- netgen/include/pybind11/pybind11.h +947 -265
- netgen/include/pybind11/pytypes.h +127 -21
- netgen/include/pybind11/stl/filesystem.h +23 -25
- netgen/include/pybind11/stl.h +277 -59
- netgen/include/pybind11/stl_bind.h +42 -7
- netgen/include/pybind11/subinterpreter.h +299 -0
- netgen/include/pybind11/trampoline_self_life_support.h +65 -0
- netgen/include/pybind11/typing.h +177 -4
- netgen/include/pybind11/warnings.h +75 -0
- netgen/include/visualization/mvdraw.hpp +48 -12
- netgen/include/visualization/vssolution.hpp +3 -1
- netgen/lib/libnggui.lib +0 -0
- netgen/lib/ngcore.lib +0 -0
- netgen/lib/nglib.lib +0 -0
- netgen/libnggui.dll +0 -0
- netgen/libngguipy.pyd +0 -0
- netgen/libngpy/_NgOCC.pyi +224 -139
- netgen/libngpy/_csg.pyi +26 -26
- netgen/libngpy/_geom2d.pyi +34 -25
- netgen/libngpy/_meshing.pyi +262 -111
- netgen/libngpy/_stl.pyi +3 -4
- netgen/libngpy.pyd +0 -0
- netgen/ngcore.dll +0 -0
- netgen/nglib.dll +0 -0
- netgen/read_gmsh.py +41 -0
- netgen/togl.dll +0 -0
- netgen/version.py +1 -1
- netgen/webgui.py +38 -2
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/METADATA +2 -1
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/RECORD +153 -132
- pyngcore/pyngcore.cp313-win_amd64.pyd +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/boundarycondition.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/boxcyl.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/circle_on_cube.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cone.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cube.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubeandring.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubeandspheres.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubemcyl.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cubemsphere.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cylinder.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/cylsphere.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/doc/ng4.pdf +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ellipsoid.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ellipticcyl.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/extrusion.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/fichera.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/frame.step +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/hinge.stl +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/lshape3d.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/manyholes.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/manyholes2.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/matrix.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/ortho.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/part1.stl +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/period.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/exportNeutral.py +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/mesh.py +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/py_tutorials/shaft.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/revolution.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/screw.step +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sculpture.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/shaft.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/shell.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sphere.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/sphereincube.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/square.in2d +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/squarecircle.in2d +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/squarehole.in2d +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/torus.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/trafo.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twobricks.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twocubes.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.data → netgen_mesher-6.2.2506.post48.dev0.data}/data/share/netgen/twocyl.geo +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/AUTHORS +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/LICENSE +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/WHEEL +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/entry_points.txt +0 -0
- {netgen_mesher-6.2.2504.post11.dev0.dist-info → netgen_mesher-6.2.2506.post48.dev0.dist-info}/top_level.txt +0 -0
netgen/include/pybind11/chrono.h
CHANGED
|
@@ -63,6 +63,9 @@ public:
|
|
|
63
63
|
get_duration(const std::chrono::duration<rep, period> &src) {
|
|
64
64
|
return src;
|
|
65
65
|
}
|
|
66
|
+
static const std::chrono::duration<rep, period> &
|
|
67
|
+
get_duration(const std::chrono::duration<rep, period> &&)
|
|
68
|
+
= delete;
|
|
66
69
|
|
|
67
70
|
// If this is a time_point get the time_since_epoch
|
|
68
71
|
template <typename Clock>
|
|
@@ -185,7 +188,7 @@ public:
|
|
|
185
188
|
using us_t = duration<int, std::micro>;
|
|
186
189
|
auto us = duration_cast<us_t>(src.time_since_epoch() % seconds(1));
|
|
187
190
|
if (us.count() < 0) {
|
|
188
|
-
us += seconds(1);
|
|
191
|
+
us += duration_cast<us_t>(seconds(1));
|
|
189
192
|
}
|
|
190
193
|
|
|
191
194
|
// Subtract microseconds BEFORE `system_clock::to_time_t`, because:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
NOTE
|
|
2
|
+
----
|
|
3
|
+
|
|
4
|
+
The C++ code here
|
|
5
|
+
|
|
6
|
+
** only depends on <Python.h> **
|
|
7
|
+
|
|
8
|
+
and nothing else.
|
|
9
|
+
|
|
10
|
+
DO NOT ADD CODE WITH OTHER EXTERNAL DEPENDENCIES TO THIS DIRECTORY.
|
|
11
|
+
|
|
12
|
+
Read on:
|
|
13
|
+
|
|
14
|
+
pybind11_conduit_v1.h — Type-safe interoperability between different
|
|
15
|
+
independent Python/C++ bindings systems.
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// Copyright (c) 2024 The pybind Community.
|
|
2
|
+
|
|
3
|
+
/* The pybind11_conduit_v1 feature enables type-safe interoperability between
|
|
4
|
+
|
|
5
|
+
* different independent Python/C++ bindings systems,
|
|
6
|
+
|
|
7
|
+
* including pybind11 versions with different PYBIND11_INTERNALS_VERSION's.
|
|
8
|
+
|
|
9
|
+
* NOTE: The conduit feature
|
|
10
|
+
only covers from-Python-to-C++ conversions, it
|
|
11
|
+
does not cover from-C++-to-Python conversions.
|
|
12
|
+
(For the latter, a different feature would have to be added.)
|
|
13
|
+
|
|
14
|
+
The naming of the feature is a bit misleading:
|
|
15
|
+
|
|
16
|
+
* The feature is in no way tied to pybind11 internals.
|
|
17
|
+
|
|
18
|
+
* It just happens to originate from pybind11 and currently still lives there.
|
|
19
|
+
|
|
20
|
+
* The only external dependency is <Python.h>.
|
|
21
|
+
|
|
22
|
+
The implementation is a VERY light-weight dependency. It is designed to be
|
|
23
|
+
compatible with any ISO C++11 (or higher) compiler, and does NOT require
|
|
24
|
+
C++ Exception Handling to be enabled.
|
|
25
|
+
|
|
26
|
+
Please see https://github.com/pybind/pybind11/pull/5296 for more background.
|
|
27
|
+
|
|
28
|
+
The implementation involves a
|
|
29
|
+
|
|
30
|
+
def _pybind11_conduit_v1_(
|
|
31
|
+
self,
|
|
32
|
+
pybind11_platform_abi_id: bytes,
|
|
33
|
+
cpp_type_info_capsule: capsule,
|
|
34
|
+
pointer_kind: bytes) -> capsule
|
|
35
|
+
|
|
36
|
+
method that is meant to be added to Python objects wrapping C++ objects
|
|
37
|
+
(e.g. pybind11::class_-wrapped types).
|
|
38
|
+
|
|
39
|
+
The design of the _pybind11_conduit_v1_ feature provides two layers of
|
|
40
|
+
protection against C++ ABI mismatches:
|
|
41
|
+
|
|
42
|
+
* The first and most important layer is that the pybind11_platform_abi_id's
|
|
43
|
+
must match between extensions. — This will never be perfect, but is the same
|
|
44
|
+
pragmatic approach used in pybind11 since 2017
|
|
45
|
+
(https://github.com/pybind/pybind11/commit/96997a4b9d4ec3d389a570604394af5d5eee2557,
|
|
46
|
+
PYBIND11_INTERNALS_ID).
|
|
47
|
+
|
|
48
|
+
* The second layer is that the typeid(std::type_info).name()'s must match
|
|
49
|
+
between extensions.
|
|
50
|
+
|
|
51
|
+
The implementation below (which is shorter than this comment!), serves as a
|
|
52
|
+
battle-tested specification. The main API is this one function:
|
|
53
|
+
|
|
54
|
+
auto *cpp_pointer = pybind11_conduit_v1::get_type_pointer_ephemeral<YourType>(py_obj);
|
|
55
|
+
|
|
56
|
+
It is meant to be a minimalistic reference implementation, intentionally
|
|
57
|
+
without comprehensive error reporting. It is expected that major bindings
|
|
58
|
+
systems will roll their own, compatible implementations, potentially with
|
|
59
|
+
system-specific error reporting. The essential specifications all bindings
|
|
60
|
+
systems need to agree on are merely:
|
|
61
|
+
|
|
62
|
+
* PYBIND11_PLATFORM_ABI_ID (const char* literal).
|
|
63
|
+
|
|
64
|
+
* The cpp_type_info capsule (see below: a void *ptr and a const char *name).
|
|
65
|
+
|
|
66
|
+
* The cpp_conduit capsule (see below: a void *ptr and a const char *name).
|
|
67
|
+
|
|
68
|
+
* "raw_pointer_ephemeral" means: the lifetime of the pointer is the lifetime
|
|
69
|
+
of the py_obj.
|
|
70
|
+
|
|
71
|
+
*/
|
|
72
|
+
|
|
73
|
+
// THIS MUST STAY AT THE TOP!
|
|
74
|
+
#include "pybind11_platform_abi_id.h"
|
|
75
|
+
|
|
76
|
+
#include <Python.h>
|
|
77
|
+
#include <typeinfo>
|
|
78
|
+
|
|
79
|
+
namespace pybind11_conduit_v1 {
|
|
80
|
+
|
|
81
|
+
inline void *get_raw_pointer_ephemeral(PyObject *py_obj, const std::type_info *cpp_type_info) {
|
|
82
|
+
PyObject *cpp_type_info_capsule
|
|
83
|
+
= PyCapsule_New(const_cast<void *>(static_cast<const void *>(cpp_type_info)),
|
|
84
|
+
typeid(std::type_info).name(),
|
|
85
|
+
nullptr);
|
|
86
|
+
if (cpp_type_info_capsule == nullptr) {
|
|
87
|
+
return nullptr;
|
|
88
|
+
}
|
|
89
|
+
PyObject *cpp_conduit = PyObject_CallMethod(py_obj,
|
|
90
|
+
"_pybind11_conduit_v1_",
|
|
91
|
+
"yOy",
|
|
92
|
+
PYBIND11_PLATFORM_ABI_ID,
|
|
93
|
+
cpp_type_info_capsule,
|
|
94
|
+
"raw_pointer_ephemeral");
|
|
95
|
+
Py_DECREF(cpp_type_info_capsule);
|
|
96
|
+
if (cpp_conduit == nullptr) {
|
|
97
|
+
return nullptr;
|
|
98
|
+
}
|
|
99
|
+
void *raw_ptr = PyCapsule_GetPointer(cpp_conduit, cpp_type_info->name());
|
|
100
|
+
Py_DECREF(cpp_conduit);
|
|
101
|
+
if (PyErr_Occurred()) {
|
|
102
|
+
return nullptr;
|
|
103
|
+
}
|
|
104
|
+
return raw_ptr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
template <typename T>
|
|
108
|
+
T *get_type_pointer_ephemeral(PyObject *py_obj) {
|
|
109
|
+
void *raw_ptr = get_raw_pointer_ephemeral(py_obj, &typeid(T));
|
|
110
|
+
if (raw_ptr == nullptr) {
|
|
111
|
+
return nullptr;
|
|
112
|
+
}
|
|
113
|
+
return static_cast<T *>(raw_ptr);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
} // namespace pybind11_conduit_v1
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 The pybind Community.
|
|
4
|
+
|
|
5
|
+
// To maximize reusability:
|
|
6
|
+
// DO NOT ADD CODE THAT REQUIRES C++ EXCEPTION HANDLING.
|
|
7
|
+
|
|
8
|
+
#include "wrap_include_python_h.h"
|
|
9
|
+
|
|
10
|
+
// Implementation details. DO NOT USE ELSEWHERE. (Unfortunately we cannot #undef them.)
|
|
11
|
+
// This is duplicated here to maximize portability.
|
|
12
|
+
#define PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x) #x
|
|
13
|
+
#define PYBIND11_PLATFORM_ABI_ID_TOSTRING(x) PYBIND11_PLATFORM_ABI_ID_STRINGIFY(x)
|
|
14
|
+
|
|
15
|
+
#ifdef PYBIND11_COMPILER_TYPE
|
|
16
|
+
// // To maintain backward compatibility (see PR #5439).
|
|
17
|
+
# define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE ""
|
|
18
|
+
#else
|
|
19
|
+
# define PYBIND11_COMPILER_TYPE_LEADING_UNDERSCORE "_"
|
|
20
|
+
# if defined(__MINGW32__)
|
|
21
|
+
# define PYBIND11_COMPILER_TYPE "mingw"
|
|
22
|
+
# elif defined(__CYGWIN__)
|
|
23
|
+
# define PYBIND11_COMPILER_TYPE "gcc_cygwin"
|
|
24
|
+
# elif defined(_MSC_VER)
|
|
25
|
+
# define PYBIND11_COMPILER_TYPE "msvc"
|
|
26
|
+
# elif defined(__clang__) || defined(__GNUC__)
|
|
27
|
+
# define PYBIND11_COMPILER_TYPE "system" // Assumed compatible with system compiler.
|
|
28
|
+
# else
|
|
29
|
+
# error "Unknown PYBIND11_COMPILER_TYPE: PLEASE REVISE THIS CODE."
|
|
30
|
+
# endif
|
|
31
|
+
#endif
|
|
32
|
+
|
|
33
|
+
// PR #5439 made this macro obsolete. However, there are many manipulations of this macro in the
|
|
34
|
+
// wild. Therefore, to maintain backward compatibility, it is kept around.
|
|
35
|
+
#ifndef PYBIND11_STDLIB
|
|
36
|
+
# define PYBIND11_STDLIB ""
|
|
37
|
+
#endif
|
|
38
|
+
|
|
39
|
+
#ifndef PYBIND11_BUILD_ABI
|
|
40
|
+
# if defined(_MSC_VER) // See PR #4953.
|
|
41
|
+
# if defined(_MT) && defined(_DLL) // Corresponding to CL command line options /MD or /MDd.
|
|
42
|
+
# if (_MSC_VER) / 100 == 19
|
|
43
|
+
# define PYBIND11_BUILD_ABI "_md_mscver19"
|
|
44
|
+
# else
|
|
45
|
+
# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
|
|
46
|
+
# endif
|
|
47
|
+
# elif defined(_MT) // Corresponding to CL command line options /MT or /MTd.
|
|
48
|
+
# define PYBIND11_BUILD_ABI "_mt_mscver" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_MSC_VER)
|
|
49
|
+
# else
|
|
50
|
+
# if (_MSC_VER) / 100 == 19
|
|
51
|
+
# define PYBIND11_BUILD_ABI "_none_mscver19"
|
|
52
|
+
# else
|
|
53
|
+
# error "Unknown major version for MSC_VER: PLEASE REVISE THIS CODE."
|
|
54
|
+
# endif
|
|
55
|
+
# endif
|
|
56
|
+
# elif defined(_LIBCPP_ABI_VERSION) // https://libcxx.llvm.org/DesignDocs/ABIVersioning.html
|
|
57
|
+
# define PYBIND11_BUILD_ABI \
|
|
58
|
+
"_libcpp_abi" PYBIND11_PLATFORM_ABI_ID_TOSTRING(_LIBCPP_ABI_VERSION)
|
|
59
|
+
# elif defined(_GLIBCXX_USE_CXX11_ABI) // See PR #5439.
|
|
60
|
+
# if defined(__NVCOMPILER)
|
|
61
|
+
// // Assume that NVHPC is in the 1xxx ABI family.
|
|
62
|
+
// // THIS ASSUMPTION IS NOT FUTURE PROOF but apparently the best we can do.
|
|
63
|
+
// // Please let us know if there is a way to validate the assumption here.
|
|
64
|
+
# elif !defined(__GXX_ABI_VERSION)
|
|
65
|
+
# error \
|
|
66
|
+
"Unknown platform or compiler (_GLIBCXX_USE_CXX11_ABI): PLEASE REVISE THIS CODE."
|
|
67
|
+
# endif
|
|
68
|
+
# if defined(__GXX_ABI_VERSION) && __GXX_ABI_VERSION < 1002 || __GXX_ABI_VERSION >= 2000
|
|
69
|
+
# error "Unknown platform or compiler (__GXX_ABI_VERSION): PLEASE REVISE THIS CODE."
|
|
70
|
+
# endif
|
|
71
|
+
# define PYBIND11_BUILD_ABI \
|
|
72
|
+
"_libstdcpp_gxx_abi_1xxx_use_cxx11_abi_" PYBIND11_PLATFORM_ABI_ID_TOSTRING( \
|
|
73
|
+
_GLIBCXX_USE_CXX11_ABI)
|
|
74
|
+
# else
|
|
75
|
+
# error "Unknown platform or compiler: PLEASE REVISE THIS CODE."
|
|
76
|
+
# endif
|
|
77
|
+
#endif
|
|
78
|
+
|
|
79
|
+
// On MSVC, debug and release builds are not ABI-compatible!
|
|
80
|
+
#if defined(_MSC_VER) && defined(_DEBUG)
|
|
81
|
+
# define PYBIND11_BUILD_TYPE "_debug"
|
|
82
|
+
#else
|
|
83
|
+
# define PYBIND11_BUILD_TYPE ""
|
|
84
|
+
#endif
|
|
85
|
+
|
|
86
|
+
#define PYBIND11_PLATFORM_ABI_ID \
|
|
87
|
+
PYBIND11_COMPILER_TYPE PYBIND11_STDLIB PYBIND11_BUILD_ABI PYBIND11_BUILD_TYPE
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
// Copyright (c) 2024 The pybind Community.
|
|
4
|
+
|
|
5
|
+
// STRONG REQUIREMENT:
|
|
6
|
+
// This header is a wrapper around `#include <Python.h>`, therefore it
|
|
7
|
+
// MUST BE INCLUDED BEFORE ANY STANDARD HEADERS are included.
|
|
8
|
+
// See also:
|
|
9
|
+
// https://docs.python.org/3/c-api/intro.html#include-files
|
|
10
|
+
// Quoting from there:
|
|
11
|
+
// Note: Since Python may define some pre-processor definitions which affect
|
|
12
|
+
// the standard headers on some systems, you must include Python.h before
|
|
13
|
+
// any standard headers are included.
|
|
14
|
+
|
|
15
|
+
// To maximize reusability:
|
|
16
|
+
// DO NOT ADD CODE THAT REQUIRES C++ EXCEPTION HANDLING.
|
|
17
|
+
|
|
18
|
+
// Disable linking to pythonX_d.lib on Windows in debug mode.
|
|
19
|
+
#if defined(_MSC_VER) && defined(_DEBUG) && !defined(Py_DEBUG)
|
|
20
|
+
// Workaround for a VS 2022 issue.
|
|
21
|
+
// See https://github.com/pybind/pybind11/pull/3497 for full context.
|
|
22
|
+
// NOTE: This workaround knowingly violates the Python.h include order
|
|
23
|
+
// requirement (see above).
|
|
24
|
+
# include <yvals.h>
|
|
25
|
+
# if _MSVC_STL_VERSION >= 143
|
|
26
|
+
# include <crtdefs.h>
|
|
27
|
+
# endif
|
|
28
|
+
# define PYBIND11_DEBUG_MARKER
|
|
29
|
+
# undef _DEBUG
|
|
30
|
+
#endif
|
|
31
|
+
|
|
32
|
+
// Don't let Python.h #define (v)snprintf as macro because they are implemented
|
|
33
|
+
// properly in Visual Studio since 2015.
|
|
34
|
+
#if defined(_MSC_VER)
|
|
35
|
+
# define HAVE_SNPRINTF 1
|
|
36
|
+
#endif
|
|
37
|
+
|
|
38
|
+
#if defined(_MSC_VER)
|
|
39
|
+
# pragma warning(push)
|
|
40
|
+
# pragma warning(disable : 4505)
|
|
41
|
+
// C4505: 'PySlice_GetIndicesEx': unreferenced local function has been removed
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
#include <Python.h>
|
|
45
|
+
#include <frameobject.h>
|
|
46
|
+
#include <pythread.h>
|
|
47
|
+
|
|
48
|
+
#if defined(_MSC_VER)
|
|
49
|
+
# pragma warning(pop)
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#if defined(PYBIND11_DEBUG_MARKER)
|
|
53
|
+
# define _DEBUG 1
|
|
54
|
+
# undef PYBIND11_DEBUG_MARKER
|
|
55
|
+
#endif
|
|
56
|
+
|
|
57
|
+
// Python #defines overrides on all sorts of core functions, which
|
|
58
|
+
// tends to wreak havok in C++ codebases that expect these to work
|
|
59
|
+
// like regular functions (potentially with several overloads).
|
|
60
|
+
#if defined(isalnum)
|
|
61
|
+
# undef isalnum
|
|
62
|
+
# undef isalpha
|
|
63
|
+
# undef islower
|
|
64
|
+
# undef isspace
|
|
65
|
+
# undef isupper
|
|
66
|
+
# undef tolower
|
|
67
|
+
# undef toupper
|
|
68
|
+
#endif
|
|
69
|
+
|
|
70
|
+
#if defined(copysign)
|
|
71
|
+
# undef copysign
|
|
72
|
+
#endif
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright (c) 2016-2025 The Pybind Development Team.
|
|
2
|
+
// All rights reserved. Use of this source code is governed by a
|
|
3
|
+
// BSD-style license that can be found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "pytypes.h"
|
|
8
|
+
|
|
9
|
+
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
|
10
|
+
|
|
11
|
+
/// This does not do anything if there's a GIL. On free-threaded Python,
|
|
12
|
+
/// it locks an object. This uses the CPython API, which has limits
|
|
13
|
+
class scoped_critical_section {
|
|
14
|
+
public:
|
|
15
|
+
#ifdef Py_GIL_DISABLED
|
|
16
|
+
explicit scoped_critical_section(handle obj1, handle obj2 = handle{}) {
|
|
17
|
+
if (obj1) {
|
|
18
|
+
if (obj2) {
|
|
19
|
+
PyCriticalSection2_Begin(§ion2, obj1.ptr(), obj2.ptr());
|
|
20
|
+
rank = 2;
|
|
21
|
+
} else {
|
|
22
|
+
PyCriticalSection_Begin(§ion, obj1.ptr());
|
|
23
|
+
rank = 1;
|
|
24
|
+
}
|
|
25
|
+
} else if (obj2) {
|
|
26
|
+
PyCriticalSection_Begin(§ion, obj2.ptr());
|
|
27
|
+
rank = 1;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
~scoped_critical_section() {
|
|
32
|
+
if (rank == 1) {
|
|
33
|
+
PyCriticalSection_End(§ion);
|
|
34
|
+
} else if (rank == 2) {
|
|
35
|
+
PyCriticalSection2_End(§ion2);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
#else
|
|
39
|
+
explicit scoped_critical_section(handle, handle = handle{}) {};
|
|
40
|
+
~scoped_critical_section() = default;
|
|
41
|
+
#endif
|
|
42
|
+
|
|
43
|
+
scoped_critical_section(const scoped_critical_section &) = delete;
|
|
44
|
+
scoped_critical_section &operator=(const scoped_critical_section &) = delete;
|
|
45
|
+
|
|
46
|
+
private:
|
|
47
|
+
#ifdef Py_GIL_DISABLED
|
|
48
|
+
int rank{0};
|
|
49
|
+
union {
|
|
50
|
+
PyCriticalSection section;
|
|
51
|
+
PyCriticalSection2 section2;
|
|
52
|
+
};
|
|
53
|
+
#endif
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|