zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 86 forks source link

Fix Python 3.12.3 regression with enums #616

Closed puddly closed 2 months ago

puddly commented 2 months ago

Python 3.12.3 recently released and (again) changed the behavior of the enum module: https://github.com/python/cpython/issues/116040

Zigpy isn't affected so I've replaced all bellows types with zigpy types to hopefully avoid these issues in the future.

puddly commented 2 months ago

Looks like there was a pretty big bug with the old types:

(Pdb) t.uint16_t.deserialize(b'\x06')
(6, b'')

This should not have deserialized.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 99.67%. Comparing base (bf634b5) to head (49a1c15).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #616 +/- ## ========================================== - Coverage 99.68% 99.67% -0.01% ========================================== Files 74 74 Lines 5014 4874 -140 ========================================== - Hits 4998 4858 -140 Misses 16 16 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

puddly commented 2 months ago

It looks like the integer parsing problem is pretty widespread. This branch runs for me on EZSP v13 but it needs to be runtime tested on all previous protocols too...

puddly commented 2 months ago

Tested with protocol versions 4, 8, and 13. I think this is fine to merge.