Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2022-05-19 09:59:25 +08:00 committed by GitHub
commit a3e7271e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -1926,7 +1926,8 @@ struct enum_base {
[](const object &arg) -> str {
handle type = type::handle_of(arg);
object type_name = type.attr("__name__");
return pybind11::str("<{}.{}: {}>").format(type_name, enum_name(arg), int_(arg));
return pybind11::str("<{}.{}: {}>")
.format(std::move(type_name), enum_name(arg), int_(arg));
},
name("__repr__"),
is_method(m_base));
@ -1936,7 +1937,7 @@ struct enum_base {
m_base.attr("__str__") = cpp_function(
[](handle arg) -> str {
object type_name = type::handle_of(arg).attr("__name__");
return pybind11::str("{}.{}").format(type_name, enum_name(arg));
return pybind11::str("{}.{}").format(std::move(type_name), enum_name(arg));
},
name("name"),
is_method(m_base));
@ -2576,8 +2577,8 @@ PYBIND11_NOINLINE void print(const tuple &args, const dict &kwargs) {
for (size_t i = 0; i < args.size(); ++i) {
strings[i] = str(args[i]);
}
auto sep = kwargs.contains("sep") ? kwargs["sep"] : cast(" ");
auto line = sep.attr("join")(strings);
auto sep = kwargs.contains("sep") ? kwargs["sep"] : str(" ");
auto line = sep.attr("join")(std::move(strings));
object file;
if (kwargs.contains("file")) {
@ -2596,7 +2597,7 @@ PYBIND11_NOINLINE void print(const tuple &args, const dict &kwargs) {
auto write = file.attr("write");
write(line);
write(kwargs.contains("end") ? kwargs["end"] : cast("\n"));
write(kwargs.contains("end") ? kwargs["end"] : str("\n"));
if (kwargs.contains("flush") && kwargs["flush"].cast<bool>()) {
file.attr("flush")();
@ -2639,7 +2640,7 @@ get_type_override(const void *this_ptr, const type_info *this_type, const char *
function override = getattr(self, name, function());
if (override.is_cpp_function()) {
cache.insert(key);
cache.insert(std::move(key));
return function();
}

View File

@ -96,7 +96,7 @@ if(MSVC) # That's also clang-cl
set_property(
TARGET pybind11::windows_extras
APPEND
PROPERTY INTERFACE_COMPILE_OPTIONS /bigobj)
PROPERTY INTERFACE_COMPILE_OPTIONS $<$<COMPILE_LANGUAGE:CXX>:/bigobj>)
# /MP enables multithreaded builds (relevant when there are many files) for MSVC
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # no Clang no Intel