Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Infinite recursion when sending frame #6

Closed
normaldotcom opened this issue Jan 22, 2016 · 1 comment
Closed

Infinite recursion when sending frame #6

normaldotcom opened this issue Jan 22, 2016 · 1 comment

Comments

@normaldotcom
Copy link

My simple test script fails to transmit and infinitely recurses:

from canard import can
from canard.hw import socketcan
dev = socketcan.SocketCanDev("can0")
dev.start()
req = can.Frame(0x705)
req.dlc = 2
req.data = [0x10, 0x11]
dev.send(req)

When run, this script returns:

  File "/usr/lib/python3.5/site-packages/canard/can.py", line 71, in data
    data_len = min(self.dlc, len(self._data))
  RecursionError: maximum recursion depth exceeded while calling a Python object

The issue appears to be in can.py:

    @property
    def data(self):
        # return bytes up to dlc length, pad with zeros
        data_len = min(self.dlc, len(self._data))
        result = self.data[:data_len]
        result.extended([0] * (8 - data_len))
        return result

I tried changing the result to result = self._data[:data_len] which fixed the recursion, but then errored out on setting the extended property on the next line. After commenting out the extended property line, everything appears to work.

@ghost ghost mentioned this issue Mar 5, 2016
@ghost
Copy link

ghost commented Mar 5, 2016

i proposed a patch that should fix it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants