Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pycapicompat
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
pycapicompat
Commits
cd111013
Commit
cd111013
authored
Jun 13, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pycapicompat.h: Initial stub - lots of TODO for
@Daetalus
parent
d48f4c17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
README.rst
README.rst
+18
-0
pycapicompat.h
pycapicompat.h
+55
-0
No files found.
README.rst
0 → 100644
View file @
cd111013
========================================================================================================
pycapicompat.h - Extra CAPI functions for compatibility between various C-based Python implementations
========================================================================================================
`pycapicompat.h` is a C-header with additional CAPI functions providing unified
access to C-based functionality between various C-bases Python implementations.
Currently covered are:
- Pyston_
- CPython_
we would also be glad to cover PyPy_ and we will try to do so on a best effort basis.
Patches are, as always, welcome.
.. _Pyston: https://pyston.org/
.. _CPython: https://www.python.org/
.. _PyPy: http://pypy.org/
pycapicompat.h
0 → 100644
View file @
cd111013
#ifndef _PYCAPICOMPAT_H_
#define _PYCAPICOMPAT_H_
/* pycapicompat.h - Extra CAPI functions for compatibility between various C-based Python implementations
* This file has been placed into Public Domain.
*
* The recommended way to use pycapicompat.h is to copy it from canonical
* location to your project on as-needed basis and include locally.
*
* The canonical location is:
*
* https://lab.nexedi.com/nexedi/pycapicompat/raw/master/pycapicompat.h
* (or https://lab.nexedi.com/nexedi/pycapicompat.git for Git access)
*
* Last updated: 2016-06-13
*/
#include <Python.h>
#ifdef __cplusplus
extern
"C"
{
#endif
// TODO(Daetalus)
#if 0
#ifndef IMPLEMENTATION_SUPPORTS_EXTENDED_C_API
#define PyErr_GetExcInfoType() PyThreadState_GET()->exc_type
#endif
#ifdef PYSTON_VERSION
foo = PyErr_GetExcInfoType(); // a new API function
#else
foo = PyThreadState_GET()->exc_type; // direct field access
#endif
#endif
// info about free variables
// TODO(Daetalus) verify and fill more
#ifdef CPYTHON_VERSION
// TODO(Daetalus) see how Cython does this check
#elif defined(PYSTON_VERSION)
void
PyCode_HasFreeVars
(
BoxedCode
*
code
)
{
return
code
->
source
->
getScopeInfo
()
->
takesClosure
();
}
#else
# error TODO pypy:PyCode_HasFreeVars not implemented for your python version
#endif
// TODO(Daetalus) add more stuff.
#ifdef __cplusplus
}
#endif
#endif
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