[issue3242] Segfault in PyFile_SoftSpace/PyEval_EvalFrameEx with sys.stdout reassigned

Amaury Forgeot d'Arc report at bugs.python.org
Tue Jul 1 10:59:24 CEST 2008


Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

I reproduced the problem on windows, and it is indeed a problem with the
"print" statement, when the write() method reassigns sys.stdout: the
code calls PyFile_WriteString(), then PyFile_SoftSpace on the same
object, which has been freed in your case.
A pair of INCREF/DECREF did the trick. See attached patch.

----------
keywords: +patch
nosy: +amaury.forgeotdarc
Added file: http://bugs.python.org/file10788/print.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3242>
_______________________________________


More information about the Python-bugs-list mailing list