Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.io.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
bob
bob.io.base
Commits
da01fa5c
Commit
da01fa5c
authored
11 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
Use technique for PyCapsule import that allows for namespaced packages
parent
53bd2b39
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
xbob/io/include/xbob.io/api.h
+8
-15
8 additions, 15 deletions
xbob/io/include/xbob.io/api.h
with
8 additions
and
15 deletions
xbob/io/include/xbob.io/api.h
+
8
−
15
View file @
da01fa5c
...
...
@@ -274,18 +274,6 @@ typedef struct {
*/
static
int
import_xbob_io
(
void
)
{
#if PY_VERSION_HEX >= 0x02070000
/* New Python API support for library loading */
PyXbobIo_API
=
(
void
**
)
PyCapsule_Import
(
BOOST_PP_STRINGIZE
(
XBOB_IO_MODULE_PREFIX
)
"."
BOOST_PP_STRINGIZE
(
XBOB_IO_MODULE_NAME
)
"._C_API"
,
0
);
if
(
!
PyXbobIo_API
)
return
-
1
;
#else
/* Old-style Python API support for library loading */
PyObject
*
c_api_object
;
PyObject
*
module
;
...
...
@@ -300,15 +288,20 @@ typedef struct {
return
-
1
;
}
# if PY_VERSION_HEX >= 0x02070000
if
(
PyCapsule_CheckExact
(
c_api_object
))
{
PyBlitzArray_API
=
(
void
**
)
PyCapsule_GetPointer
(
c_api_object
,
PyCapsule_GetName
(
c_api_object
));
}
# else
if
(
PyCObject_Check
(
c_api_object
))
{
Py
XbobIo
_API
=
(
void
**
)
PyCObject_AsVoidPtr
(
c_api_object
);
Py
BlitzArray
_API
=
(
void
**
)
PyCObject_AsVoidPtr
(
c_api_object
);
}
# endif
Py_DECREF
(
c_api_object
);
Py_DECREF
(
module
);
#endif
/* Checks that the imported version matches the compiled version */
int
imported_version
=
*
(
int
*
)
PyXbobIo_API
[
PyIo_APIVersion_NUM
];
...
...
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