|
164 | 164 | # endif
|
165 | 165 | #endif
|
166 | 166 |
|
167 |
| -#if !defined(PYBIND11_EXPORT_EXCEPTION) |
168 |
| -# if defined(__apple_build_version__) |
169 |
| -# define PYBIND11_EXPORT_EXCEPTION PYBIND11_EXPORT |
170 |
| -# else |
171 |
| -# define PYBIND11_EXPORT_EXCEPTION |
172 |
| -# endif |
173 |
| -#endif |
174 |
| - |
175 | 167 | // For CUDA, GCC7, GCC8:
|
176 | 168 | // PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
|
177 | 169 | // When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`.
|
@@ -299,7 +291,7 @@ PYBIND11_WARNING_DISABLE_MSVC(4505)
|
299 | 291 | # define PYBIND11_INTERNAL_NUMPY_1_ONLY_DETECTED
|
300 | 292 | #endif
|
301 | 293 |
|
302 |
| -#if defined(PYPY_VERSION) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT) |
| 294 | +#if (defined(PYPY_VERSION) || defined(GRAALVM_PYTHON)) && !defined(PYBIND11_SIMPLE_GIL_MANAGEMENT) |
303 | 295 | # define PYBIND11_SIMPLE_GIL_MANAGEMENT
|
304 | 296 | #endif
|
305 | 297 |
|
@@ -329,6 +321,17 @@ PYBIND11_WARNING_POP
|
329 | 321 | # endif
|
330 | 322 | #endif
|
331 | 323 |
|
| 324 | +// For libc++, the exceptions should be exported, |
| 325 | +// otherwise, the exception translation would be incorrect. |
| 326 | +// IMPORTANT: This code block must stay BELOW the #include <exception> above (see PR #5390). |
| 327 | +#if !defined(PYBIND11_EXPORT_EXCEPTION) |
| 328 | +# if defined(_LIBCPP_EXCEPTION) |
| 329 | +# define PYBIND11_EXPORT_EXCEPTION PYBIND11_EXPORT |
| 330 | +# else |
| 331 | +# define PYBIND11_EXPORT_EXCEPTION |
| 332 | +# endif |
| 333 | +#endif |
| 334 | + |
332 | 335 | // Must be after including <version> or one of the other headers specified by the standard
|
333 | 336 | #if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L
|
334 | 337 | # define PYBIND11_HAS_U8STRING
|
@@ -387,6 +390,20 @@ PYBIND11_WARNING_POP
|
387 | 390 | #define PYBIND11_CONCAT(first, second) first##second
|
388 | 391 | #define PYBIND11_ENSURE_INTERNALS_READY pybind11::detail::get_internals();
|
389 | 392 |
|
| 393 | +#if !defined(GRAALVM_PYTHON) |
| 394 | +# define PYBIND11_PYCFUNCTION_GET_DOC(func) ((func)->m_ml->ml_doc) |
| 395 | +# define PYBIND11_PYCFUNCTION_SET_DOC(func, doc) \ |
| 396 | + do { \ |
| 397 | + (func)->m_ml->ml_doc = (doc); \ |
| 398 | + } while (0) |
| 399 | +#else |
| 400 | +# define PYBIND11_PYCFUNCTION_GET_DOC(func) (GraalPyCFunction_GetDoc((PyObject *) (func))) |
| 401 | +# define PYBIND11_PYCFUNCTION_SET_DOC(func, doc) \ |
| 402 | + do { \ |
| 403 | + GraalPyCFunction_SetDoc((PyObject *) (func), (doc)); \ |
| 404 | + } while (0) |
| 405 | +#endif |
| 406 | + |
390 | 407 | #define PYBIND11_CHECK_PYTHON_VERSION \
|
391 | 408 | { \
|
392 | 409 | const char *compiled_ver \
|
|
0 commit comments