This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Markus Wegmann
Recipients Madhav Datt, Markus Wegmann, adrianwan2, ethan.furman, r.david.murray
Date 2018-08-11.09:25:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533979515.26.0.56676864532.issue30545@psf.upfronthosting.co.za>
In-reply-to
Content
Hi there!

I came as well in contact with this kind of bug. Sadly, I could not replicate it with a simplified toy example.

You can experience the bug, if checkout

https://github.com/Atokulus/flora_tools/tree/56bb17ea33c910915875214e916ab73f567b3b0c

and run

`python3.7 main.py generate_code -d ..`

You find the crucial part where the identity check fails at 'radio_math.py:102' in function `get_message_toa`. The program then fails, due to the wrong program flow.

`
C:\Users\marku\AppData\Local\Programs\Python\Python37\python.exe C:/Users/marku/PycharmProjects/flora_tools/flora_tools/__main__.py generate_code -d C:\Users\marku\Documents\flora
Traceback (most recent call last):
  File "C:/Users/marku/PycharmProjects/flora_tools/flora_tools/__main__.py", line 110, in <module>
    main()
  File "C:/Users/marku/PycharmProjects/flora_tools/flora_tools/__main__.py", line 104, in main
    generate_code(args.path)
  File "C:/Users/marku/PycharmProjects/flora_tools/flora_tools/__main__.py", line 58, in generate_code
    code_gen = CodeGen(flora_path)
  File "C:\Users\marku\PycharmProjects\flora_tools\flora_tools\codegen\codegen.py", line 37, in __init__
    self.generate_all()
  File "C:\Users\marku\PycharmProjects\flora_tools\flora_tools\codegen\codegen.py", line 40, in generate_all
    self.generate_radio_constants()
  File "C:\Users\marku\PycharmProjects\flora_tools\flora_tools\codegen\codegen.py", line 72, in generate_radio_constants
    radio_toas.append([math.get_message_toa(payload) for payload in payloads])
  File "C:\Users\marku\PycharmProjects\flora_tools\flora_tools\codegen\codegen.py", line 72, in <listcomp>
    radio_toas.append([math.get_message_toa(payload) for payload in payloads])
  File "C:\Users\marku\PycharmProjects\flora_tools\flora_tools\radio_math.py", line 130, in get_message_toa
    ) / self.configuration.bitrate
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'

Process finished with exit code 1
`

In the appendix, you find a toy project with similar structure, which in contrast to `flora_tools` works flawlessly.

I hope there is somebody out there with a little more experience in spotting the cause. If there is a bug in Python or CPython, it might have quite a security & safety impact.

Meanwhile I will hotfix my program by comparing the unerlying enum values.

Best regards
Atokulus
History
Date User Action Args
2018-08-11 09:25:15Markus Wegmannsetrecipients: + Markus Wegmann, r.david.murray, ethan.furman, adrianwan2, Madhav Datt
2018-08-11 09:25:15Markus Wegmannsetmessageid: <1533979515.26.0.56676864532.issue30545@psf.upfronthosting.co.za>
2018-08-11 09:25:15Markus Wegmannlinkissue30545 messages
2018-08-11 09:25:14Markus Wegmanncreate