blynkkk/lib-python

BlynkTimer Broken on Low Memory Ports

BradenM opened this issue · 1 comments

Expected Behavior

Registering a Timer via register decorator should work on devices with low memory.

Actual Behavior

An AttributeError is raised, complaining that a function object has no attribute 'func', as this seems to be the current fallback if a __name__ attribute cannot be found. This completely breaks BlynkTimer on low memory ports.

Steps to Reproduce the Problem

from blynktimer import Timer

timer = Timer()

@timer.register(interval=1)
def test():
   print('Hello!')

while 1:
   timer.run()

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "main.py", line 8, in start
 File "/lib/blynktimer.py", line 58, in __init__
 File "/lib/blynktimer.py", line 48, in _get_func_name
AttributeError: 'function' object has no attribute 'func'

Specifications

  • Version: MicroPython Official v1.11.0
  • Platform: ESP8266

Added one comment to your pull request. And Thanks for your investigation.