Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gaoqiong
pybind11
Commits
77586fd6
Commit
77586fd6
authored
Mar 06, 2016
by
Wenzel Jakob
Browse files
add version suffix to internal pybind11 data structures to avoid conflicts with future versions
parent
8d862b37
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
2 deletions
+7
-2
include/pybind11/cast.h
include/pybind11/cast.h
+3
-2
include/pybind11/common.h
include/pybind11/common.h
+4
-0
No files found.
include/pybind11/cast.h
View file @
77586fd6
...
...
@@ -34,12 +34,13 @@ PYBIND11_NOINLINE inline internals &get_internals() {
if
(
internals_ptr
)
return
*
internals_ptr
;
handle
builtins
(
PyEval_GetBuiltins
());
capsule
caps
(
builtins
[
"__pybind11__"
]);
const
char
*
id
=
PYBIND11_INTERNALS_ID
;
capsule
caps
(
builtins
[
id
]);
if
(
caps
.
check
())
{
internals_ptr
=
caps
;
}
else
{
internals_ptr
=
new
internals
();
builtins
[
"__pybind11__"
]
=
capsule
(
internals_ptr
);
builtins
[
id
]
=
capsule
(
internals_ptr
);
}
return
*
internals_ptr
;
}
...
...
include/pybind11/common.h
View file @
77586fd6
...
...
@@ -110,6 +110,10 @@
#endif
#define PYBIND11_TRY_NEXT_OVERLOAD ((PyObject *) 1) // special failure return code
#define PYBIND11_STRINGIFY(x) #x
#define PYBIND11_TOSTRING(x) PYBIND11_STRINGIFY(x)
#define PYBIND11_INTERNALS_ID "__pybind11_" \
PYBIND11_TOSTRING(PYBIND11_VERSION_MAJOR) "_" PYBIND11_TOSTRING(PYBIND11_VERSION_MINOR) "__"
#define PYBIND11_PLUGIN(name) \
static PyObject *pybind11_init(); \
...
...
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