This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Nicolas Savoire
Recipients Nicolas Savoire
Date 2016-12-14.10:49:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
With python3.5, fnmatch appears not to be thrad safe. It fails with the following exception:

Traceback (most recent call last):
  File "", line 18, in <module>
  File "/opt/anaconda3/lib/python3.5/concurrent/futures/", line 405, in result
    return self.__get_result()
  File "/opt/anaconda3/lib/python3.5/concurrent/futures/", line 357, in __get_result
    raise self._exception
  File "/opt/anaconda3/lib/python3.5/concurrent/futures/", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "", line 12, in foo
    fnmatch(ref, s)
  File "/opt/anaconda3/lib/python3.5/", line 36, in fnmatch
    return fnmatchcase(name, pat)
  File "/opt/anaconda3/lib/python3.5/", line 70, in fnmatchcase
    match = _compile_pattern(pat)
KeyError: ('SXJ8WZ9F7Z', <class 'str'>)

Here is a minimal example reproducing the issue:

import concurrent.futures
from fnmatch import fnmatch
import random
import string

def str_generator(size=10, chars=string.ascii_uppercase + string.digits):
   return ''.join(random.choice(chars) for _ in range(size))

def foo(strs, ref):
    for s in strs:
        fnmatch(ref, s)

some_strings = [str_generator() for _ in range(500)]
with concurrent.futures.ThreadPoolExecutor() as executor:
    futures = [executor.submit(foo, some_strings, some_strings[0]) for _ in range(8)]
    for f in futures:

$ python3 --version
Python 3.5.2 :: Anaconda 4.2.0 (64-bit)
Date User Action Args
2016-12-14 10:49:24Nicolas Savoiresetrecipients: + Nicolas Savoire
2016-12-14 10:49:24Nicolas Savoiresetmessageid: <>
2016-12-14 10:49:24Nicolas Savoirelinkissue28969 messages
2016-12-14 10:49:24Nicolas Savoirecreate