Support Python 3.8+ functions with positional-only arguments.

Review Request #10918 — Created Feb. 25, 2020 and submitted

Information

kgb
master

Reviewers

kgb

Python 3.8 added syntax for positional-only arguments, which is not
compatible with prior releases. This involved changes to the CodeType
parameters and function signatures.

It unfortunately did not implement this new support in
inspect.getfullargspec(), meaning we finally needed to move fully over
to the inspect.Signature support. This involved a fair amount of work
in the inspection and formatting code for functions. It also required
that we call into an internal function in the inspect module, which is
needed in order to retain some state in the signature that is otherwise
not available publicly.

The end result is that we can now spy on functions with positional-only
arguments in Python 3.8+.

Unit tests pass on Python 2.7 and 3.5-3.8.

Ran the full Djblets and Review Board test suites on all supported
versions of Python without errors.

Summary ID
Support Python 3.8+ functions with positional-only arguments.
Python 3.8 added syntax for positional-only arguments, which is not compatible with prior releases. This involved changes to the `CodeType` parameters and function signatures. It unfortunately did not implement this new support in `inspect.getfullargspec()`, meaning we finally needed to move fully over to the `inspect.Signature` support. This involved a fair amount of work in the inspection and formatting code for functions. It also required that we call into an internal function in the `inspect` module, which is needed in order to retain some state in the signature that is otherwise not available publicly. The end result is that we can now spy on functions with positional-only arguments in Python 3.8+.
3a907de3a956fefa6e915f8b9db2f09cc3ad6087
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to master (1f4ebc0)