Skip to content

Commit

Permalink
[#367] Removed the code that reaches to the now removed `atexit._exit…
Browse files Browse the repository at this point in the history
…handlers` attribute in `DisplayCAL.multiprocess.WorkerFunc.__call__()`.
  • Loading branch information
eoyilmaz committed Jun 5, 2024
1 parent 96a487f commit bcee335
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions DisplayCAL/multiprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,18 +222,22 @@ def __call__(self, data, thread_abort_event, progress_queue, *args, **kwds):
# interested in our own exit handler though.
# Note all of this only applies to Windows, as it doesn't
# have fork().
for func, targs, kargs in atexit._exithandlers:
# Find our lockfile removal exit handler
if (
targs
and isinstance(targs[0], str)
and targs[0].endswith(".lock")
):
print("Removing lockfile", targs[0])
try:
func(*targs, **kargs)
except Exception as exception:
print("Could not remove lockfile:", exception)

# This is not working with Ptyhon 3 as atexit is reimplemented in C
# and atexit._exithandlers are not available.
# for func, targs, kargs in atexit._exithandlers:
# # Find our lockfile removal exit handler
# if (
# targs
# and isinstance(targs[0], str)
# and targs[0].endswith(".lock")
# ):
# print("Removing lockfile", targs[0])
# try:
# func(*targs, **kargs)
# except Exception as exception:
# print("Could not remove lockfile:", exception)

# Logging is normally shutdown by atexit, as well. Do
# it explicitly instead.
logging.shutdown()
Expand Down

0 comments on commit bcee335

Please sign in to comment.