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: readlines() bombs - last line incomplete
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: gvanrossum, scav
Priority: low Keywords:

Created on 2002-04-19 13:23 by scav, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (5)
msg10433 - (view) Author: Peter Harris (scav) Date: 2002-04-19 13:23
HP-UX 11 64bit, compiled with HP ansi c compiler.
Python version 2.2.1rc2

>>> f=open(some_big_file)
>>> f.readlines()
Pid 23292 received a SIGSEGV for stack growth failure.
Possible causes: insufficient memory or swap space,
or stack size exceeded maxssiz.
Memory fault(coredump)

Happens when last line of file lacks a terminating \n,
also the file has to be big enough (my example is about
2K in size)

Oddly, xreadlines() can be created, but attempting to
iterate over it crashes before the first line is 
returned:
>>> f=open(some_big_file)
>>> lines=f.xreadlines()    # OK so far
>>> for line in lines:
...    print line      # never gets here
...

Pid 23257 received a SIGSEGV for stack growth failure.
Possible causes: insufficient memory or swap space,
or stack size exceeded maxssiz.
Memory fault(coredump)

I'll try 2.2.1 final.
msg10434 - (view) Author: Peter Harris (scav) Date: 2002-04-22 11:12
Logged In: YES 
user_id=8911

2.2.1 final does it too. :(
msg10435 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-22 17:45
Logged In: YES 
user_id=6380

I can't reproduce this on Linux. Can you upload the data
file or (preferably, if you have access) on a Linux system,
with Python 2.2.1? I'd like to see if this is data dependent
or platform specific before we go any further with this.
msg10436 - (view) Author: Peter Harris (scav) Date: 2002-04-23 07:59
Logged In: YES 
user_id=8911

I think it's compiler/architecture dependent. It works fine 
on Linux.

Re-compiling Objects/fileobject.c without optimisation 
cures the problem. I think HP's compiler is a bit dodgy, 
because the last version of Python was dumping core until I 
recompiled longobject.c.

I would try compiling with gcc but I don't have it on our 
HP machine.

I think the README should maybe warn HP PA-RISC 2.0 users 
that the C compiler will occasionally break things.

Thanks for your time.
msg10437 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-04-23 13:06
Logged In: YES 
user_id=6380

OK, I've added a note to the README. Sigh.
History
Date User Action Args
2022-04-10 16:05:14adminsetgithub: 36468
2002-04-19 13:23:10scavcreate