Skip to content

Commit 3577fe9

Browse files
authored
Fix Python < 3
1 parent caac9ab commit 3577fe9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tests/test_pysoundfile.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,22 +758,21 @@ def test_concurren_open_error_reporting(file_inmemory):
758758
n_threads = 4
759759
n_trials_per_thread = 10
760760

761-
n_reported_errors = 0
761+
n_reported_errors = [0]
762762

763763
def target():
764-
nonlocal n_reported_errors
765764
for _ in range(n_trials_per_thread):
766765
try:
767766
sf.SoundFile(file_inmemory)
768767
except sf.LibsndfileError:
769-
n_reported_errors += 1
768+
n_reported_errors[0] += 1
770769

771770
threads = [threading.Thread(target=target) for _ in range(n_threads)]
772771
for thread in threads:
773772
thread.start()
774773
for thread in threads:
775774
thread.join()
776-
assert n_reported_errors == n_threads * n_trials_per_thread
775+
assert n_reported_errors[0] == n_threads * n_trials_per_thread
777776

778777

779778
# -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)