Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pybind11
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
pybind11
Commits
96e6a8d5
Commit
96e6a8d5
authored
Sep 10, 2020
by
Henry Schreiner
Committed by
Henry Schreiner
Sep 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: clang-tidy: readability-container-size-empty
parent
5dfbe6f9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
.clang-tidy
+1
-0
include/pybind11/cast.h
+2
-2
include/pybind11/detail/class.h
+2
-2
include/pybind11/pybind11.h
+2
-2
No files found.
.clang-tidy
View file @
96e6a8d5
...
@@ -4,6 +4,7 @@ Checks: '
...
@@ -4,6 +4,7 @@ Checks: '
-*,
-*,
llvm-namespace-comment,
llvm-namespace-comment,
modernize-use-override,
modernize-use-override,
readability-container-size-empty,
'
'
HeaderFilterRegex: 'pybind11/.*h'
HeaderFilterRegex: 'pybind11/.*h'
include/pybind11/cast.h
View file @
96e6a8d5
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
Py_CLEAR
(
ptr
);
Py_CLEAR
(
ptr
);
// A heuristic to reduce the stack's capacity (e.g. after long recursive calls)
// A heuristic to reduce the stack's capacity (e.g. after long recursive calls)
if
(
stack
.
capacity
()
>
16
&&
stack
.
size
()
!=
0
&&
stack
.
capacity
()
/
stack
.
size
()
>
2
)
if
(
stack
.
capacity
()
>
16
&&
!
stack
.
empty
()
&&
stack
.
capacity
()
/
stack
.
size
()
>
2
)
stack
.
shrink_to_fit
();
stack
.
shrink_to_fit
();
}
}
...
@@ -163,7 +163,7 @@ inline const std::vector<detail::type_info *> &all_type_info(PyTypeObject *type)
...
@@ -163,7 +163,7 @@ inline const std::vector<detail::type_info *> &all_type_info(PyTypeObject *type)
*/
*/
PYBIND11_NOINLINE
inline
detail
::
type_info
*
get_type_info
(
PyTypeObject
*
type
)
{
PYBIND11_NOINLINE
inline
detail
::
type_info
*
get_type_info
(
PyTypeObject
*
type
)
{
auto
&
bases
=
all_type_info
(
type
);
auto
&
bases
=
all_type_info
(
type
);
if
(
bases
.
size
()
==
0
)
if
(
bases
.
empty
()
)
return
nullptr
;
return
nullptr
;
if
(
bases
.
size
()
>
1
)
if
(
bases
.
size
()
>
1
)
pybind11_fail
(
"pybind11::detail::get_type_info: type has multiple pybind11-registered bases"
);
pybind11_fail
(
"pybind11::detail::get_type_info: type has multiple pybind11-registered bases"
);
...
...
include/pybind11/detail/class.h
View file @
96e6a8d5
...
@@ -592,7 +592,7 @@ inline PyObject* make_new_python_type(const type_record &rec) {
...
@@ -592,7 +592,7 @@ inline PyObject* make_new_python_type(const type_record &rec) {
auto
&
internals
=
get_internals
();
auto
&
internals
=
get_internals
();
auto
bases
=
tuple
(
rec
.
bases
);
auto
bases
=
tuple
(
rec
.
bases
);
auto
base
=
(
bases
.
size
()
==
0
)
?
internals
.
instance_base
auto
base
=
(
bases
.
empty
()
)
?
internals
.
instance_base
:
bases
[
0
].
ptr
();
:
bases
[
0
].
ptr
();
/* Danger zone: from now (and until PyType_Ready), make sure to
/* Danger zone: from now (and until PyType_Ready), make sure to
...
@@ -616,7 +616,7 @@ inline PyObject* make_new_python_type(const type_record &rec) {
...
@@ -616,7 +616,7 @@ inline PyObject* make_new_python_type(const type_record &rec) {
type
->
tp_doc
=
tp_doc
;
type
->
tp_doc
=
tp_doc
;
type
->
tp_base
=
type_incref
((
PyTypeObject
*
)
base
);
type
->
tp_base
=
type_incref
((
PyTypeObject
*
)
base
);
type
->
tp_basicsize
=
static_cast
<
ssize_t
>
(
sizeof
(
instance
));
type
->
tp_basicsize
=
static_cast
<
ssize_t
>
(
sizeof
(
instance
));
if
(
bases
.
size
()
>
0
)
if
(
!
bases
.
empty
()
)
type
->
tp_bases
=
bases
.
release
().
ptr
();
type
->
tp_bases
=
bases
.
release
().
ptr
();
/* Don't inherit base __init__ */
/* Don't inherit base __init__ */
...
...
include/pybind11/pybind11.h
View file @
96e6a8d5
...
@@ -626,7 +626,7 @@ protected:
...
@@ -626,7 +626,7 @@ protected:
}
}
// 3. Check everything was consumed (unless we have a kwargs arg)
// 3. Check everything was consumed (unless we have a kwargs arg)
if
(
kwargs
&&
kwargs
.
size
()
>
0
&&
!
func
.
has_kwargs
)
if
(
kwargs
&&
!
kwargs
.
empty
()
&&
!
func
.
has_kwargs
)
continue
;
// Unconsumed kwargs, but no py::kwargs argument to accept them
continue
;
// Unconsumed kwargs, but no py::kwargs argument to accept them
// 4a. If we have a py::args argument, create a new tuple with leftovers
// 4a. If we have a py::args argument, create a new tuple with leftovers
...
@@ -814,7 +814,7 @@ protected:
...
@@ -814,7 +814,7 @@ protected:
}
}
if
(
kwargs_in
)
{
if
(
kwargs_in
)
{
auto
kwargs
=
reinterpret_borrow
<
dict
>
(
kwargs_in
);
auto
kwargs
=
reinterpret_borrow
<
dict
>
(
kwargs_in
);
if
(
kwargs
.
size
()
>
0
)
{
if
(
!
kwargs
.
empty
()
)
{
if
(
some_args
)
msg
+=
"; "
;
if
(
some_args
)
msg
+=
"; "
;
msg
+=
"kwargs: "
;
msg
+=
"kwargs: "
;
bool
first
=
true
;
bool
first
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment