1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
Description: Fixes _speedup.c for Python 3
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2014-06-27
--- python-pyscss-1.2.0.post3.orig/scss/src/_speedups.c
+++ python-pyscss-1.2.0.post3/scss/src/_speedups.c
@@ -12,8 +12,16 @@
#include "block_locator.h"
#include "scanner.h"
+#ifndef Py_TYPE
+ #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
+#endif
+
+#if PY_MAJOR_VERSION >=3
+# define Py_TPFLAGS_HAVE_ITER 0
+#endif
+
/* BlockLocator */
-staticforward PyTypeObject scss_BlockLocatorType;
+static PyTypeObject scss_BlockLocatorType;
typedef struct {
PyObject_HEAD
@@ -46,7 +54,7 @@ scss_BlockLocator_dealloc(scss_BlockLoca
{
if (self->locator != NULL) BlockLocator_del(self->locator);
- self->ob_type->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
#ifdef DEBUG
PySys_WriteStderr("Scss BlockLocator object destroyed!\n");
@@ -136,7 +144,7 @@ static PyTypeObject scss_BlockLocatorTyp
/* Scanner */
static PyObject *PyExc_scss_NoMoreTokens;
-staticforward PyTypeObject scss_ScannerType;
+static PyTypeObject scss_ScannerType;
typedef struct {
PyObject_HEAD
@@ -442,7 +450,7 @@ scss_Scanner_dealloc(scss_Scanner *self)
{
if (self->scanner != NULL) Scanner_del(self->scanner);
- self->ob_type->tp_free((PyObject*)self);
+ Py_TYPE(self)->tp_free((PyObject*)self);
#ifdef DEBUG
PySys_WriteStderr("Scss Scanner object destroyed!\n");
|