[Python-Dev] ImportError message suggestion (original) (raw)
Matt Giuca matt.giuca at gmail.com
Tue Aug 19 19:17:37 CEST 2008
- Previous message: [Python-Dev] ImportError message suggestion
- Next message: [Python-Dev] [Pydotorg] Should we help pythonmac.org?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I think this is not the place to be discussing the patch (the tracker is), but while I think of it, I'll just say:
You need to DECREF the fn variable (both PyObject_GetAttrString<http://www.python.org/doc/api/object.html>and PyString_FromString <http://www.python.org/doc/api/stringObjects.html>return new references). If this makes no sense, read up on reference counting (http://docs.python.org/ext/refcounts.html, http://www.python.org/doc/api/countingRefs.html).
.... + PyString_AsString(name),
PyString_AsString(fn));
}Py_DECREF(fn);
Also:
- Do you really want "?" if you can't get the filename for some reason -- why not just not say anything?
- Perhaps don't create a new variable "fn", use one of the many defined at the top of the eval function.
Otherwise, looks like it will do the job.
But I haven't tested it, just eyeballed it.
Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20080820/3359b6a0/attachment-0001.htm>
- Previous message: [Python-Dev] ImportError message suggestion
- Next message: [Python-Dev] [Pydotorg] Should we help pythonmac.org?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]