This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from distutils.core import setup | |
from Cython.Build import cythonize | |
setup(name = 'tst', | |
ext_modules = cythonize(['tst.pyx']) | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from demo import incx | |
class Point(object): | |
"""A 1-diml Point""" | |
def __init__(self, x): | |
self.x = x | |
incx = incx | |
p = Point(0) | |
p.incx() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/python.hpp> | |
void report(std::string msg) { | |
PyObject *f = PySys_GetObject((char *)"stdout"); | |
PyFile_WriteString(msg.c_str(), f); | |
PyFile_WriteString("\n", f); | |
} | |
BOOST_PYTHON_MODULE(reporting) { | |
boost::python::def("report", &report); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generated by Cython 0.13 on Thu Oct 13 10:39:36 2011 */ | |
#define PY_SSIZE_T_CLEAN | |
#include "Python.h" | |
#ifndef Py_PYTHON_H | |
#error Python headers needed to compile C extensions, please install development version of Python. | |
#else | |
#include <stddef.h> /* For offsetof */ | |
#ifndef offsetof |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <boost/python.hpp> | |
#include <iostream> | |
namespace { | |
void *convert_to_FILEptr(PyObject* obj) { | |
return PyFile_Check(obj) ? PyFile_AsFile(obj) : 0; | |
} | |
} | |
void test_argument(FILE* f) { |
NewerOlder