Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
77643c48
Commit
77643c48
authored
Sep 09, 2019
by
animalize
Committed by
Victor Stinner
Sep 09, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-38037: Fix reference counters in signal module (GH-15753)
parent
ef66f31c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
8 deletions
+18
-8
Misc/NEWS.d/next/Library/2019-09-09-18-39-23.bpo-38037.B0UgFU.rst
...S.d/next/Library/2019-09-09-18-39-23.bpo-38037.B0UgFU.rst
+1
-0
Modules/signalmodule.c
Modules/signalmodule.c
+17
-8
No files found.
Misc/NEWS.d/next/Library/2019-09-09-18-39-23.bpo-38037.B0UgFU.rst
0 → 100644
View file @
77643c48
Fix reference counters in the :mod:`signal` module.
Modules/signalmodule.c
View file @
77643c48
...
...
@@ -1329,7 +1329,7 @@ static struct PyModuleDef signalmodule = {
PyMODINIT_FUNC
PyInit__signal
(
void
)
{
PyObject
*
m
,
*
d
,
*
x
;
PyObject
*
m
,
*
d
;
int
i
;
/* Create the module and add the functions */
...
...
@@ -1350,13 +1350,17 @@ PyInit__signal(void)
/* Add some symbolic constants to the module */
d
=
PyModule_GetDict
(
m
);
x
=
DefaultHandler
=
PyLong_FromVoidPtr
((
void
*
)
SIG_DFL
);
if
(
PyModule_AddObject
(
m
,
"SIG_DFL"
,
x
))
DefaultHandler
=
PyLong_FromVoidPtr
((
void
*
)
SIG_DFL
);
if
(
!
DefaultHandler
||
PyDict_SetItemString
(
d
,
"SIG_DFL"
,
DefaultHandler
)
<
0
)
{
goto
finally
;
}
x
=
IgnoreHandler
=
PyLong_FromVoidPtr
((
void
*
)
SIG_IGN
);
if
(
PyModule_AddObject
(
m
,
"SIG_IGN"
,
x
))
IgnoreHandler
=
PyLong_FromVoidPtr
((
void
*
)
SIG_IGN
);
if
(
!
IgnoreHandler
||
PyDict_SetItemString
(
d
,
"SIG_IGN"
,
IgnoreHandler
)
<
0
)
{
goto
finally
;
}
if
(
PyModule_AddIntMacro
(
m
,
NSIG
))
goto
finally
;
...
...
@@ -1374,8 +1378,8 @@ PyInit__signal(void)
goto
finally
;
#endif
x
=
IntHandler
=
PyDict_GetItemString
(
d
,
"default_int_handler"
);
if
(
!
x
)
IntHandler
=
PyDict_GetItemString
(
d
,
"default_int_handler"
);
if
(
!
IntHandler
)
goto
finally
;
Py_INCREF
(
IntHandler
);
...
...
@@ -1568,8 +1572,10 @@ PyInit__signal(void)
#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER)
ItimerError
=
PyErr_NewException
(
"signal.ItimerError"
,
PyExc_OSError
,
NULL
);
if
(
PyModule_AddObject
(
m
,
"ItimerError"
,
ItimerError
))
if
(
!
ItimerError
||
PyDict_SetItemString
(
d
,
"ItimerError"
,
ItimerError
)
<
0
)
{
goto
finally
;
}
#endif
#ifdef CTRL_C_EVENT
...
...
@@ -1615,6 +1621,9 @@ finisignal(void)
Py_CLEAR
(
IntHandler
);
Py_CLEAR
(
DefaultHandler
);
Py_CLEAR
(
IgnoreHandler
);
#ifdef HAVE_GETITIMER
Py_CLEAR
(
ItimerError
);
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment