Re: [Python-Dev] I plan to push faulthandler into Python 3.3 in one week

2011-03-25 Thread Victor Stinner
Le jeudi 24 mars 2011 à 00:49 +0100, Victor Stinner a écrit :
> If nobody complains, I plan to push my faulthandler module into Python
> 3.3 in one week. It's a module to display the Python backtrace on a
> segfault, on a user signal or after a timeout.

I created a feature repo to prepare the work, features/faulthandler, and
the integration is done. You can try it, or try the last patch attached
to #11393.

I choose to add faulthandler as a builtin module to be able to control
exactly when it is initialized/finalized.

You can enable it at startup using -X faulthandler=1 or
PYTHONFAULTHANDLER=1 env var.

Example:
--
$ ./python -X faulthandler Lib/test/crashers/borrowed_ref_2.py 
hi
Fatal Python error: Segmentation fault

Traceback (most recent call first):
  File "Lib/test/crashers/borrowed_ref_2.py", line 18 in __set__
  File "Lib/test/crashers/borrowed_ref_2.py", line 36 in 
Erreur de segmentation
--

Try Lib/test/crashers/recursive_call.py if you would like to try the
stack overflow feature: faulthandler is able to dump the traceback, even
after a stack overflow. But only if sigaltstack() is available (e.g. not
on Windows, sorry).

faulthandler can also dump the traceback explicitly, after a timeout, or
on a user signal: it is not specific to segmentation faults ;-)

Victor

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] I plan to push faulthandler into Python 3.3 in one week

2011-03-23 Thread Victor Stinner
Le jeudi 24 mars 2011 à 01:05 +0100, "Martin v. Löwis" a écrit :
> > What is the procedure to add a new module? Just add the code into
> > Modules and patch setup.py? The module is distributed under the BSD
> > (2-clause) license.
> 
> Also add it to the Visual Studio build process. It either needs to go
> into pythonXY.dll (i.e. pythoncore.vcproj), or into a separate project,
> to be referenced from pcbuild.sln.

Antoine would like to enable faulthandler by default on fatal error. I
suppose that it would be more easy to do that if the module is a builtin
module, especially if we want to dump the traceback on fatal errors at
*startup* (during Py_InitializeEx).

But we can make it optional, and use a command line option (eg. python
-x faulthandler) or an environment variable to enable it
(PYTHONFAULTHANDLER=1). I am not sure that it is really useful to enable
it *by default*, and some people don't want it enabled by default
because it writes into file descriptor 2 (sys.stderr.fileno()) which may
have been replaced by something else.

Because the module is still a little bit experimental (well, it's stable
but it is not tested by enough people), I would prefer to disable it by
default and have it has an extension (use a dynamic module). But it
doesn't really matter to me :-)

(ok, I will also patch the Visual Studio project)

> Contributions under the BSD license are not acceptable. You did provide
> a contributor agreement, right?

If it is a paper thing, I don't think so. I only sent a paper to the
PSF, but I think that it is different. When I got my commit access one
year ago, I was only asked for a SSH public key. It looks like I will
need to sign this agreement :-)

I can distribute the module under two licenses, I am the only author (I
got two minor contributors).

Victor

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] I plan to push faulthandler into Python 3.3 in one week

2011-03-23 Thread Michael Foord

On 24/03/2011 00:05, "Martin v. Löwis" wrote:

What is the procedure to add a new module? Just add the code into
Modules and patch setup.py? The module is distributed under the BSD
(2-clause) license.

Also add it to the Visual Studio build process. It either needs to go
into pythonXY.dll (i.e. pythoncore.vcproj), or into a separate project,
to be referenced from pcbuild.sln.

Contributions under the BSD license are not acceptable. You did provide
a contributor agreement, right? If so, you need to submit it under the
terms of that agreement, which means that the code will be licensed
under the PSF license (subject to PSF changes to the license). If you
accepted contributions of others into the code, make sure they also
filed a contributor agreement.


Although note you are still free to distribute it under whatever license 
you want as an external project (you retain copyright). If you have 
already signed a contributor agreement then there is no need for further 
discussion of how your contributions are licensed for inclusion in 
Python, that is already dealt with.


All the best,

Michael Foord

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk



--
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html

___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] I plan to push faulthandler into Python 3.3 in one week

2011-03-23 Thread Martin v. Löwis
> What is the procedure to add a new module? Just add the code into
> Modules and patch setup.py? The module is distributed under the BSD
> (2-clause) license.

Also add it to the Visual Studio build process. It either needs to go
into pythonXY.dll (i.e. pythoncore.vcproj), or into a separate project,
to be referenced from pcbuild.sln.

Contributions under the BSD license are not acceptable. You did provide
a contributor agreement, right? If so, you need to submit it under the
terms of that agreement, which means that the code will be licensed
under the PSF license (subject to PSF changes to the license). If you
accepted contributions of others into the code, make sure they also
filed a contributor agreement.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com