Skip to content

Commit 5c52b9f

Browse files
committed
Fix for python2 wrong cache_location type
- Python2.7.15 version of os.path.join doesn't check for the types of the parameters before trying to join them
1 parent 597f024 commit 5c52b9f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

pokepy/api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import functools
1111
import os
12+
import sys
1213
import types
1314
from collections import namedtuple
1415
import appdirs # dependency of FileCache
@@ -54,6 +55,10 @@ def caching(disk_or_memory, cache_directory=None):
5455
def memoize(func):
5556
if disk_or_memory == 'disk':
5657
if cache_directory:
58+
# Python 2 workaround
59+
if sys.version_info[0] == 2 and not isinstance(cache_directory, str):
60+
raise TypeError('expected str')
61+
5762
cache_dir = os.path.join(cache_directory, 'pokepy_cache', str(get_methods_id[0]))
5863
else:
5964
cache_dir = os.path.join(

0 commit comments

Comments
 (0)