Commit ec8f8f79 authored by Ned Deily's avatar Ned Deily

Issue #15782: Prevent compile errors of OS X Carbon modules _Fm, _Qd, and

_Qdoffs when compiling with an SDK of 10.7 or later.  The OS X APIs they
wrap have long been deprecated and have now been removed with 10.7.
These modules were already empty for 64-bit builds and have been removed
in Python 3.  (Original patch by Ronald Oussoren.)
parent c4b82c03
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Mac OS Toolbox Modules Mac OS Toolbox Modules
********************** **********************
There are a set of modules that provide interfaces to various Mac OS toolboxes. These are a set of modules that provide interfaces to various legacy Mac OS toolboxes.
If applicable the module will define a number of Python objects for the various If applicable the module will define a number of Python objects for the various
structures declared by the toolbox, and operations will be implemented as structures declared by the toolbox, and operations will be implemented as
methods of the object. Other operations will be implemented as functions in the methods of the object. Other operations will be implemented as functions in the
...@@ -24,7 +24,10 @@ framework and Qt is in the QuickTime framework. The normal use pattern is :: ...@@ -24,7 +24,10 @@ framework and Qt is in the QuickTime framework. The normal use pattern is ::
.. note:: .. note::
The Carbon modules have been removed in Python 3. Most of the OS X APIs that these modules use are deprecated or removed
in recent versions of OS X. Many are not available when Python is
executing in 64-bit mode. The Carbon modules have been removed in
Python 3. You should avoid using them in Python 2.
:mod:`Carbon.AE` --- Apple Events :mod:`Carbon.AE` --- Apple Events
......
...@@ -12,7 +12,10 @@ Mac-specific Python programming. ...@@ -12,7 +12,10 @@ Mac-specific Python programming.
.. note:: .. note::
These modules are deprecated and have been removed in Python 3.x. Most of the OS X APIs that these modules use are deprecated or removed
in recent versions of OS X. Many are not available when Python is
executing in 64-bit mode. These modules have been removed in
Python 3. You should avoid using them in Python 2.
.. toctree:: .. toctree::
......
...@@ -2,8 +2,9 @@ ...@@ -2,8 +2,9 @@
/* =========================== Module _Fm =========================== */ /* =========================== Module _Fm =========================== */
#include "Python.h" #include "Python.h"
#include <Carbon/Carbon.h>
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
#include "pymactoolbox.h" #include "pymactoolbox.h"
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
}} while(0) }} while(0)
#include <Carbon/Carbon.h>
/* /*
...@@ -347,7 +347,7 @@ static PyMethodDef Fm_methods[] = { ...@@ -347,7 +347,7 @@ static PyMethodDef Fm_methods[] = {
void init_Fm(void) void init_Fm(void)
{ {
PyObject *m; PyObject *m;
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
PyObject *d; PyObject *d;
#endif /* __LP64__ */ #endif /* __LP64__ */
...@@ -355,7 +355,7 @@ void init_Fm(void) ...@@ -355,7 +355,7 @@ void init_Fm(void)
m = Py_InitModule("_Fm", Fm_methods); m = Py_InitModule("_Fm", Fm_methods);
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
Fm_Error = PyMac_GetOSErrException(); Fm_Error = PyMac_GetOSErrException();
if (Fm_Error == NULL || if (Fm_Error == NULL ||
......
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
#include "Python.h" #include "Python.h"
#include <Carbon/Carbon.h>
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
#include "pymactoolbox.h" #include "pymactoolbox.h"
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
}} while(0) }} while(0)
#include <Carbon/Carbon.h>
#ifdef USE_TOOLBOX_OBJECT_GLUE #ifdef USE_TOOLBOX_OBJECT_GLUE
extern PyObject *_GrafObj_New(GrafPtr); extern PyObject *_GrafObj_New(GrafPtr);
...@@ -6548,7 +6548,7 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args) ...@@ -6548,7 +6548,7 @@ static PyObject *Qd_RawBitMap(PyObject *_self, PyObject *_args)
#endif /* __LP64__ */ #endif /* __LP64__ */
static PyMethodDef Qd_methods[] = { static PyMethodDef Qd_methods[] = {
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
{"GetPort", (PyCFunction)Qd_GetPort, 1, {"GetPort", (PyCFunction)Qd_GetPort, 1,
PyDoc_STR("() -> (GrafPtr port)")}, PyDoc_STR("() -> (GrafPtr port)")},
{"GrafDevice", (PyCFunction)Qd_GrafDevice, 1, {"GrafDevice", (PyCFunction)Qd_GrafDevice, 1,
...@@ -7088,7 +7088,7 @@ static PyMethodDef Qd_methods[] = { ...@@ -7088,7 +7088,7 @@ static PyMethodDef Qd_methods[] = {
}; };
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
/* Like BMObj_New, but the original bitmap data structure is copied (and /* Like BMObj_New, but the original bitmap data structure is copied (and
** released when the object is released) ** released when the object is released)
...@@ -7112,7 +7112,7 @@ PyObject *BMObj_NewCopied(BitMapPtr itself) ...@@ -7112,7 +7112,7 @@ PyObject *BMObj_NewCopied(BitMapPtr itself)
void init_Qd(void) void init_Qd(void)
{ {
PyObject *m; PyObject *m;
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
PyObject *d; PyObject *d;
...@@ -7127,7 +7127,7 @@ void init_Qd(void) ...@@ -7127,7 +7127,7 @@ void init_Qd(void)
#endif /* __LP64__ */ #endif /* __LP64__ */
m = Py_InitModule("_Qd", Qd_methods); m = Py_InitModule("_Qd", Qd_methods);
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
Qd_Error = PyMac_GetOSErrException(); Qd_Error = PyMac_GetOSErrException();
if (Qd_Error == NULL || if (Qd_Error == NULL ||
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
#include "Python.h" #include "Python.h"
#ifndef __LP64__ #include <Carbon/Carbon.h>
#if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
#include "pymactoolbox.h" #include "pymactoolbox.h"
...@@ -16,7 +17,6 @@ ...@@ -16,7 +17,6 @@
}} while(0) }} while(0)
#include <Carbon/Carbon.h>
#ifdef USE_TOOLBOX_OBJECT_GLUE #ifdef USE_TOOLBOX_OBJECT_GLUE
extern PyObject *_GWorldObj_New(GWorldPtr); extern PyObject *_GWorldObj_New(GWorldPtr);
...@@ -634,7 +634,7 @@ static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args) ...@@ -634,7 +634,7 @@ static PyObject *Qdoffs_PutPixMapBytes(PyObject *_self, PyObject *_args)
#endif /* __LP64__ */ #endif /* __LP64__ */
static PyMethodDef Qdoffs_methods[] = { static PyMethodDef Qdoffs_methods[] = {
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
{"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1, {"NewGWorld", (PyCFunction)Qdoffs_NewGWorld, 1,
PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")}, PyDoc_STR("(short PixelDepth, Rect boundsRect, CTabHandle cTable, GDHandle aGDevice, GWorldFlags flags) -> (GWorldPtr offscreenGWorld)")},
{"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1, {"LockPixels", (PyCFunction)Qdoffs_LockPixels, 1,
...@@ -691,7 +691,7 @@ static PyMethodDef Qdoffs_methods[] = { ...@@ -691,7 +691,7 @@ static PyMethodDef Qdoffs_methods[] = {
void init_Qdoffs(void) void init_Qdoffs(void)
{ {
PyObject *m; PyObject *m;
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
PyObject *d; PyObject *d;
...@@ -702,7 +702,7 @@ void init_Qdoffs(void) ...@@ -702,7 +702,7 @@ void init_Qdoffs(void)
#endif /* __LP64__ */ #endif /* __LP64__ */
m = Py_InitModule("_Qdoffs", Qdoffs_methods); m = Py_InitModule("_Qdoffs", Qdoffs_methods);
#ifndef __LP64__ #if !defined(__LP64__) && !defined(MAC_OS_X_VERSION_10_7)
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
Qdoffs_Error = PyMac_GetOSErrException(); Qdoffs_Error = PyMac_GetOSErrException();
if (Qdoffs_Error == NULL || if (Qdoffs_Error == NULL ||
......
...@@ -600,6 +600,12 @@ Library ...@@ -600,6 +600,12 @@ Library
- Issue #16441: Avoid excessive memory usage working with large gzip - Issue #16441: Avoid excessive memory usage working with large gzip
files using the gzip module. files using the gzip module.
- Issue #15782: Prevent compile errors of OS X Carbon modules _Fm, _Qd, and
_Qdoffs when compiling with an SDK of 10.7 or later. The OS X APIs they
wrap have long been deprecated and have now been removed with 10.7.
These modules were already empty for 64-bit builds and have been removed
in Python 3.
Extension Modules Extension Modules
----------------- -----------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment