Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 478c105 commit c5131bcCopy full SHA for c5131bc
1 file changed
Python/ceval.c
@@ -1501,6 +1501,11 @@ eval_frame(PyFrameObject *f)
1501
err = -1;
1502
}
1503
1504
+ /* PyFile_SoftSpace() can exececute arbitrary code
1505
+ if sys.stdout is an instance with a __getattr__.
1506
+ If __getattr__ raises an exception, w will
1507
+ be freed, so we need to prevent that temporarily. */
1508
+ Py_XINCREF(w);
1509
if (w != NULL && PyFile_SoftSpace(w, 0))
1510
err = PyFile_WriteString(" ", w);
1511
if (err == 0)
@@ -1528,6 +1533,7 @@ eval_frame(PyFrameObject *f)
1528
1533
else
1529
1534
PyFile_SoftSpace(w, 1);
1530
1535
1536
+ Py_XDECREF(w);
1531
1537
Py_DECREF(v);
1532
1538
Py_XDECREF(stream);
1539
stream = NULL;
0 commit comments