mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-11 08:03:55 +00:00
Automatic part of merging branch 'master' into sh_merge_master.
The only manual intervention was to remove the merge conflict markers in pybind11.h. TODO in separate commit: complete removal of the obsolete detail/pragma_warning_block.h.
This commit is contained in:
commit
8865d28317
@ -1,6 +1,7 @@
|
||||
FormatStyle: file
|
||||
|
||||
Checks: '
|
||||
*bugprone*,
|
||||
cppcoreguidelines-init-variables,
|
||||
clang-analyzer-optin.cplusplus.VirtualCall,
|
||||
llvm-namespace-comment,
|
||||
@ -43,6 +44,9 @@ readability-static-accessed-through-instance,
|
||||
readability-static-definition-in-anonymous-namespace,
|
||||
readability-string-compare,
|
||||
readability-uniqueptr-delete-release,
|
||||
-bugprone-exception-escape,
|
||||
-bugprone-reserved-identifier,
|
||||
-bugprone-unused-raii,
|
||||
'
|
||||
|
||||
CheckOptions:
|
||||
|
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -76,7 +76,7 @@ jobs:
|
||||
run: brew install boost
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Cache wheels
|
||||
if: runner.os == 'macOS'
|
||||
@ -194,7 +194,7 @@ jobs:
|
||||
debug: ${{ matrix.python-debug }}
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Valgrind cache
|
||||
if: matrix.valgrind
|
||||
@ -446,7 +446,7 @@ jobs:
|
||||
run: python3 -m pip install --upgrade pip
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
@ -595,13 +595,13 @@ jobs:
|
||||
|
||||
- name: VAR_BUILD_TYPE 7
|
||||
if: matrix.centos == 7
|
||||
run: echo Release > VAR_BUILD_TYPE
|
||||
run: echo MinSizeRel > VAR_BUILD_TYPE
|
||||
|
||||
# Using Debug to avoid segfault that appeared around 2021-06-04,
|
||||
# Using Release to avoid segfault that appeared around 2021-06-04,
|
||||
# apparently when the gcc version changed from 8.3 to 8.4.
|
||||
- name: VAR_BUILD_TYPE 8
|
||||
if: matrix.centos == 8
|
||||
run: echo Debug > VAR_BUILD_TYPE
|
||||
run: echo Release > VAR_BUILD_TYPE
|
||||
|
||||
- name: Configure
|
||||
shell: bash
|
||||
@ -665,7 +665,7 @@ jobs:
|
||||
-DPYTHON_EXECUTABLE=$(python3 -c "import sys; print(sys.executable)")
|
||||
working-directory: /build-tests
|
||||
|
||||
- name: Run tests
|
||||
- name: Python tests
|
||||
run: make pytest -j 2
|
||||
working-directory: /build-tests
|
||||
|
||||
@ -739,7 +739,7 @@ jobs:
|
||||
architecture: x86
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Prepare MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1.9.0
|
||||
@ -761,7 +761,7 @@ jobs:
|
||||
- name: Build C++11
|
||||
run: cmake --build build -j 2
|
||||
|
||||
- name: Run tests
|
||||
- name: Python tests
|
||||
run: cmake --build build -t pytest
|
||||
|
||||
win32-msvc2015:
|
||||
@ -785,7 +785,7 @@ jobs:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Prepare MSVC
|
||||
uses: ilammy/msvc-dev-cmd@v1.9.0
|
||||
@ -839,7 +839,7 @@ jobs:
|
||||
python-version: ${{ matrix.python }}
|
||||
|
||||
- name: Update CMake
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
|
||||
- name: Prepare env
|
||||
run: python -m pip install -r tests/requirements.txt --prefer-binary
|
||||
|
2
.github/workflows/configure.yml
vendored
2
.github/workflows/configure.yml
vendored
@ -56,7 +56,7 @@ jobs:
|
||||
# An action for adding a specific version of CMake:
|
||||
# https://github.com/jwlawson/actions-setup-cmake
|
||||
- name: Setup CMake ${{ matrix.cmake }}
|
||||
uses: jwlawson/actions-setup-cmake@v1.9
|
||||
uses: jwlawson/actions-setup-cmake@v1.10
|
||||
with:
|
||||
cmake-version: ${{ matrix.cmake }}
|
||||
|
||||
|
@ -32,10 +32,15 @@ repos:
|
||||
exclude: ^noxfile.py$
|
||||
|
||||
- repo: https://github.com/asottile/pyupgrade
|
||||
rev: v2.23.0
|
||||
rev: v2.23.3
|
||||
hooks:
|
||||
- id: pyupgrade
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.9.3
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
# Black, the code formatter, natively supports pre-commit
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 21.7b0
|
||||
|
@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import random
|
||||
import os
|
||||
import time
|
||||
import datetime as dt
|
||||
import os
|
||||
import random
|
||||
import time
|
||||
|
||||
nfns = 4 # Functions per class
|
||||
nargs = 4 # Arguments per function
|
||||
|
@ -6,9 +6,54 @@ Changelog
|
||||
Starting with version 1.8.0, pybind11 releases use a `semantic versioning
|
||||
<http://semver.org>`_ policy.
|
||||
|
||||
Next version (WIP)
|
||||
------------------
|
||||
v2.8.0 (WIP)
|
||||
------------
|
||||
|
||||
* Allow exception translators to be optionally registered local to a module
|
||||
instead of applying globally across all pybind11 modules. Use
|
||||
``register_local_exception_translator(ExceptionTranslator&& translator)``
|
||||
instead of ``register_exception_translator(ExceptionTranslator&&
|
||||
translator)`` to keep your exception remapping code local to the module.
|
||||
`#2650 <https://github.com/pybind/pybind11/pull/2650>`_
|
||||
|
||||
v2.7.1 (Aug 3, 2021)
|
||||
---------------------
|
||||
|
||||
Minor missing functionality added:
|
||||
|
||||
* Allow Python builtins to be used as callbacks in CPython.
|
||||
`#1413 <https://github.com/pybind/pybind11/pull/1413>`_
|
||||
|
||||
Bug fixes:
|
||||
|
||||
* Fix regression in CMake Python package config: improper use of absolute path.
|
||||
`#3144 <https://github.com/pybind/pybind11/pull/3144>`_
|
||||
|
||||
* Fix Mingw64 and add to the CI testing matrix.
|
||||
`#3132 <https://github.com/pybind/pybind11/pull/3132>`_
|
||||
|
||||
* Specified UTF8-encoding in setup.py calls of open().
|
||||
`#3137 <https://github.com/pybind/pybind11/pull/3137>`_
|
||||
|
||||
* Add clang-tidy-readability rules to make boolean casts explicit improving
|
||||
code readability. Also enabled other misc and readability clang-tidy checks.
|
||||
`#3148 <https://github.com/pybind/pybind11/pull/3148>`_
|
||||
|
||||
* Move object in ``.pop()`` for list.
|
||||
`#3116 <https://github.com/pybind/pybind11/pull/3116>`_
|
||||
|
||||
Backend and tidying up:
|
||||
|
||||
* Removed and fixed warning suppressions.
|
||||
`#3127 <https://github.com/pybind/pybind11/pull/3127>`_
|
||||
`#3129 <https://github.com/pybind/pybind11/pull/3129>`_
|
||||
`#3135 <https://github.com/pybind/pybind11/pull/3135>`_
|
||||
`#3141 <https://github.com/pybind/pybind11/pull/3141>`_
|
||||
`#3142 <https://github.com/pybind/pybind11/pull/3142>`_
|
||||
`#3150 <https://github.com/pybind/pybind11/pull/3150>`_
|
||||
`#3152 <https://github.com/pybind/pybind11/pull/3152>`_
|
||||
`#3160 <https://github.com/pybind/pybind11/pull/3160>`_
|
||||
`#3161 <https://github.com/pybind/pybind11/pull/3161>`_
|
||||
|
||||
|
||||
v2.7.0 (Jul 16, 2021)
|
||||
|
@ -13,12 +13,12 @@
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
DIR = Path(__file__).parent.resolve()
|
||||
|
||||
|
@ -124,7 +124,7 @@ enum op_id : int;
|
||||
enum op_type : int;
|
||||
struct undefined_t;
|
||||
template <op_id id, op_type ot, typename L = undefined_t, typename R = undefined_t> struct op_;
|
||||
inline void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret);
|
||||
void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret);
|
||||
|
||||
/// Internal data structure which holds metadata about a keyword argument
|
||||
struct argument_record {
|
||||
@ -517,23 +517,30 @@ template <size_t Nurse, size_t Patient> struct process_attribute<keep_alive<Nurs
|
||||
template <typename... Args> struct process_attributes {
|
||||
static void init(const Args&... args, function_record *r) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(r);
|
||||
int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::init(args, r), 0) ... };
|
||||
ignore_unused(unused);
|
||||
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(r);
|
||||
using expander = int[];
|
||||
(void) expander{
|
||||
0, ((void) process_attribute<typename std::decay<Args>::type>::init(args, r), 0)...};
|
||||
}
|
||||
static void init(const Args&... args, type_record *r) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(r);
|
||||
int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::init(args, r), 0) ... };
|
||||
ignore_unused(unused);
|
||||
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(r);
|
||||
using expander = int[];
|
||||
(void) expander{0,
|
||||
(process_attribute<typename std::decay<Args>::type>::init(args, r), 0)...};
|
||||
}
|
||||
static void precall(function_call &call) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(call);
|
||||
int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::precall(call), 0) ... };
|
||||
ignore_unused(unused);
|
||||
using expander = int[];
|
||||
(void) expander{0,
|
||||
(process_attribute<typename std::decay<Args>::type>::precall(call), 0)...};
|
||||
}
|
||||
static void postcall(function_call &call, handle fn_ret) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(call, fn_ret);
|
||||
int unused[] = { 0, (process_attribute<typename std::decay<Args>::type>::postcall(call, fn_ret), 0) ... };
|
||||
ignore_unused(unused);
|
||||
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(fn_ret);
|
||||
using expander = int[];
|
||||
(void) expander{
|
||||
0, (process_attribute<typename std::decay<Args>::type>::postcall(call, fn_ret), 0)...};
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -124,9 +124,9 @@ public:
|
||||
} \
|
||||
return cast(*src, policy, parent); \
|
||||
} \
|
||||
operator type *() { return &value; } \
|
||||
operator type &() { return value; } \
|
||||
operator type &&() && { return std::move(value); } \
|
||||
operator type *() { return &value; } /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
operator type &() { return value; } /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
operator type &&() && { return std::move(value); } /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
template <typename T_> \
|
||||
using cast_op_type = pybind11::detail::movable_cast_op_type<T_>
|
||||
|
||||
@ -167,9 +167,8 @@ public:
|
||||
py_value = (py_type) PyFloat_AsDouble(src.ptr());
|
||||
else
|
||||
return false;
|
||||
} else if (PyFloat_Check(src.ptr())) {
|
||||
return false;
|
||||
} else if (!convert && !PYBIND11_LONG_CHECK(src.ptr()) && !index_check(src.ptr())) {
|
||||
} else if (PyFloat_Check(src.ptr())
|
||||
|| (!convert && !PYBIND11_LONG_CHECK(src.ptr()) && !index_check(src.ptr()))) {
|
||||
return false;
|
||||
} else {
|
||||
handle src_or_index = src;
|
||||
@ -632,6 +631,7 @@ protected:
|
||||
template <typename T, size_t... Is>
|
||||
static handle cast_impl(T &&src, return_value_policy policy, handle parent, index_sequence<Is...>) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(src, policy, parent);
|
||||
PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(policy, parent);
|
||||
std::array<object, size> entries{{
|
||||
reinterpret_steal<object>(make_caster<Ts>::cast(std::get<Is>(std::forward<T>(src)), policy, parent))...
|
||||
}};
|
||||
@ -1263,8 +1263,8 @@ public:
|
||||
// Tuples aren't (easily) resizable so a list is needed for collection,
|
||||
// but the actual function call strictly requires a tuple.
|
||||
auto args_list = list();
|
||||
int _[] = { 0, (process(args_list, std::forward<Ts>(values)), 0)... };
|
||||
ignore_unused(_);
|
||||
using expander = int[];
|
||||
(void) expander{0, (process(args_list, std::forward<Ts>(values)), 0)...};
|
||||
|
||||
m_args = std::move(args_list);
|
||||
}
|
||||
|
@ -10,12 +10,12 @@
|
||||
#pragma once
|
||||
|
||||
#define PYBIND11_VERSION_MAJOR 2
|
||||
#define PYBIND11_VERSION_MINOR 7
|
||||
#define PYBIND11_VERSION_PATCH 1.dev1
|
||||
#define PYBIND11_VERSION_MINOR 8
|
||||
#define PYBIND11_VERSION_PATCH 0.dev1
|
||||
|
||||
// Similar to Python's convention: https://docs.python.org/3/c-api/apiabiversion.html
|
||||
// Additional convention: 0xD = dev
|
||||
#define PYBIND11_VERSION_HEX 0x020701D1
|
||||
#define PYBIND11_VERSION_HEX 0x020800D1
|
||||
|
||||
#define PYBIND11_NAMESPACE_BEGIN(name) namespace name {
|
||||
#define PYBIND11_NAMESPACE_END(name) }
|
||||
@ -99,10 +99,26 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define PYBIND11_NOINLINE __declspec(noinline)
|
||||
// For CUDA, GCC7, GCC8:
|
||||
// PYBIND11_NOINLINE_FORCED is incompatible with `-Wattributes -Werror`.
|
||||
// When defining PYBIND11_NOINLINE_FORCED, it is best to also use `-Wno-attributes`.
|
||||
// However, the measured shared-library size saving when using noinline are only
|
||||
// 1.7% for CUDA, -0.2% for GCC7, and 0.0% for GCC8 (using -DCMAKE_BUILD_TYPE=MinSizeRel,
|
||||
// the default under pybind11/tests).
|
||||
#if !defined(PYBIND11_NOINLINE_FORCED) && \
|
||||
(defined(__CUDACC__) || (defined(__GNUC__) && (__GNUC__ == 7 || __GNUC__ == 8)))
|
||||
# define PYBIND11_NOINLINE_DISABLED
|
||||
#endif
|
||||
|
||||
// The PYBIND11_NOINLINE macro is for function DEFINITIONS.
|
||||
// In contrast, FORWARD DECLARATIONS should never use this macro:
|
||||
// https://stackoverflow.com/questions/9317473/forward-declaration-of-inline-functions
|
||||
#if defined(PYBIND11_NOINLINE_DISABLED) // Option for maximum portability and experimentation.
|
||||
# define PYBIND11_NOINLINE inline
|
||||
#elif defined(_MSC_VER)
|
||||
# define PYBIND11_NOINLINE __declspec(noinline) inline
|
||||
#else
|
||||
# define PYBIND11_NOINLINE __attribute__ ((noinline))
|
||||
# define PYBIND11_NOINLINE __attribute__ ((noinline)) inline
|
||||
#endif
|
||||
|
||||
#if defined(__MINGW32__)
|
||||
@ -220,8 +236,8 @@
|
||||
#define PYBIND11_BYTES_SIZE PyBytes_Size
|
||||
#define PYBIND11_LONG_CHECK(o) PyLong_Check(o)
|
||||
#define PYBIND11_LONG_AS_LONGLONG(o) PyLong_AsLongLong(o)
|
||||
#define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) o)
|
||||
#define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) o)
|
||||
#define PYBIND11_LONG_FROM_SIGNED(o) PyLong_FromSsize_t((ssize_t) (o))
|
||||
#define PYBIND11_LONG_FROM_UNSIGNED(o) PyLong_FromSize_t((size_t) (o))
|
||||
#define PYBIND11_BYTES_NAME "bytes"
|
||||
#define PYBIND11_STRING_NAME "str"
|
||||
#define PYBIND11_SLICE_OBJECT PyObject
|
||||
@ -356,24 +372,23 @@ extern "C" {
|
||||
});
|
||||
}
|
||||
\endrst */
|
||||
#define PYBIND11_MODULE(name, variable) \
|
||||
static ::pybind11::module_::module_def \
|
||||
PYBIND11_CONCAT(pybind11_module_def_, name) PYBIND11_MAYBE_UNUSED; \
|
||||
PYBIND11_MAYBE_UNUSED \
|
||||
static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
|
||||
PYBIND11_PLUGIN_IMPL(name) { \
|
||||
PYBIND11_CHECK_PYTHON_VERSION \
|
||||
PYBIND11_ENSURE_INTERNALS_READY \
|
||||
auto m = ::pybind11::module_::create_extension_module( \
|
||||
PYBIND11_TOSTRING(name), nullptr, \
|
||||
&PYBIND11_CONCAT(pybind11_module_def_, name)); \
|
||||
try { \
|
||||
PYBIND11_CONCAT(pybind11_init_, name)(m); \
|
||||
return m.ptr(); \
|
||||
} PYBIND11_CATCH_INIT_EXCEPTIONS \
|
||||
} \
|
||||
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &variable)
|
||||
|
||||
#define PYBIND11_MODULE(name, variable) \
|
||||
static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name) \
|
||||
PYBIND11_MAYBE_UNUSED; \
|
||||
PYBIND11_MAYBE_UNUSED \
|
||||
static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
|
||||
PYBIND11_PLUGIN_IMPL(name) { \
|
||||
PYBIND11_CHECK_PYTHON_VERSION \
|
||||
PYBIND11_ENSURE_INTERNALS_READY \
|
||||
auto m = ::pybind11::module_::create_extension_module( \
|
||||
PYBIND11_TOSTRING(name), nullptr, &PYBIND11_CONCAT(pybind11_module_def_, name)); \
|
||||
try { \
|
||||
PYBIND11_CONCAT(pybind11_init_, name)(m); \
|
||||
return m.ptr(); \
|
||||
} \
|
||||
PYBIND11_CATCH_INIT_EXCEPTIONS \
|
||||
} \
|
||||
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ & (variable))
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||
|
||||
@ -735,9 +750,6 @@ using function_signature_t = conditional_t<
|
||||
template <typename T> using is_lambda = satisfies_none_of<remove_reference_t<T>,
|
||||
std::is_function, std::is_pointer, std::is_member_pointer>;
|
||||
|
||||
/// Ignore that a variable is unused in compiler warnings
|
||||
inline void ignore_unused(const int *) { }
|
||||
|
||||
// [workaround(intel)] Internal error on fold expression
|
||||
/// Apply a function over each element of a parameter pack
|
||||
#if defined(__cpp_fold_expressions) && !defined(__INTEL_COMPILER)
|
||||
@ -782,8 +794,8 @@ PYBIND11_RUNTIME_EXCEPTION(import_error, PyExc_ImportError)
|
||||
PYBIND11_RUNTIME_EXCEPTION(cast_error, PyExc_RuntimeError) /// Thrown when pybind11::cast or handle::call fail due to a type casting error
|
||||
PYBIND11_RUNTIME_EXCEPTION(reference_cast_error, PyExc_RuntimeError) /// Used internally
|
||||
|
||||
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const char *reason) { throw std::runtime_error(reason); }
|
||||
[[noreturn]] PYBIND11_NOINLINE inline void pybind11_fail(const std::string &reason) { throw std::runtime_error(reason); }
|
||||
[[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const char *reason) { throw std::runtime_error(reason); }
|
||||
[[noreturn]] PYBIND11_NOINLINE void pybind11_fail(const std::string &reason) { throw std::runtime_error(reason); }
|
||||
|
||||
template <typename T, typename SFINAE = void> struct format_descriptor { };
|
||||
|
||||
@ -928,19 +940,29 @@ inline static std::shared_ptr<T> try_get_shared_from_this(std::enable_shared_fro
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1916
|
||||
|
||||
// warning C4100: Unreferenced formal parameter
|
||||
// For silencing "unused" compiler warnings in special situations.
|
||||
template <typename... Args>
|
||||
inline constexpr void workaround_incorrect_msvc_c4100(Args &&...) {}
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER < 1920 // MSVC 2017
|
||||
constexpr
|
||||
#endif
|
||||
inline void silence_unused_warnings(Args &&...) {}
|
||||
|
||||
// MSVC warning C4100: Unreferenced formal parameter
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1916
|
||||
# define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...) \
|
||||
detail::workaround_incorrect_msvc_c4100(__VA_ARGS__)
|
||||
|
||||
detail::silence_unused_warnings(__VA_ARGS__)
|
||||
#else
|
||||
# define PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(...)
|
||||
#endif
|
||||
|
||||
// GCC -Wunused-but-set-parameter All GCC versions (as of July 2021).
|
||||
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
# define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...) \
|
||||
detail::silence_unused_warnings(__VA_ARGS__)
|
||||
#else
|
||||
# define PYBIND11_WORKAROUND_INCORRECT_GCC_UNUSED_BUT_SET_PARAMETER(...)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) // All versions (as of July 2021).
|
||||
|
||||
// warning C4127: Conditional expression is constant
|
||||
|
@ -264,7 +264,7 @@ inline void translate_local_exception(std::exception_ptr p) {
|
||||
#endif
|
||||
|
||||
/// Return a reference to the current `internals` data
|
||||
PYBIND11_NOINLINE inline internals &get_internals() {
|
||||
PYBIND11_NOINLINE internals &get_internals() {
|
||||
auto **&internals_pp = get_internals_pp();
|
||||
if (internals_pp && *internals_pp)
|
||||
return **internals_pp;
|
||||
@ -359,14 +359,14 @@ PYBIND11_NAMESPACE_END(detail)
|
||||
/// Returns a named pointer that is shared among all extension modules (using the same
|
||||
/// pybind11 version) running in the current interpreter. Names starting with underscores
|
||||
/// are reserved for internal usage. Returns `nullptr` if no matching entry was found.
|
||||
inline PYBIND11_NOINLINE void *get_shared_data(const std::string &name) {
|
||||
PYBIND11_NOINLINE void *get_shared_data(const std::string &name) {
|
||||
auto &internals = detail::get_internals();
|
||||
auto it = internals.shared_data.find(name);
|
||||
return it != internals.shared_data.end() ? it->second : nullptr;
|
||||
}
|
||||
|
||||
/// Set the shared data that can be later recovered by `get_shared_data()`.
|
||||
inline PYBIND11_NOINLINE void *set_shared_data(const std::string &name, void *data) {
|
||||
PYBIND11_NOINLINE void *set_shared_data(const std::string &name, void *data) {
|
||||
detail::get_internals().shared_data[name] = data;
|
||||
return data;
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ public:
|
||||
inline std::pair<decltype(internals::registered_types_py)::iterator, bool> all_type_info_get_cache(PyTypeObject *type);
|
||||
|
||||
// Populates a just-created cache entry.
|
||||
PYBIND11_NOINLINE inline void all_type_info_populate(PyTypeObject *t, std::vector<type_info *> &bases) {
|
||||
PYBIND11_NOINLINE void all_type_info_populate(PyTypeObject *t, std::vector<type_info *> &bases) {
|
||||
std::vector<PyTypeObject *> check;
|
||||
for (handle parent : reinterpret_borrow<tuple>(t->tp_bases))
|
||||
check.push_back((PyTypeObject *) parent.ptr());
|
||||
@ -150,7 +150,7 @@ inline const std::vector<detail::type_info *> &all_type_info(PyTypeObject *type)
|
||||
* ancestors are pybind11-registered. Throws an exception if there are multiple bases--use
|
||||
* `all_type_info` instead if you want to support multiple bases.
|
||||
*/
|
||||
PYBIND11_NOINLINE inline detail::type_info* get_type_info(PyTypeObject *type) {
|
||||
PYBIND11_NOINLINE detail::type_info* get_type_info(PyTypeObject *type) {
|
||||
auto &bases = all_type_info(type);
|
||||
if (bases.empty())
|
||||
return nullptr;
|
||||
@ -176,7 +176,7 @@ inline detail::type_info *get_global_type_info(const std::type_index &tp) {
|
||||
}
|
||||
|
||||
/// Return the type info for a given C++ type; on lookup failure can either throw or return nullptr.
|
||||
PYBIND11_NOINLINE inline detail::type_info *get_type_info(const std::type_index &tp,
|
||||
PYBIND11_NOINLINE detail::type_info *get_type_info(const std::type_index &tp,
|
||||
bool throw_if_missing = false) {
|
||||
if (auto ltype = get_local_type_info(tp))
|
||||
return ltype;
|
||||
@ -191,13 +191,13 @@ PYBIND11_NOINLINE inline detail::type_info *get_type_info(const std::type_index
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline handle get_type_handle(const std::type_info &tp, bool throw_if_missing) {
|
||||
PYBIND11_NOINLINE handle get_type_handle(const std::type_info &tp, bool throw_if_missing) {
|
||||
detail::type_info *type_info = get_type_info(tp, throw_if_missing);
|
||||
return handle(type_info ? ((PyObject *) type_info->type) : nullptr);
|
||||
}
|
||||
|
||||
// Searches the inheritance graph for a registered Python instance, using all_type_info().
|
||||
PYBIND11_NOINLINE inline handle find_registered_python_instance(void *src,
|
||||
PYBIND11_NOINLINE handle find_registered_python_instance(void *src,
|
||||
const detail::type_info *tinfo) {
|
||||
auto it_instances = get_internals().registered_instances.equal_range(src);
|
||||
for (auto it_i = it_instances.first; it_i != it_instances.second; ++it_i) {
|
||||
@ -325,7 +325,7 @@ public:
|
||||
* The returned object should be short-lived: in particular, it must not outlive the called-upon
|
||||
* instance.
|
||||
*/
|
||||
PYBIND11_NOINLINE inline value_and_holder instance::get_value_and_holder(const type_info *find_type /*= nullptr default in common.h*/, bool throw_if_missing /*= true in common.h*/) {
|
||||
PYBIND11_NOINLINE value_and_holder instance::get_value_and_holder(const type_info *find_type /*= nullptr default in common.h*/, bool throw_if_missing /*= true in common.h*/) {
|
||||
// Optimize common case:
|
||||
if (!find_type || Py_TYPE(this) == find_type->type)
|
||||
return value_and_holder(this, find_type, 0, 0);
|
||||
@ -349,7 +349,7 @@ PYBIND11_NOINLINE inline value_and_holder instance::get_value_and_holder(const t
|
||||
#endif
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline void instance::allocate_layout() {
|
||||
PYBIND11_NOINLINE void instance::allocate_layout() {
|
||||
auto &tinfo = all_type_info(Py_TYPE(this));
|
||||
|
||||
const size_t n_types = tinfo.size();
|
||||
@ -397,19 +397,19 @@ PYBIND11_NOINLINE inline void instance::allocate_layout() {
|
||||
owned = true;
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline void instance::deallocate_layout() const {
|
||||
PYBIND11_NOINLINE void instance::deallocate_layout() const {
|
||||
if (!simple_layout)
|
||||
PyMem_Free(nonsimple.values_and_holders);
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline bool isinstance_generic(handle obj, const std::type_info &tp) {
|
||||
PYBIND11_NOINLINE bool isinstance_generic(handle obj, const std::type_info &tp) {
|
||||
handle type = detail::get_type_handle(tp, false);
|
||||
if (!type)
|
||||
return false;
|
||||
return isinstance(obj, type);
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline std::string error_string() {
|
||||
PYBIND11_NOINLINE std::string error_string() {
|
||||
if (!PyErr_Occurred()) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Unknown internal error occurred");
|
||||
return "Unknown internal error occurred";
|
||||
@ -456,7 +456,7 @@ PYBIND11_NOINLINE inline std::string error_string() {
|
||||
return errorString;
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline handle get_object_handle(const void *ptr, const detail::type_info *type ) {
|
||||
PYBIND11_NOINLINE handle get_object_handle(const void *ptr, const detail::type_info *type ) {
|
||||
auto &instances = get_internals().registered_instances;
|
||||
auto range = instances.equal_range(ptr);
|
||||
for (auto it = range.first; it != range.second; ++it) {
|
||||
@ -483,7 +483,7 @@ inline PyThreadState *get_thread_state_unchecked() {
|
||||
}
|
||||
|
||||
// Forward declarations
|
||||
inline void keep_alive_impl(handle nurse, handle patient);
|
||||
void keep_alive_impl(handle nurse, handle patient);
|
||||
inline PyObject *make_new_instance(PyTypeObject *type);
|
||||
|
||||
class type_caster_generic {
|
||||
@ -927,18 +927,17 @@ protected:
|
||||
using Constructor = void *(*)(const void *);
|
||||
|
||||
/* Only enabled when the types are {copy,move}-constructible *and* when the type
|
||||
does not have a private operator new implementation. */
|
||||
does not have a private operator new implementation. A comma operator is used in the decltype
|
||||
argument to apply SFINAE to the public copy/move constructors.*/
|
||||
template <typename T, typename = enable_if_t<is_copy_constructible<T>::value>>
|
||||
static auto make_copy_constructor(const T *x) -> decltype(new T(*x), Constructor{}) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(x);
|
||||
static auto make_copy_constructor(const T *) -> decltype(new T(std::declval<const T>()), Constructor{}) {
|
||||
return [](const void *arg) -> void * {
|
||||
return new T(*reinterpret_cast<const T *>(arg));
|
||||
};
|
||||
}
|
||||
|
||||
template <typename T, typename = enable_if_t<std::is_move_constructible<T>::value>>
|
||||
static auto make_move_constructor(const T *x) -> decltype(new T(std::move(*const_cast<T *>(x))), Constructor{}) {
|
||||
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(x);
|
||||
static auto make_move_constructor(const T *) -> decltype(new T(std::declval<T&&>()), Constructor{}) {
|
||||
return [](const void *arg) -> void * {
|
||||
return new T(std::move(*const_cast<T *>(reinterpret_cast<const T *>(arg))));
|
||||
};
|
||||
|
@ -29,7 +29,7 @@ inline void erase_all(std::string &string, const std::string &search) {
|
||||
}
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline void clean_type_id(std::string &name) {
|
||||
PYBIND11_NOINLINE void clean_type_id(std::string &name) {
|
||||
#if defined(__GNUG__)
|
||||
int status = 0;
|
||||
std::unique_ptr<char, void (*)(void *)> res {
|
||||
|
@ -45,25 +45,23 @@
|
||||
});
|
||||
}
|
||||
\endrst */
|
||||
#define PYBIND11_EMBEDDED_MODULE(name, variable) \
|
||||
static ::pybind11::module_::module_def \
|
||||
PYBIND11_CONCAT(pybind11_module_def_, name); \
|
||||
static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
|
||||
static PyObject PYBIND11_CONCAT(*pybind11_init_wrapper_, name)() { \
|
||||
auto m = ::pybind11::module_::create_extension_module( \
|
||||
PYBIND11_TOSTRING(name), nullptr, \
|
||||
&PYBIND11_CONCAT(pybind11_module_def_, name)); \
|
||||
try { \
|
||||
PYBIND11_CONCAT(pybind11_init_, name)(m); \
|
||||
return m.ptr(); \
|
||||
} PYBIND11_CATCH_INIT_EXCEPTIONS \
|
||||
} \
|
||||
PYBIND11_EMBEDDED_MODULE_IMPL(name) \
|
||||
::pybind11::detail::embedded_module PYBIND11_CONCAT(pybind11_module_, name) \
|
||||
(PYBIND11_TOSTRING(name), \
|
||||
PYBIND11_CONCAT(pybind11_init_impl_, name)); \
|
||||
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &variable)
|
||||
|
||||
#define PYBIND11_EMBEDDED_MODULE(name, variable) \
|
||||
static ::pybind11::module_::module_def PYBIND11_CONCAT(pybind11_module_def_, name); \
|
||||
static void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ &); \
|
||||
static PyObject PYBIND11_CONCAT(*pybind11_init_wrapper_, name)() { \
|
||||
auto m = ::pybind11::module_::create_extension_module( \
|
||||
PYBIND11_TOSTRING(name), nullptr, &PYBIND11_CONCAT(pybind11_module_def_, name)); \
|
||||
try { \
|
||||
PYBIND11_CONCAT(pybind11_init_, name)(m); \
|
||||
return m.ptr(); \
|
||||
} \
|
||||
PYBIND11_CATCH_INIT_EXCEPTIONS \
|
||||
} \
|
||||
PYBIND11_EMBEDDED_MODULE_IMPL(name) \
|
||||
::pybind11::detail::embedded_module PYBIND11_CONCAT(pybind11_module_, name)( \
|
||||
PYBIND11_TOSTRING(name), PYBIND11_CONCAT(pybind11_init_impl_, name)); \
|
||||
void PYBIND11_CONCAT(pybind11_init_, name)(::pybind11::module_ \
|
||||
& variable) // NOLINT(bugprone-macro-parentheses)
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
|
@ -70,9 +70,11 @@ public:
|
||||
struct func_handle {
|
||||
function f;
|
||||
func_handle(function &&f_) noexcept : f(std::move(f_)) {}
|
||||
func_handle(const func_handle& f_) {
|
||||
func_handle(const func_handle &f_) { operator=(f_); }
|
||||
func_handle &operator=(const func_handle &f_) {
|
||||
gil_scoped_acquire acq;
|
||||
f = f_.f;
|
||||
return *this;
|
||||
}
|
||||
~func_handle() {
|
||||
gil_scoped_acquire acq;
|
||||
|
@ -104,7 +104,7 @@ struct numpy_internals {
|
||||
}
|
||||
};
|
||||
|
||||
inline PYBIND11_NOINLINE void load_numpy_internals(numpy_internals* &ptr) {
|
||||
PYBIND11_NOINLINE void load_numpy_internals(numpy_internals* &ptr) {
|
||||
ptr = &get_or_create_shared_data<numpy_internals>("_numpy_internals");
|
||||
}
|
||||
|
||||
@ -478,11 +478,11 @@ public:
|
||||
|
||||
dtype(list names, list formats, list offsets, ssize_t itemsize) {
|
||||
dict args;
|
||||
args["names"] = names;
|
||||
args["formats"] = formats;
|
||||
args["offsets"] = offsets;
|
||||
args["names"] = std::move(names);
|
||||
args["formats"] = std::move(formats);
|
||||
args["offsets"] = std::move(offsets);
|
||||
args["itemsize"] = pybind11::int_(itemsize);
|
||||
m_ptr = from_args(args).release().ptr();
|
||||
m_ptr = from_args(std::move(args)).release().ptr();
|
||||
}
|
||||
|
||||
/// This is essentially the same as calling numpy.dtype(args) in Python.
|
||||
@ -560,7 +560,7 @@ private:
|
||||
formats.append(descr.format);
|
||||
offsets.append(descr.offset);
|
||||
}
|
||||
return dtype(names, formats, offsets, itemsize);
|
||||
return dtype(std::move(names), std::move(formats), std::move(offsets), itemsize);
|
||||
}
|
||||
};
|
||||
|
||||
@ -1110,7 +1110,7 @@ struct field_descriptor {
|
||||
dtype descr;
|
||||
};
|
||||
|
||||
inline PYBIND11_NOINLINE void register_structured_dtype(
|
||||
PYBIND11_NOINLINE void register_structured_dtype(
|
||||
any_container<field_descriptor> fields,
|
||||
const std::type_info& tinfo, ssize_t itemsize,
|
||||
bool (*direct_converter)(PyObject *, void *&)) {
|
||||
@ -1134,7 +1134,10 @@ inline PYBIND11_NOINLINE void register_structured_dtype(
|
||||
formats.append(field.descr);
|
||||
offsets.append(pybind11::int_(field.offset));
|
||||
}
|
||||
auto dtype_ptr = pybind11::dtype(names, formats, offsets, itemsize).release().ptr();
|
||||
auto dtype_ptr
|
||||
= pybind11::dtype(std::move(names), std::move(formats), std::move(offsets), itemsize)
|
||||
.release()
|
||||
.ptr();
|
||||
|
||||
// There is an existing bug in NumPy (as of v1.11): trailing bytes are
|
||||
// not encoded explicitly into the format string. This will supposedly
|
||||
@ -1551,8 +1554,11 @@ private:
|
||||
"pybind11::vectorize(...) requires a function with at least one vectorizable argument");
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
explicit vectorize_helper(T &&f) : f(std::forward<T>(f)) { }
|
||||
template <typename T,
|
||||
// SFINAE to prevent shadowing the copy constructor.
|
||||
typename = detail::enable_if_t<
|
||||
!std::is_same<vectorize_helper, typename std::decay<T>::type>::value>>
|
||||
explicit vectorize_helper(T &&f) : f(std::forward<T>(f)) {}
|
||||
|
||||
object operator()(typename vectorize_arg<Args>::type... args) {
|
||||
return run(args...,
|
||||
|
@ -11,10 +11,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
// Legacy pragma warning block moved to separate file, to enable iwyu cleanup of newly developed
|
||||
// code, without having to open up this can of worms. #HelpAppreciated cleaning this up.
|
||||
#include "detail/pragma_warning_block.h"
|
||||
|
||||
#include "attr.h"
|
||||
#include "gil.h"
|
||||
#include "options.h"
|
||||
@ -1838,7 +1834,7 @@ struct enum_base {
|
||||
m_base.attr(op) = cpp_function( \
|
||||
[](const object &a, const object &b) { \
|
||||
if (!type::handle_of(a).is(type::handle_of(b))) \
|
||||
strict_behavior; \
|
||||
strict_behavior; /* NOLINT(bugprone-macro-parentheses) */ \
|
||||
return expr; \
|
||||
}, \
|
||||
name(op), \
|
||||
@ -1988,7 +1984,7 @@ private:
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
|
||||
|
||||
inline void keep_alive_impl(handle nurse, handle patient) {
|
||||
PYBIND11_NOINLINE void keep_alive_impl(handle nurse, handle patient) {
|
||||
if (!nurse || !patient)
|
||||
pybind11_fail("Could not activate keep_alive!");
|
||||
|
||||
@ -2015,7 +2011,7 @@ inline void keep_alive_impl(handle nurse, handle patient) {
|
||||
}
|
||||
}
|
||||
|
||||
PYBIND11_NOINLINE inline void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret) {
|
||||
PYBIND11_NOINLINE void keep_alive_impl(size_t Nurse, size_t Patient, function_call &call, handle ret) {
|
||||
auto get_arg = [&](size_t n) {
|
||||
if (n == 0)
|
||||
return ret;
|
||||
@ -2265,7 +2261,7 @@ exception<CppException> ®ister_local_exception(handle scope,
|
||||
}
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
PYBIND11_NOINLINE inline void print(const tuple &args, const dict &kwargs) {
|
||||
PYBIND11_NOINLINE void print(const tuple &args, const dict &kwargs) {
|
||||
auto strings = tuple(args.size());
|
||||
for (size_t i = 0; i < args.size(); ++i) {
|
||||
strings[i] = str(args[i]);
|
||||
@ -2496,7 +2492,3 @@ PYBIND11_NAMESPACE_END(PYBIND11_NAMESPACE)
|
||||
#if defined(__GNUC__) && __GNUC__ == 7
|
||||
# pragma GCC diagnostic pop // -Wnoexcept-type
|
||||
#endif
|
||||
|
||||
#if defined(__GNUG__) && !defined(__clang__) && !defined(__INTEL_COMPILER)
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
@ -24,7 +24,7 @@ struct arg; struct arg_v;
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
class args_proxy;
|
||||
inline bool isinstance_generic(handle obj, const std::type_info &tp);
|
||||
bool isinstance_generic(handle obj, const std::type_info &tp);
|
||||
|
||||
// Accessor forward declarations
|
||||
template <typename Policy> class accessor;
|
||||
@ -316,7 +316,7 @@ template <typename T> T reinterpret_borrow(handle h) { return {h, object::borrow
|
||||
template <typename T> T reinterpret_steal(handle h) { return {h, object::stolen_t{}}; }
|
||||
|
||||
PYBIND11_NAMESPACE_BEGIN(detail)
|
||||
inline std::string error_string();
|
||||
std::string error_string();
|
||||
PYBIND11_NAMESPACE_END(detail)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
@ -1,6 +1,5 @@
|
||||
import nox
|
||||
|
||||
|
||||
nox.options.sessions = ["lint", "tests", "tests_packaging"]
|
||||
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from ._version import version_info, __version__
|
||||
from .commands import get_include, get_cmake_dir
|
||||
|
||||
from ._version import __version__, version_info
|
||||
from .commands import get_cmake_dir, get_include
|
||||
|
||||
__all__ = (
|
||||
"version_info",
|
||||
|
@ -5,7 +5,7 @@ import argparse
|
||||
import sys
|
||||
import sysconfig
|
||||
|
||||
from .commands import get_include, get_cmake_dir
|
||||
from .commands import get_cmake_dir, get_include
|
||||
|
||||
|
||||
def print_includes():
|
||||
|
@ -8,5 +8,5 @@ def _to_int(s):
|
||||
return s
|
||||
|
||||
|
||||
__version__ = "2.7.1.dev1"
|
||||
__version__ = "2.8.0.dev1"
|
||||
version_info = tuple(_to_int(s) for s in __version__.split("."))
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Union, Tuple
|
||||
from typing import Tuple, Union
|
||||
|
||||
def _to_int(s: str) -> Union[int, str]: ...
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
|
||||
|
||||
DIR = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
|
||||
|
@ -41,23 +41,23 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import contextlib
|
||||
import os
|
||||
import platform
|
||||
import shutil
|
||||
import sys
|
||||
import sysconfig
|
||||
import tempfile
|
||||
import threading
|
||||
import platform
|
||||
import warnings
|
||||
import sysconfig
|
||||
|
||||
try:
|
||||
from setuptools.command.build_ext import build_ext as _build_ext
|
||||
from setuptools import Extension as _Extension
|
||||
from setuptools.command.build_ext import build_ext as _build_ext
|
||||
except ImportError:
|
||||
from distutils.command.build_ext import build_ext as _build_ext
|
||||
from distutils.extension import Extension as _Extension
|
||||
|
||||
import distutils.errors
|
||||
import distutils.ccompiler
|
||||
import distutils.errors
|
||||
|
||||
WIN = sys.platform.startswith("win32") and "mingw" not in sysconfig.get_platform()
|
||||
PY2 = sys.version_info[0] < 3
|
||||
|
@ -1,13 +1,12 @@
|
||||
# IMPORTANT: Should stay in sync with setup_helpers.py (mostly checked by CI /
|
||||
# pre-commit).
|
||||
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar, Union
|
||||
from types import TracebackType
|
||||
|
||||
import contextlib
|
||||
import distutils.ccompiler
|
||||
from distutils.command.build_ext import build_ext as _build_ext # type: ignore
|
||||
from distutils.extension import Extension as _Extension
|
||||
import distutils.ccompiler
|
||||
import contextlib
|
||||
from types import TracebackType
|
||||
from typing import Any, Callable, Dict, Iterator, List, Optional, Type, TypeVar, Union
|
||||
|
||||
WIN: bool
|
||||
PY2: bool
|
||||
|
@ -15,6 +15,12 @@ ignore = [
|
||||
"noxfile.py",
|
||||
]
|
||||
|
||||
[tool.isort]
|
||||
# Needs the compiled .so modules and env.py from tests
|
||||
known_first_party = "env,pybind11_cross_module_tests,pybind11_tests,"
|
||||
# For black compatibility
|
||||
profile = "black"
|
||||
|
||||
[tool.mypy]
|
||||
files = "pybind11"
|
||||
python_version = "2.7"
|
||||
|
@ -20,6 +20,7 @@ classifiers =
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: 3.9
|
||||
Programming Language :: Python :: 3.10
|
||||
License :: OSI Approved :: BSD License
|
||||
Programming Language :: Python :: Implementation :: PyPy
|
||||
Programming Language :: Python :: Implementation :: CPython
|
||||
|
2
setup.py
2
setup.py
@ -4,6 +4,7 @@
|
||||
# Setup script for PyPI; use CMakeFile.txt to build extension modules
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
@ -11,7 +12,6 @@ import string
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
import io
|
||||
|
||||
import setuptools.command.sdist
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
|
||||
import pytest
|
||||
|
@ -110,7 +110,11 @@ public:
|
||||
|
||||
/// Overwrite this reference with another reference
|
||||
ref& operator=(const ref& r) {
|
||||
print_copy_assigned(this, "pointer", r.m_ptr); track_copy_assigned((ref_tag*) this);
|
||||
if (this == &r) {
|
||||
return *this;
|
||||
}
|
||||
print_copy_assigned(this, "pointer", r.m_ptr);
|
||||
track_copy_assigned((ref_tag *) this);
|
||||
|
||||
if (m_ptr == r.m_ptr)
|
||||
return *this;
|
||||
|
@ -23,11 +23,10 @@ public:
|
||||
test_initializer(const char *submodule_name, Initializer init);
|
||||
};
|
||||
|
||||
#define TEST_SUBMODULE(name, variable) \
|
||||
void test_submodule_##name(py::module_ &); \
|
||||
test_initializer name(#name, test_submodule_##name); \
|
||||
void test_submodule_##name(py::module_ &variable)
|
||||
|
||||
#define TEST_SUBMODULE(name, variable) \
|
||||
void test_submodule_##name(py::module_ &); \
|
||||
test_initializer name(#name, test_submodule_##name); \
|
||||
void test_submodule_##name(py::module_ &(variable))
|
||||
|
||||
/// Dummy type which is not exported anywhere -- something to trigger a conversion error
|
||||
struct UnregisteredType { };
|
||||
|
@ -40,7 +40,11 @@ TEST_SUBMODULE(buffers, m) {
|
||||
}
|
||||
|
||||
Matrix &operator=(const Matrix &s) {
|
||||
print_copy_assigned(this, std::to_string(m_rows) + "x" + std::to_string(m_cols) + " matrix");
|
||||
if (this == &s) {
|
||||
return *this;
|
||||
}
|
||||
print_copy_assigned(this,
|
||||
std::to_string(m_rows) + "x" + std::to_string(m_cols) + " matrix");
|
||||
delete[] m_data;
|
||||
m_rows = s.m_rows;
|
||||
m_cols = s.m_cols;
|
||||
|
@ -1,14 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import ctypes
|
||||
import io
|
||||
import struct
|
||||
import ctypes
|
||||
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import buffers as m
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import buffers as m
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import IncType, UserType
|
||||
from pybind11_tests import builtin_casters as m
|
||||
from pybind11_tests import UserType, IncType
|
||||
|
||||
|
||||
def test_simple_string():
|
||||
|
@ -2,9 +2,8 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import call_policies as m
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import call_policies as m
|
||||
|
||||
|
||||
@pytest.mark.xfail("env.PYPY", reason="sometimes comes out 1 off on PyPy", strict=False)
|
||||
|
@ -1,9 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from pybind11_tests import callbacks as m
|
||||
from threading import Thread
|
||||
import time
|
||||
from threading import Thread
|
||||
|
||||
import pytest
|
||||
|
||||
import env # NOQA: F401
|
||||
from pybind11_tests import callbacks as m
|
||||
|
||||
|
||||
def test_callbacks():
|
||||
|
@ -1,9 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pybind11_tests import chrono as m
|
||||
import datetime
|
||||
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
from pybind11_tests import chrono as m
|
||||
|
||||
|
||||
def test_chrono_system_clock():
|
||||
|
@ -505,15 +505,15 @@ using DoesntBreak5 = py::class_<BreaksBase<5>>;
|
||||
using DoesntBreak6 = py::class_<BreaksBase<6>, std::shared_ptr<BreaksBase<6>>, BreaksTramp<6>>;
|
||||
using DoesntBreak7 = py::class_<BreaksBase<7>, BreaksTramp<7>, std::shared_ptr<BreaksBase<7>>>;
|
||||
using DoesntBreak8 = py::class_<BreaksBase<8>, std::shared_ptr<BreaksBase<8>>>;
|
||||
#define CHECK_BASE(N) static_assert(std::is_same<typename DoesntBreak##N::type, BreaksBase<N>>::value, \
|
||||
#define CHECK_BASE(N) static_assert(std::is_same<typename DoesntBreak##N::type, BreaksBase<(N)>>::value, \
|
||||
"DoesntBreak" #N " has wrong type!")
|
||||
CHECK_BASE(1); CHECK_BASE(2); CHECK_BASE(3); CHECK_BASE(4); CHECK_BASE(5); CHECK_BASE(6); CHECK_BASE(7); CHECK_BASE(8);
|
||||
#define CHECK_ALIAS(N) static_assert(DoesntBreak##N::has_alias && std::is_same<typename DoesntBreak##N::type_alias, BreaksTramp<N>>::value, \
|
||||
#define CHECK_ALIAS(N) static_assert(DoesntBreak##N::has_alias && std::is_same<typename DoesntBreak##N::type_alias, BreaksTramp<(N)>>::value, \
|
||||
"DoesntBreak" #N " has wrong type_alias!")
|
||||
#define CHECK_NOALIAS(N) static_assert(!DoesntBreak##N::has_alias && std::is_void<typename DoesntBreak##N::type_alias>::value, \
|
||||
"DoesntBreak" #N " has type alias, but shouldn't!")
|
||||
CHECK_ALIAS(1); CHECK_ALIAS(2); CHECK_NOALIAS(3); CHECK_ALIAS(4); CHECK_NOALIAS(5); CHECK_ALIAS(6); CHECK_ALIAS(7); CHECK_NOALIAS(8);
|
||||
#define CHECK_HOLDER(N, TYPE) static_assert(std::is_same<typename DoesntBreak##N::holder_type, std::TYPE##_ptr<BreaksBase<N>>>::value, \
|
||||
#define CHECK_HOLDER(N, TYPE) static_assert(std::is_same<typename DoesntBreak##N::holder_type, std::TYPE##_ptr<BreaksBase<(N)>>>::value, \
|
||||
"DoesntBreak" #N " has wrong holder_type!")
|
||||
#define CHECK_SMART_HOLDER(N) static_assert(std::is_same<typename DoesntBreak##N::holder_type, py::smart_holder>::value, \
|
||||
"DoesntBreak" #N " has wrong holder_type!")
|
||||
@ -530,7 +530,7 @@ CHECK_HOLDER(6, shared); CHECK_HOLDER(7, shared); CHECK_HOLDER(8, shared);
|
||||
// failures occurs).
|
||||
|
||||
// We have to actually look into the type: the typedef alone isn't enough to instantiate the type:
|
||||
#define CHECK_BROKEN(N) static_assert(std::is_same<typename Breaks##N::type, BreaksBase<-N>>::value, \
|
||||
#define CHECK_BROKEN(N) static_assert(std::is_same<typename Breaks##N::type, BreaksBase<-(N)>>::value, \
|
||||
"Breaks1 has wrong type!");
|
||||
|
||||
//// Two holder classes:
|
||||
|
@ -2,9 +2,8 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import ConstructorStats, UserType
|
||||
from pybind11_tests import class_ as m
|
||||
from pybind11_tests import UserType, ConstructorStats
|
||||
|
||||
|
||||
def test_repr():
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import sys
|
||||
|
||||
import test_cmake_build
|
||||
|
||||
assert test_cmake_build.add(1, 2) == 3
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import copy_move_policies as m
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import custom_type_casters as m
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import ConstructorStats
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import enums as m
|
||||
|
||||
|
||||
|
@ -98,4 +98,22 @@ TEST_SUBMODULE(eval_, m) {
|
||||
auto int_class = py::eval("isinstance(42, int)", global);
|
||||
return global;
|
||||
});
|
||||
|
||||
// test_eval_closure
|
||||
m.def("test_eval_closure", []() {
|
||||
py::dict global;
|
||||
global["closure_value"] = 42;
|
||||
py::dict local;
|
||||
local["closure_value"] = 0;
|
||||
py::exec(R"(
|
||||
local_value = closure_value
|
||||
|
||||
def func_global():
|
||||
return closure_value
|
||||
|
||||
def func_local():
|
||||
return local_value
|
||||
)", global, local);
|
||||
return std::make_pair(global, local);
|
||||
});
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import os
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import eval_ as m
|
||||
|
||||
|
||||
@ -33,3 +32,20 @@ def test_eval_empty_globals():
|
||||
g = {}
|
||||
assert "__builtins__" in m.eval_empty_globals(g)
|
||||
assert "__builtins__" in g
|
||||
|
||||
|
||||
def test_eval_closure():
|
||||
global_, local = m.test_eval_closure()
|
||||
|
||||
assert global_["closure_value"] == 42
|
||||
assert local["closure_value"] == 0
|
||||
|
||||
assert "local_value" not in global_
|
||||
assert local["local_value"] == 0
|
||||
|
||||
assert "func_global" not in global_
|
||||
assert local["func_global"]() == 42
|
||||
|
||||
assert "func_local" not in global_
|
||||
with pytest.raises(NameError):
|
||||
local["func_local"]()
|
||||
|
@ -4,9 +4,8 @@ import sys
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import exceptions as m
|
||||
import pybind11_cross_module_tests as cm
|
||||
from pybind11_tests import exceptions as m
|
||||
|
||||
|
||||
def test_std_exception(msg):
|
||||
|
@ -1,12 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
import re
|
||||
|
||||
import env # noqa: F401
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import factory_constructors as m
|
||||
from pybind11_tests.factory_constructors import tag
|
||||
from pybind11_tests import ConstructorStats
|
||||
|
||||
|
||||
def test_init_factory_basic():
|
||||
|
@ -1,9 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pybind11_tests import iostream as m
|
||||
import sys
|
||||
|
||||
from contextlib import contextmanager
|
||||
|
||||
from pybind11_tests import iostream as m
|
||||
|
||||
try:
|
||||
# Python 3
|
||||
from io import StringIO
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import kwargs_and_defaults as m
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import local_bindings as m
|
||||
|
||||
|
||||
|
@ -2,9 +2,8 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import methods_and_attributes as m
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import methods_and_attributes as m
|
||||
|
||||
|
||||
def test_methods_and_attributes():
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import modules as m
|
||||
from pybind11_tests.modules import subsubmodule as ms
|
||||
from pybind11_tests import ConstructorStats
|
||||
|
||||
|
||||
def test_nested_modules():
|
||||
@ -54,18 +54,20 @@ def test_reference_internal():
|
||||
|
||||
|
||||
def test_importing():
|
||||
from pybind11_tests.modules import OD
|
||||
from collections import OrderedDict
|
||||
|
||||
from pybind11_tests.modules import OD
|
||||
|
||||
assert OD is OrderedDict
|
||||
assert str(OD([(1, "a"), (2, "b")])) == "OrderedDict([(1, 'a'), (2, 'b')])"
|
||||
|
||||
|
||||
def test_pydoc():
|
||||
"""Pydoc needs to be able to provide help() for everything inside a pybind11 module"""
|
||||
import pybind11_tests
|
||||
import pydoc
|
||||
|
||||
import pybind11_tests
|
||||
|
||||
assert pybind11_tests.__name__ == "pybind11_tests"
|
||||
assert pybind11_tests.__doc__ == "pybind11 test module"
|
||||
assert pydoc.text.docmodule(pybind11_tests)
|
||||
|
@ -108,7 +108,10 @@ TEST_SUBMODULE(multiple_inheritance, m) {
|
||||
|
||||
|
||||
// test_multiple_inheritance_python_many_bases
|
||||
#define PYBIND11_BASEN(N) py::class_<BaseN<N>>(m, "BaseN" #N).def(py::init<int>()).def("f" #N, [](BaseN<N> &b) { return b.i + N; })
|
||||
#define PYBIND11_BASEN(N) \
|
||||
py::class_<BaseN<(N)>>(m, "BaseN" #N).def(py::init<int>()).def("f" #N, [](BaseN<N> &b) { \
|
||||
return b.i + (N); \
|
||||
})
|
||||
PYBIND11_BASEN( 1); PYBIND11_BASEN( 2); PYBIND11_BASEN( 3); PYBIND11_BASEN( 4);
|
||||
PYBIND11_BASEN( 5); PYBIND11_BASEN( 6); PYBIND11_BASEN( 7); PYBIND11_BASEN( 8);
|
||||
PYBIND11_BASEN( 9); PYBIND11_BASEN(10); PYBIND11_BASEN(11); PYBIND11_BASEN(12);
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import multiple_inheritance as m
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import numpy_array as m
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
@ -148,11 +148,13 @@ py::array mkarray_via_buffer(size_t n) {
|
||||
1, { n }, { sizeof(T) }));
|
||||
}
|
||||
|
||||
#define SET_TEST_VALS(s, i) do { \
|
||||
s.bool_ = (i) % 2 != 0; \
|
||||
s.uint_ = (uint32_t) (i); \
|
||||
s.float_ = (float) (i) * 1.5f; \
|
||||
s.ldbl_ = (long double) (i) * -2.5L; } while (0)
|
||||
#define SET_TEST_VALS(s, i) \
|
||||
do { \
|
||||
(s).bool_ = (i) % 2 != 0; \
|
||||
(s).uint_ = (uint32_t) (i); \
|
||||
(s).float_ = (float) (i) *1.5f; \
|
||||
(s).ldbl_ = (long double) (i) * -2.5L; \
|
||||
} while (0)
|
||||
|
||||
template <typename S>
|
||||
py::array_t<S, 0> create_recarray(size_t n) {
|
||||
|
@ -4,7 +4,6 @@ import re
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import numpy_dtypes as m
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import numpy_vectorize as m
|
||||
|
||||
np = pytest.importorskip("numpy")
|
||||
|
@ -1,7 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from pybind11_tests import opaque_types as m
|
||||
|
||||
from pybind11_tests import ConstructorStats, UserType
|
||||
from pybind11_tests import opaque_types as m
|
||||
|
||||
|
||||
def test_string_list():
|
||||
|
@ -1,7 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from pybind11_tests import operators as m
|
||||
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import operators as m
|
||||
|
||||
|
||||
def test_operator_overloading():
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import pickling as m
|
||||
|
||||
try:
|
||||
|
@ -1,12 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import division
|
||||
import pytest
|
||||
|
||||
import sys
|
||||
|
||||
import env # noqa: F401
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import pytypes as m
|
||||
import env # noqa: F401
|
||||
from pybind11_tests import debug_enabled
|
||||
from pybind11_tests import pytypes as m
|
||||
|
||||
|
||||
def test_int(doc):
|
||||
|
@ -1,7 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
from pybind11_tests import sequences_and_iterators as m
|
||||
|
||||
from pybind11_tests import ConstructorStats
|
||||
from pybind11_tests import sequences_and_iterators as m
|
||||
|
||||
|
||||
def isclose(a, b, rel_tol=1e-05, abs_tol=0.0):
|
||||
|
@ -182,6 +182,7 @@ struct SharedPtrRef {
|
||||
struct SharedFromThisRef {
|
||||
struct B : std::enable_shared_from_this<B> {
|
||||
B() { print_created(this); }
|
||||
// NOLINTNEXTLINE(bugprone-copy-constructor-init)
|
||||
B(const B &) : std::enable_shared_from_this<B>() { print_copy_created(this); }
|
||||
B(B &&) noexcept : std::enable_shared_from_this<B>() { print_move_created(this); }
|
||||
~B() { print_destroyed(this); }
|
||||
|
@ -1,9 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
from pybind11_tests import ConstructorStats, UserType
|
||||
from pybind11_tests import stl as m
|
||||
from pybind11_tests import UserType
|
||||
from pybind11_tests import ConstructorStats
|
||||
|
||||
|
||||
def test_vector(doc):
|
||||
|
@ -2,7 +2,6 @@
|
||||
import pytest
|
||||
|
||||
import env # noqa: F401
|
||||
|
||||
from pybind11_tests import stl_binders as m
|
||||
|
||||
|
||||
|
@ -86,13 +86,13 @@ std::vector<std::unique_ptr<Animal>> create_zoo()
|
||||
const std::type_info* Animal::type_of_kind(Kind kind)
|
||||
{
|
||||
switch (kind) {
|
||||
case Kind::Unknown: break;
|
||||
|
||||
case Kind::Unknown:
|
||||
case Kind::Dog: break;
|
||||
|
||||
case Kind::Labrador: return &typeid(Labrador);
|
||||
case Kind::Chihuahua: return &typeid(Chihuahua);
|
||||
case Kind::LastDog: break;
|
||||
|
||||
case Kind::LastDog:
|
||||
case Kind::Cat: break;
|
||||
case Kind::Panther: return &typeid(Panther);
|
||||
case Kind::LastCat: break;
|
||||
|
@ -454,6 +454,7 @@ template <class Base = B_Tpl>
|
||||
class PyB_Tpl : public PyA_Tpl<Base> {
|
||||
public:
|
||||
using PyA_Tpl<Base>::PyA_Tpl; // Inherit constructors (via PyA_Tpl's inherited constructors)
|
||||
// NOLINTNEXTLINE(bugprone-parent-virtual-call)
|
||||
int unlucky_number() override { PYBIND11_OVERRIDE(int, Base, unlucky_number, ); }
|
||||
double lucky_number() override { PYBIND11_OVERRIDE(double, Base, lucky_number, ); }
|
||||
};
|
||||
|
@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import print_function, division
|
||||
from __future__ import division, print_function
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
@ -4,11 +4,9 @@
|
||||
import re
|
||||
|
||||
import ghapi.all
|
||||
|
||||
from rich import print
|
||||
from rich.syntax import Syntax
|
||||
|
||||
|
||||
ENTRY = re.compile(
|
||||
r"""
|
||||
Suggested \s changelog \s entry:
|
||||
|
@ -147,7 +147,7 @@ Add a module and setup all helpers. You can select the type of the library; the
|
||||
default is ``MODULE``. There are several options:
|
||||
|
||||
``OPT_SIZE``
|
||||
Optimize for size, even if the ``CMAKE_BUILD_TYPE`` is not ``RelSize``.
|
||||
Optimize for size, even if the ``CMAKE_BUILD_TYPE`` is not ``MinSizeRel``.
|
||||
``THIN_LTO``
|
||||
Use thin TLO instead of regular if there's a choice (pybind11's selection
|
||||
is disabled if ``CMAKE_INTERPROCEDURAL_OPTIMIZATIONS`` is set).
|
||||
|
Loading…
Reference in New Issue
Block a user