Re: Python running wild

Guido.van.Rossum@cwi.nl
Mon, 06 Jun 1994 10:20:37 +0200

> I've been using Python with Emacs 19.22 and the python-mode. Every so
> often, the python shell goes carzy and begins hogging the CPU and
> starts accumulating memory. On average, it consumes 5 megs before I
> can stop Emacs. By the time I get to a shell, the python sessions
> itself is a 'ghost' running continouslly and chewing CPU. It only
> dies with a kill -KILL combination of 'kill'.
>
> I remmeber some sort of patch that was discussed here, somthing that
> goblled memeory if I'm not mistaking. Is this related ?

There's a bug in the 1.0.2 tokenizer.c that makes it run wild if it
receives a last line that doesn't end in \n. Here's the fix (again?):

===================================================================
RCS file: /hosts/voorn/ufs/guido/python-RCS/new/Parser/RCS/tokenizer.c,v
retrieving revision 2.14.2.3
diff -c -1 -r2.14.2.3 tokenizer.c
*** 2.14.2.3 1994/04/28 12:31:46
--- tokenizer.c 1994/05/23 12:40:51
***************
*** 269,272 ****
(int)(tok->end - tok->inp),
! tok->fp) == NULL)
! break;
tok->inp = strchr(tok->inp, '\0');
--- 269,275 ----
(int)(tok->end - tok->inp),
! tok->fp) == NULL) {
! /* Last line does not end in \n,
! fake one */
! strcpy(tok->inp, "\n");
! }
tok->inp = strchr(tok->inp, '\0');

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
URL: <http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>