Cosimo Lupo 972b3e6a15
[py23] handle exception at shutdown in 'lastResort' logging handler
On python2.7, the fonttools py23 module registers a 'lastResort' StreamHandler
similar to the one found in python3's logging module, that always writes
to the current value `sys.stderr`.

This also applies to any python library that imports from fontTools.misc.py23
under python2.7.

The logging module has a 'shutdown' atexit handler that flushes all the
logging handlers' streams just before the python interpreter exits.

Sometimes (e.g. when calling `python setup.py test` as in MutatorMath's test
suite), the interpreter termination ends with a traceback, which is
triggered by the atexit handler failing to flush the lastResort handler's
stream, sys.stderr

AttributeError: None has no attribute 'stderr'

This is because during module teardown, the globals (in this case 'sys')
are set to None, and the order in which modules are deleted is not
guaranteed.

See 58531934a8
2017-01-28 14:18:29 +00:00
..
2016-08-13 16:29:49 -07:00
2015-06-16 22:44:57 +01:00
2016-01-27 19:02:48 +00:00
2015-04-26 02:01:01 -04:00
2017-01-10 17:57:04 +01:00
2016-04-10 22:59:52 +01:00