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
61e3b0bd
Commit
61e3b0bd
authored
Aug 13, 2016
by
Ivan Smirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use builtin str type for recarray field names
parent
1cdd171f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
include/pybind11/numpy.h
+4
-4
No files found.
include/pybind11/numpy.h
View file @
61e3b0bd
...
@@ -117,7 +117,7 @@ public:
...
@@ -117,7 +117,7 @@ public:
PYBIND11_OBJECT_DEFAULT
(
dtype
,
object
,
detail
::
npy_api
::
get
().
PyArrayDescr_Check_
);
PYBIND11_OBJECT_DEFAULT
(
dtype
,
object
,
detail
::
npy_api
::
get
().
PyArrayDescr_Check_
);
dtype
(
const
buffer_info
&
info
)
{
dtype
(
const
buffer_info
&
info
)
{
dtype
descr
(
_dtype_from_pep3118
()(
pybind11
::
str
(
info
.
format
)));
dtype
descr
(
_dtype_from_pep3118
()(
PYBIND11_STR_TYPE
(
info
.
format
)));
m_ptr
=
descr
.
strip_padding
().
release
().
ptr
();
m_ptr
=
descr
.
strip_padding
().
release
().
ptr
();
}
}
...
@@ -174,7 +174,7 @@ private:
...
@@ -174,7 +174,7 @@ private:
if
(
fields
.
ptr
()
==
Py_None
)
if
(
fields
.
ptr
()
==
Py_None
)
return
*
this
;
return
*
this
;
struct
field_descr
{
pybind11
::
str
name
;
object
format
;
int_
offset
;
};
struct
field_descr
{
PYBIND11_STR_TYPE
name
;
object
format
;
int_
offset
;
};
std
::
vector
<
field_descr
>
field_descriptors
;
std
::
vector
<
field_descr
>
field_descriptors
;
auto
items
=
fields
.
attr
(
"items"
).
cast
<
object
>
();
auto
items
=
fields
.
attr
(
"items"
).
cast
<
object
>
();
...
@@ -185,7 +185,7 @@ private:
...
@@ -185,7 +185,7 @@ private:
auto
offset
=
spec
[
1
].
cast
<
tuple
>
()[
1
].
cast
<
int_
>
();
auto
offset
=
spec
[
1
].
cast
<
tuple
>
()[
1
].
cast
<
int_
>
();
if
(
!
len
(
name
)
&&
format
.
kind
()
==
"V"
)
if
(
!
len
(
name
)
&&
format
.
kind
()
==
"V"
)
continue
;
continue
;
field_descriptors
.
push_back
({
name
,
format
.
strip_padding
(),
offset
});
field_descriptors
.
push_back
({
(
PYBIND11_STR_TYPE
)
name
,
format
.
strip_padding
(),
offset
});
}
}
std
::
sort
(
field_descriptors
.
begin
(),
field_descriptors
.
end
(),
std
::
sort
(
field_descriptors
.
begin
(),
field_descriptors
.
end
(),
...
@@ -405,7 +405,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
...
@@ -405,7 +405,7 @@ struct npy_format_descriptor<T, typename std::enable_if<is_pod_struct<T>::value>
for
(
auto
field
:
fields
)
{
for
(
auto
field
:
fields
)
{
if
(
!
field
.
descr
)
if
(
!
field
.
descr
)
pybind11_fail
(
"NumPy: unsupported field dtype"
);
pybind11_fail
(
"NumPy: unsupported field dtype"
);
names
.
append
(
str
(
field
.
name
));
names
.
append
(
PYBIND11_STR_TYPE
(
field
.
name
));
formats
.
append
(
field
.
descr
);
formats
.
append
(
field
.
descr
);
offsets
.
append
(
int_
(
field
.
offset
));
offsets
.
append
(
int_
(
field
.
offset
));
}
}
...
...
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