|
220 | 220 | #define PYBIND11_BYTES_SIZE PyBytes_Size |
221 | 221 | #define PYBIND11_LONG_CHECK(o) PyLong_Check(o) |
222 | 222 | #define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o) |
223 | | -#define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) o) |
224 | | -#define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) o) |
| 223 | +#define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) (o)) |
| 224 | +#define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) (o)) |
225 | 225 | #define PYBIND11_BYTES_NAME "bytes" |
226 | 226 | #define PYBIND11_STRING_NAME "str" |
227 | 227 | #define PYBIND11_SLICE_OBJECT PyObject |
@@ -356,24 +356,23 @@ extern "C" { |
356 | 356 | }); |
357 | 357 | } |
358 | 358 | \endrst */ |
359 | | -#define PYBIND11_MODULE(name, variable) \ |
360 | | - static ::pybind11::module_::module_def \ |
361 | | - PYBIND11_CONCAT(pybind11_module_def_, name) PYBIND11_MAYBE_UNUSED; \ |
362 | | - PYBIND11_MAYBE_UNUSED \ |
363 | | - static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \ |
364 | | - PYBIND11_PLUGIN_IMPL(name) { \ |
365 | | - PYBIND11_CHECK_PYTHON_VERSION \ |
366 | | - PYBIND11_ENSURE_INTERNALS_READY \ |
367 | | - auto m = ::pybind11::module_::create_extension_module( \ |
368 | | - PYBIND11_TOSTRING(name), nullptr, \ |
369 | | - &PYBIND11_CONCAT(pybind11_module_def_, name)); \ |
370 | | - try { \ |
371 | | - PYBIND11_CONCAT(pybind11_init_, name)(m); \ |
372 | | - return m.ptr(); \ |
373 | | - } PYBIND11_CATCH_INIT_EXCEPTIONS \ |
374 | | - } \ |
375 | | - void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &variable) |
376 | | - |
| 359 | +#define PYBIND11_MODULE(name, variable) \ |
| 360 | + static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \ |
| 361 | + PYBIND11_MAYBE_UNUSED; \ |
| 362 | + PYBIND11_MAYBE_UNUSED \ |
| 363 | + static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \ |
| 364 | + PYBIND11_PLUGIN_IMPL(name) { \ |
| 365 | + PYBIND11_CHECK_PYTHON_VERSION \ |
| 366 | + PYBIND11_ENSURE_INTERNALS_READY \ |
| 367 | + auto m = ::pybind11::module_::create_extension_module( \ |
| 368 | + PYBIND11_TOSTRING(name), nullptr, &PYBIND11_CONCAT(pybind11_module_def_, name)); \ |
| 369 | + try { \ |
| 370 | + PYBIND11_CONCAT(pybind11_init_, name)(m); \ |
| 371 | + return m.ptr(); \ |
| 372 | + } \ |
| 373 | + PYBIND11_CATCH_INIT_EXCEPTIONS \ |
| 374 | + } \ |
| 375 | + void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ & (variable)) |
377 | 376 |
|
378 | 377 | PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE) |
379 | 378 |
|
|
0 commit comments