[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable
Ethan Furman added the comment: For the curious, here are all the tracebacks: -- json.dumps(a) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.3/json/__init__.py, line 236, in dumps return _default_encoder.encode(obj) File /usr/lib/python3.3/json/encoder.py, line 191, in encode chunks = self.iterencode(o, _one_shot=True) File /usr/lib/python3.3/json/encoder.py, line 249, in iterencode return _iterencode(o, 0) File /usr/lib/python3.3/json/encoder.py, line 173, in default raise TypeError(repr(o) + is not JSON serializable) TypeError: array([ True, True, True, True, False, False], dtype=bool) is not JSON serializable -- json.dumps(a[0]) Traceback (most recent call last): File stdin, line 1, in module File /usr/lib/python3.3/json/__init__.py, line 236, in dumps return _default_encoder.encode(obj) File /usr/lib/python3.3/json/encoder.py, line 191, in encode chunks = self.iterencode(o, _one_shot=True) File /usr/lib/python3.3/json/encoder.py, line 249, in iterencode return _iterencode(o, 0) File /usr/lib/python3.3/json/encoder.py, line 173, in default raise TypeError(repr(o) + is not JSON serializable) TypeError: True is not JSON serializable While the repr says 'True', the type is class 'numpy.bool_'. and the success: -- json.dumps(a.tolist()) #this works! '[true, true, true, true, false, false]' Summary === No bug here, defined behavior. Raising the issue with NumPy won't help as this is not a bug... although perhaps they have a json handler already written somewhere? At any rate, yes, said handler would have to be specified as the 'default' parameter. -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18303 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18305] [patch] Fast sum() for non-numbers
New submission from Sergey: Problem === Code: sum([[1,2,3]]*100, []) takes forever to complete. Suggestion == Patch sum() function so that it did not created 100 copies of result, but created just one. Attached patch does that. Before patch: $ ./python -mtimeit --setup=x=[[1,2,3]]*1 sum(x,[]) 10 loops, best of 3: 915 msec per loop After patch: $ ./python -mtimeit --setup=x=[[1,2,3]]*1 sum(x,[]) 1000 loops, best of 3: 469 usec per loop 20% boost! :) Details === Built-in sum function could look like this: def sum(seq, start = 0): for item in seq: start += item return start But that would be bad, becaust in cases like: empty = [] result = sum(list_of_lists, empty) content of empty would be modified. So instead it looks like this: def sum(seq, start = 0): for item in seq: start = start + item return start it creates a copy of the entire partial result on EVERY start + item. While instead it could look like this: def sum(seq, start = 0): start = start + seq[0:1] for item in seq[1:]: start += item return start create just ONE copy, and use it. That's what attached patch is doing. An alternative is something like this: def sum(seq, start = 0): start = copy.copy(start) for item in seq: start += item return start But I'm not sure how to make a copy of arbitrary object yet. -- components: Interpreter Core files: fastsum.patch keywords: patch messages: 191896 nosy: Sergey priority: normal severity: normal status: open title: [patch] Fast sum() for non-numbers type: performance versions: Python 2.7 Added file: http://bugs.python.org/file30705/fastsum.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18305 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18298] pythonw.exe fails with redirected stderr
anatoly techtonik added the comment: I am not using pythonw.exe, it is the option users prefer to run the program. pythonw.exe is a binary, how do you propose to patch that? Or is it translated to .exe with RPython? Can you be more specific what shell does not work correctly, what exactly does not work correctly, and what is the backward-incompatible behaviour that you want to avoid? pythonw.exe is meant to suppresses the terminal window on startup (console window to be exact), but not to kill vital streams for an application. I posted links Spyder IDE source to show how it should be done. -- resolution: wont fix - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18298] pythonw.exe fails with redirected stderr
Amaury Forgeot d'Arc added the comment: RPython... let's be serious. The code of pythonw.exe is very simple, see PC/WinMain.c. No, pythonw.exe is not meant to suppresses the terminal window on startup. This is only a consequence of being a windows application. There is a lot of documentation about this, for example: http://comsci.liu.edu/~murali/win32gui/Win32Apps.htm - python.exe is a regular console application, with a main() function. - pythonw.exe is a gui application, with a WinMain() function; as a consequence, stdout/stderr won't work properly. Again, it's a won't fix for 2.7, unless someone comes with a patch. But this has already been tried, and be careful, different versions of the msvcrt differ in behavior here. -- resolution: - wont fix status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18298 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
New submission from John Jefferies: If os.stat is executed on a Windows junction with Python 3.3 I see an exception: import os os.stat('C:\Windows\System32\config\systemprofile\SendTo') Traceback (most recent call last): File stdin, line 1, in module FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Windows\\System32\\config\\systemprofile\\SendTo' whereas with Python 3.2 it works without error: import os os.stat('C:\Windows\System32\config\systemprofile\SendTo') nt.stat_result(st_mode=16895, st_ino=281474977136630, st_dev=0, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1295885671, st_mtime=1295885671, st_ctime=1295885671) FTR. Some background: It's a pity that Python doesn't just treat Windows junctions as a normal soft link. But given that islink() returns False for a junction, I was able to work around that in Python 3.2 like this: if os.path.islink(fullname) or \ os.stat(fullname)[stat.ST_INO] != os.lstat(fullname)[stat.ST_INO]: # If it's not a link, it's probably a junction... Many thanks for looking. John -- components: Library (Lib) messages: 191899 nosy: John.Jefferies priority: normal severity: normal status: open title: os.stat gives exception for Windows junctions in v3.3 type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18295] Possible integer overflow in PyCode_New()
Martin v. Löwis added the comment: I don't think they are actually the *same* issue. For the limitations wrt. code objects (maximum size of byte code, maximum number of local variables, maximum number of parameters, etc.), I recommend the following thorough procedure: 1. document in a single text file all the limitations 2. check for each one whether an int is sufficient to represent them at runtime. 3. if yes: leave all structure definitions as-is. Local variables might be changed to size_t where this simplifies the code. Otherwise, Py_SAFE_DOWNCAST should be used where the actual value ought to be valid already. Runtime errors where a value may come from the outside that might be out of range. 4. if not: widen the structures to Py_ssize_t. -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18295 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue706263] print in pythonw raises silent exception when no console available
anatoly techtonik added the comment: This is still an issue for Python 2 users. Most important that pythonw.exe has a magic ability to fail silently leaving users with no means to create valid bug reports (the reason why StackOverflow questions are downvoted and erased). http://bugs.ascend4.org/print_bug_page.php?bug_id=471 stream https://code.google.com/p/spyderlib/issues/detail?id=1260 The argument in msg15198 is somewhat misleading. If pythonw.exe fails because of print statement or because other issue, there is no way to report that. Anyway, this reminds me very much of mod_wsgi, with only problem that Python developers don't receive as much feedback as Graham to make the change: http://blog.dscpl.com.au/2009/04/wsgi-and-printing-to-standard-output.html -- nosy: +techtonik title: print raises exception when no console available - print in pythonw raises silent exception when no console available ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue706263 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5845] rlcompleter should be enabled automatically
Changes by anatoly techtonik techto...@gmail.com: -- nosy: +techtonik ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5845 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue706263] print in pythonw raises silent exception when no console available
Christian Heimes added the comment: I recommend against changing the code so late in the Python 2.7 release cycle. A change in behavior is too confusing. And it's not a bug but a design decision, too. Over five years ago I implement parts of the IO interaction with the operating system for Python 3.0. I deliberately did NOT port modifications to 2.6. If you want to get Python 3.x style print() behavior in Python 2.7 you can have it already: from __future__ import print_function import sys if sys.executable.endswith(pythonw.exe): sys.stdout = sys.stdout = None print(can handle sys.stdout = None just fine.) -- nosy: +christian.heimes resolution: - wont fix stage: - committed/rejected status: open - pending type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue706263 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
Christian Heimes added the comment: Let's have a look -- assignee: - christian.heimes keywords: +3.3regression nosy: +christian.heimes stage: - test needed versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18305] [patch] Fast sum() for non-numbers
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18305 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
Christian Heimes added the comment: On my Windows box (Win 7) I'm getting an error with Python 3.2 and 3.3. It looks like I'm not allowed to enter the parent directory (Zugriff verweigert == Permission Denied): os.stat(r'C:\Windows\System32\config') Traceback (most recent call last): File stdin, line 1, in module WindowsError: [Error 5] Zugriff verweigert: 'C:\\Windows\\System32\\config' In order to reproduce your problem anyway I have created a directory, a junction point and a symlink (as admin): mkdir testdir mklink /j testjunktion testdir mklink /d testlinkk testdir Neither os.stat() nor os.lstat() have failed with an exception. There must be something different going on on your system. By the way junction points are soft links but not symbolic links. They are implemented as a different kind of NTFS reparsing points. Python should not treat a junction point as a link but have yet another check for it. os.lstat(r'c:\users\heimes\testdir') nt.stat_result(st_mode=16895, st_ino=58265320179130300, st_dev=3366304641, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1372247959, st_mtime=1372247959, st_ctime=1372247959) os.lstat(r'c:\users\heimes\testjunction') nt.stat_result(st_mode=16895, st_ino=4785074604141776, st_dev=3366304641, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1372247983, st_mtime=1372247983, st_ctime=1372247983) os.lstat(r'c:\users\heimes\testlink') nt.stat_result(st_mode=41471, st_ino=12384898975270541, st_dev=3366304641, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1372249830, st_mtime=1372249830, st_ctime=1372249830) PS: You should use raw strings on Windows or escape the backslashes. -- assignee: christian.heimes - nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
Christian Heimes added the comment: There is much confusing about junction point on the internet. Some sites like Wikipedia claim that a junction point is a kind of soft link. Other sites refer to junction points as directory hard links. IMO directory hard links is wrong. Contrary to file hard links a junction point doesn't keep the target directory alive when the target is removed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18289] python.org Interactive interpreter linked with libedit can segfault on future OS X
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18289 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
John Jefferies added the comment: On 26/06/2013 13:38, Christian Heimes wrote: Christian Heimes added the comment: On my Windows box (Win 7) I'm getting an error with Python 3.2 and 3.3. It looks like I'm not allowed to enter the parent directory (Zugriff verweigert == Permission Denied): Ah. You need to be an administrator to look at the system directories? [I'm also on Win7]. Neither os.stat() nor os.lstat() have failed with an exception. There must be something different going on on your system. I didn't look closely enough; only the junctions in system folders are failing for me with an exception. The junctions in my user directory are not. I do hope I haven't wasted too much of your time in not describing the problem correctly. By the way junction points are soft links but not symbolic links. They are implemented as a different kind of NTFS reparsing points. Python should not treat a junction point as a link but have yet another check for it. I realise there are differences between junctions and symlinks at the ntfs level, but the only things that seem relevant to the application are that junctions are limited to directories on a local volume. So I consider junctions to be a subset of symlinks. Regardless, any reliable indication that a directory is a junction would be useful, and the hack I've been using thus far appeared to work for all the junctions on my system. PS: You should use raw strings on Windows or escape the backslashes. Yes, I'm ashamed, I did know that but missed it from the example. Many thanks. John -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18307] Relative path in co_filename for zipped modules
New submission from Vitaly Murashev: Recently I found out that it not possible to debug python code if it is a part of zip-module. Python version being used is 3.3.0 Well known GUI debuggers like Eclipse+PyDev or PyCharm are unable to start debugging and give the following warning: --- pydev debugger: CRITICAL WARNING: This version of python seems to be incorrectly compiled (internal generated filenames are not absolute) pydev debugger: The debugger may still function, but it will work slower and may miss breakpoints. --- So I started my own investigation of this issue and results are the following. At first I took traditional python debugger 'pdb' to analyze how it behaves during debug of zipped module. 'pdb' showed me some backtaces and filename part for stack entries looks malformed. I expected something like 'full-path-to-zip-dir/my_zipped_module.zip/subdir/test_module.py' but realy it looks like 'full-path-to-current-dir/subdir/test_module.py' Source code in pdb.py and bdb.py (which one are a part of python stdlib) gave me the answer why it happens. The root cause are inside Bdb.format_stack_entry() + Bdb.canonic() Please take a look at the following line inside 'format_stack_entry' method: filename = self.canonic(frame.f_code.co_filename) For zipped module variable 'frame.f_code.co_filename' holds _relative_ file path started from the root of zip archive like 'subdir/test_module.py' And as relult Bdb.canonic() method gives what we have - 'full-path-to-current-dir/subdir/test_module.py' --- Looks like it is a bug in: - in python core subsystem which one is responsible for loading zipped modules - or in pdb debugger -- components: Interpreter Core, Library (Lib) messages: 191907 nosy: vmurashev priority: normal severity: normal status: open title: Relative path in co_filename for zipped modules type: behavior versions: Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18307 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18308] checkRecvmsgAddress wrong in test_socket.py (AIX failures)
New submission from David Edelsohn: The recvmsg tests in test_socket.py check that the address returned by recvmsg matches the original address to which the socket was bound. For IPv6, sockaddr includes sin6_scope_id, in addition to the address and port. The test connects to host ::1, which is loopback, but is an under-specified address because the link scope is left ambiguous. The scope_id in the original bind call defaults to 0, which represents an ambiguous scoped address and allows the IPV6 protocol and implementation to choose the interface or site identifier. The recvmsg call returns the actual scope_id. The test incorrectly checks that the full sockaddr matches. sin6_scope_id may not match for IPv6 addresses. This generates bogus failures on AIX. (Microsoft has a good description about scope_id: http://msdn.microsoft.com/en-us/library/windows/desktop/ms739166%28v=vs.85%29.aspx) -- components: Tests messages: 191908 nosy: David.Edelsohn priority: normal severity: normal status: open title: checkRecvmsgAddress wrong in test_socket.py (AIX failures) type: behavior versions: Python 3.3, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18309] Make python slightly more relocatable
New submission from Mathias Fröhlich: Hi all, I want to move python a bit closer to be relocatable. One problem to solve is where python finds its modules. The usual lookup mechanism is to compile in a configure time determined prefix that is used as a last resort path if the paths are not set otherwise during application/interpreter startup. The most commonly known way to change the module path at startup time are probably the environment variables PYTHONPATH and PYTHONHOME. The python interpreter itself already tries to interpret argv[0] to get to this point, but it would be nice if an application embedded interpreter also finds its module path without providing this argv[0] directly to the python library. This should even work if being moved or being installed at a different path than the configure time prefix path. The proposal is to add an additional attempt to find the python modules just before we resort to the compiled in prefix by looking at the path to the python27.{so,dll}. Relative to this shared object python library file the python modules are searched in the usual way. If there are no python modules found relative to the python library file, the very last resort compiled in prefix is used as usual. For architectures where we cannot determine the path of the shared library file, nothing changes. I have attached a patch that tries to implement this. It should serve as a base for discussions. This change is tested on linux and behaves like expected. The windows code for this is copied over from an other project where I have this actively running. But this python code variant is not even compile tested on windows. thanks in advance Mathias -- components: Installation files: python-relative-path-lookup.diff keywords: patch messages: 191909 nosy: mathias priority: normal severity: normal status: open title: Make python slightly more relocatable versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4, Python 3.5 Added file: http://bugs.python.org/file30706/python-relative-path-lookup.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
Roundup Robot added the comment: New changeset 520490c4c388 by R David Murray in branch 'default': #11454: Reduce email module load time, improve surrogate check efficiency. http://hg.python.org/cpython/rev/520490c4c388 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11454] email.message import time
R. David Murray added the comment: I've checked in the encode version of the method. I'm going to pass on doing the other inlines, given that the improvement isn't that large. I will, however, keep the issue in mind as I make other changes to the code, and there will be a general performance review phase when I get done with the API additions/bug fixing in the email6 project. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11454 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18307] Relative path in co_filename for zipped modules
Changes by Christian Heimes li...@cheimes.de: -- nosy: +brett.cannon, christian.heimes stage: - test needed versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18307 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18310] itertools.tee() can't accept keyword arguments
New submission from py.user: import itertools itertools.tee('x', n=2) Traceback (most recent call last): File stdin, line 1, in module TypeError: tee() takes no keyword arguments -- components: Library (Lib) messages: 191912 nosy: py.user priority: normal severity: normal status: open title: itertools.tee() can't accept keyword arguments type: behavior versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18311] Typo in SSL documentation
New submission from mp: Under http://docs.python.org/3.4/library/ssl.html#ssl.SSLContext.set_npn_protocols avertise should be advertise. This is in documentation for both 3.4 and 3.3 -- assignee: docs@python components: Documentation messages: 191913 nosy: docs@python, pfista priority: normal severity: normal status: open title: Typo in SSL documentation versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18242] IDLE should not be replacing warnings.formatwarning
Changes by Terry J. Reedy tjre...@udel.edu: -- assignee: - terry.reedy versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18311] Typo in SSL documentation
Roundup Robot added the comment: New changeset d7ae8a84f443 by R David Murray in branch '3.3': #18311: fix typo. http://hg.python.org/cpython/rev/d7ae8a84f443 New changeset 16fe29689f3f by R David Murray in branch 'default': Merge #18311: fix typo. http://hg.python.org/cpython/rev/16fe29689f3f -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18311] Typo in SSL documentation
R. David Murray added the comment: Fixed, thanks. -- nosy: +r.david.murray resolution: - fixed stage: - committed/rejected status: open - closed type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18310] itertools.tee() can't accept keyword arguments
Christian Heimes added the comment: A bunch builtin types and functions don't accept keyword args. kwargs make code slightly more complexity and a tiny bit slower. -- assignee: - rhettinger nosy: +christian.heimes, rhettinger priority: normal - low ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue7936] sys.argv contains only scriptname
TonyP added the comment: I have v2.7, v3.2, and v3.3 installed on a Win7 64-bit machine and the exact same setup on a Win7 32-bit machine. The 32-bit works OK. The 64-bit machine had this argv problem, too! (I tried installing either Win32/Win64 version, no difference!) Adding %* fixed the argv problem, but I noticed there was one more. The wrong version was called. To sum it up, I had to change only the key HKEY_CLASSES_ROOT/py_auto_file/shell/open/command from: c:\Python32\Python32.exe %1 %* to: c:\Python33\Python33.exe %1 %* or to: c:\windows\py.exe %1 %* (for auto-detection, both worked) -- nosy: +tonypdmtr ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue7936 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18081] test_logging failure in WarningsTest on buildbots
Terry J. Reedy added the comment: I should have changed the Versions sooner, as soon as it became obvious that this was not just a 3.4 issue. The 'temporary' 3.4-only patch breaks forward merging of a better patch. I will back it out just before I commit a 3.3 patch to both eliminate the .formatwarning replacement (#18242) and move the .showwarning replacement (part of Victor's patch). If we ever add tests of PyShell.main and run.main (which we should), the problem of this issue will recur unless we make *sure* that the monkey patch moved inside those functions is reverted. Will try: finally: do that? I will leave this for a second patch. -- assignee: - terry.reedy versions: +Python 2.7, Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18081 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9625] argparse: Problem with defaults for variable nargs when using choices
Changes by paul j3 ajipa...@gmail.com: -- nosy: +paul.j3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9625 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18306] os.stat gives exception for Windows junctions in v3.3
Changes by STINNER Victor victor.stin...@gmail.com: -- components: +Windows nosy: +haypo, tim.golden ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18306 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18305] [patch] Fast sum() for non-numbers
Changes by STINNER Victor victor.stin...@gmail.com: -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18305 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17206] Py_XDECREF() expands its argument multiple times
Jeremy Kloth added the comment: Here is some additional analysis of recursive functions in the 'pythoncore' MSVC project: Ratio Release Debug Filename:Function Name StackStack --- 1.000 32 32_sre.asm:_validate_inner 1.159 352 408ast.asm:set_context 1.167 48 56compile.asm:stackdepth_walk 1.188 128 152memoryobject.asm:copy_rec 1.250 160 200ast.asm:num_stmts 1.308 104 136firstsets.asm:calcfirstset 1.312 128 168posixmodule.asm:win32_xstat_impl_w 1.400 40 56node.asm:freechildren 1.667 72 120memoryobject.asm:tolist_rec 1.750 32 56listnode.asm:list1node 1.750 32 56parsermodule.asm:parser_compare_nodes 1.750 32 56parsermodule.asm:validate_factor 1.750 32 56parsermodule.asm:validate_not_test 1.750 32 56rotatingtree.asm:RotatingTree_Enum 1.750 32 56typeobject.asm:solid_base 1.786 112 200bytearrayobject.asm:bytearray_setslice 1.900 80 152compile.asm:compiler_comprehension_generator 2.143 56 120pythonrun.asm:print_exception_recursive 2.167 48 104arraymodule.asm:array_ass_slice 2.250 32 72ast.asm:validate_slice 2.250 32 72getargs.asm:skipitem 2.250 32 72node.asm:sizeofchildren 2.250 32 72parsermodule.asm:validate_test 2.250 32 72setobject.asm:set_issuperset 2.278 144 328listobject.asm:list_ass_slice 2.417 96 232arraymodule.asm:array_ass_subscr 2.429 56 136longobject.asm:PyLong_AsLongLong 2.429 56 136parsermodule.asm:node2tuple 2.429 56 136typeobject.asm:mro_subclasses 2.500 80 200bytearrayobject.asm:bytearray_ass_subscript 2.600 40 104errors.asm:PyErr_GivenExceptionMatches 2.750 32 88import.asm:update_code_filenames 2.750 32 88setobject.asm:set_richcompare 2.750 32 88symtable.asm:symtable_visit_slice 2.750 32 88typeobject.asm:PyType_Modified 2.766 512 1416marshal.asm:r_object 3.125 64 200longobject.asm:long_rshift 3.250 32 104compile.asm:compiler_with 3.250 32 104setobject.asm:set_issubset 3.250 32 104typeobject.asm:assign_version_tag 3.750 32 120abstract.asm:abstract_issubclass 3.750 32 120typeobject.asm:PyType_Ready 3.833 48 184ast.asm:ast_for_expr 4.250 32 136compile.asm:compiler_visit_expr 4.250 32 136mathmodule.asm:factorial_partial_product 4.500 80 360genobject.asm:gen_throw 4.692 312 1464symtable.asm:symtable_visit_stmt 5.250 32 168_collectionsmodule.asm:deque_extend 5.250 32 168_collectionsmodule.asm:deque_extendleft 5.250 32 168ast.asm:alias_for_import_name 5.750 32 184typeobject.asm:merge_class_dict 6.250 32 200abstract.asm:PyObject_IsInstance 6.250 32 200abstract.asm:PyObject_IsSubclass 6.250 32 200ast.asm:validate_expr 6.500 48 312Python-ast.asm:obj2ast_slice 7.182 88 632parsermodule.asm:build_node_children 7.250 32 232errors.asm:PyErr_NormalizeException 9.167 48 440symtable.asm:symtable_visit_expr 10.250 32 328_json.asm:encoder_listencode_obj 10.344 256 2648Python-ast.asm:obj2ast_expr 15.955 176 2808Python-ast.asm:obj2ast_stmt 31.750 32 1016Python-ast.asm:ast2obj_expr -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17206 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18308] checkRecvmsgAddress wrong in test_socket.py (AIX failures)
David Edelsohn added the comment: The current arguments to checkRecvmsgAddress() are the sockaddrs, so it does not know the protocol family. One potential patch to infer the family and apply the correct test is: diff -r 035d8fed07ad Lib/test/test_socket.py --- a/Lib/test/test_socket.py Tue Jun 25 22:54:35 2013 +0200 +++ b/Lib/test/test_socket.py Wed Jun 26 15:16:31 2013 -0700 @@ -1809,7 +1809,10 @@ def checkRecvmsgAddress(self, addr1, addr2): # Called to compare the received address with the address of # the peer. -self.assertEqual(addr1, addr2) +if len(addr1) 3 or len(addr2) 3: +self.assertEqual(addr1[:-1], addr2[:-1]) +else: +self.assertEqual(addr1, addr2) # Flags that are normally unset in msg_flags msg_flags_common_unset = 0 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18244] singledispatch: When virtual-inheriting ABCs at distinct points in MRO, composed MRO is dependent on haystack ordering
Guido van Rossum added the comment: Wow. This is heady stuff. I can't say I totally get every detail, so I'll just pick on some things you wrote. In particular, I'm not sure I agree that there should be a conflict when there are two applicable base classes with a different dispatch if one of them is explicit in the MRO and the other isn't. After all, it both were explicit in the MRO the first one there would be picked, right? And virtual base classes are considered to appear after explicit base classes, right? (Or not?) I do think the new approach is better (the extra code doesn't bother me), and I may be convinced yet that you made the right choice in the above case. I have some trivial review comments on your patch to, will send those via Rietveld. -- nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be specified from memory rather than files.
Kristján Valur Jónsson added the comment: Here is an updated patch. We now support file-like objects. New helper functions try to turn file arguments into either Py_buffer objects containing the read data, or PyBytesObject argument with the file system encoding of the path. A file-like object is recognized by the successful execution of a read() method call. docs and tests updated. -- Added file: http://bugs.python.org/file30707/ssl.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be specified from memory rather than files.
Christian Heimes added the comment: Thx Kristján! My patch maps PyUnicode to PEM encoded cert data and objects with Py_Buffer support to DER encoded cert data. Perhaps you like to you the same concept in your patch to support TextIO and BytesIO read() methods. Feel free to reuse as much of my patch as you like. You don't check ERR_GET_LIB() in some places. Could you please add a comment about extra_chain_cert in PySSL_CTX_use_certificate_chain_mem() and SSL_CTX_get_cert_store() in PySSL_CTX_load_verify_certs_mem()? The difference between the extra chain and the trusted store got me confused more than once. As far as I recall the trusted store is suppose to contain only trusted root CA. The extra chain is uesd to provide intermediate certs for the cert chain between a root CA and the service's cert. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16487] Allow ssl certificates to be specified from memory rather than files.
Christian Heimes added the comment: PS: I like to have DER cert support for #17134. I'd rather not convert DER to PEM. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16487 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18173] Add MixedTypeKey to reprlib
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18173 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18081] test_logging failure in WarningsTest on buildbots
Terry J. Reedy added the comment: Here is a patch that looks much bigger than it really is. Idle was written before the warnings module, so the warnings system was conditioned on a successful warnings import. The test is no longer needed, and neither Vinay nor Victor repeated the test at the new location for the warnings.showwarning patch, within PyShell.main and run.main. I just deleted the test and dedented the indented blocks, which were, except for three lines, otherwise unchanged. For run.py, I copied warnings.showwarnings and changed it to call idle_formatwarnings_subproc instead of (patched) warnings.formatwarnings. I then put the replacement of warnings.showwarnings in main after the sanity checks. For PyShell.py, I made a similar change in showwarnings and the warnings.showwarnings replacement. I also added AttributeError to the print exception. At least on Windows, warning_stream = sys.__stderr__ is None when Idle is started normally, from an icon. But otherwise changing Idle to stop expecting a writable console is another issue. -- stage: needs patch - commit review Added file: http://bugs.python.org/file30708/issue18081-warn.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18081 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18242] IDLE should not be replacing warnings.formatwarning
Terry J. Reedy added the comment: See #18103 for patch that will fix this also. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18242 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18310] itertools.tee() can't accept keyword arguments
py.user added the comment: tee() docs describe n as a keyword -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18312] make distclean deletes files under .hg directory
New submission from Eric V. Smith: See: http://mail.python.org/pipermail/python-dev/2013-June/127068.html The find command: find $(srcdir) '(' -name '*.fdc' -o -name '*~' \ -o -name '[@,#]*' -o -name '*.old' \ -o -name '*.orig' -o -name '*.rej' \ -o -name '*.bak' ')' \ -exec rm -f {} ';' will walk into .hg (and other dot directories) and delete files there. The particular problem noted in the email was a filename beginning with '@'. Some suggestions are to change it to: find \( -type d -name .hg -prune \) -o ... or find $(srcdir)/[a-zA-Z]* ... Other suggestions are included in the thread starting at the above link. These include deleting the find command, or using hg purge. I think that we have enough history of using and suggesting make distclean that we should just fix up the find command to do what it does now, but not recurse into any dot directories (.hg, .svn, .git, etc.). -- components: Build messages: 191928 nosy: eric.smith priority: normal severity: normal status: open title: make distclean deletes files under .hg directory type: behavior versions: Python 2.7, Python 3.4, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18312 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18312] make distclean deletes files under .hg directory
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18312 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18310] itertools.tee() can't accept keyword arguments
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18310 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18244] singledispatch: When virtual-inheriting ABCs at distinct points in MRO, composed MRO is dependent on haystack ordering
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18244 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18309] Make python slightly more relocatable
Eric Snow added the comment: Hi Mathias. There is a current proposal (http://www.python.org/dev/peps/pep-0432/) for improving interpreter startup. So changes in this area are subject to extra caution. The changes you are talking about are at least indirectly impacted by the proposal, though I expect they are more directly tied to what happens in site.py. As to your proposal, aren't the embedding needs already addressed? See http://docs.python.org/2/c-api/intro.html#embedding-python. Is there some convention for keeping the site files adjacent to the SO/DLL that would warrant your proposed code? p.s. this would be a new feature so it only applies to Python 3.4. -- components: +Interpreter Core -Installation nosy: +eric.snow, ncoghlan versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18309 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18313] In itertools recipes repeatfunc() defines a non-keyword argument as keyword
New submission from py.user: http://docs.python.org/3/library/itertools.html#itertools-recipes def repeatfunc(func, times=None, *args): repeatfunc(lambda x: x, times=None, 1) File stdin, line 1 SyntaxError: non-keyword arg after keyword arg repeatfunc(lambda x: x, 1, times=None) Traceback (most recent call last): File stdin, line 1, in module TypeError: repeatfunc() got multiple values for argument 'times' -- assignee: docs@python components: Documentation messages: 191930 nosy: docs@python, py.user priority: normal severity: normal status: open title: In itertools recipes repeatfunc() defines a non-keyword argument as keyword type: enhancement versions: Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18313 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18093] Move main functions to a separate Programs directory
Changes by Eric Snow ericsnowcurren...@gmail.com: -- nosy: +eric.snow ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18093 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16113] Add SHA-3 (Keccak) support
Aaron Gallagher added the comment: As long as the reference Keccak code is going to live in the python stdlib anyway, I would /greatly/ appreciate it if the Keccak sponge function was directly exposed instead of just the fixed parameters used for SHA-3. A Keccak sponge can have a much wider range of rates/capacities, and after absorption can have any number of bytes squeezed out. The ability to get an unbounded number of bytes out is very useful and I've written some code that uses that behavior. I ended up having to write my own Keccak python library since none of the other SHA-3 libraries exposed this either. -- nosy: +habnabit ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16113 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com