[issue24849] Add __len__ to map, everything in itertools
flying sheep added the comment: The *iterable* itself may be reentrant, but the iterator formed from iter(iterable) is not. So by your previous comment, giving the iterator form a length is not appropriate. With the exception of tee, all the functions in itertools return iterators. ah, so your gripe is that the itertools functions return iterators, not (possibly) reentrant objects like range(). and changing that would break backwards compatibility, since the documentation says “iterator”, not “iterable” (i.e. people can expect e.g. next(groupby(...))) to work. that’s probably the end of this :( the only thing i can imagine that adds reentrant properties (and an useful len()) to iterators would be an optional function (maybe __uniter__ :D) that returns an iterable whose __iter__ function creates a restarted iterator copy, or an optional function that directly returns such a copy. probably too much to ask for :/ Since you can't rely on it having a length, you have to program as if it doesn't. So in practice, I believe this will just add complication. I don’t agree here. If something accepts iterables and expects to sometimes be called on iterators and sometimes on sequences/len()gthy objects, it will already try/catch len(iterable) and do something useful if that succeeds. The best we ended-up with has having __length_hint__ to indicate size to list(). Just out of interest, how does my __uniter__ compare? because it changed their boolean value from always-true it does? is it forbidden to define methods so that int(bool(o)) != len(o)? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24849 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] Crash on comparing call_args with long strings
New submission from Wilfred Hughes: What steps will reproduce the problem? from mock import Mock m = Mock() m(1, 2) Mock name='mock()' id='139781492681104' m.call_args == foob Traceback (most recent call last): File stdin, line 1, in module File /home/wilfred/.py_envs/trifle/lib/python2.7/site-packages/mock.py, line 2061, in __eq__ first, second = other ValueError: too many values to unpack What is the expected output? What do you see instead? Expected False, got an error instead. (Migrated from https://github.com/testing-cabal/mock/issues/232 ) -- components: Library (Lib) messages: 248504 nosy: Wilfred.Hughes priority: normal severity: normal status: open title: Crash on comparing call_args with long strings type: crash ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24852] Python 3.5.0rc1 HOWTO Use Python in the web needs fix
Berker Peksag added the comment: +1 I'd delete most of the CGI section, add a note about PEP and mention Gunicorn, uwsgi and Waitress. The frameworks section also needs a cleanup. Do you want to work on a patch? -- nosy: +berker.peksag stage: - needs patch versions: +Python 3.4, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24852 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24852] Python 3.5.0rc1 HOWTO Use Python in the web needs fix
Georg Brandl added the comment: It's probably better to remove the document for now, and add a rewritten version back when it arrives. Although, this topic sees lot of change regularly, so it is probably not a good one for the standard documentation after all. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24852 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] Crash on comparing call_args with long strings
Michael Foord added the comment: call_args is not user settable! It is set for you by the mock when it is called. Arguably it could be a property instead. -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] mock: Crash on comparing call_args with long strings
Changes by Wilfred Hughes yowilf...@gmail.com: -- title: Crash on comparing call_args with long strings - mock: Crash on comparing call_args with long strings ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
New submission from sih4sing5hong5: I also posted in stackoverflow: http://stackoverflow.com/questions/30978207/python-urlopen-mock-fail ``` from unittest.mock import patch import urllib from urllib import request from urllib.request import urlopen @patch('urllib.request.urlopen') def openPatch(urlopenMock): print(urlopenMock) print(urlopen) print(request.urlopen) print(urllib.request.urlopen) openPatch() ``` and got ``` MagicMock name='urlopen' id='140645541554384' function urlopen at 0x7fea9764c268 MagicMock name='urlopen' id='140645541554384' MagicMock name='urlopen' id='140645541554384' ``` request.urlopen and urllib.request.urlopen worked. Why urlopen had been not mocked? -- components: Library (Lib) messages: 248500 nosy: sih4sing5hong5 priority: normal severity: normal status: open title: fail to mock the urlopen function versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24855 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24856] Mock.side_effect as iterable or iterator
New submission from Martijn Pieters: The documentation states that `side_effect` can be set to an [iterable](https://docs.python.org/3/glossary.html#term-iterable): If you pass in an iterable, it is used to retrieve an iterator which must yield a value on every call. This value can either be an exception instance to be raised, or a value to be returned from the call to the mock (`DEFAULT` handling is identical to the function case). but the [actual handling of the side effect](https://github.com/testing-cabal/mock/blob/27a20329b25c8de200a8964ed5dd7762322e91f6/mock/mock.py#L1112-L1123) expects it to be an [*iterator*](https://docs.python.org/3/glossary.html#term-iterator): if not _callable(effect): result = next(effect) This excludes using a list or tuple object to produce the side effect sequence. Can the documentation be updated to state an *iterator* is required (so an object that defines __next__ and who's __iter__ method returns self), or can the CallableMixin constructor be updated to call iter() on the side_effect argument if it is not an exception or a callable? You could even re-use the [_MockIter() class](https://hg.python.org/cpython/file/256d2f01e975/Lib/unittest/mock.py#l348) already used for the [NonCallableMock.side_effect property](https://hg.python.org/cpython/file/256d2f01e975/Lib/unittest/mock.py#l509). -- components: Library (Lib) messages: 248501 nosy: mjpieters priority: normal severity: normal status: open title: Mock.side_effect as iterable or iterator versions: Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24856 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] Crash on comparing call_args with long strings
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +michael.foord stage: - needs patch type: crash - behavior versions: +Python 3.4, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue23530] os and multiprocessing.cpu_count do not respect cpuset/affinity
Serhiy Storchaka added the comment: Argument Clinic code was not regenerated. Actually the commit breaks Argument Clinic. $ make clinic ./python -E ./Tools/clinic/clinic.py --make Error in file ./Modules/posixmodule.c on line 11211: Docstring for os.cpu_count does not have a summary line! Every non-blank function docstring must start with a single line summary followed by an empty line. make: *** [clinic] Error 255 -- nosy: +serhiy.storchaka resolution: fixed - stage: resolved - needs patch status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23530 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
sih4sing5hong5 added the comment: It is normal because of __all__ syntax. By: https://github.com/testing-cabal/mock/issues/313#issuecomment-130564364 -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24855 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] mock: Crash on comparing call_args with long strings
Wilfred Hughes added the comment: This caught me by surprise and I spent a while debugging due to this issue. Isn't it reasonable that I can compare two values in Python without exceptions being raised? (1, 2) == foob False I'm happy to write a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] Crash on comparing call_args with long strings
Michael Foord added the comment: Oops, I misunderstood the bug report - however, call_args is a tuple, so you can't compare it directly to a string like that. Please refer to the docs on using call_args. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] mock: Crash on comparing call_args with long strings
Wilfred Hughes added the comment: This bug is particularly subtle because it only applies to *long* strings. m.call_args == f False m.call_args == fo False m.call_args == foo False m.call_args == foob Traceback (most recent call last): File stdin, line 1, in module File build/bdist.linux-x86_64/egg/mock.py, line 2061, in __eq__ ValueError: too many values to unpack -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files
Robert Collins added the comment: Ok, so will someone commit 3), or would you like me to do so? After that it sounds like we can move this back to patch review, since there will be nothing left ready for commit. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20180 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] mock: Crash on comparing call_args with long strings
Michael Foord added the comment: Ok, fair enough. -- resolution: not a bug - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24854] Null check handle return by new_string()
New submission from Pankaj Sharma: The issue reported in python-2.7.10/Parser/tokenizer.c:237 to handle NULL return by new_string() if PyMem_MALLOC() failed. So need to check for NULL and return to prevent from crash happened in get_normal_name().this issue related with issue18470 has been taken care by setting error code E_NOMEM in 3.4.X. i have attached patch, please review it. -- files: Python-2.7.10-tokenizer.patch keywords: patch messages: 248498 nosy: benjamin.peterson, pankaj.s01 priority: normal severity: normal status: open title: Null check handle return by new_string() type: crash versions: Python 2.7 Added file: http://bugs.python.org/file40172/Python-2.7.10-tokenizer.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24854 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18383] test_warnings modifies warnings.filters when running with -W default
Alex Shkop added the comment: @rbcollins that is exactly what was trying to say in previous comment. We can make a change to current patch that won't affect behavior. In old API in this sequence of filters last filter was never used: simplefilter(ignore) simplefilter(error, append=True) simplefilter(ignore, append=True) # never used So I suggest that new patch should work like this: simplefilter(error) simplefilter(ignore, append=True) # appends new filter to the end simplefilter(ignore) simplefilter(error, append=True) simplefilter(ignore, append=True) # does nothing since same filter is present. This way filtering will work in the same way it worked before patch and we won't have duplicates. I'll update the patch as soon as I will get to my computer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18383 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24852] Python 3.5.0rc1 HOWTO Use Python in the web needs fix
John Hagen added the comment: A couple other notes I saw: The examples (https://docs.python.org/3.5/howto/webservers.html#setting-up-fastcgi) do not follow PEP 8 (should not have an encoding statement if it is UTF-8 Python 3) or the current guidance in PEP 394 to use python3 in the shebang rather than python. Unfortunately, I think I should defer writing the patch/new page to someone with more experience in the Python/web world. I am still pretty new to it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24852 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24856] Mock.side_effect as iterable or iterator
R. David Murray added the comment: The documentation is accurate. The object being manipulated by the code clause you site is not the original object passed in to the side_effect argument. -- nosy: +r.david.murray resolution: - not a bug stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24856 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15601] tkinter test_variables fails with OS X Aqua Tk 8.4
Terry J. Reedy added the comment: Andrew (and others): I wasn't sure whether to reopen this or start a new issue. Will re-close this and open new if preferable. -- nosy: +terry.reedy status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15601 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24857] mock: Crash on comparing call_args with long strings
R. David Murray added the comment: Yeah, if it isn't comparable it should return either False or NotImplemented, not raise an exception. False would be better here, I think. -- keywords: +easy nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24857 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24855] fail to mock the urlopen function
R. David Murray added the comment: It has nothing to do with __all__, and everything to do with the way namespaces work in Python. 'from urllib.request import urllib' creates a name 'urllib' in the global namespace of your module pointing to the urlopen function (*before* you do your patch), and patch has no effect on the global namespace of your module, only on the global namespace of urllib.request. By contrast, urllib in your module's global namespace points to the urllib module, so urllib.request points to the urllib.request's global namespace, which patch has altered to point to your mock by the time you print its value. -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24855 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21167] float('nan') returns 0.0 on Python compiled with icc
Roundup Robot added the comment: New changeset d9c85b6bab3a by R David Murray in branch '2.7': #21167: Fix definition of NAN when ICC used without -fp-model strict. https://hg.python.org/cpython/rev/d9c85b6bab3a New changeset 5e71a489f01d by R David Murray in branch '3.4': #21167: Fix definition of NAN when ICC used without -fp-model strict. https://hg.python.org/cpython/rev/5e71a489f01d New changeset e3008318f76b by R David Murray in branch '3.5': Merge: #21167: Fix definition of NAN when ICC used without -fp-model strict. https://hg.python.org/cpython/rev/e3008318f76b New changeset 1dd4f473c627 by R David Murray in branch 'default': Merge: #21167: Fix definition of NAN when ICC used without -fp-model strict. https://hg.python.org/cpython/rev/1dd4f473c627 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21167] float('nan') returns 0.0 on Python compiled with icc
R. David Murray added the comment: Thanks Chris, and Mark. I ran the tests on 3.6 both on Linux (non ICC) and on Mac (with ICC without -fp-model strict) and all the tests passed. -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21167] float('nan') returns 0.0 on Python compiled with icc
R. David Murray added the comment: Larry, do you want this for 3.5.0a2? It's an innocuous patch for anyone not using ICC, and makes ICC just work (with the default ICC build arguments) for people using ICC. (Well, on (lin/u)nux and mac, anyway, I'm not sure we've resolved all the ICC issues on Windows yet.) -- nosy: +larry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24847] Can't import tkinter in Python 3.5.0rc1
R. David Murray added the comment: Is this buildbot failure: http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.5/builds/189 related to this issue? LINK : fatal error LNK1104: cannot open file 'C:\buildbot.python.org\3.5.kloth-win64\build\PCBuild\amd64\_tkinter_d.pyd' [C:\buildbot.python.org\3.5.kloth-win64\build\PCbuild\_tkinter.vcxproj] -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24847 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24851] infinite loop in faulthandler._stack_overflow
Antoine Pitrou added the comment: To fix this in a generic way, perhaps the function could update a volatile global variable after the recursive call? -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24851 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24570] IDLE Autocomplete and Call Tips Do Not Pop Up on OS X with ActiveTcl 8.5.18
Mark Roseman added the comment: Awesome, thanks Kevin. Have attached calltip.patch. The extra lift() call doesn't seem to hurt on Windows or X11, so didn't make it conditional. -- keywords: +patch Added file: http://bugs.python.org/file40173/calltip.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24570 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue15601] tkinter test_variables fails with OS X Aqua Tk 8.4
Serhiy Storchaka added the comment: Please open a new issue Laura. -- nosy: +serhiy.storchaka status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15601 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
New submission from Laura Creighton: I have tried this on several debian unstable releases, and get the following 3 failures lac at smartwheels:~$ lsb_release -a LSB Version: core-2.0-amd64:core-2.0-noarch:core-3.0-amd64:core-3.0-noarch:core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:core-4.0-amd64:core-4.0-noarch:core-4.1-amd64:core-4.1-noarch:security-4.0-amd64:security-4.0-noarch:security-4.1-amd64:security-4.1-noarch Distributor ID:Debian Description: Debian GNU/Linux unstable (sid) Release: unstable Codename: sid Idle shows my tk version as 8.6.4 python3 -m test -ugui -v test_tk gives 3 failures = CPython 3.4.3+ (default, Jul 28 2015, 13:17:50) [GCC 4.9.3] == Linux-3.16.0-4-amd64-x86_64-with-debian-stretch-sid little-endian == hash algorithm: siphash24 64bit == /tmp/test_python_7974 Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, verbose=0, bytes_warning=0, quiet=0, hash_randomization=1, isolated=0) test_default (tkinter.test.test_tkinter.test_variables.TestBooleanVar) ... FAIL test_get (tkinter.test.test_tkinter.test_variables.TestBooleanVar) ... FAIL test_set (tkinter.test.test_tkinter.test_variables.TestBooleanVar) ... FAIL == FAIL: test_default (tkinter.test.test_tkinter.test_variables.TestBooleanVar) -- Traceback (most recent call last): File /usr/lib/python3.4/tkinter/test/test_tkinter/test_variables.py, line 163, in test_default self.assertIs(v.get(), False) AssertionError: 0 is not False == FAIL: test_get (tkinter.test.test_tkinter.test_variables.TestBooleanVar) -- Traceback (most recent call last): File /usr/lib/python3.4/tkinter/test/test_tkinter/test_variables.py, line 167, in test_get self.assertIs(v.get(), True) AssertionError: 1 is not True == FAIL: test_set (tkinter.test.test_tkinter.test_variables.TestBooleanVar) -- Traceback (most recent call last): File /usr/lib/python3.4/tkinter/test/test_tkinter/test_variables.py, line 186, in test_set self.assertEqual(self.root.globalgetvar(name), true) AssertionError: 42 != 1 -- Ran 660 tests in 3.901s FAILED (failures=3) 1 test failed: test_tk -- components: Tkinter messages: 248529 nosy: lac, terry.reedy priority: normal severity: normal status: open title: python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid) versions: Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16554] The description of the argument of MAKE_FUNCTION and MAKE_CLOSURE is incorrect
Roundup Robot added the comment: New changeset c515b40a70eb by Antoine Pitrou in branch '3.4': Issue #16554: fix description for MAKE_CLOSURE. Initial patch by Daniel Urban. https://hg.python.org/cpython/rev/c515b40a70eb New changeset 2a41fb63c095 by Antoine Pitrou in branch '3.5': Issue #16554: fix description for MAKE_CLOSURE. Initial patch by Daniel Urban. https://hg.python.org/cpython/rev/2a41fb63c095 New changeset 7aed2d7e7dd5 by Antoine Pitrou in branch 'default': Issue #16554: fix description for MAKE_CLOSURE. Initial patch by Daniel Urban. https://hg.python.org/cpython/rev/7aed2d7e7dd5 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16554 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24856] Mock.side_effect as iterable or iterator
Martijn Pieters added the comment: Bugger, that's the last time I take someone's word for it and not test properly. Indeed, I missed the inheritance of NonCallableMock, so the property is inherited from there. Mea Culpa! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24856 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16554] The description of the argument of MAKE_FUNCTION and MAKE_CLOSURE is incorrect
Antoine Pitrou added the comment: The description for MAKE_FUNCTION had already been fixed in the meantime, so I pushed the changes for MAKE_CLOSURE. Thank you! -- nosy: +pitrou resolution: - fixed stage: patch review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16554 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24853] Py_Finalize doesn't clean up PyImport_Inittab
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24853 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17703] Trashcan mechanism segfault during interpreter finalization in Python 2.7.4
Antoine Pitrou added the comment: I'm seeing this bug in Python 3.4.2 as well, and the patch here (tstate_trashcan.patch) appears to fix it. What is the context? Some specific C code? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17703 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24492] using custom objects as modules: AttributeErrors new in 3.5
Brett Cannon added the comment: I noticed you accepted the PR on Bitbucket, Larry. Should I consider your part done and I can now pull the commit into the 3.5 and default branches on hg.python.org? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24492 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21159] configparser.InterpolationMissingOptionError is not very intuitive
Changes by Robert Collins robe...@robertcollins.net: -- resolution: - fixed stage: commit review - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21159] configparser.InterpolationMissingOptionError is not very intuitive
Robert Collins added the comment: I've applied this since it seems Lukasz was busy. Thanks for the patch Lukasz! -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24861] deprecate importing components of IDLE
Terry J. Reedy added the comment: Thank you for doing the research. It seems that extensions are the only unknown. Steps for doing this. 1. Nick once said to start with a notice in idlelib.__init__. How about the following. The idlelib package implements the Idle application, which include an interactive shell and editor. The files named idle.* should be used to start Idle. The other files are private implementations and should not be imported by other applications. Their details are subject to change. See PEP 434 for more informaton. 2. Put same in NEWS.txt -- not just a notice that a notice was added to .__init__, but the notice itself. 3. Put a single line at the top of each 'new' file. Perhaps # Private implementation module. API subject to change. 4. 'Old' files, which will go away someday, perhaps as soon as 3.6, are less of a concern to me. If one that has been replaced by a ttk version is imported when use_ttk is true, we can assume that it is being imported by an extension and issue a DeprecationWarning. 5. PyShell is a special case since from idlelib.PyShell import main; main() (essentially the content of idlelib.__main__) was once advertised as the way to start Idle. PyShell is also a special case because it includes startup code, shell code, and editor debug code, making it a prime target for refactoring. If main() were moved elsewhere and __main__.py and idle.* files modified to point to the new location, we could raise a DeprecationWarning in PyShell.main before calling the new main. -- assignee: - terry.reedy priority: normal - high versions: +Python 2.7, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24861 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24861] deprecate importing components of IDLE
Changes by Terry J. Reedy tjre...@udel.edu: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24861 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Serhiy Storchaka added the comment: Oh, sorry. The issue still looks strange to me. It looks as a result of mix Python core, library or tests of different versions. Could you please test what following commands output? import tkinter tcl = tkinter.Tcl() tcl.getboolean(42) True tkinter.BooleanVar.set function BooleanVar.set at 0xb6ed5614 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24860] handling of IDLE 'open module' errors
Terry J. Reedy added the comment: I see this as two related changes: a) Leave the module name query box open when there is a error, so the user can either correct a mistake (or hit Cancel) without reopening the box and re-entering the module name. Good idea. b) Put the error message in the box itself, perhaps with a beep. I presume there would be no [OK] button, but rather the cursor would remain in the entry box. Nice simplification. I believe 'not a source-based module' means 'not a python-coded module', which seems a little clearer. We could check the importlib doc. -- stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24860 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21159] configparser.InterpolationMissingOptionError is not very intuitive
Roundup Robot added the comment: New changeset 267422f7c927 by Robert Collins in branch '3.4': Issue #21159: Improve message in configparser.InterpolationMissingOptionError. https://hg.python.org/cpython/rev/267422f7c927 New changeset 1a144ff2d78b by Robert Collins in branch '3.5': Issue #21159: Improve message in configparser.InterpolationMissingOptionError. https://hg.python.org/cpython/rev/1a144ff2d78b New changeset fb4e67040779 by Robert Collins in branch 'default': Issue #21159: Improve message in configparser.InterpolationMissingOptionError. https://hg.python.org/cpython/rev/fb4e67040779 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21159 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24860] handling of IDLE 'open module' errors
Mark Roseman added the comment: Exactly. The querydialog code (which will replace the simpledialog askstring/askinteger calls) displays errors as shown in querydialog.png, with the error messages disappearing as soon as you hit another key. You can also pass in a 'validator' to check if the input is ok, so in this case it would check if the module could be loaded and return the appropriate message if not. -- Added file: http://bugs.python.org/file40175/querydialog.png ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24860 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Serhiy Storchaka added the comment: This looks strange. Current default Tcl in Debian unstable is 8.6 [1]. New Python3 builds depend on libtcl8.6 [2]. The full version of the 8.4 branch is 8.4.20 [3], this is the last release in the 8.4 branch. Perhaps your installation was not updated too long time if you see 8.6.4. [1] https://packages.debian.org/sid/tcl [2] https://packages.debian.org/sid/python3-tk [3] https://packages.debian.org/sid/tcl8.4 -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24861] deprecate importing components of IDLE
New submission from Mark Roseman: One of the concerns with making significant structural changes to the IDLE codebase is breakage of external that might import a piece of idlelib (so not just 'import idlelib' but a particular submodule). PEP 434 already makes the case that this behaviour is unsupported (the modules are undocumented and effectively private implementations). In the interests of not digging this particular hole any further, I'm suggesting we make this official. I don't know what the appropriate mechanism would be (e.g. something in IDLE's README.txt file, something at the top of each IDLE module, etc.). Based on some suggestions on idle-dev, I did some searching to find out what impact this might have. As expected, most uses import the whole thing, either documenting how to run IDLE, or launching it as an external editor. This is done as both import idlelib but also as import idlelib.idle Turtledemo appears to be the only thing in stdlib that imports a piece of idlelib. From nullege.com, one reference to a now-defunct wiki/collaboration tool called Springnote. From programcreek.com, nothing significant. Multiple applications do import PyShell as a way of starting a Python shell in their application. Usually they do just call PyShell.main(). Sometimes though they do reach inside in fairly significant ways that might break if the code were substantially changed. For example, search for PyShell in http://igraph.org/python/doc/igraph.app.shell-pysrc.html I could locate no other significant uses based on Google search, etc. The one exception I would therefore suggest to the no importing submodules would be importing PyShell to open up a Python shell window. I'd go further to suggest that the existing PyShell be called something else, and a new PyShell wrapper be created which documents an official API (with therefore very limited mucking inside), and then delegates to an actual implementation. -- components: IDLE messages: 248540 nosy: Al.Sweigart, kbk, markroseman, roger.serwy, terry.reedy priority: normal severity: normal status: open title: deprecate importing components of IDLE type: enhancement versions: Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24861 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24860] handling of IDLE 'open module' errors
New submission from Mark Roseman: In EditorWindow.open_module... once switch to querydialog, display errors (e.g. module not found) in askstring dialog itself, not open up subsequent 'showerror' dialog -- components: IDLE messages: 248539 nosy: kbk, markroseman, roger.serwy, terry.reedy priority: normal severity: normal status: open title: handling of IDLE 'open module' errors type: enhancement versions: Python 2.7, Python 3.5, Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24860 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24860] handling of IDLE 'open module' errors
Terry J. Reedy added the comment: Where is querydialog? (It looks like something than should be in tkinter ;-). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24860 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue21167] float('nan') returns 0.0 on Python compiled with icc
Larry Hastings added the comment: Assuming that ICC_NAN_STRICT is only on for Intel icc: yes, please. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21167 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Serhiy Storchaka added the comment: Thanks Laura. Looks as binary _tkinter is out of sync with the library and tests. Failing tests were added in issue15133 together with related changes in Python library (added BooleanVar.set and other changes) and _tkinter (changed getboolean()). If Debian version includes 117f45749359, getboolean() always should return boolean. Otherwise failing tests shouldn't exist. -- nosy: +doko ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24492] using custom objects as modules: AttributeErrors new in 3.5
Larry Hastings added the comment: Yep. This time I have foisted nearly all the work, including the forward-merging, onto y'all. *sits back, sips iced coffee* -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24492 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Laura Creighton added the comment: So this is a debian packaging issue we need to tell the debian package maintainers about? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24862] subprocess.Popen behaves incorrect when moved in process tree
New submission from Andre Merzky: - create a class which is a subclass of multiprocessing.Process ('A') - in its __init__ create new thread ('B') and share a queue with it - in A's run() method, run 'C=subprocess.Popen(args=/bin/false)' - push 'C' though the queue to 'B' - call 'C.pull()' -- returns 0 Apart from returning 0, the pull will also return immediately, even if the task is long running. The task does not die -- 'ps' shows it is well alive. I assume that the underlying reason is that 'C' is moved sideways in the process tree, and the wait is happening in a thread which is not the parent of C. I assume (or rather guess, really) that the system level waitpid call raises a 'ECHILD' (see wait(2)), but maybe that is misinterpreted as 'process gone'? I append a test script which shows different combinations of process spawner and watcher classes. All of them should report an exit code of '1' (as all run /bin/false), or should raise an error. None should report an exit code of 0 -- but some do. PS.: I implore you not to argue if the above setup makes sense -- it probably does not. However, it took significant work to condense a real problem into that small excerpt, and it is not a full representation of our application stack. I am not interested in discussing alternative approaches: we have those, and I can live with the error not being fixed. #!/usr/bin/env python from subprocess import Popen from threading import Thread as T from multiprocessing import Process as P import multiprocessing as mp class A(P): def __init__(self): P.__init__(self) self.q = mp.Queue() def b(q): C = q.get() exit_code = C.poll() print exit code: %s % exit_code B = T(target = b, args=[self.q]) B.start () def run(self): C = Popen(args = '/bin/false') self.q.put(C) a = A() a.start() a.join() -- components: Library (Lib) files: test_mp.py messages: 248553 nosy: Andre Merzky priority: normal severity: normal status: open title: subprocess.Popen behaves incorrect when moved in process tree type: behavior versions: Python 2.7 Added file: http://bugs.python.org/file40177/test_mp.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24862 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24860] handling of IDLE 'open module' errors
Mark Roseman added the comment: Work in progress, have a few more tweaks to make, but here's a snapshot... -- Added file: http://bugs.python.org/file40176/querydialog.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24860 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24854] Null check handle return by new_string()
Roundup Robot added the comment: New changeset 208d6d14c2a3 by Benjamin Peterson in branch '2.7': add missing NULL checks to get_coding_spec (closes #24854) https://hg.python.org/cpython/rev/208d6d14c2a3 -- nosy: +python-dev resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24854 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Serhiy Storchaka added the comment: Yes, this looks as packaging issue. Added Matthias Klose, the Debian package maintainer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24859] ctypes.Structure bit order is reversed - counts from right
Martin Panter added the comment: It would be helpful if you could trim down your example code a bit. Without studying the whole file, it is hard to see exactly what order you are seeing and what order you expect, since there are two versions with different orders in the code. My understanding of the “ctypes” module is that it is for interacting with the local OS, ABI, compiler, etc, which could use various layouts depending on the platform. According to the Linux x86-64 ABI http:/www.x86-64.org/documentation/abi.pdf, page 14, “bit-fields are allocated from right to left”, which I interpret to mean from least-significant to most-significant bit. Not so sure about Windows, but https://msdn.microsoft.com/en-us/library/yszfawxh.aspx suggests a similar story (LSB first). This behaviour agrees with my experiments on Linux and Wine: class Bitfield(Structure): ... _fields_ = ((a, c_uint8, 4), (b, c_uint8, 4)) ... bytes(Bitfield(0xA, 0xB)) b'\xba' Does this agree with what you expect? Otherwise, what leads you to expect something different? Also: * bytes(saej1939_message_id) should copy the bytes directly; no need for a union. * struct.unpack() should also accept a “ctypes” object directly; no need for the copy. -- nosy: +martin.panter ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24859 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24858] python3 -m test -ugui -v test_tk gives 3 failures under Debian unstable (sid)
Laura Creighton added the comment: Python 3.4.3+ (default, Jul 28 2015, 13:17:50) [GCC 4.9.3] on linux Type help, copyright, credits or license for more information. import tkinter tcl = tkinter.Tcl() tcl.getboolean(42) 42 tkinter.BooleanVar.set function BooleanVar.set at 0x7f15b780bea0 print (tkinter) module 'tkinter' from '/usr/lib/python3.4/tkinter/__init__.py' import _tkinter print(_tkinter) module '_tkinter' from '/usr/lib/python3.4/lib-dynload_tkinter.cpython-34m-x86_64-linux-gnu.so' I have the libpython3.4-testsuite installed lac@fido:~$ apt-cache policy libpython3.4-testsuite libpython3.4-testsuite: Installed: 3.4.3-8 Candidate: 3.4.3-8 Version table: *** 3.4.3-8 0 500 http://ftp.se.debian.org/debian/ unstable/main amd64 Packages 500 http://ftp.debian.org/debian/ unstable/main amd64 Packages 100 /var/lib/dpkg/status I am getting these same errors on multiple machines. As far as I know every one of them gets their packages from the same place, ftp.se.debian.org -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24858 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24851] infinite loop in faulthandler._stack_overflow
Paul Murphy added the comment: Somehow, you need to preserve access to the stack memory. The generated code is still growing the stack, it just fails to touch any of it. I'm guessing a volatile access would just add an extra non-stack access to the infinite loop. Initially, I had tried creating a non-inlined function to touch the stack memory. It worked in this case, but still required some undesirable compiler specific assistance. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24851 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24851] infinite loop in faulthandler._stack_overflow
Antoine Pitrou added the comment: Initially, I had tried creating a non-inlined function to touch the stack memory. It worked in this case, but still required some undesirable compiler specific assistance. Hmm... store the non-inlined function's pointer in a volatile global, and call that pointer? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24851 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue24847] Can't import tkinter in Python 3.5.0rc1
Steve Dower added the comment: No, any machine with Visual Studio installed is unaffected by this. That buildbot seems to have a previous failed/aborted build that still has some files locked. A reboot is the easiest solution, but going through and killing any extra processes is what's needed there. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24847 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com