Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-29403: Fix mock's broken autospec behavior on method-bound builtin functions #3

Merged

Commits on Jul 19, 2017

  1. Fix autospec's behavior on method-bound builtins.

    Cython will, in the right circumstances, offer a MethodType instance
    where im_func is a builtin function. Any instance of MethodType is
    automatically assumed to be a python-defined function (more
    specifically, a function that has an inspectable signature), but
    _set_signature was still conservative in its assumptions. As a result
    _set_signature would return early with None instead of a mock since the
    im_func had no inspectable signature. This causes problems deeper inside
    mock, as _set_signature is assumed to _always_ return a mock, and
    nothing checked its return value.
    
    In similar corner cases, autospec will simply not check the spec of the
    function, so _set_signature is amended to now return early with the
    original, not-wrapped mock object.
    habnabit authored and berkerpeksag committed Jul 19, 2017
    Configuration menu
    Copy the full SHA
    5563d44 View commit details
    Browse the repository at this point in the history
  2. Add blurb entry

    berkerpeksag committed Jul 19, 2017
    Configuration menu
    Copy the full SHA
    989e99a View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    4f4ed02 View commit details
    Browse the repository at this point in the history