The other day I released PyBindGen 0.8. Main news is that it features a new
experimental header file scanner based on pygccxml (i.e., it's similar to
py++ in scope, if not in maturity, but does not use boost.pythonunderneath).
== What ==
PyBindGen is a Python module that is geared to generating C/C++ code that
binds a C/C++ library for Python. It does so without extensive use of either
C++ templates or C pre-processor macros. It has modular handling of C/C++
types, and can be easily extended with Python plugins. The generated code is
almost as clean as what a human programmer would write, and does not depend
on any library or header files besides Python itself.
== Where ==
== NEWS ==
- Support C++ instance attributes through getter/setter methods
- Support functions as methods of C++ classes
- Support the PyObject* type
- Support unsigned int, C strings (char*) (from Mark Lee)
- Add basic support for enum types
- New experimental automatic module generator based on C/C++
header file scanner and annotations in comments, using pygccxml
- Some bug fixes
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert
I'm the author of an extension module (blist) that provides a type that fits
the MutableSequence API. Is there a canonical way for me to register the
type as a MutableSequence from the C API?
Daniel Stutzbach, Ph.D.
President, Stutzbach Enterprises, LLC <http://stutzbachenterprises.com>
I'm trying to port my posix_ipc extension to Python 3, and I'm
confused by the documentation for PyObject_HEAD and PyObject_VAR_HEAD.
My understanding is that a PyObject-derived type should begin its
PyTypeObject struct with PyObject_HEAD and a PyVarObject-derived type
with PyObject_VAR_HEAD. the documentation says of PyVarObject, "This
type does not often appear in the Python/C API."
The doc also says that PyObject_VAR_HEAD, "is used when declaring new
types which represent objects with a length that varies from instance
I assumed, then, that PyObject_VAR_HEAD would also appear
infrequently, but that's not the case at all. In fact, I can't find
PyObject_HEAD used at all in the Python 3.1.1 source code, whereas
PyObject_VAR_HEAD is used hundreds of times, including for objects
that don't have a length (like the float type, for instance).
Is the documentation wrong, or am I misreading it? Suggestions
I want to create an instance given its type object. I expected that calling the type would be enough, something like this:
obj = (MyFooObject *) PyObject_CallFunctionObjArgs(&MyFooType, other, arguments, NULL)
but it doesn't work (nor even compiles, I think). So this is what I'm doing now:
obj = (MyFooObject *) PyObject_CallMethod((PyObject *)&PyType_Type, "__call__", "OOO", &MyFooType, other, arguments);
where MyFooType is a PyTypeObject struct. Ok, it works, but I'm pretty sure there is a more direct way - but how?
Encontra las mejores recetas con Yahoo! Cocina.