Staging
v0.5.1
https://github.com/python/cpython
Revision dba976b8a28d6e5daa66ef31a6a7c694a9193f6a authored by Nathaniel J. Smith on 26 January 2018, 19:28:31 UTC, committed by Yury Selivanov on 26 January 2018, 19:28:31 UTC
When an unawaited coroutine is collected very late in shutdown --
like, during the final GC at the end of PyImport_Cleanup -- then it
was triggering an interpreter abort, because we'd try to look up the
"warnings" module and not only was it missing (we were prepared for
that), but the entire module system was missing (which we were not
prepared for).

I've tried to fix this at the source, by making the utility function
get_warnings_attr robust against this in general. Note that it already
has the convention that it can return NULL without setting an error,
which is how it signals that the attribute it was asked to fetch is
missing, and that all callers already check for NULL returns.

There's a similar check for being late in shutdown at the top of
warn_explicit, which might be unnecessary after this fix, but I'm not
sure so I'm going to leave it.
1 parent 95e4d58
History
Tip revision: dba976b8a28d6e5daa66ef31a6a7c694a9193f6a authored by Nathaniel J. Smith on 26 January 2018, 19:28:31 UTC
bpo-32591: fix abort in _PyErr_WarnUnawaitedCoroutine during shutdown (#5337)
Tip revision: dba976b
File Mode Size
.github
Doc
Grammar
Include
Lib
Mac
Misc
Modules
Objects
PC
PCbuild
Parser
Programs
Python
Tools
m4
.gitattributes -rw-r--r-- 772 bytes
.gitignore -rw-r--r-- 1.5 KB
.hgeol -rw-r--r-- 1.0 KB
.hgignore -rw-r--r-- 1.3 KB
.hgtags -rw-r--r-- 8.7 KB
.travis.yml -rw-r--r-- 5.3 KB
LICENSE -rw-r--r-- 12.5 KB
Makefile.pre.in -rw-r--r-- 60.9 KB
README.rst -rw-r--r-- 9.1 KB
aclocal.m4 -rw-r--r-- 13.1 KB
config.guess -rwxr-xr-x 43.2 KB
config.sub -rwxr-xr-x 35.7 KB
configure -rwxr-xr-x 480.0 KB
configure.ac -rw-r--r-- 158.0 KB
install-sh -rwxr-xr-x 7.0 KB
pyconfig.h.in -rw-r--r-- 41.5 KB
setup.py -rw-r--r-- 97.9 KB

README.rst

back to top