mirror of
https://github.com/pyenv/pyenv.git
synced 2024-11-21 20:47:00 -05:00
Fix build of native modules of Carbon/ncurses on OS X 10.7
This commit is contained in:
parent
e1ea64b0b9
commit
0c38147fcb
7 changed files with 868 additions and 0 deletions
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
|
@ -0,0 +1,124 @@
|
|||
diff --git ./Mac/Modules/cg/_CGmodule.c ./Mac/Modules/cg/_CGmodule.c
|
||||
index 8115614..e36fce9 100755
|
||||
--- ./Mac/Modules/cg/_CGmodule.c
|
||||
+++ ./Mac/Modules/cg/_CGmodule.c
|
||||
@@ -1025,6 +1025,7 @@ static PyObject *CGContextRefObj_CGContextSetShouldAntialias(CGContextRefObject
|
||||
return _res;
|
||||
}
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CGContextRefObj_SyncCGContextOriginWithPort(CGContextRefObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1055,6 +1056,7 @@ static PyObject *CGContextRefObj_ClipCGContextToRegion(CGContextRefObject *_self
|
||||
_res = Py_None;
|
||||
return _res;
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CGContextRefObj_methods[] = {
|
||||
{"CGContextSaveGState", (PyCFunction)CGContextRefObj_CGContextSaveGState, 1,
|
||||
@@ -1173,10 +1175,12 @@ static PyMethodDef CGContextRefObj_methods[] = {
|
||||
PyDoc_STR("() -> None")},
|
||||
{"CGContextSetShouldAntialias", (PyCFunction)CGContextRefObj_CGContextSetShouldAntialias, 1,
|
||||
PyDoc_STR("(int shouldAntialias) -> None")},
|
||||
+#ifndef __LP64__
|
||||
{"SyncCGContextOriginWithPort", (PyCFunction)CGContextRefObj_SyncCGContextOriginWithPort, 1,
|
||||
PyDoc_STR("(CGrafPtr port) -> None")},
|
||||
{"ClipCGContextToRegion", (PyCFunction)CGContextRefObj_ClipCGContextToRegion, 1,
|
||||
PyDoc_STR("(Rect portRect, RgnHandle region) -> None")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -1254,6 +1258,7 @@ PyTypeObject CGContextRef_Type = {
|
||||
/* ------------------ End object type CGContextRef ------------------ */
|
||||
|
||||
|
||||
+#ifndef __LP64__
|
||||
static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
{
|
||||
PyObject *_res = NULL;
|
||||
@@ -1271,10 +1276,13 @@ static PyObject *CG_CreateCGContextForPort(PyObject *_self, PyObject *_args)
|
||||
return _res;
|
||||
|
||||
}
|
||||
+#endif
|
||||
|
||||
static PyMethodDef CG_methods[] = {
|
||||
+#ifndef __LP64__
|
||||
{"CreateCGContextForPort", (PyCFunction)CG_CreateCGContextForPort, 1,
|
||||
PyDoc_STR("(CGrafPtr) -> CGContextRef")},
|
||||
+#endif
|
||||
{NULL, NULL, 0}
|
||||
};
|
||||
|
||||
diff --git ./Modules/_curses_panel.c ./Modules/_curses_panel.c
|
||||
index 0acf3fd..1728b59 100644
|
||||
--- ./Modules/_curses_panel.c
|
||||
+++ ./Modules/_curses_panel.c
|
||||
@@ -56,7 +56,7 @@ typedef struct {
|
||||
|
||||
PyTypeObject PyCursesPanel_Type;
|
||||
|
||||
-#define PyCursesPanel_Check(v) ((v)->ob_type == &PyCursesPanel_Type)
|
||||
+#define PyCursesPanel_Check(v) (Py_TYPE(v) == &PyCursesPanel_Type)
|
||||
|
||||
/* Some helper functions. The problem is that there's always a window
|
||||
associated with a panel. To ensure that Python's GC doesn't pull
|
||||
@@ -178,12 +178,13 @@ PyCursesPanel_New(PANEL *pan, PyCursesWindowObject *wo)
|
||||
po = PyObject_NEW(PyCursesPanelObject, &PyCursesPanel_Type);
|
||||
if (po == NULL) return NULL;
|
||||
po->pan = pan;
|
||||
- po->wo = wo;
|
||||
- Py_INCREF(wo);
|
||||
if (insert_lop(po) < 0) {
|
||||
- PyObject_DEL(po);
|
||||
- return NULL;
|
||||
+ po->wo = NULL;
|
||||
+ Py_DECREF(po);
|
||||
+ return NULL;
|
||||
}
|
||||
+ po->wo = wo;
|
||||
+ Py_INCREF(wo);
|
||||
return (PyObject *)po;
|
||||
}
|
||||
|
||||
@@ -191,8 +192,10 @@ static void
|
||||
PyCursesPanel_Dealloc(PyCursesPanelObject *po)
|
||||
{
|
||||
(void)del_panel(po->pan);
|
||||
- Py_DECREF(po->wo);
|
||||
- remove_lop(po);
|
||||
+ if (po->wo != NULL) {
|
||||
+ Py_DECREF(po->wo);
|
||||
+ remove_lop(po);
|
||||
+ }
|
||||
PyObject_DEL(po);
|
||||
}
|
||||
|
||||
@@ -338,11 +341,10 @@ PyCursesPanel_GetAttr(PyCursesPanelObject *self, char *name)
|
||||
/* -------------------------------------------------------*/
|
||||
|
||||
PyTypeObject PyCursesPanel_Type = {
|
||||
- PyObject_HEAD_INIT(NULL)
|
||||
- 0, /*ob_size*/
|
||||
- "_curses_panel.curses panel", /*tp_name*/
|
||||
- sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
- 0, /*tp_itemsize*/
|
||||
+ PyVarObject_HEAD_INIT(NULL, 0)
|
||||
+ "_curses_panel.curses panel", /*tp_name*/
|
||||
+ sizeof(PyCursesPanelObject), /*tp_basicsize*/
|
||||
+ 0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
(destructor)PyCursesPanel_Dealloc, /*tp_dealloc*/
|
||||
0, /*tp_print*/
|
||||
@@ -458,7 +460,7 @@ init_curses_panel(void)
|
||||
PyObject *m, *d, *v;
|
||||
|
||||
/* Initialize object type */
|
||||
- PyCursesPanel_Type.ob_type = &PyType_Type;
|
||||
+ Py_TYPE(&PyCursesPanel_Type) = &PyType_Type;
|
||||
|
||||
import_curses();
|
||||
|
Loading…
Reference in a new issue