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
c9149d99
Unverified
Commit
c9149d99
authored
Sep 13, 2023
by
Sergei Izmailov
Committed by
GitHub
Sep 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Use lowercase builtin collection names (#4833)
parent
c8360593
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
include/pybind11/cast.h
+1
-1
include/pybind11/stl.h
+4
-4
tests/test_builtin_casters.py
+2
-2
tests/test_kwargs_and_defaults.py
+1
-1
tests/test_stl.py
+12
-12
No files found.
include/pybind11/cast.h
View file @
c9149d99
...
@@ -661,7 +661,7 @@ public:
...
@@ -661,7 +661,7 @@ public:
}
}
static
constexpr
auto
name
static
constexpr
auto
name
=
const_name
(
"
T
uple["
)
+
concat
(
make_caster
<
Ts
>::
name
...)
+
const_name
(
"]"
);
=
const_name
(
"
t
uple["
)
+
concat
(
make_caster
<
Ts
>::
name
...)
+
const_name
(
"]"
);
template
<
typename
T
>
template
<
typename
T
>
using
cast_op_type
=
type
;
using
cast_op_type
=
type
;
...
...
include/pybind11/stl.h
View file @
c9149d99
...
@@ -100,7 +100,7 @@ public:
...
@@ -100,7 +100,7 @@ public:
return
s
.
release
();
return
s
.
release
();
}
}
PYBIND11_TYPE_CASTER
(
type
,
const_name
(
"
S
et["
)
+
key_conv
::
name
+
const_name
(
"]"
));
PYBIND11_TYPE_CASTER
(
type
,
const_name
(
"
s
et["
)
+
key_conv
::
name
+
const_name
(
"]"
));
};
};
template
<
typename
Type
,
typename
Key
,
typename
Value
>
template
<
typename
Type
,
typename
Key
,
typename
Value
>
...
@@ -157,7 +157,7 @@ public:
...
@@ -157,7 +157,7 @@ public:
}
}
PYBIND11_TYPE_CASTER
(
Type
,
PYBIND11_TYPE_CASTER
(
Type
,
const_name
(
"
D
ict["
)
+
key_conv
::
name
+
const_name
(
", "
)
+
value_conv
::
name
const_name
(
"
d
ict["
)
+
key_conv
::
name
+
const_name
(
", "
)
+
value_conv
::
name
+
const_name
(
"]"
));
+
const_name
(
"]"
));
};
};
...
@@ -208,7 +208,7 @@ public:
...
@@ -208,7 +208,7 @@ public:
return
l
.
release
();
return
l
.
release
();
}
}
PYBIND11_TYPE_CASTER
(
Type
,
const_name
(
"
L
ist["
)
+
value_conv
::
name
+
const_name
(
"]"
));
PYBIND11_TYPE_CASTER
(
Type
,
const_name
(
"
l
ist["
)
+
value_conv
::
name
+
const_name
(
"]"
));
};
};
template
<
typename
Type
,
typename
Alloc
>
template
<
typename
Type
,
typename
Alloc
>
...
@@ -274,7 +274,7 @@ public:
...
@@ -274,7 +274,7 @@ public:
PYBIND11_TYPE_CASTER
(
ArrayType
,
PYBIND11_TYPE_CASTER
(
ArrayType
,
const_name
<
Resizable
>
(
const_name
(
""
),
const_name
(
"Annotated["
))
const_name
<
Resizable
>
(
const_name
(
""
),
const_name
(
"Annotated["
))
+
const_name
(
"
L
ist["
)
+
value_conv
::
name
+
const_name
(
"]"
)
+
const_name
(
"
l
ist["
)
+
value_conv
::
name
+
const_name
(
"]"
)
+
const_name
<
Resizable
>
(
const_name
(
""
),
+
const_name
<
Resizable
>
(
const_name
(
""
),
const_name
(
", FixedSize("
)
const_name
(
", FixedSize("
)
+
const_name
<
Size
>
()
+
const_name
(
")]"
)));
+
const_name
<
Size
>
()
+
const_name
(
")]"
)));
...
...
tests/test_builtin_casters.py
View file @
c9149d99
...
@@ -352,7 +352,7 @@ def test_tuple(doc):
...
@@ -352,7 +352,7 @@ def test_tuple(doc):
assert
(
assert
(
doc
(
m
.
pair_passthrough
)
doc
(
m
.
pair_passthrough
)
==
"""
==
"""
pair_passthrough(arg0:
Tuple[bool, str]) -> T
uple[str, bool]
pair_passthrough(arg0:
tuple[bool, str]) -> t
uple[str, bool]
Return a pair in reversed order
Return a pair in reversed order
"""
"""
...
@@ -360,7 +360,7 @@ def test_tuple(doc):
...
@@ -360,7 +360,7 @@ def test_tuple(doc):
assert
(
assert
(
doc
(
m
.
tuple_passthrough
)
doc
(
m
.
tuple_passthrough
)
==
"""
==
"""
tuple_passthrough(arg0:
Tuple[bool, str, int]) -> T
uple[int, str, bool]
tuple_passthrough(arg0:
tuple[bool, str, int]) -> t
uple[int, str, bool]
Return a triple in reversed order
Return a triple in reversed order
"""
"""
...
...
tests/test_kwargs_and_defaults.py
View file @
c9149d99
...
@@ -8,7 +8,7 @@ def test_function_signatures(doc):
...
@@ -8,7 +8,7 @@ def test_function_signatures(doc):
assert
doc
(
m
.
kw_func1
)
==
"kw_func1(x: int, y: int) -> str"
assert
doc
(
m
.
kw_func1
)
==
"kw_func1(x: int, y: int) -> str"
assert
doc
(
m
.
kw_func2
)
==
"kw_func2(x: int = 100, y: int = 200) -> str"
assert
doc
(
m
.
kw_func2
)
==
"kw_func2(x: int = 100, y: int = 200) -> str"
assert
doc
(
m
.
kw_func3
)
==
"kw_func3(data: str = 'Hello world!') -> None"
assert
doc
(
m
.
kw_func3
)
==
"kw_func3(data: str = 'Hello world!') -> None"
assert
doc
(
m
.
kw_func4
)
==
"kw_func4(myList:
L
ist[int] = [13, 17]) -> str"
assert
doc
(
m
.
kw_func4
)
==
"kw_func4(myList:
l
ist[int] = [13, 17]) -> str"
assert
doc
(
m
.
kw_func_udl
)
==
"kw_func_udl(x: int, y: int = 300) -> str"
assert
doc
(
m
.
kw_func_udl
)
==
"kw_func_udl(x: int, y: int = 300) -> str"
assert
doc
(
m
.
kw_func_udl_z
)
==
"kw_func_udl_z(x: int, y: int = 0) -> str"
assert
doc
(
m
.
kw_func_udl_z
)
==
"kw_func_udl_z(x: int, y: int = 0) -> str"
assert
doc
(
m
.
args_function
)
==
"args_function(*args) -> tuple"
assert
doc
(
m
.
args_function
)
==
"args_function(*args) -> tuple"
...
...
tests/test_stl.py
View file @
c9149d99
...
@@ -16,8 +16,8 @@ def test_vector(doc):
...
@@ -16,8 +16,8 @@ def test_vector(doc):
assert
m
.
load_bool_vector
([
True
,
False
])
assert
m
.
load_bool_vector
([
True
,
False
])
assert
m
.
load_bool_vector
((
True
,
False
))
assert
m
.
load_bool_vector
((
True
,
False
))
assert
doc
(
m
.
cast_vector
)
==
"cast_vector() ->
L
ist[int]"
assert
doc
(
m
.
cast_vector
)
==
"cast_vector() ->
l
ist[int]"
assert
doc
(
m
.
load_vector
)
==
"load_vector(arg0:
L
ist[int]) -> bool"
assert
doc
(
m
.
load_vector
)
==
"load_vector(arg0:
l
ist[int]) -> bool"
# Test regression caused by 936: pointers to stl containers weren't castable
# Test regression caused by 936: pointers to stl containers weren't castable
assert
m
.
cast_ptr_vector
()
==
[
"lvalue"
,
"lvalue"
]
assert
m
.
cast_ptr_vector
()
==
[
"lvalue"
,
"lvalue"
]
...
@@ -39,10 +39,10 @@ def test_array(doc):
...
@@ -39,10 +39,10 @@ def test_array(doc):
assert
m
.
load_array
(
lst
)
assert
m
.
load_array
(
lst
)
assert
m
.
load_array
(
tuple
(
lst
))
assert
m
.
load_array
(
tuple
(
lst
))
assert
doc
(
m
.
cast_array
)
==
"cast_array() -> Annotated[
L
ist[int], FixedSize(2)]"
assert
doc
(
m
.
cast_array
)
==
"cast_array() -> Annotated[
l
ist[int], FixedSize(2)]"
assert
(
assert
(
doc
(
m
.
load_array
)
doc
(
m
.
load_array
)
==
"load_array(arg0: Annotated[
L
ist[int], FixedSize(2)]) -> bool"
==
"load_array(arg0: Annotated[
l
ist[int], FixedSize(2)]) -> bool"
)
)
...
@@ -53,8 +53,8 @@ def test_valarray(doc):
...
@@ -53,8 +53,8 @@ def test_valarray(doc):
assert
m
.
load_valarray
(
lst
)
assert
m
.
load_valarray
(
lst
)
assert
m
.
load_valarray
(
tuple
(
lst
))
assert
m
.
load_valarray
(
tuple
(
lst
))
assert
doc
(
m
.
cast_valarray
)
==
"cast_valarray() ->
L
ist[int]"
assert
doc
(
m
.
cast_valarray
)
==
"cast_valarray() ->
l
ist[int]"
assert
doc
(
m
.
load_valarray
)
==
"load_valarray(arg0:
L
ist[int]) -> bool"
assert
doc
(
m
.
load_valarray
)
==
"load_valarray(arg0:
l
ist[int]) -> bool"
def
test_map
(
doc
):
def
test_map
(
doc
):
...
@@ -66,8 +66,8 @@ def test_map(doc):
...
@@ -66,8 +66,8 @@ def test_map(doc):
assert
"key2"
in
d
assert
"key2"
in
d
assert
m
.
load_map
(
d
)
assert
m
.
load_map
(
d
)
assert
doc
(
m
.
cast_map
)
==
"cast_map() ->
D
ict[str, str]"
assert
doc
(
m
.
cast_map
)
==
"cast_map() ->
d
ict[str, str]"
assert
doc
(
m
.
load_map
)
==
"load_map(arg0:
D
ict[str, str]) -> bool"
assert
doc
(
m
.
load_map
)
==
"load_map(arg0:
d
ict[str, str]) -> bool"
def
test_set
(
doc
):
def
test_set
(
doc
):
...
@@ -78,8 +78,8 @@ def test_set(doc):
...
@@ -78,8 +78,8 @@ def test_set(doc):
assert
m
.
load_set
(
s
)
assert
m
.
load_set
(
s
)
assert
m
.
load_set
(
frozenset
(
s
))
assert
m
.
load_set
(
frozenset
(
s
))
assert
doc
(
m
.
cast_set
)
==
"cast_set() ->
S
et[str]"
assert
doc
(
m
.
cast_set
)
==
"cast_set() ->
s
et[str]"
assert
doc
(
m
.
load_set
)
==
"load_set(arg0:
S
et[str]) -> bool"
assert
doc
(
m
.
load_set
)
==
"load_set(arg0:
s
et[str]) -> bool"
def
test_recursive_casting
():
def
test_recursive_casting
():
...
@@ -303,7 +303,7 @@ def test_stl_pass_by_pointer(msg):
...
@@ -303,7 +303,7 @@ def test_stl_pass_by_pointer(msg):
msg
(
excinfo
.
value
)
msg
(
excinfo
.
value
)
==
"""
==
"""
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
1. (v:
List[int] = None) -> L
ist[int]
1. (v:
list[int] = None) -> l
ist[int]
Invoked with:
Invoked with:
"""
"""
...
@@ -315,7 +315,7 @@ def test_stl_pass_by_pointer(msg):
...
@@ -315,7 +315,7 @@ def test_stl_pass_by_pointer(msg):
msg
(
excinfo
.
value
)
msg
(
excinfo
.
value
)
==
"""
==
"""
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
stl_pass_by_pointer(): incompatible function arguments. The following argument types are supported:
1. (v:
List[int] = None) -> L
ist[int]
1. (v:
list[int] = None) -> l
ist[int]
Invoked with: None
Invoked with: None
"""
"""
...
...
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