Mercurial > cpython-lru_cache-weakref
comparison Python/import.c @ 42687:ee9ebbf5f3dc legacy-trunk
Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Tue, 21 Aug 2007 06:01:18 +0000 |
| parents | 6620a510e9a9 |
| children | 62eee79de923 |
comparison
equal
deleted
inserted
replaced
| 42684:8d7fa8a5a7e3 | 42687:ee9ebbf5f3dc |
|---|---|
| 1393 if (Py_VerboseFlag > 1) | 1393 if (Py_VerboseFlag > 1) |
| 1394 PySys_WriteStderr("# trying %s\n", buf); | 1394 PySys_WriteStderr("# trying %s\n", buf); |
| 1395 filemode = fdp->mode; | 1395 filemode = fdp->mode; |
| 1396 if (filemode[0] == 'U') | 1396 if (filemode[0] == 'U') |
| 1397 filemode = "r" PY_STDIOTEXTMODE; | 1397 filemode = "r" PY_STDIOTEXTMODE; |
| 1398 errno = 0; | |
| 1398 fp = fopen(buf, filemode); | 1399 fp = fopen(buf, filemode); |
| 1399 if (fp != NULL) { | 1400 if (fp != NULL) { |
| 1400 if (case_ok(buf, len, namelen, name)) | 1401 if (case_ok(buf, len, namelen, name)) |
| 1401 break; | 1402 break; |
| 1402 else { /* continue search */ | 1403 else { /* continue search */ |
| 1403 fclose(fp); | 1404 fclose(fp); |
| 1404 fp = NULL; | 1405 fp = NULL; |
| 1405 } | 1406 } |
| 1406 } | 1407 } |
| 1408 /* issue a warning if the file is there */ | |
| 1409 /*if (errno != ENOENT) { | |
| 1410 char warnstr[MAXPATHLEN+80]; | |
| 1411 sprintf(warnstr, "Not importing '%.*s': "); | |
| 1412 | |
| 1413 if (PyErr_Warn(PyExc_ImportWarning, | |
| 1414 warnstr)) { | |
| 1415 | |
| 1416 }*/ | |
| 1407 #if defined(PYOS_OS2) | 1417 #if defined(PYOS_OS2) |
| 1408 /* restore the saved snapshot */ | 1418 /* restore the saved snapshot */ |
| 1409 strcpy(buf, saved_buf); | 1419 strcpy(buf, saved_buf); |
| 1410 len = saved_len; | 1420 len = saved_len; |
| 1411 namelen = saved_namelen; | 1421 namelen = saved_namelen; |
