Browse Source

use _hooks[:] instead of calling .copy()

pull/3/head
Brett Langdon 5 years ago
parent
commit
46343c7471
Signed by: brettlangdon GPG Key ID: A70042D88B95AA2B
2 changed files with 3 additions and 5 deletions
  1. +1
    -2
      sysaudit/__init__.py
  2. +2
    -3
      sysaudit/_csysaudit.pyx

+ 1
- 2
sysaudit/__init__.py View File

@ -17,8 +17,7 @@ else:
def audit(event, *args):
global _hooks
# Grab a copy of hooks so we don't need to lock here
hooks = _hooks.copy()
for hook in hooks:
for hook in _hooks[:]:
hook(event, args)
def addaudithook(callback):


+ 2
- 3
sysaudit/_csysaudit.pyx View File

@ -3,9 +3,8 @@ _hooks = list()
def audit(event, *args):
global _hooks
hooks = _hooks.copy()
for hook in hooks:
# Grab a copy of hooks so we don't need to lock here
for hook in _hooks[:]:
hook(event, args)


Loading…
Cancel
Save