Mock.GPIO
Mock.GPIO copied to clipboard
[BUG] Global variables not set correctly on Python 3.11
Describe the bug
Variables such as setModeDone and _mode aren't set correctly.
I believe this is only an issue specifically with the setmode() function. After calling setmode(), the results of getmode() and setModeDone remain unchanged.
To Reproduce Steps to reproduce the behavior:
- call
setmode() - call
getmode()and view the return value - return value remains 0 regardless of what you set the mode to
- view the contents of
setModeDone -
setModeDoneisFalsedespite that you just set mode
Expected behavior
After calling, for example, setmode(GPIO.BCM),
getmode() should return 11
setModeDone should contain True
Screenshots If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: [e.g. iOS] Windows
- Browser [e.g. chrome, safari] N/A
- Version [e.g. 22] 0.1.10
- Python Version 3.11.9
Additional context
The solution should really just be a 2 line change. At the top of the setmode function, add:
global setModeDone
global _mode