Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 58d3711

Browse files
author
Victor Stinner
committed
Issue #3080: Drop OS/2 support for the import machinery
Sorry Andrew I MacIntyre!
1 parent 9599de5 commit 58d3711

1 file changed

Lines changed: 0 additions & 52 deletions

File tree

Python/import.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,11 +1804,6 @@ find_module_path_list(char *fullname, const char *name,
18041804
struct filedescr *fdp = NULL;
18051805
char *filemode;
18061806
FILE *fp = NULL;
1807-
#if defined(PYOS_OS2)
1808-
size_t saved_len;
1809-
size_t saved_namelen;
1810-
char *saved_buf = NULL;
1811-
#endif
18121807

18131808
npath = PyList_Size(search_path_list);
18141809
namelen = strlen(name);
@@ -1832,40 +1827,7 @@ find_module_path_list(char *fullname, const char *name,
18321827
return fdp;
18331828

18341829
len = strlen(buf);
1835-
#if defined(PYOS_OS2)
1836-
/* take a snapshot of the module spec for restoration
1837-
* after the 8 character DLL hackery
1838-
*/
1839-
saved_buf = strdup(buf);
1840-
saved_len = len;
1841-
saved_namelen = namelen;
1842-
#endif /* PYOS_OS2 */
18431830
for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) {
1844-
#if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING)
1845-
/* OS/2 limits DLLs to 8 character names (w/o
1846-
extension)
1847-
* so if the name is longer than that and its a
1848-
* dynamically loaded module we're going to try,
1849-
* truncate the name before trying
1850-
*/
1851-
if (strlen(name) > 8) {
1852-
/* is this an attempt to load a C extension? */
1853-
const struct filedescr *scan;
1854-
scan = _PyImport_DynLoadFiletab;
1855-
while (scan->suffix != NULL) {
1856-
if (!strcmp(scan->suffix, fdp->suffix))
1857-
break;
1858-
else
1859-
scan++;
1860-
}
1861-
if (scan->suffix != NULL) {
1862-
/* yes, so truncate the name */
1863-
namelen = 8;
1864-
len -= strlen(name) - namelen;
1865-
buf[len] = '\0';
1866-
}
1867-
}
1868-
#endif /* PYOS_OS2 */
18691831
strcpy(buf+len, fdp->suffix);
18701832
if (Py_VerboseFlag > 1)
18711833
PySys_WriteStderr("# trying %s\n", buf);
@@ -1881,21 +1843,7 @@ find_module_path_list(char *fullname, const char *name,
18811843
fp = NULL;
18821844
}
18831845
}
1884-
#if defined(PYOS_OS2)
1885-
/* restore the saved snapshot */
1886-
strcpy(buf, saved_buf);
1887-
len = saved_len;
1888-
namelen = saved_namelen;
1889-
#endif
1890-
}
1891-
#if defined(PYOS_OS2)
1892-
/* don't need/want the module name snapshot anymore */
1893-
if (saved_buf)
1894-
{
1895-
free(saved_buf);
1896-
saved_buf = NULL;
18971846
}
1898-
#endif
18991847
if (fp != NULL)
19001848
break;
19011849
}

0 commit comments

Comments
 (0)