classification
Title: segfault in curses when calling redrawwin() before refresh()
Type: crash Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: akuchling Nosy List: Thorben, akuchling, mark.dickinson, nnorwitz
Priority: normal Keywords:

Created on 2007-10-11 18:14 by Thorben, last changed 2010-01-13 12:41 by mark.dickinson. This issue is now closed.

Files
File name Uploaded Description Edit
curses-01.py Thorben, 2007-10-11 18:14
Messages (4)
msg56348 - (view) Author: Thorben (Thorben) Date: 2007-10-11 18:14
attached file makes python 2.5.1 segfault
msg56355 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2007-10-12 05:22
What platform are you on?  I can reproduce this with 2.5.1+ and trunk on
Ubuntu.  I can reproduce with a trivial C program that does the same
thing.  This could be a bug in the curses implementation.  Or it could
be misuse of the API.  I don't know enough to suggest which is the case.  

The C program is:

#include <curses.h>

int main(int argc, char**argv) {
  WINDOW *win = initscr();
  WINDOW *win2 = newwin(50, 50, 50, 50);
  redrawwin(win2);
  return 0;
}

Perhaps a bug should be filed against curses.
msg60157 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2008-01-19 13:46
The C program does crash, but newwin() is returning NULL 
and the code should really be checking for this case.   When I try 
the Python script with 2.5-maint and 2.6-trunk, I get the error:
amk@amk:~/source/p/25$ ./python.exe ../python/curses-01.py
Traceback (most recent call last):
  File "../python/curses-01.py", line 8, in <module>
    curses.wrapper(foobar)
  File "/Users/amk/source/p/25/Lib/curses/wrapper.py", line 44, in wrapper
    return func(stdscr, *args, **kwds)
  File "../python/curses-01.py", line 4, in foobar
    winmain = curses.newwin(50,50,50,50)
_curses.error: curses function returned NULL

I removed the import of the 'readline' module 
because I don't have it on my Mac, but that seems unlikely to 
make a difference.
msg97710 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2010-01-13 12:41
I wonder whether issue 7384 (test_curses crash on FreeBSD) is related to this.  There does seem to be some sort of readline interaction going on in that issue.
History
Date User Action Args
2010-01-13 12:41:44mark.dickinsonsetnosy: + mark.dickinson
messages: + msg97710
2008-01-19 13:46:58akuchlingsetstatus: open -> closed
resolution: works for me
messages: + msg60157
2008-01-09 12:49:23akuchlingsetassignee: akuchling
nosy: + akuchling
2007-10-12 05:22:26nnorwitzsetnosy: + nnorwitz
messages: + msg56355
components: + Extension Modules, - Library (Lib)
2007-10-11 18:14:44Thorbencreate