Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
eigenpy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stack Of Tasks
eigenpy
Commits
b620c5b3
Verified
Commit
b620c5b3
authored
5 years ago
by
Justin Carpentier
Browse files
Options
Downloads
Patches
Plain Diff
core: fix potential bug in rvalue_from_python_data
parent
0d32f041
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/eigenpy/details/rvalue_from_python_data.hpp
+48
-7
48 additions, 7 deletions
include/eigenpy/details/rvalue_from_python_data.hpp
with
48 additions
and
7 deletions
include/eigenpy/details/rvalue_from_python_data.hpp
+
48
−
7
View file @
b620c5b3
/*
* Copyright 2018-2020, INRIA
*/
#ifndef __eigenpy_details_rvalue_from_python_data_hpp__
#ifndef __eigenpy_details_rvalue_from_python_data_hpp__
#define __eigenpy_details_rvalue_from_python_data_hpp__
#define __eigenpy_details_rvalue_from_python_data_hpp__
...
@@ -10,14 +14,51 @@ namespace boost
...
@@ -10,14 +14,51 @@ namespace boost
{
{
namespace
converter
namespace
converter
{
{
/// \brief Template specialization of rvalue_from_python_data
/// \brief Template specialization of rvalue_from_python_data
template
<
typename
Derived
>
template
<
typename
Derived
>
struct
rvalue_from_python_data
<
Eigen
::
MatrixBase
<
Derived
>
const
&
>
struct
rvalue_from_python_data
<
Eigen
::
MatrixBase
<
Derived
>
const
&
>
:
rvalue_from_python_storage
<
Eigen
::
MatrixBase
<
Derived
>
const
&
>
:
rvalue_from_python_storage
<
Derived
const
&
>
{
typedef
Eigen
::
MatrixBase
<
Derived
>
const
&
T
;
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
&& !defined(BOOST_PYTHON_SYNOPSIS)
/* Synopsis' OpenCXX has trouble parsing this */
// This must always be a POD struct with m_data its first member.
BOOST_STATIC_ASSERT
(
BOOST_PYTHON_OFFSETOF
(
rvalue_from_python_storage
<
T
>
,
stage1
)
==
0
);
# endif
// The usual constructor
rvalue_from_python_data
(
rvalue_from_python_stage1_data
const
&
_stage1
)
{
this
->
stage1
=
_stage1
;
}
// This constructor just sets m_convertible -- used by
// implicitly_convertible<> to perform the final step of the
// conversion, where the construct() function is already known.
rvalue_from_python_data
(
void
*
convertible
)
{
this
->
stage1
.
convertible
=
convertible
;
}
// Destroys any object constructed in the storage.
~
rvalue_from_python_data
()
{
if
(
this
->
stage1
.
convertible
==
this
->
storage
.
bytes
)
static_cast
<
Derived
*>
((
void
*
)
this
->
storage
.
bytes
)
->~
Derived
();
}
};
/// \brief Template specialization of rvalue_from_python_data
template
<
typename
Derived
>
struct
rvalue_from_python_data
<
Eigen
::
EigenBase
<
Derived
>
const
&
>
:
rvalue_from_python_storage
<
Derived
const
&
>
{
{
typedef
Eigen
::
MatrixBase
<
Derived
>
const
&
T
;
typedef
Eigen
::
MatrixBase
<
Derived
>
const
&
T
;
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
# if (!defined(__MWERKS__) || __MWERKS__ >= 0x3000) \
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
&& (!defined(__EDG_VERSION__) || __EDG_VERSION__ >= 245) \
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
&& (!defined(__DECCXX_VER) || __DECCXX_VER > 60590014) \
...
@@ -25,13 +66,13 @@ namespace boost
...
@@ -25,13 +66,13 @@ namespace boost
// This must always be a POD struct with m_data its first member.
// This must always be a POD struct with m_data its first member.
BOOST_STATIC_ASSERT
(
BOOST_PYTHON_OFFSETOF
(
rvalue_from_python_storage
<
T
>
,
stage1
)
==
0
);
BOOST_STATIC_ASSERT
(
BOOST_PYTHON_OFFSETOF
(
rvalue_from_python_storage
<
T
>
,
stage1
)
==
0
);
# endif
# endif
// The usual constructor
// The usual constructor
rvalue_from_python_data
(
rvalue_from_python_stage1_data
const
&
_stage1
)
rvalue_from_python_data
(
rvalue_from_python_stage1_data
const
&
_stage1
)
{
{
this
->
stage1
=
_stage1
;
this
->
stage1
=
_stage1
;
}
}
// This constructor just sets m_convertible -- used by
// This constructor just sets m_convertible -- used by
// implicitly_convertible<> to perform the final step of the
// implicitly_convertible<> to perform the final step of the
// conversion, where the construct() function is already known.
// conversion, where the construct() function is already known.
...
@@ -39,7 +80,7 @@ namespace boost
...
@@ -39,7 +80,7 @@ namespace boost
{
{
this
->
stage1
.
convertible
=
convertible
;
this
->
stage1
.
convertible
=
convertible
;
}
}
// Destroys any object constructed in the storage.
// Destroys any object constructed in the storage.
~
rvalue_from_python_data
()
~
rvalue_from_python_data
()
{
{
...
@@ -47,7 +88,7 @@ namespace boost
...
@@ -47,7 +88,7 @@ namespace boost
static_cast
<
Derived
*>
((
void
*
)
this
->
storage
.
bytes
)
->~
Derived
();
static_cast
<
Derived
*>
((
void
*
)
this
->
storage
.
bytes
)
->~
Derived
();
}
}
};
};
}
}
}
}
}
// namespace boost::python::converter
}
// namespace boost::python::converter
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment