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
5b4751af
Commit
5b4751af
authored
Aug 27, 2019
by
Stephen Larew
Committed by
Wenzel Jakob
Aug 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add const to buffer:request() (#1890)
parent
8f5a8ab4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
include/pybind11/pytypes.h
+1
-1
tests/test_buffers.cpp
+1
-1
No files found.
include/pybind11/pytypes.h
View file @
5b4751af
...
...
@@ -1312,7 +1312,7 @@ class buffer : public object {
public
:
PYBIND11_OBJECT_DEFAULT
(
buffer
,
object
,
PyObject_CheckBuffer
)
buffer_info
request
(
bool
writable
=
false
)
{
buffer_info
request
(
bool
writable
=
false
)
const
{
int
flags
=
PyBUF_STRIDES
|
PyBUF_FORMAT
;
if
(
writable
)
flags
|=
PyBUF_WRITABLE
;
Py_buffer
*
view
=
new
Py_buffer
();
...
...
tests/test_buffers.cpp
View file @
5b4751af
...
...
@@ -78,7 +78,7 @@ TEST_SUBMODULE(buffers, m) {
py
::
class_
<
Matrix
>
(
m
,
"Matrix"
,
py
::
buffer_protocol
())
.
def
(
py
::
init
<
ssize_t
,
ssize_t
>
())
/// Construct from a buffer
.
def
(
py
::
init
([](
py
::
buffer
b
)
{
.
def
(
py
::
init
([](
py
::
buffer
const
b
)
{
py
::
buffer_info
info
=
b
.
request
();
if
(
info
.
format
!=
py
::
format_descriptor
<
float
>::
format
()
||
info
.
ndim
!=
2
)
throw
std
::
runtime_error
(
"Incompatible buffer format!"
);
...
...
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