X Tutup
Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bfrascher/bpython
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: bfrascher/bpython
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bugfix/decorated-function-signature
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Feb 16, 2019

  1. Display the correct signature for a decorated function in Python 3

    This patch changes it so that `inspect.signature` is used instead of
    `inspect.getfullargspec` to get a function's signature, when using Python 3.
    
    Python 3.3 introduced the `inspect.signature` function as a new way to get the
    signature of a function (as an alternative to `inspect.getargspec` and
    `inspect.getfullargspec`).  `inspect.signature` has the advantage that it
    preserves the signature of a decorated function if `functools.wraps` is used to
    decorated the wrapper function.  Having a function's signature available is very
    hepful, especially when testing things out in a REPL.
    bfrascher committed Feb 16, 2019
    Configuration menu
    Copy the full SHA
    e6d6074 View commit details
    Browse the repository at this point in the history
  2. Correctly reference inspect parameter kinds

    Instead of referencing parameter kinds as class attributes on the private
    `_ParameterKind` class we reference them on the public `Parameter` class.  This
    has two advantages:
    
    1) We don't use a private interface.
    2) The class attributes on `_ParameterKind` have only been added in Python 3.5,
       but on `Parameter` they have existed since Python 3.3.
    bfrascher committed Feb 16, 2019
    Configuration menu
    Copy the full SHA
    2713669 View commit details
    Browse the repository at this point in the history
  3. Catch function signature inspection errors for built-in types

    Some built-in functions (e.g. `map`) can't be inspected with
    `inspect.getargspec`, `inspect.getfullargspec` or `inspect.signature`.  The
    exceptions from `inspect.getargspec` and `inspect.getfullargspec` are all caught
    in the code, but `inspect.signature` raises a `ValueError` instead of a
    `TypeError`.  This exception is now also caught.
    bfrascher committed Feb 16, 2019
    Configuration menu
    Copy the full SHA
    26afdd9 View commit details
    Browse the repository at this point in the history
Loading
X Tutup