[ python-Bugs-1251631 ] Python 2.4.1 crashes when importing the attached script

SourceForge.net noreply at sourceforge.net
Thu Aug 25 08:07:28 CEST 2005


Bugs item #1251631, was opened at 2005-08-04 09:18
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1251631&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Parser/Compiler
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Viktor Ferenczi (complex)
Assigned to: Martin v. Löwis (loewis)
Summary: Python 2.4.1 crashes when importing the attached script

Initial Comment:
OS: WinXP Prog. ENG SP1
Python: 2.4.1 MSI installer downloaded from python.org

Python crashes or rarely raises MemoryError or SyntaxError when trying to import/execute the script attached. The behaviour changes when some lines are modified, but mostly crashes the python process with a memory access violation. The python process used 4.2Mbytes of system memory when crashed. There were more than 500Mbytes free.

Register dump:

EAX = 00A8CC61
EBX = 0000000A
ECX = 00000000
EDX = 00000000
ESI = 00A10DA0
EDI = 00000022
EIP = 1E0A7F10
ESP = 0021FD98
EBP = 00000222
EFlags = 00000293

Other registers are irrelevant. The bug occured at the last line of the following instruction sequence because ECX was zero:

1E0A7EB2 66 C7 02 0A 00       mov         word ptr [edx],0Ah
1E0A7EB7 8B 46 08             mov         eax,dword ptr [esi+8]
1E0A7EBA 6A 00                push        0
1E0A7EBC 50                   push        eax
1E0A7EBD FF 15 B4 31 0C 1E    call        dword ptr ds:[1E0C31B4h]
1E0A7EC3 89 46 08             mov         dword ptr [esi+8],eax
1E0A7EC6 8A 48 FF             mov         cl,byte ptr [eax-1]
1E0A7EC9 83 C4 08             add         esp,8
1E0A7ECC 80 F9 0A             cmp         cl,0Ah
1E0A7ECF 0F 85 72 FF FF FF    jne         1E0A7E47
1E0A7ED5 BB 0A 00 00 00       mov         ebx,0Ah
1E0A7EDA 8B 0E                mov         ecx,dword ptr [esi]
1E0A7EDC 8B 54 24 0C          mov         edx,dword ptr [esp+0Ch]
1E0A7EE0 8D 04 11             lea         eax,[ecx+edx]
1E0A7EE3 89 46 04             mov         dword ptr [esi+4],eax
1E0A7EE6 8B 46 08             mov         eax,dword ptr [esi+8]
1E0A7EE9 83 E8 02             sub         eax,2
1E0A7EEC 3B C1                cmp         eax,ecx
1E0A7EEE 72 0F                jb          1E0A7EFF
1E0A7EF0 80 38 0D             cmp         byte ptr [eax],0Dh
1E0A7EF3 75 0A                jne         1E0A7EFF
1E0A7EF5 C6 00 0A             mov         byte ptr [eax],0Ah
1E0A7EF8 40                   inc         eax
1E0A7EF9 C6 00 00             mov         byte ptr [eax],0
1E0A7EFC 89 46 08             mov         dword ptr [esi+8],eax
1E0A7EFF 39 5E 14             cmp         dword ptr [esi+14h],ebx
1E0A7F02 75 21                jne         1E0A7F25
1E0A7F04 8B 4E 04             mov         ecx,dword ptr [esi+4]
1E0A7F07 3B 4E 08             cmp         ecx,dword ptr [esi+8]
1E0A7F0A 0F 84 24 FD FF FF    je          1E0A7C34
1E0A7F10 0F B6 01             movzx       eax,byte ptr [ecx]

It may be possible to find the source line related to this bug by searching for this code in the retail python.exe then looking up the address in the map file produced by the compiler (if enabled). I can run the script with a debug version of python.exe. Please send me information about how to download a debug version for Windows.

Note: I've tried to search this bug in the bug database, but it's not specific enough to find an exact match. No viruses nor spyware found on my machine using multiple antivirus/antispyware product. No memory errors found in 6 hours. I use LF (UNIX type) line ends on Windows to prevent errors when my scripts copied and edited on a Linux box.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2005-08-25 08:07

Message:
Logged In: YES 
user_id=21627

This is now fixed for 2.4.2, which will say

  File "python_2.4.1_crash.py", line 225
SyntaxError: 'ascii' codec can't decode byte 0xc1 in
position 0: ordinal not in range(128)

----------------------------------------------------------------------

Comment By: Walter Dörwald (doerwalter)
Date: 2005-08-08 09:17

Message:
Logged In: YES 
user_id=89016

The line number problem might be related to
http://www.python.org/sf/1178484

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2005-08-07 19:40

Message:
Logged In: YES 
user_id=31435

Note that it's not legal input:  there's a non-ASCII character in 
line 225, which conflicts with the explicit

# -*- coding: ascii -*-"

directive near the top of file.  Get rid of the non-ASCII 
character, and it seems to load fine.

Current Python HEAD (2.4.2 development) gives a different 
outcome:

  File "pycrash.py", line 222
SyntaxError: unknown decode error

That's peculiar too, because the offending character is 
actually on line 225, and because "unknown decode error" is 
unhelpful.  Python 2.3 at least got the line number right:

  File "pycrash.py", line 225
SyntaxError: unknown decode error

The best error report is gotten by deleting the encoding 
directive instead (using 2.4.1 here):

sys:1: DeprecationWarning: Non-ASCII character '\xc1' in file 
pycrash.py on line 224, but no encoding declared; see http
://www.python.org/peps/pep-0263.html for details

Assigning to Martin under the vague recollection that he 
knows most about the encoding implementation.

----------------------------------------------------------------------

Comment By: Viktor Ferenczi (complex)
Date: 2005-08-04 09:21

Message:
Logged In: YES 
user_id=142612

The bug could be in python.dll, of course. I need a debug version of python.dll.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1251631&group_id=5470


More information about the Python-bugs-list mailing list