diff options
| author | Senthil Kumaran <orsenthil@gmail.com> | 2011-04-26 21:10:23 +0800 |
|---|---|---|
| committer | Senthil Kumaran <orsenthil@gmail.com> | 2011-04-26 21:10:23 +0800 |
| commit | 1aa611b27b5c6aca69579e7e873bb2ddddb1a2fc (patch) | |
| tree | 4d073d00abfaf5d7fbbf14d2b453823892adf00f /Python/traceback.c | |
| parent | 60186e61c8796c0e4cff2e681adee0be4c0b4d42 (diff) | |
| parent | 95cbf834835f9d8128ba7a418e2f5bc5f99aa32f (diff) | |
| download | cpython-1aa611b27b5c6aca69579e7e873bb2ddddb1a2fc.tar.gz | |
merge from 3.1
Diffstat (limited to 'Python/traceback.c')
| -rw-r--r-- | Python/traceback.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/Python/traceback.c b/Python/traceback.c index 2f1c213fa3..59bb3f0d15 100644 --- a/Python/traceback.c +++ b/Python/traceback.c @@ -7,7 +7,6 @@ #include "frameobject.h" #include "structmember.h" #include "osdefs.h" -#include "traceback.h" #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif @@ -114,8 +113,7 @@ newtracebackobject(PyTracebackObject *next, PyFrameObject *frame) Py_XINCREF(frame); tb->tb_frame = frame; tb->tb_lasti = frame->f_lasti; - tb->tb_lineno = PyCode_Addr2Line(frame->f_code, - frame->f_lasti); + tb->tb_lineno = PyFrame_GetLineNumber(frame); PyObject_GC_Track(tb); } return tb; @@ -150,8 +148,7 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject * Py_ssize_t len; PyObject* result; - filebytes = PyUnicode_AsEncodedObject(filename, - Py_FileSystemDefaultEncoding, "surrogateescape"); + filebytes = PyUnicode_EncodeFSDefault(filename); if (filebytes == NULL) { PyErr_Clear(); return NULL; @@ -179,9 +176,7 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject * } if (!PyUnicode_Check(v)) continue; - - path = PyUnicode_AsEncodedObject(v, Py_FileSystemDefaultEncoding, - "surrogateescape"); + path = PyUnicode_EncodeFSDefault(v); if (path == NULL) { PyErr_Clear(); continue; |
