[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Changed status to pending, will close once we've had 3.9.1 in our env and tested proper, but should be OK, cheers! -- status: pending -> open ___ Python tracker

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Change by Valeriu Predoi : -- status: open -> pending ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Excellent, just gonna let my team know about this and we'll hold off on 3.9.0 then - good stuff, mate! -- ___ Python tracker ___

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: 3.9.1 is in RC1 as per https://www.python.org/dev/peps/pep-0596/#lifespan . It will be available as part of 3.9.1 or 3.9.2 . I am not sure about anaconda packaging schedule though. -- ___ Python tracker

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Great, cheers mate, I read through the PR's (and sorry to have pestered you over at the mock backport GitHub too haha) - this looks it will fix the issue nicely. Do you know when will the release be available for us using Python from Anaconda etc.? Feel

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: It's a problem with 3.9 only as far as I know. The fix has been merged to master (3.10) and 3.9 . I will check with 3.8 but I don't think it will be a problem since 3.8 has a different code path. You can check the PR merged for more discussion.

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Note however, that the need I have for my type of functionality is fulfilled and all works fine for Python 3.7 and 3.8, I noticed the problem only for 3.9 - the OP in that issue says their versions affected include 3.8 (maybe it creeps up for 3.8.6 or

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Indeed so! Sorry, I only glossed over that one before posting mine, now that I looked at it more carefully you are right, it does need a check on None and not calling the __bool__ member, which is affecting functionally passing an ndarray as spec - what

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Thanks, this looks like a duplicate of https://bugs.python.org/issue42532 -- ___ Python tracker ___

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
Valeriu Predoi added the comment: Hello mate, yes it used to work fine with Python 3.8, no issue with Python 3.9 and numpy if you call mock as ob = mg.Mock(spec=np.array([4, 4])) this results in a nice exception being raised: Traceback (most recent call last): File

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: I don't have Python 3.9 with numpy to test this. Does this used to work with python 3.8? Does using numpy produce any error or traceback in 3.9? -- nosy: +xtreak ___ Python tracker

[issue42586] unittest.mock.Mock spec can't be array/ndarray in Python 3.9

2020-12-07 Thread Valeriu Predoi
New submission from Valeriu Predoi : Hey guys, the new unittest.mock.Mock for Python 3.9 can not accept a spec arg if it is a numpy array, it'll accept all other types but not ndarray, have a look at this quick minimal code: import numpy as np from unittest import mock as mg ob =