mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Got rid of the python.rsrc resource file. The error message strings and
dialogs are now stored in Mac/Lib, and loaded on demand through macresource. Not only does this simplify a MacPython based on Apple's Python, but it also makes Mac error codes come out symbolically when running command line python (if you have Mac/Lib in your path). The resource files are copied from Mac/Resources. The old ones will disappear after the OS9 build procedure has been adjusted.
This commit is contained in:
parent
430b1563dd
commit
dde800ec4e
7 changed files with 74 additions and 76 deletions
|
@ -81,8 +81,42 @@ char *PyMac_StrError(int err)
|
|||
static char buf[256];
|
||||
Handle h;
|
||||
char *str;
|
||||
static int errors_loaded;
|
||||
|
||||
h = GetResource('Estr', err);
|
||||
if (!h && !errors_loaded) {
|
||||
/*
|
||||
** Attempt to open the resource file containing the
|
||||
** Estr resources. We ignore all errors. We also try
|
||||
** this only once.
|
||||
*/
|
||||
errors_loaded = 1;
|
||||
PyObject *m, *rv;
|
||||
|
||||
m = PyImport_ImportModule("macresource");
|
||||
if (!m) {
|
||||
if (Py_VerboseFlag)
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
} else {
|
||||
rv = PyObject_CallMethod(m, "open_error_resource", "");
|
||||
if (!rv) {
|
||||
if (Py_VerboseFlag)
|
||||
PyErr_Print();
|
||||
PyErr_Clear();
|
||||
} else {
|
||||
Py_DECREF(rv);
|
||||
/* And try again... */
|
||||
h = GetResource('Estr', err);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
** Whether the code above succeeded or not, we won't try
|
||||
** again.
|
||||
*/
|
||||
errors_loaded = 1;
|
||||
|
||||
if ( h ) {
|
||||
HLock(h);
|
||||
str = (char *)*h;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue