summaryrefslogtreecommitdiff
path: root/Python/traceback.c
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2011-03-28 13:53:40 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2011-03-28 13:53:40 +0300
commitdce235203d23310e1ca12e8a8a8ed8be8e585a12 (patch)
tree7a3b79eef005b8881e3175189ff9db64dd36e2f7 /Python/traceback.c
parent23bb1f0966b9d6b169f929dac91163cec082b741 (diff)
parente5b28bc7ccd71ef30cfee95b1ead7c91c2fdaa8d (diff)
downloadcpython-dce235203d23310e1ca12e8a8a8ed8be8e585a12.tar.gz
#10617: merge with 3.1.
Diffstat (limited to 'Python/traceback.c')
-rw-r--r--Python/traceback.c11
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;