[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-21 Thread Berker Peksag

Berker Peksag added the comment:

Thank you for the PR, Aaron!

--
resolution:  -> fixed
stage: backport needed -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-21 Thread Berker Peksag

Berker Peksag added the comment:


New changeset e78dc0aaf03cd98373910150c2d35418cf938254 by Berker Peksag in 
branch '3.5':
[3.5] bpo-29403: Fix mock's broken autospec behavior on method-bound builtin 
functions (GH-3)
https://github.com/python/cpython/commit/e78dc0aaf03cd98373910150c2d35418cf938254


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-21 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +2860

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-21 Thread Berker Peksag

Berker Peksag added the comment:


New changeset 64b9a15886840df422c5203fad25c9801b4cf61e by Berker Peksag in 
branch '3.6':
[3.6] bpo-29403: Fix mock's broken autospec behavior on method-bound builtin 
functions (GH-3)
https://github.com/python/cpython/commit/64b9a15886840df422c5203fad25c9801b4cf61e


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-21 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +2858

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-19 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: patch review -> backport needed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-07-19 Thread Berker Peksag

Berker Peksag added the comment:


New changeset 856cbcc12f2e4cca93af5dc7ed6bcea4dd942f10 by Berker Peksag (Aaron 
Gallagher) in branch 'master':
bpo-29403: Fix mock's broken autospec behavior on method-bound builtin 
functions (GH-3)
https://github.com/python/cpython/commit/856cbcc12f2e4cca93af5dc7ed6bcea4dd942f10


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-06-06 Thread Cheryl Sabella

Cheryl Sabella added the comment:

This PR appears to have been approved, perhaps pending input from michael.foord?

--
nosy: +csabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-02-21 Thread Aaron Gallagher

Changes by Aaron Gallagher :


--
pull_requests: +193

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-02-13 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag, michael.foord
stage:  -> patch review
versions:  -Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-01-31 Thread Aaron Gallagher

Aaron Gallagher added the comment:

Patch adapted from https://github.com/testing-cabal/mock/pull/389

--
keywords: +patch
Added file: http://bugs.python.org/file46468/mock.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29403] mock's autospec's behavior on method-bound builtin functions is broken

2017-01-31 Thread Aaron Gallagher

New submission from Aaron Gallagher:

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.

There is another None early return in _set_signature, but it seems.. harder to 
trigger? It seems more appropriate to raise an exception there if this is being 
fixed.

--
components: Library (Lib)
messages: 286565
nosy: Aaron Gallagher
priority: normal
severity: normal
status: open
title: mock's autospec's behavior on method-bound builtin functions is broken
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com