[issue1215] documentation doesn't say that you can't handle C segfaults from python

2013-10-06 Thread Georg Brandl

Georg Brandl added the comment:

I see not much to be done here, except from committing Martin's patch updated 
to the current trunk.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2013-10-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bd16e333 by Georg Brandl in branch '3.3':
Closes #1215: document better why it is not a good idea to catch e.g. SIGSEGV 
and refer to faulthandler.
http://hg.python.org/cpython/rev/bd16e333

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-31 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Le mercredi 31 août 2011 02:52:01, vous avez écrit :
  What do you want to do on a SIGSEGV? On a real fault, you cannot rely on
   Python internal state, you cannot use any Python object. To handle a
  real SIGSEGV fault, you have to implement a signal handler using only
  *signal safe* functions in C.
 
 Well, strictly speaking, it is very hard or impossible to write C code
 that's guaranteed to be safe after an unexpected segv too

It is possible if you only use signal safe functions. I think that no Python 
function is signal safe :-)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-30 Thread Éric Araujo

Changes by Éric Araujo mer...@netwok.org:


--
nosy: +eric.araujo, haypo
versions: +Python 3.3 -Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-30 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

 def handler(signal, stackframe):
 print OUCH
 stdout.flush()
 _exit(1)

What do you want to do on a SIGSEGV? On a real fault, you cannot rely on  
Python internal state, you cannot use any Python object. To handle a real 
SIGSEGV fault, you have to implement a signal handler using only *signal safe* 
functions in C.

See faulthandler_fatal_error() function:
https://github.com/haypo/faulthandler/blob/master/faulthandler.c#L257

 The documentation for this can now point to the faulthandler module
 (in Python 3).

For your information, faulthandler is available for Python older than 3.3 as a 
third party module:
http://pypi.python.org/pypi/faulthandler

 segfault is the following C module:

For tests, you can use ctypes.string_at(0) to read a word from NULL.

--

faulthandler installs a signal handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and 
SIGILL signals:
http://docs.python.org/dev/library/faulthandler.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-30 Thread Martin Pool

Martin Pool m...@sourcefrog.net added the comment:

On 31 August 2011 07:56, STINNER Victor rep...@bugs.python.org wrote:

 STINNER Victor victor.stin...@haypocalc.com added the comment:

 def handler(signal, stackframe):
     print OUCH
     stdout.flush()
     _exit(1)

 What do you want to do on a SIGSEGV? On a real fault, you cannot rely on  
 Python internal state, you cannot use any Python object. To handle a real 
 SIGSEGV fault, you have to implement a signal handler using only *signal 
 safe* functions in C.

Well, strictly speaking, it is very hard or impossible to write C code
that's guaranteed to be safe after an unexpected segv too; who knows
what might have caused it.  The odds are probably better that it will work in
in C than in Python.  At any rate I think it's agreed that the
original code is not supported and it's just the docs that need to
change.

So what do you think of
http://bugs.python.org/file22989/20110822-1525-signal-doc.diff ?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-21 Thread Martin Pool

Changes by Martin Pool m...@sourcefrog.net:


--
title: Python hang when catching a segfault - documentation doesn't say that 
you can't handle C segfaults from python

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1215] documentation doesn't say that you can't handle C segfaults from python

2011-08-21 Thread Martin Pool

Martin Pool m...@sourcefrog.net added the comment:

This patch tries to improve the documentation a bit more to address the issue 
that confused tebeka and to advertise faulthandler.  Could someone review or 
apply it?

--
keywords: +patch
Added file: http://bugs.python.org/file22989/20110822-1525-signal-doc.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1215
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com