Python complains about lru_cache (Python versions compatibility issues)
BloodyFoxy opened this issue · comments
How does the problem look like and what steps reproduce it?
Trying to launch a sample tm.py from root of repository:
Traceback (most recent call last):
File "./tm.py", line 3, in <module>
from pytm import TM, Actor, Boundary, Dataflow, Datastore, Lambda, Server, Data, Classification
File "/usr/lib/python3.6/site-packages/pytm-1.1.1-py3.6.egg/pytm/__init__.py", line 3, in <module>
from .pytm import Element, Server, ExternalEntity, Dataflow, Datastore, Actor, Process, SetOfProcesses, Boundary, TM, Action, Lambda, Threat, Classification, Data
File "/usr/lib/python3.6/site-packages/pytm-1.1.1-py3.6.egg/pytm/pytm.py", line 487, in <module>
class TM():
File "/usr/lib/python3.6/site-packages/pytm-1.1.1-py3.6.egg/pytm/pytm.py", line 781, in TM
@lru_cache
File "/usr/lib64/python3.6/functools.py", line 477, in lru_cache
raise TypeError('Expected maxsize to be an integer or None')
TypeError: Expected maxsize to be an integer or None
Can you reproduce it using the latest master?
Yes
What is your running environment?
OS: SUSE SLES 15 SP1
Python version: Python 3.6.10
Also reproduced in Docker container python:3.7.9-alpine
What have you already tried to solve the problem?
Change @lru_cache
on line 487 to @lru_cache()
.
Line 781 in 5db9b2e
See this Python bug
After changing to
@lru_cache
still works in Docker container python:3.8.6-alpine
which is current stable version of Python 3.8Thanks for the report! I don't think we tried with anything earlier than 3.8, but this doesn't seem to break anything. Would you like to wait until October and submit a PR (just in case you're into #hacktoberfest)?
Yeah, I wish I could always use latest Python too.
I'm not into #hacktoberfest (at least yet) but I can try to contribute OSS in October 😄 I will submit a PR in October then.
@BloodyFoxy sorry, that was overlooked. We don't specify which particular Python 3 versions we support so I assume all of them. We can try adding an action for some older version (oldest still supported, 3.5?) to catch issues like this.