Skip to content
This repository has been archived by the owner on Mar 8, 2018. It is now read-only.

Commit

Permalink
Add Python 2.3 compatibility macros
Browse files Browse the repository at this point in the history
  • Loading branch information
R. Tyler Ballance committed Jun 22, 2009
1 parent d31b642 commit 551fe77
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
18 changes: 17 additions & 1 deletion src/c/Cheetah.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
extern "C" {
#endif

/*
* Python 2.3 compatibility
*/
#ifndef Py_RETURN_TRUE
#define Py_RETURN_TRUE Py_INCREF(Py_True);\
return Py_True
#endif
#ifndef Py_RETURN_FALSE
#define Py_RETURN_FALSE Py_INCREF(Py_False);\
return Py_False
#endif
#ifndef Py_RETURN_NONE
#define Py_RETURN_NONE Py_INCREF(Py_None);\
return Py_None
#endif


/*
* Filter Module
Expand All @@ -23,7 +39,7 @@ typedef struct {
static PyObject *py_filter(PyObject *self, PyObject *args, PyObject *kwargs);

static struct PyMethodDef py_filtermethods[] = {
{"filter", (PyCFunction)(py_filter), METH_STATIC | METH_VARAGES | METH_KEYWORDS,
{"filter", (PyCFunction)(py_filter), METH_STATIC | METH_VARARGS | METH_KEYWORDS,
PyDoc_STR("Filter stuff")},
{NULL},
};
Expand Down
1 change: 1 addition & 0 deletions src/c/_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ extern "C" {

static PyObject *py_filter(PyObject *self, PyObject *args, PyObject *kwargs)
{
Py_RETURN_FALSE;
}

static const char _filtersdoc[] = "\
Expand Down
5 changes: 2 additions & 3 deletions src/c/_verifytype.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
* (c) 2009, R. Tyler Ballance <tyler@slide.com>
*/
#include <Python.h>

#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>

#include "Cheetah.h"

#ifdef __cplusplus
extern "C" {
Expand Down

0 comments on commit 551fe77

Please sign in to comment.