This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Patch for fatal stack overflow in Windows caused by -v
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.0
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: trent Nosy List: dgreiman, trent
Priority: normal Keywords: patch

Created on 2008-03-16 05:24 by dgreiman, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
py3k-win-codec-recursion-20080315.diff dgreiman, 2008-03-16 05:24 Patch for pythonrun.c
py3k-win-codec-recursion-20080316.diff dgreiman, 2008-03-17 02:34 Updated patch including testcase
Messages (5)
msg63570 - (view) Author: Douglas Greiman (dgreiman) * Date: 2008-03-16 05:24
When python is invoked with -v or -vv under Windows, the process of
importing the codec for sys.stderr causes a message to be written to
stderr, which in turn causes the codec to be recursively imported. 
Sometimes the stack overflow exception is swallowed, other times it is
not.  The bug depends on the particular locale settings of the Windows
machine.

To reproduce: python_d.exe -v
and look for many repeated imports of encodings.<some codec>

Patch is attached.
msg63611 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2008-03-17 01:09
Any chance of getting a test case that demonstrates this?  I'll happily 
test the patch if there's an associated test case I can run to assert 
before/after behaviour.
msg63613 - (view) Author: Douglas Greiman (dgreiman) * Date: 2008-03-17 02:34
Good call.  I've attached an updated patch which includes a testcase in
test_cmd_line.py.
msg63615 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2008-03-17 03:14
+1, tested on x86 XP and x64 2k8.
msg64044 - (view) Author: Trent Nelson (trent) * (Python committer) Date: 2008-03-19 06:53
Fixed in r61607, thanks for the report + patch.
History
Date User Action Args
2022-04-11 14:56:31adminsetgithub: 46550
2008-03-19 06:53:27trentsetstatus: open -> closed
resolution: accepted
messages: + msg64044
2008-03-18 06:55:45trentsetpriority: normal
assignee: trent
2008-03-17 03:14:02trentsetmessages: + msg63615
2008-03-17 02:34:27dgreimansetfiles: + py3k-win-codec-recursion-20080316.diff
messages: + msg63613
2008-03-17 01:09:03trentsetnosy: + trent
messages: + msg63611
2008-03-16 05:24:44dgreimancreate