Resolve an unset data_bitrate to no operation in slcan. by dcasnowdon · Pull Request #1978 · hardbyte/python-can

@dcasnowdon

Summary of Changes

  • Fix the default setting for data_bitrate when it is not set.

Related Issues / Pull Requests

Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactoring
  • Other (please describe):

Checklist

  • I have followed the contribution guide.
  • I have added or updated tests as appropriate.
  • I have added or updated documentation as appropriate.
  • I have added a news fragment for towncrier.
  • All checks and tests pass (tox).

Additional Notes

Tested on canable 2.0 hardware locally (in addition to the unit tests).

@zariiii9003

Hi, thank you for the fix. But I'd prefer the function signature as it is, so instead you could change the _DATA_BITRATES value to None: ""

@dcasnowdon

@dcasnowdon

Hi, thank you for the fix. But I'd prefer the function signature as it is, so instead you could change the _DATA_BITRATES value to None: ""

I wasn't sure whether 0 might be passed in as a no-op. Is it OK to change the interface in this way? Instead, I've changed it to add an explicit check for None in the body of the method. I can change the value in the _DATA_BITRATES table if you'd prefer.

@dcasnowdon dcasnowdon changed the title Change the default to 0, which is a no-op for data_bitrate. Resolve an unset data_bitrate to no operation in slcan.

Aug 11, 2025

@zariiii9003

Yes, looks good now. Could you add a little bit more information to the news fragment? I'll create a patch release afterwards

@dcasnowdon

@dcasnowdon

Yes, looks good now. Could you add a little bit more information to the news fragment? I'll create a patch release afterwards

I have added a little more detail (is this what you'd like?), and I've changed it to be a fix, rather than added.

zariiii9003

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