[New-bugs-announce] [issue10311] Signal handlers must preserve errno

Hallvard B Furuseth report at bugs.python.org
Thu Nov 4 13:18:18 CET 2010

New submission from Hallvard B Furuseth <h.b.furuseth at usit.uio.no>:

Signal handlers that can change errno, must restore it.
I enclose a patch for <2.7, 3.2a3>/Modules/signalmodule.c
which also rearranges the code to make this a bit easier.

The patch does   if (errno != save_errno) errno = save_errno;
instead of just  errno = save_errno;
in case it's less thread-safe to write than to read errno,
which would not surprise me but may be pointless paranoia.

I don't know what needs to be done on non-Unix systems,
like Windows' WSAError stuff.

components: Interpreter Core
files: signalmodule-errno.diff
keywords: patch
messages: 120395
nosy: hfuru
priority: normal
severity: normal
status: open
title: Signal handlers must preserve errno
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file19488/signalmodule-errno.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list