[Python-checkins] r85595 - python/branches/py3k/Python/import.c
victor.stinner
python-checkins at python.org
Sun Oct 17 04:07:09 CEST 2010
Author: victor.stinner
Date: Sun Oct 17 04:07:09 2010
New Revision: 85595
Log:
find_module(): use FS encoding to display the missing __init__ warning
Modified:
python/branches/py3k/Python/import.c
Modified: python/branches/py3k/Python/import.c
==============================================================================
--- python/branches/py3k/Python/import.c (original)
+++ python/branches/py3k/Python/import.c Sun Oct 17 04:07:09 2010
@@ -1736,14 +1736,16 @@
return &fd_package;
}
else {
- char warnstr[MAXPATHLEN+80];
- sprintf(warnstr, "Not importing directory "
- "'%.*s': missing __init__.py",
- MAXPATHLEN, buf);
- if (PyErr_WarnEx(PyExc_ImportWarning,
- warnstr, 1)) {
+ int err;
+ PyObject *unicode = PyUnicode_DecodeFSDefault(buf);
+ if (unicode == NULL)
+ return NULL;
+ err = PyErr_WarnFormat(PyExc_ImportWarning, 1,
+ "Not importing directory '%U': missing __init__.py",
+ unicode);
+ Py_DECREF(unicode);
+ if (err)
return NULL;
- }
}
}
#endif
More information about the Python-checkins
mailing list