nvda
2faf24bb - Python 3: Remove Python 2 specific workarounds (PR #9889)

Commit
6 years ago
Python 3: Remove Python 2 specific workarounds (PR #9889) Our Python 2 code contained some workarounds and code paths that are no longer necessary or confusing when on Python 3. 1. Most notably, this is related to functions with `*args` and `**kwargs` catch all handlers which also required a specific keyword argument. Once of these was part of the `hwIo` module and has already been removed in an earlier state. - Code where we pop a particular argument from `kwargs` now contains that argument as a keyword only argument in the signature of the function. 2. Furthermore, there was a workaround in the `gui` code to register support for the `cp65001` codec in Python 2, which is a known codec in Python 3. - This is removed 3. The `scriptHandler.script` decorator checked whether the decorated script was a routine. This also returned `True` for bound instance methods, and therefore no warning was raised when trying to decorate a bound instance method (which is unsupported). Now, such a warning will be raised. See also #9884 - When decorating a script, we now use `isinstance(script, types.FunctionType)` 4. `config.AggregatedSection` still had an `iteritems` method. - `config.AggregatedSection.iteritems` has been renamed to items.
Author
Committer
Parents
Loading