Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ed4c711

Browse files
author
Victor Stinner
committed
Remove filename variable from ceval.c
Issue #11168: Remove filename debug variable from PyEval_EvalFrameEx(). It encoded the Unicode filename to UTF-8, but the encoding fails on undecodable filename (on surrogate characters) which raises an unexpected UnicodeEncodeError on recursion limit.
1 parent 441cc01 commit ed4c711

2 files changed

Lines changed: 6 additions & 17 deletions

File tree

Misc/NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,17 @@ What's New in Python 3.3 Alpha 1?
1010
Core and Builtins
1111
-----------------
1212

13-
- Check for NULL result in PyType_FromSpec.
13+
- Issue #11168: Remove filename debug variable from PyEval_EvalFrameEx().
14+
It encoded the Unicode filename to UTF-8, but the encoding fails on
15+
undecodable filename (on surrogate characters) which raises an unexpected
16+
UnicodeEncodeError on recursion limit.
1417

1518
- Issue #11187: Remove bootstrap code (use ASCII) of
1619
PyUnicode_AsEncodedString(), it was replaced by a better fallback (use the
1720
locale encoding) in PyUnicode_EncodeFSDefault().
1821

22+
- Check for NULL result in PyType_FromSpec.
23+
1924
Library
2025
-------
2126

Python/ceval.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -811,10 +811,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
811811
unsigned char *first_instr;
812812
PyObject *names;
813813
PyObject *consts;
814-
#if defined(Py_DEBUG) || defined(LLTRACE)
815-
/* Make it easier to find out where we are with a debugger */
816-
char *filename;
817-
#endif
818814

819815
/* Computed GOTOs, or
820816
the-optimization-commonly-but-improperly-known-as-"threaded code"
@@ -1227,18 +1223,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)
12271223
#ifdef LLTRACE
12281224
lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL;
12291225
#endif
1230-
#if defined(Py_DEBUG) || defined(LLTRACE)
1231-
{
1232-
PyObject *error_type, *error_value, *error_traceback;
1233-
PyErr_Fetch(&error_type, &error_value, &error_traceback);
1234-
filename = _PyUnicode_AsString(co->co_filename);
1235-
if (filename == NULL && tstate->overflowed) {
1236-
/* maximum recursion depth exceeded */
1237-
goto exit_eval_frame;
1238-
}
1239-
PyErr_Restore(error_type, error_value, error_traceback);
1240-
}
1241-
#endif
12421226

12431227
why = WHY_NOT;
12441228
err = 0;

0 commit comments

Comments
 (0)