Markus Wegmann <atoku...@gmail.com> added the comment:

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

----------
nosy: +Markus Wegmann
Added file: https://bugs.python.org/file47747/enum_bug-flawless_example.zip

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30545>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to