[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-09 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@kakshay, I am not working on it so feel free to pick it up. I stumbled upon 
this while looking into mock issues and I just posted a patch to gather API 
feedback. I guess it would be helpful if someone confirms it would be a good 
addition so that there is less rework.

Thanks

--

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think "Actual" is more consistent with other error messages like 
assert_has_calls. I haven't seen usage of observed or received in error 
messages and hence my opinion on using expected and actual though they are not 
visually aligned. I don't have a strong opinion on this. I will leave it to the 
maintainer who wants to merge this change and I am fine as long as the calls 
are represented on separate lines which is a good improvement over current 
format.

>>> m.assert_has_calls(mock.call(1))
Traceback (most recent call last):
  File "", line 1, in 
  File 
"/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/unittest/mock.py", 
line 857, in assert_has_calls
raise AssertionError(
AssertionError: Calls not found.
Expected: ['', (1,), {}]
Actual: [call(1), call(2)].

--

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Tal Einat


Tal Einat  added the comment:

Karthikeyan, what do you think of the suggestions by Terry and myself to 
achieve alignment by replacing the word "Actual" with a longer alternative, 
such as "Observed" or "Received"?

--

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -11816, 11817, 11818

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -11816, 11817

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Tal Einat


Change by Tal Einat :


--
pull_requests:  -11816

___
Python tracker 

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



[issue34424] Unicode names break email header

2019-02-09 Thread Celelibi


Change by Celelibi :


--
nosy: +Celelibi

___
Python tracker 

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



[issue16353] add function to os module for getting path to default shell

2019-02-09 Thread Chih-Hsuan Yen


Change by Chih-Hsuan Yen :


--
nosy:  -yan12125

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch, patch
pull_requests: +11815, 11816, 11817, 11818
stage: test needed -> patch review

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch, patch
pull_requests: +11815, 11816, 11817
stage: test needed -> patch review

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +11815
stage: test needed -> patch review

___
Python tracker 

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



[issue35500] Align expected and actual calls on mock.assert_called_with error message

2019-02-09 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch, patch
pull_requests: +11815, 11816
stage: test needed -> patch review

___
Python tracker 

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



[issue18283] shutil.which() should support bytes

2019-02-09 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Would it be worthwhile to make a PR of this for 3.8?

--
nosy: +cheryl.sabella
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35875] Crash by Pandas - algos.cp36-win_amd64.pyd join.cp36-win_amd64.pyd

2019-02-09 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-09 Thread Kumar Akshay


Kumar Akshay  added the comment:

Hey @xtreak, if you're not working on this, can I submit the patch?

--
nosy: +kakshay

___
Python tracker 

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



[issue35952] test.pythoninfo prints a stack trace and exits with 1 when the compiler does not exist

2019-02-09 Thread Xavier de Gaye


New submission from Xavier de Gaye :

The call to subprocess.Popen() in collect_cc() of Lib/test/pythoninfo.py raises 
an exception when the compiler that has been used to build python is not 
present on the host running python. In that case pythoninfo prints a stack 
trace and exits with an error.

On the other side if the execution of the compiler to get its version fails, 
the error is silently ignored. It seems the exception should be ignored as well.

--
components: Library (Lib)
messages: 335139
nosy: xdegaye
priority: normal
severity: normal
status: open
title: test.pythoninfo prints a stack trace and exits with 1 when the compiler 
does not exist
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue16353] add function to os module for getting path to default shell

2019-02-09 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I think the functionality of getting either the system-wide default shell or 
the current user's default shell can be useful regardless of whether the 
specific subprocess issue was fixed.

--
nosy: +ncoghlan
stage: patch review -> needs patch
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue16353] add function to os module for getting path to default shell

2019-02-09 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

3.7 added `sys.getandroidapilevel()` under #28740.  As Xavier mentioned in 
msg271439, that was used for subprocess.Popen in #16255 and also merged as part 
of 3.7.

I'm not sure if there is still interest in adding a `default_shell` to the os 
module using `sys.androidapilevel()` and the last batch that Xavier uploaded in 
2016.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue21269] Provide args and kwargs attributes on mock call objects

2019-02-09 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

args and kwargs property can be introduced on the call object to return the 
args and kwargs stored in the tuple. Currently wrapping call object with tuple 
can get a tuple of args and kwargs but a property would be helpful. A first 
attempt patch on this. Feedback on the API would be helpful.

