Merge branch 'pybind:master' into master

This commit is contained in:
Steve R. Sun 2022-06-07 09:41:13 +08:00 committed by GitHub
commit bb6ae5013c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 8 deletions

View File

@ -10,6 +10,7 @@ cppcoreguidelines-pro-type-static-cast-downcast,
cppcoreguidelines-slicing,
google-explicit-constructor,
llvm-namespace-comment,
misc-definitions-in-headers,
misc-misplaced-const,
misc-non-copyable-objects,
misc-static-assert,
@ -17,6 +18,7 @@ misc-throw-by-value-catch-by-reference,
misc-uniqueptr-reset-release,
misc-unused-parameters,
modernize-avoid-bind,
modernize-loop-convert,
modernize-make-shared,
modernize-redundant-void-arg,
modernize-replace-auto-ptr,
@ -63,6 +65,8 @@ readability-uniqueptr-delete-release,
CheckOptions:
- key: performance-for-range-copy.WarnOnAllAutoCopies
value: true
- key: performance-inefficient-string-concatenation.StrictMode
value: true
- key: performance-unnecessary-value-param.AllowedTypes
value: 'exception_ptr$;'
- key: readability-implicit-bool-conversion.AllowPointerConditions

View File

@ -32,7 +32,7 @@ repos:
# Upgrade old Python syntax
- repo: https://github.com/asottile/pyupgrade
rev: "v2.32.1"
rev: "v2.33.0"
hooks:
- id: pyupgrade
args: [--py36-plus]
@ -59,7 +59,7 @@ repos:
# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: "v1.1.13"
rev: "v1.2.0"
hooks:
- id: remove-tabs
@ -71,7 +71,7 @@ repos:
# Autoremoves unused imports
- repo: https://github.com/hadialqattan/pycln
rev: "v1.3.2"
rev: "v1.3.3"
hooks:
- id: pycln
stages: [manual]
@ -107,7 +107,7 @@ repos:
# PyLint has native support - not always usable, but works for us
- repo: https://github.com/PyCQA/pylint
rev: "v2.13.8"
rev: "v2.14.1"
hooks:
- id: pylint
files: ^pybind11
@ -123,7 +123,7 @@ repos:
# Check static types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v0.950"
rev: "v0.960"
hooks:
- id: mypy
args: []

View File

@ -753,7 +753,7 @@ public:
}
/// type number of dtype.
ssize_t num() const {
int num() const {
// Note: The signature, `dtype::num` follows the naming of NumPy's public
// Python API (i.e., ``dtype.num``), rather than its internal
// C API (``PyArray_Descr::type_num``).

View File

@ -31,8 +31,8 @@ py::bytes return_bytes() {
std::string print_bytes(const py::bytes &bytes) {
std::string ret = "bytes[";
const auto value = static_cast<std::string>(bytes);
for (size_t i = 0; i < value.length(); ++i) {
ret += std::to_string(static_cast<int>(value[i])) + " ";
for (char c : value) {
ret += std::to_string(static_cast<int>(c)) + ' ';
}
ret.back() = ']';
return ret;