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
7c99ff2a
Commit
7c99ff2a
authored
Jun 02, 2016
by
Wenzel Jakob
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix segfault when passing a docstring to def_property* (fixes #222)
parent
9767c480
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletions
+12
-1
include/pybind11/pybind11.h
+12
-1
No files found.
include/pybind11/pybind11.h
View file @
7c99ff2a
...
@@ -860,9 +860,20 @@ public:
...
@@ -860,9 +860,20 @@ public:
template
<
typename
...
Extra
>
template
<
typename
...
Extra
>
class_
&
def_property_static
(
const
char
*
name
,
const
cpp_function
&
fget
,
const
cpp_function
&
fset
,
const
Extra
&
...
extra
)
{
class_
&
def_property_static
(
const
char
*
name
,
const
cpp_function
&
fget
,
const
cpp_function
&
fset
,
const
Extra
&
...
extra
)
{
auto
rec_fget
=
get_function_record
(
fget
),
rec_fset
=
get_function_record
(
fset
);
auto
rec_fget
=
get_function_record
(
fget
),
rec_fset
=
get_function_record
(
fset
);
char
*
doc_prev
=
rec_fget
->
doc
;
/* 'extra' field may include a property-specific documentation string */
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fget
);
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fget
);
if
(
rec_fset
)
if
(
rec_fget
->
doc
&&
rec_fget
->
doc
!=
doc_prev
)
{
free
(
doc_prev
);
rec_fget
->
doc
=
strdup
(
rec_fget
->
doc
);
}
if
(
rec_fset
)
{
doc_prev
=
rec_fset
->
doc
;
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fset
);
detail
::
process_attributes
<
Extra
...
>::
init
(
extra
...,
rec_fset
);
if
(
rec_fset
->
doc
&&
rec_fset
->
doc
!=
doc_prev
)
{
free
(
doc_prev
);
rec_fset
->
doc
=
strdup
(
rec_fset
->
doc
);
}
}
pybind11
::
str
doc_obj
=
pybind11
::
str
(
rec_fget
->
doc
?
rec_fget
->
doc
:
""
);
pybind11
::
str
doc_obj
=
pybind11
::
str
(
rec_fget
->
doc
?
rec_fget
->
doc
:
""
);
object
property
(
object
property
(
PyObject_CallFunctionObjArgs
((
PyObject
*
)
&
PyProperty_Type
,
fget
.
ptr
()
?
fget
.
ptr
()
:
Py_None
,
PyObject_CallFunctionObjArgs
((
PyObject
*
)
&
PyProperty_Type
,
fget
.
ptr
()
?
fget
.
ptr
()
:
Py_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