$ ./python.exe
Python 3.8.0a1+ (heads/master:8a03ff2ff4, Feb  9 2019, 10:42:29)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from unittest.mock import Mock
>>> m = Mock()
>>> m(1, a=1)

>>> m.call_args_list[0]
call(1, a=1)
>>> tuple(m.call_args_list[0]) # wrapping it with tuple can give args and 
>>> kwargs currently
((1,), {'a': 1})
>>> m.call_args_list[0].args # With patch return args
(1,)
>>> m.call_args_list[0].kwargs # With patch return kwargs
{'a': 1}

A simple patch would be as below : 

➜  cpython git:(master) ✗ git diff | cat
diff --git a/Lib/unittest/mock.py b/Lib/unittest/mock.py
index ef5c55d6a1..ef1aa1dcea 100644
--- a/Lib/unittest/mock.py
+++ b/Lib/unittest/mock.py
@@ -2124,6 +2124,24 @@ class _Call(tuple):
 def index(self, *args, **kwargs):
 return self.__getattr__('index')(*args, **kwargs)

+@property
+def args(self):
+if len(self) == 2:
+args, kwargs = self
+else:
+name, args, kwargs = self
+
+return args
+
+@property
+def kwargs(self):
+if len(self) == 2:
+args, kwargs = self
+else:
+name, args, kwargs = self
+
+return kwargs
+
 def __repr__(self):
 if not self._mock_from_kall:
 name = self._mock_name or 'call'

--
nosy: +cjw296, xtreak
versions: +Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35364] Datetime “fromtimestamp()” ignores inheritance if timezone is not None

2019-02-09 Thread Paul Ganssle


Paul Ganssle  added the comment:

This issue and bpo-32417 can be closed now, as they are fixed on master.

--
versions: +Python 3.8 -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



[issue35951] os.renames() creates directories if original name doesn't exist

2019-02-09 Thread Chris Jerdonek


New submission from Chris Jerdonek :

os.renames() creates and leaves behind the intermediate directories if the 
original (source) path doesn't exist.

>>> import os
>>> os.mkdir('temp')
>>> os.mkdir('temp/test')
>>> os.renames('temp/not-exists', 'temp/test2/test3/test4')
Traceback (most recent call last):
  File "", line 1, in 
  File "/.../3.6.5/lib/python3.6/os.py", line 267, in renames
rename(old, new)
FileNotFoundError: [Errno 2] No such file or directory: 'temp/not-exists' -> 
'temp/test2/test3/test4'
>>> os.listdir('temp/test2')
['test3']
>>> os.listdir('temp/test2/test3')
[]

--
components: Library (Lib)
messages: 335134
nosy: chris.jerdonek
priority: normal
severity: normal
status: open
title: os.renames() creates directories if original name doesn't exist
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue35808] Let's retire pgen

2019-02-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +pablogsal

___
Python tracker 

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



[issue35940] multiprocessing manager tests fail in the Refleaks buildbots

2019-02-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch, patch
pull_requests: +11812, 11813, 11814
stage:  -> patch review

___
Python tracker 

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



[issue35940] multiprocessing manager tests fail in the Refleaks buildbots

2019-02-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +11812
stage:  -> patch review

___
Python tracker 

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



[issue35940] multiprocessing manager tests fail in the Refleaks buildbots

2019-02-09 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch
pull_requests: +11812, 11813
stage:  -> patch review

___
Python tracker 

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



[issue34028] Python 3.7.0 wont compile with SSL Support 1.1.0 > alledged missing X509_VERIFY_PARAM_set1_host() support

2019-02-09 Thread Bob Kline


Bob Kline  added the comment:

I had to add $HOME/usr/lib64 to LD_LIBRARY_PATH to get make to work.

--
nosy: +bkline

___
Python tracker 

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



[issue35950] io.BufferedReader.writabe is False, but io.BufferedReader.truncate does not raise OSError

2019-02-09 Thread Steve Palmer


Change by Steve Palmer :


--
nosy: +martin.panter

___
Python tracker 

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



[issue35950] io.BufferedReader.writabe is False, but io.BufferedReader.truncate does not raise OSError

2019-02-09 Thread Steve Palmer


New submission from Steve Palmer :

An io.BUfferedReader object has an (inherited) writable method that returns 
False.  io.IOBase states in the description of the writable method that "If 
False, write() and truncate() will raise OSError."

However, if the BufferedReader object is constructed from a writabe 
io.RawIOBase object, then the truncate does not raise the exception.

