comparison Python/import.c @ 42736:ddefbdbdbcb5 2.5

Backport fix of #1752175.
author Georg Brandl <georg@python.org>
date Thu, 23 Aug 2007 18:08:33 +0000
parents a3bf55a03f66
children 787b969d37f0
comparison
equal deleted inserted replaced
42733:bcbdc95dfba9 42736:ddefbdbdbcb5
117 int countS = 0; 117 int countS = 0;
118 118
119 /* prepare _PyImport_Filetab: copy entries from 119 /* prepare _PyImport_Filetab: copy entries from
120 _PyImport_DynLoadFiletab and _PyImport_StandardFiletab. 120 _PyImport_DynLoadFiletab and _PyImport_StandardFiletab.
121 */ 121 */
122 #ifdef HAVE_DYNAMIC_LOADING
122 for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan) 123 for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan)
123 ++countD; 124 ++countD;
125 #endif
124 for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) 126 for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan)
125 ++countS; 127 ++countS;
126 filetab = PyMem_NEW(struct filedescr, countD + countS + 1); 128 filetab = PyMem_NEW(struct filedescr, countD + countS + 1);
127 if (filetab == NULL) 129 if (filetab == NULL)
128 Py_FatalError("Can't initialize import file table."); 130 Py_FatalError("Can't initialize import file table.");
131 #ifdef HAVE_DYNAMIC_LOADING
129 memcpy(filetab, _PyImport_DynLoadFiletab, 132 memcpy(filetab, _PyImport_DynLoadFiletab,
130 countD * sizeof(struct filedescr)); 133 countD * sizeof(struct filedescr));
134 #endif
131 memcpy(filetab + countD, _PyImport_StandardFiletab, 135 memcpy(filetab + countD, _PyImport_StandardFiletab,
132 countS * sizeof(struct filedescr)); 136 countS * sizeof(struct filedescr));
133 filetab[countD + countS].suffix = NULL; 137 filetab[countD + countS].suffix = NULL;
134 138
135 _PyImport_Filetab = filetab; 139 _PyImport_Filetab = filetab;
1364 saved_buf = strdup(buf); 1368 saved_buf = strdup(buf);
1365 saved_len = len; 1369 saved_len = len;
1366 saved_namelen = namelen; 1370 saved_namelen = namelen;
1367 #endif /* PYOS_OS2 */ 1371 #endif /* PYOS_OS2 */
1368 for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { 1372 for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
1369 #if defined(PYOS_OS2) 1373 #if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
1370 /* OS/2 limits DLLs to 8 character names (w/o 1374 /* OS/2 limits DLLs to 8 character names (w/o
1371 extension) 1375 extension)
1372 * so if the name is longer than that and its a 1376 * so if the name is longer than that and its a
1373 * dynamically loaded module we're going to try, 1377 * dynamically loaded module we're going to try,
1374 * truncate the name before trying 1378 * truncate the name before trying