>>> import io
>>> import tempfile
>>> rf = tempfile.TemporaryFile(buffering=0)
>>> rf
<_io.FileIO name=3 mode='rb+' closefd=True>
>>> bf = io.BufferedReader(rf)
>>> bf.writable()
False
>>> bf.truncate(0)
0

Looking at _pyio.py file, the truncate method in the  _BufferedIOMixin wrapper 
class delegates the truncation to it's raw attribute.  If the raw element 
permits the truncation, then it will proceed regardless of the writable state 
of the wrapper class.  I'd suggest that modifying the truncate method in 
_BufferedIOMixin to raise OSError (or Unsupported) if not self.writable() could 
fix this problem.

--
components: IO
messages: 335132
nosy: steverpalmer
priority: normal
severity: normal
status: open
title: io.BufferedReader.writabe is False, but io.BufferedReader.truncate does 
not raise OSError
versions: Python 3.7

___
Python tracker 

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



[issue35912] _testembed.c fails to compile when using --with-cxx-main in the configure step

2019-02-09 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35912] _testembed.c fails to compile when using --with-cxx-main in the configure step

2019-02-09 Thread Eric N. Vander Weele


Change by Eric N. Vander Weele :


--
nosy: +ericvw

___
Python tracker 

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



[issue35859] Capture behavior depends on the order of an alternation

2019-02-09 Thread Ma Lin


Ma Lin  added the comment:

For a capture group, state->mark[] array stores it's begin and end:
begin: state->mark[(group_number-1)*2]
end:   state->mark[(group_number-1)*2+1]

So state->mark[0] is the begin of the first capture group.
state->mark[1] is the end of the first capture group.

re.search(r'(ab|a)*?b', 'ab')
In this case, here is a simplified actions record:

01  MARK 0
02  "a":  first "a" in the pattern [SUCCESS]
03  BRANCH
04"b": first "b" in the pattern [SUCCESS]
05MARK 1
06"b": second "b" in the pattern [FAIL]
07try next (ab|a)*? [FAIL]
08  MARK 0
09  "a":  first "a" in the pattern [FAIL]
10  BRANCH: try next branch
11"": the second branch [SUCCESS]
12MARK 1
13"b" [SUCCESS]: second "b" in the pattern

MARK_PUSH(lastmark) macro didn't protect MARK-0 if it was the only available 
mark, while the BRANCH op uses this macro to protect capture groups before 
trying a branch.

So capture group 1 is [MARK-0 at Line-08, MARK-1 at line-12), this is wrong. 
The correct capture group 1 should be [MARK-0 at Line-01, MARK-1 at line-12).

--
versions: +Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35875] Crash by Pandas - algos.cp36-win_amd64.pyd join.cp36-win_amd64.pyd

2019-02-09 Thread Bangert


Bangert  added the comment:

Yes I wanted to upload the crash dump files at the beginning of the session but 
your upload size restriction does not allow this

--
Added file: 
https://bugs.python.org/file48131/Crash-Dump-Files-Win7-RWTH-SAP1-Size-Too-Large-For-Upload-To-PythonBugs.jpg

___
Python tracker 

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



[issue35904] Add statistics.fmean(seq)

2019-02-09 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

FWIW, fabs() and fmod() are other examples of where "f" indicates a function 
specialized to convert inputs to floats, perform floating point math, and 
return a float.

--

___
Python tracker 

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



[issue35875] Crash by Pandas - algos.cp36-win_amd64.pyd join.cp36-win_amd64.pyd

2019-02-09 Thread Bangert


Bangert  added the comment:

So the solution is:
If you don't need algos then comment it out
C:\A-Cond-3-64\envs\TensorflowCpu\Lib\site-packages\pandas\_libs\algos.cp36-win_amd64.pyd

The sequence crash of the join extension only depends on algos and is gone if 
you comment out algos in Win7 and Win10.
Best regards
Axel Arnold Bangert - Herzogenrath 09.02.2019

--
Added file: 
https://bugs.python.org/file48130/Algos-Commented-Out-Crash-Popup-Win7-Win10-RWTH-SAP.jpg

___
Python tracker 

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



[issue35875] Crash by Pandas - algos.cp36-win_amd64.pyd join.cp36-win_amd64.pyd

2019-02-09 Thread Bangert


Bangert  added the comment:

yes OK - thank you very much

--

___
Python tracker 

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



[issue21625] help()'s more-mode is frustrating

2019-02-09 Thread Steven D'Aprano


Change by Steven D'Aprano :


--
nosy: +steven.daprano
versions: +Python 3.8 -Python 2.7, Python 3.5

___
Python tracker 

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