[issue18118] curses utf8 output broken in Python2
helmut added the comment: I suppose that screen.addstr(0, 0, uäöü.encode(utf-8)) works. It works as in the output looks as the one expected. Long lines with utf8 characters will make it break again though. screen.addstr(0, 0, äöü * 20) # assuming COLUMNS=80 Will give two rows of characters of which the first row is 40 characters long. If _cursessomething.so is already linked against libncursesw.so.5, the fix is to use waddwstr(), but such change cannot be done in a minor release like Python 2.7.6. So I'm closing this issue as wont fix = you have to move to Python 3.3. Sounds sensible. Are you aware of a workaround for this issue? I.e. is there any way to force Python2.7 to use the wide mode for outputting characters? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18118 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18116] getpass.getpass() triggers ResourceWarning
Benjamin Peterson added the comment: This code is pretty broken. I don't think ttys are ever seekable, so the os.fdopen has probably been always failing since 3.0. It thus always leaks an fd to '/dev/tty' if the first os.open succeeds. The whole function should probably be rewriten to work with byte streams encoding the prompt with os.device_encoding(tty_fd) falling back on locale.getpreferredencoding(). -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18116 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18118] curses utf8 output broken in Python2
STINNER Victor added the comment: Sounds sensible. Are you aware of a workaround for this issue? I.e. is there any way to force Python2.7 to use the wide mode for outputting characters? I don't think that it is possible to workaround this issue, it is a bug in the design of curses, related to Unicode. I suppose that libncursesw uses an array of wchar_t characters when the *_wch() and *wstr() functions are used, whereas your version looks to use an array of char* characters and so is unable to understand that a character is composed of two bytes (ex: b\xc3\xa4 for uä). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18118 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
Richard Oudkerk added the comment: On 03/06/2013 1:02am, spresse1 wrote: Whats really bugging me is that it remains open and I can't fetch a reference. If I could do either of these, I'd be happy. ... Perhaps I really want to be implementing with os.fork(). Sigh, I was trying to save myself some effort... I don't see how using os.fork() would make things any easier. In either case you need to prepare a list of fds which the child process should close before it starts, or alternatively a list of fds *not* to close. The real issue is that there is no way for multiprocessing (or os.fork()) to automatically infer which fds the child process is going to use: if don't explicitly close unneeded ones then the child process will inherit all of them. It might be helpful if multiprocessing exposed a function to close all fds except those specified -- see close_all_fds_except() at http://hg.python.org/sandbox/sbt/file/5d4397a38445/Lib/multiprocessing/popen_spawn_posix.py#l81 Remembering not to close stdout (fd=1) and stderr (fd=2), you could use it like def foo(reader): close_all_fds_except([1, 2, reader.fileno()]) ... r, w = Pipe(False) p = Process(target=foo, args=(r,)) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Armin Rigo added the comment: The bug is different, because it doesn't depend on details of the platform. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18124] Broken build on target machine with incorrect hostname (non-ascii)
Charles-François Natali added the comment: Why open this issue, since it's obviously a duplicate of #18109? -- nosy: +neologix ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18124 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18125] Out-of-tree build cannot regenerate Makefile.pre
New submission from Paul TBBle Hampson: Noticed in Python 2.7 but a quick look in the repository suggests this is also true in Python 3 releases. The Makefile rule for Makefile.pre in Makefile.pre.in is: # Build the toplevel Makefile Makefile.pre: Makefile.pre.in config.status CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status $(MAKE) -f Makefile.pre Makefile However, when built out-of-tree, Makefile.pre is in the build directory, as as config.status, but Makefile.pre.in is in the source directory. So the rule should be # Build the toplevel Makefile Makefile.pre: $(srcdir)/Makefile.pre.in config.status CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status $(MAKE) -f Makefile.pre Makefile Note that the recipe doesn't change, as config.status internally knows where Makefile.pre.in is found, so it's just the rule dependency that's wrong. This bug results in No rule to create Makefile.pre.in if Makefile.pre is somehow newer than Makefile or Modules/config.c in the build tree. -- components: Build messages: 190525 nosy: TBBle priority: normal severity: normal status: open title: Out-of-tree build cannot regenerate Makefile.pre versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18125 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Antoine Pitrou added the comment: 2.7.3 passes, 2.7 trunk fails Python 2.7.0, 2.7.2 and 2.6.8 all fail here. Dmi is right: it starts failing at 4afc50d15544. (note that Python 3 isn't affected) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18125] Out-of-tree build cannot regenerate Makefile.pre
Changes by Paul TBBle Hampson paul.hamp...@pobox.com: -- type: - compile error ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18125 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18125] Out-of-tree build cannot regenerate Makefile.pre
Paul TBBle Hampson added the comment: Forgot to mention, this is the only occurrence of a *.in file in Makefile.pre.in that isn't prefixed with $(srcdir)/ -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18125 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
Kristján Valur Jónsson added the comment: Hi. the file and line arguments are for expanding from macros such as PyMem_MALLOC. I had them added because they provide the features of a comprehensive debugging API. Of course, I'm not showing you the entire set of modifications that we have made to the memory allocation scheme. They including more extensive versions of the memory allocation tools, in order to more easily monitor memory allocations from within C. For your information, I'm uploading pymemory.h from our 2.7 patch. The extent of our modifications can be gleaned from there. Basically, we have layered the macros into outer and inner versions, in order to better support internal diagnostics. I'm happy with the api you provide, with a small addition: PyAPI_FUNC(int) Py_SetAllocators( char api, void* (*malloc) (size_t size, void *data), void* (*realloc) (void* ptr, size_t size, void *data), void (*free) (void* ptr, void *data), void *data ); The 'data' pointer is pointless unless you can provide it as part of the api. This sort of extra indirection is necessary for C callbacks to provide instance specific context to statically compiled and linked callback functions. -- Added file: http://bugs.python.org/file30451/pymem.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
Kristján Valur Jónsson added the comment: Also, our ccpmem.h, the interface to the ccpmem.cpp, internal flexible memory allocator framework. Again, just FYI. There are no trade secrets here, so please ask me for more details, if interested. One particular trick we have been using, which might be of interest, is to be able to tag each allocation with a context id. This is then set according to a global sys.memcontext variable, which the program will modify according to what it is doing. This can then be used to track memory usage by different parts of the program. -- Added file: http://bugs.python.org/file30452/ccpmem.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation
Ronald Oussoren added the comment: Linking with -framework Python is always a bad idea because you have no control over which version of Python you link with other than by changing global system state (the Current link). Also: include files aren't included using the framework conventions (e.g. we use #include Python.h, not #include Python/Python.h). I'd prefer to remove the Current link from from source installs instead adding them to the py3k installer, that makes is clearer that you are not supposed to use -framework Python. I'm also not too keen on renaming the Python framework for Python 3.4. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18117 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Dmi Baranov added the comment: My system python-2.7.3 affected too: python -c 'import sys;print(sys.version);import x' 2.7.3 (default, Aug 1 2012, 05:16:07) [GCC 4.6.3] Traceback (most recent call last): File string, line 1, in module RuntimeError: not holding the import lock $ uname -a Linux d9frog9n-desktop 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:32:50 UTC 2012 i686 i686 i386 GNU/Linux Armin, at which system/architecture you passing that case on 2.7.3? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17925] asynchat.async_chat.initiate_send : del deque[0] is not safe
Andrew Stormont added the comment: Great. Everybody's happy now, surely? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17925 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Richard Oudkerk added the comment: Forking as a side effect of importing a module is evil. I think raising a RuntimeError is preferable to trying to make it Just Work. But maybe one could do void _PyImport_ReInitLock(void) { if (import_lock != NULL) { import_lock = PyThread_allocate_lock(); PyThread_acquire_lock(import_lock, WAIT_LOCK); } import_lock_thread = PyThread_get_thread_ident(); _PyImport_ReleaseLock(); } -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
STINNER Victor added the comment: I'm happy with the api you provide, with a small addition: PyAPI_FUNC(int) Py_SetAllocators( char api, void* (*malloc) (size_t size, void *data), void* (*realloc) (void* ptr, size_t size, void *data), void (*free) (void* ptr, void *data), void *data ); Oops, I forgot void *data. Yeah, each group of allocator functions (malloc, free and realloc) will get its own data pointer. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17925] asynchat.async_chat.initiate_send : del deque[0] is not safe
Giampaolo Rodola' added the comment: patch plus self.producer_fifo.extendleft([data, first]) seems legit and I verified pyftpdlib tests pass. Last thing missing from the patch is a test case. Pierrick can you merge test_initiate_send.py into Lib/test_asynchat.py and provide a new patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17925 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation
Gavan Schneider added the comment: A lot of this is past my level but speaking from my level I just want packages to be consistent, i.e., if there is a symlink it should point to something (preferably useful) not dangle as is the case now. Also I want an installed version to look the same no matter what version it might be. Specifically the version number should only occur once in the file tree. This then allows me to specify ***at the system level*** what I want when invoking (via a Current or similar link) my postgres and other build scripts, specifically so they don't need to be hand crafted just so they build against new new and latest install. If I ever get to the stage where I am building to a specific version that's not the global selection I can do that by taking proper steps (but that's not what I usually want to do after installing a new version). Continuing in the vein of one only mention of the version number in the package tree: why is there a python3.3 folder inside .../Pyton.framework/Versions/3.3/lib? Won't lib/Python3.4 stuff get put in its own Version? As for the reluctance to rename the package for 3.4. Wont it be Python3 and the rename could just as logically be done for the current release: /Library/Frameworks/ Python.framework/... # all the Pyton 2 stuff Python3.famework Versions 3.3/... 3.4/... Current - 3.4 ... Finally there seems to be a convention with all the other installed packages for a Current symlink (note especially Tcl/Tk) to do something useful within their respective Versions folder. Is it too much to suggest that Python just follow this convention (albeit with the package name changed to pyton3 to prevent potential conflicts)? Anyway, please excuse my drifting so far from a simple report of a broken and/or missing installer link :) Regards Gavan Schneider -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18117 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18117] Missing symlink:Current after Mac OS X 3.3.2 package installation
Ronald Oussoren added the comment: There is a python3.3 in .../Python.framework/Versions/3.3/lib because .../Python.framework/Versions/3.3 is basicly a regular unix install with some trivial changes (in particular, there is a Python shared library in the root of the tree, there is a Python.app and bin/python isn't the real interpreter but a stub). Keeping the framework close to a regular unix install is an explicit design choice, it minimizes the difference from those unix installs and reduces the amount of needless incompatibilities (for example with scripts that run on unix-like systems and assume a particular layout of sys.prefix) I try to avoid relying on the Current symlink because it depends on the order in which packages are installed, for example when you have two version of Python installed and update one of them the Current link may change even if you might not want to. Futhermore the Current link can only be changed by users with elevated privileges (an admin account or root). Again, I don't think renaming the framework for Python 3 would be useful and even if it were done it could only be done for Python 3.4 al existing releases of Py3k would still use Python.framework because changing the framework name will break existing installations when installing an update with a changed framework name. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18117 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Thomas Wouters added the comment: For the record, Raymond, I think you're wrong about this. Itertools isn't always a solution to every problem, and it makes for a very awkward way around a silly limitation in min() and max(). Their API is already awkward -- because they already take a keyword argument as well as *args or an iterable -- and this does not make it worse in any way. It's trivial to add this, it's trivial to explain -- return a specific value instead of raising a particular exception -- and it's wasteful, complex, fragile or unreadable (except if you have itertools on the mind, I guess) to do the same thing in another way. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue3329] API for setting the memory allocator used by Python
STINNER Victor added the comment: New patch (version 2), more complete: * add void *data argument to all allocator functions * add block API used for pymalloc allocator to allocate arenas. Use mmap or malloc, but may use VirtualAlloc in a near future (see #13483). Callbacks prototype: - void block_malloc (size_t, void*); - void block_free (void*, size_t, void*); * remove PY_ALLOC_SYSTEM_API Main API: --- #define PY_ALLOC_MEM_API 'm' /* PyMem_Malloc() API */ #define PY_ALLOC_OBJECT_API 'o' /* PyObject_Malloc() API */ PyAPI_FUNC(int) Py_GetAllocators( char api, void* (**malloc_p) (size_t size, void *user_data), void* (**realloc_p) (void *ptr, size_t size, void *user_data), void (**free_p) (void *ptr, void *user_data), void **user_data_p ); PyAPI_FUNC(int) Py_SetAllocators( char api, void* (*malloc) (size_t size, void *user_data), void* (*realloc) (void *ptr, size_t size, void *user_data), void (*free) (void *ptr, void *user_data), void *user_data ); PyAPI_FUNC(void) Py_GetBlockAllocators( void* (**malloc_p) (size_t size, void *user_data), void (**free_p) (void *ptr, size_t size, void *user_data), void **user_data_p ); PyAPI_FUNC(int) Py_SetBlockAllocators( void* (*malloc) (size_t size, void *user_data), void (*free) (void *ptr, size_t size, void *user_data), void *user_data ); --- I see the following use cases using allocators: * Don't use malloc nor mmap but your own allocator: replace PyMem and PyObject allocators * Track memory leaks (my pytracemalloc project, or Antoine's simple _Py_AllocatedBlocks counter): hook PyMem and PyObject allocators * Fill newly allocated memory with a pattern and check for buffer underflow and overflow: hook PyMem and PyObject allocators Hook means adding extra code before and/or after calling the original function. The final API should allow to hook the APIS multiple times and replacing allocators. So it should be possible to track memory leaks, detect buffer overflow and our your own allocators. It is not yet possible with the patch 2, because _PyMem_DebugMalloc() calls directly malloc(). _PyMem_DebugMalloc is no more used by PyObject_Malloc. This code should be rewritten to use the hook approach instead of replacing memory allocators. Example tracing PyMem calls using the hook approach: --- typedef struct { void* (*malloc) (size_t, void*); void* (*realloc) (void*, size_t, void*); void (*free) (void*, void*); void *data; } allocators_t; allocators_t pymem, pyobject; void* trace_malloc (size_t size, void* data) { allocators_t *alloc = (allocators_t *)data; printf(malloc(%z)\n, size); return alloc.malloc(size, alloc.data); } void* trace_realloc (void* ptr, size_t size, void* data) { allocators_t *alloc = (allocators_t *)data; printf(realloc(%p, %z)\n, ptr, size); return alloc.realloc(ptr, size, alloc.data); } void trace_free (void* ptr, void* data) { allocators_t *alloc = (allocators_t *)data; printf(free(%p)\n, ptr); alloc.free(ptr, alloc.data); } void hook_pymem(void) { Py_GetAllocators(PY_ALLOC_MEM_API, pymem.malloc, pymem.realloc, pymem.free, pymem.data); Py_SetAllocators(PY_ALLOC_MEM_API, trace_malloc, trace_realloc, trace_free, pymem); Py_GetAllocators(PY_ALLOC_OBJECT_API, pyobject.malloc, pyobject.realloc, pyobject.free, pyobject.data); Py_SetAllocators(PY_ALLOC_OBJECT_API, trace_malloc, trace_realloc, trace_free, pyobject); } --- I didn't try the example :-p It is just to give you an idea of the API and how to use it. -- Added file: http://bugs.python.org/file30453/py_setallocators-2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue3329 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
Dmi Baranov added the comment: There is patch. Test is non-LGTM, because having a side effect for hostname and requires root's permissions for manipulations with hostname[*]. Someone having ideas how I can mock system `uname` call? [*] But this way is OK for Lib/test/test_sockets.py. I'm overheading here? (-: -- keywords: +patch Added file: http://bugs.python.org/file30454/issue18109.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18124] Broken build on target machine with incorrect hostname (non-ascii)
Dmi Baranov added the comment: Just a another behavior. My mistake, sorry. -- resolution: - duplicate status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18124 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Nick Coghlan added the comment: +1 for adding this. It's simple to implement, simple to explain and the alternatives for dealing with the empty iterable case (or even the fact it may need to be handled at all) are definitely not obvious. The relationship to next() is straightforward: the supplied value is effectively used as the default value for the first next call when iterating and then ignored thereafter. -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18045] get_python_version is not import in bdist_rpm.py
Changes by Nick Coghlan ncogh...@gmail.com: -- nosy: +ncoghlan ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18045 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18126] Update links to NumPy resources in documentation
New submission from Yury V. Zaytsev: Hi, The links to NumPy sites and documentation are outdated. I replaced them with www.numpy.org, and also the canonical location for documentation (docs.scipy.org). I removed the explicit mention of the PDF file, because the documentation has been split in several guides, so I think it no longer makes sense, and it's better to link docs.scipy.org instead. Thanks! -- assignee: docs@python components: Documentation files: doc-numpy.patch keywords: patch messages: 190543 nosy: docs@python, eric.araujo, ezio.melotti, georg.brandl, zaytsev priority: normal severity: normal status: open title: Update links to NumPy resources in documentation type: enhancement Added file: http://bugs.python.org/file30455/doc-numpy.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18126 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
spresse1 added the comment: I don't see how using os.fork() would make things any easier. In either case you need to prepare a list of fds which the child process should close before it starts, or alternatively a list of fds *not* to close. With fork() I control where the processes diverge much more readily. I could create the pipe in the main process, fork, close unnecessary fds, then call into the class that represents the operation of the subprocess. (ie: do it the c way). This way the class never needs to know about pipes it doesnt care about and I can ensure that unnecessary pipes get closed. So I get the clean, understandable semantics I was after and my pipes get closed. The only thing I lose is windows interoperability. I could reimplement the close_all_fds_except() call (in straight python, using os.closerange()). That seems like a reasonable solution, if a bit of a hack. However, given that pipes are exposed by multiprocessing, it might make sense to try to get this function incorperated into the main version of it? I also think that with introspection it would be possible for the subprocessing module to be aware of which file descriptors are still actively referenced. (ie: 0,1,2 always referenced, introspect through objects in the child to see if they have the file.fileno() method) However, I can't state this as a certainty without going off and actually implementing such a version. Additionally, I can make absolutely no promises as to the speed of this. Perhaps, if it functioned, it would be an option one could turn on for cases like mine. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Ned Batchelder added the comment: I find the workarounds mentioned here to be baroque and confusing. The concept of a default value to return in the case of an empty iterator is straightforward. I'm +1 on adding this as well. -- nosy: +nedbat ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
Richard Oudkerk added the comment: On 03/06/2013 3:07pm, spresse1 wrote: I could reimplement the close_all_fds_except() call (in straight python, using os.closerange()). That seems like a reasonable solution, if a bit of a hack. However, given that pipes are exposed by multiprocessing, it might make sense to try to get this function incorperated into the main version of it? close_all_fds_except() is already pure python: try: MAXFD = os.sysconf(SC_OPEN_MAX) except: MAXFD = 256 def close_all_fds_except(fds): fds = list(fds) + [-1, MAXFD] fds.sort() for i in range(len(fds) - 1): os.closerange(fds[i]+1, fds[i+1]) I also think that with introspection it would be possible for the subprocessing module to be aware of which file descriptors are still actively referenced. (ie: 0,1,2 always referenced, introspect through objects in the child to see if they have the file.fileno() method) However, I can't state this as a certainty without going off and actually implementing such a version. Additionally, I can make absolutely no promises as to the speed of this. Perhaps, if it functioned, it would be an option one could turn on for cases like mine. So you want a way to visit all objects directly or indirectly referenced by the process object, so you can check whether they have a fileno() method? At the C level all object types which support GC define a tp_traverse function, so maybe that could be made available from pure Python. But really, this sounds rather fragile. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
spresse1 added the comment: Oooh, thanks. I'll use that. But really, this sounds rather fragile. Absolutely. I concur there is no good way to do this. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Doug Hellmann added the comment: +1 on adding this I found today via @dabeaz's cookbook that iter() has a sentinel-detection use case. Having one in min/max seems *far* more obviously useful. It's also consistent with quite a few methods on builtin types where we provide a way to deal with unknown data safely by having a default instead of catching exceptions directly. -- nosy: +doughellmann ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18122] RuntimeError: not holding the import lock
Armin Rigo added the comment: Indeed, no clue: it seems I don't get the error only on my system-installed 2.7.3 on Linux 32. I do get it on any other Python I tried, like 2.6.x, or the system-installed 2.7.1 on Linux 64. So it's not actually a new bug. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Changes by Brett Cannon br...@python.org: -- stage: - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Changes by Brett Cannon br...@python.org: -- stage: patch review - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18120] multiprocessing: garbage collector fails to GC Pipe() end when spawning child process
Richard Oudkerk added the comment: Actually, you can use gc.get_referents(obj) which returns the direct children of obj (and is presumably implemented using tp_traverse). I will close. -- resolution: - rejected stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18120 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Madison May added the comment: The attached patch updates the urls on the Documenting and Doc Quality pages to reference the new Apple Style Guide. -- keywords: +patch Added file: http://bugs.python.org/file30456/apple_style_guide.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13647] Python SSL stack doesn't securely validate certificate (as client)
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13647 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13655] Python SSL stack doesn't have a default CA Store
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13655 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Dmi Baranov added the comment: That link will be outdated in next few months (I believe :-)). What about https://help.apple.com/asg/mac ? -- nosy: +dmi.baranov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Terry J. Reedy added the comment: The latter link redirects to the current online searchable html version, http://help.apple.com/asg/mac/2013/ and presumably always will. I think this is better than the 200 page pdf. -- nosy: +terry.reedy stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17810] Implement PEP 3154 (pickle protocol 4)
Alexandre Vassalotti added the comment: Stefan, could you address my review comments soon? The improved support for globals is the only big piece missing from the implementation of PEP, which I would like to get done and submitted by the end of the month. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17810 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Madison May added the comment: Updated patch to link instead to http://help.apple.com/asg/mac. Thanks for that catch, Dmi and Terry. I have to agree that its a much better alternative. -- Added file: http://bugs.python.org/file30457/apple_style_guide_v2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18078] threading.Condition to allow notify on a specific waiter
João Bernardo added the comment: Hi, This code is working quite well on my system, but I'm still not sure if the behavior of multiple predicates is the one other people want. So, for the thread start running again: - Should it test only the predicates from the awakened Conditions an accept if one of them is true? - Or any of the predicates must be true (current implementation)? - Or all of them must be true (less likely, but possible)? Another option is that we allow the behavior to be configurable. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18078 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18127] Strange behaviour with default list argument
New submission from Poul-Henning Kamp: I'd like to nominate this piece of code as candidate for the next round of Most unexpected python behaviour awards: def foo(a, x = []): x.append(a) return x print(foo(1)) print(foo(2)) I expected the output to be: [1] [2] but I get: [1] [1, 2] Bug? (If not, I'd *love* to read the rationale for this behaviour...) -- messages: 190557 nosy: bsdphk priority: normal severity: normal status: open title: Strange behaviour with default list argument type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18127] Strange behaviour with default list argument
Eric V. Smith added the comment: It's by design. Search for mutable default arguments, for example http://docs.python-guide.org/en/latest/writing/gotchas.html#mutable-default-arguments -- nosy: +eric.smith resolution: - invalid stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
Roundup Robot added the comment: New changeset ffdee6b36305 by Victor Stinner in branch '3.3': Close #18109: os.uname() now decodes fields from the locale encoding, and http://hg.python.org/cpython/rev/ffdee6b36305 New changeset 2472603af83e by Victor Stinner in branch 'default': (Merge 3.3) Close #18109: os.uname() now decodes fields from the locale http://hg.python.org/cpython/rev/2472603af83e -- nosy: +python-dev resolution: invalid - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
STINNER Victor added the comment: issue18109.patch is not correct: it uses the locale encoding in strict mode, the surrogateescape error handler should be used instead. I rewrote the patch. I removed the unit test because changing a hostname is really unexpected and may break (crash?) running desktop applications. The hostname is something too critical IMO. I ran the test manually on my Linux box at least ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
STINNER Victor added the comment: test_logging is failing with a non-ASCII hostname because of the following error: error: uncaptured python exception, closing channel test.test_logging.TestSMTPServer listening localhost:0 at 0x7f09a0ef89b0 (class 'UnicodeEncodeError':'ascii' codec can't encode character '\xe9' in position 6: ordinal not in range(128) [/home/haypo/prog/python/default/Lib/asyncore.py|read|83] [/home/haypo/prog/python/default/Lib/asyncore.py|handle_read_event|436] [/home/haypo/prog/python/default/Lib/asyncore.py|handle_accept|513] [/home/haypo/prog/python/default/Lib/test/test_logging.py|handle_accepted|746] [/home/haypo/prog/python/default/Lib/test/test_logging.py|__init__|692] [/home/haypo/prog/python/default/Lib/smtpd.py|push|276]) SMTPChannel.push() uses explicitly the ASCII encoding, whereas test_logging pass the FQDN to push(). I'm not interested to work on this issue. Please open a new issue if you consider important enough. -- More tests are also failing with *undecodable* hostnames (ex: aé€\udcff with UTF-8 locale encoding): test_socket test_urllib test_urllib2 test_logging test_pydoc test_smtplib. I fixed and closed the issue, even I still think that you should only use ASCII for your hostname ;-) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
STINNER Victor added the comment: Oh, by the way, I also changed socket.gethostname(). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18128] pygettext: non-standard timestamp format in POT-Creation-Date
New submission from Jakub Wilk: pygettext uses non-standard timestamp format in the POT-Creation-Date field. For example: POT-Creation-Date: 2013-06-03 22:31+CEST whereas xgettext uses this format: POT-Creation-Date: 2013-06-03 22:31+0200 You could use this code to generate timestamps in the same format as xgettext: from time import time, localtime, strftime from calendar import timegm def gettext_timestamp(): now = int(time()) nowtuple = localtime(now) offset = timegm(nowtuple) - now sign = '-' if offset 0 else '+' hour, minute = divmod(abs(offset) // 60, 60) return strftime('%Y-%m-%d %H:%M', nowtuple) + sign + '%02d%02d' % (hour, minute) -- messages: 190563 nosy: jwilk priority: normal severity: normal status: open title: pygettext: non-standard timestamp format in POT-Creation-Date ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18128 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18128] pygettext: non-standard timestamp format in POT-Creation-Date
Changes by Barry A. Warsaw ba...@python.org: -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18128 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18128] pygettext: non-standard timestamp format in POT-Creation-Date
Barry A. Warsaw added the comment: It's probably worth changing. My only concern would be backwards compatibility issues. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18128 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18123] fnmatchicase for case insensitive file search
STINNER Victor added the comment: The bug tracker is not the best place to discuss adding new features to the standard library. It's better to discuss them first on the python-ideas mailing list. You should also give an use case, explain why do you consider that Python needs this feature, etc. For example, I don't need such functionn and why not converting filenames to lowercase? -- nosy: +haypo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18123 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18127] Strange behaviour with default list argument
Barry A. Warsaw added the comment: While it's true that it can be confusing to users, it's not a bug. http://docs.python.org/2/reference/compound_stmts.html#function and a nice treatise on the subject by the Effbot: http://effbot.org/zone/default-values.htm -- nosy: +barry ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18127 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Ned Deily added the comment: Has anyone looked at the current Apple style guide to determine whether it is still an appropriate reference for Python doc usage? It appears to have undergone some major changes over the years as Apple's docs have changed. -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18129] Fatal Python error: Cannot recover from stack overflow.
New submission from Oscar Benjamin: This is from a thread on python-list that started here: http://mail.python.org/pipermail/python-list/2013-May/647895.html There are situations in which the Python 3.2 and 3.3 interpreters crash with Fatal Python error: Cannot recover from stack overflow. when I believe the correct response is a RuntimeError (as happens in 2.7). I've attached a file crash.py that demonstrates the problem. The following gives the same behaviour in 2.7, 3.2 and 3.3: $ cat tmp.py def loop(): loop() loop() $ py -3.2 tmp.py Traceback (most recent call last): File tmp.py, line 4, in module loop() File tmp.py, line 2, in loop loop() File tmp.py, line 2, in loop loop() File tmp.py, line 2, in loop loop() File tmp.py, line 2, in loop ... However the following leads to a RuntimeError in 2.7 but different fatal stack overflow errors in 3.2 and 3.3 (tested on Windows XP using 32-bit python.org installers): $ cat tmp.py def loop(): try: (lambda: None)() except RuntimeError: pass loop() loop() $ py -2.7 tmp.py Traceback (most recent call last): File tmp.py, line 8, in module loop() File tmp.py, line 6, in loop loop() File tmp.py, line 6, in loop loop() File tmp.py, line 6, in loop loop() File tmp.py, line 6, in loop ... RuntimeError: maximum recursion depth exceeded $ py -3.2 tmp.py Fatal Python error: Cannot recover from stack overflow. This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. $ py -3.3 tmp.py Fatal Python error: Cannot recover from stack overflow. Current thread 0x05c4: File tmp.py, line 3 in loop File tmp.py, line 6 in loop File tmp.py, line 6 in loop File tmp.py, line 6 in loop File tmp.py, line 6 in loop File tmp.py, line 6 in loop File tmp.py, line 6 in loop ... Also tested on stock Python 3.2.3 on Ubuntu (2.7 gives RuntimeError): $ python3 tmp.py Fatal Python error: Cannot recover from stack overflow. Aborted (core dumped) I would expect this to give RuntimeError: maximum recursion depth exceeded in all cases. Oscar -- components: Interpreter Core files: crash.py messages: 190568 nosy: oscarbenjamin priority: normal severity: normal status: open title: Fatal Python error: Cannot recover from stack overflow. type: crash versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file30458/crash.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18129 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Nick Coghlan added the comment: As stated, I don't agree with the closure of this one. min/max deserve a more elegant mechanism for dealing with the empty iterable edge case. -- resolution: rejected - status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18053] Add checks for Misc/NEWS in make patchcheck
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti stage: - needs patch type: - enhancement ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18053 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18054] Add more exception related assertions to unittest
Ezio Melotti added the comment: What about adding a recipes section in the docs with sample implementation of specific assertMethods? -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18054 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18101] Tk.split() doesn't work with nested Unicode strings
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18101 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18104] Idle: make human-mediated GUI tests usable
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18102] except-clause with own exception class inside generator can lead to confusing warning on termination
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18102 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
David Beazley added the comment: I could have used this feature myself somewhat recently. It was in some code involving document matching where zero or more possible candidates were assigned a score and I was trying to find the max score. The fact that an empty list was a possibility complicated everything because I had to add extra checks for it. max(scores, default=0) would have been a lot simpler. -- nosy: +dabeaz ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18130] idlelib.configSectionNameDialog: fix and add tests and mocks
New submission from Terry J. Reedy: The patch to configSectionNameDialog.py fixes the human test (adds required arg) so it runs, adds instructions to the test, fixes a bug in name_ok, removes redundant code, adds needed spaces, de-camelcases internal names, and changes the master for the two StringVars so they can be collected [sys:1: ResourceWarning: gc: 2 uncollectable objects at shutdown [tkinter.StringVar object at 0x02C597E0, tkinter.StringVar ...]]. (I plan to open an issue about this.) The new mock_tk.py adds generic mocks for tkinter String/Int/BooleanVars and tkinter.messagebox and its 8 functions. The new test_name_dialog.py uses these to unittest the non-gui parts of the dialog. The backport to 2.7 required changes to the tkinter imports and print in configSectionNameDialog.py and in test_config_name.py, addition of '.im_func' to the names of methods/functions being added to the dummy class. Both unittests and human tests run on all three branches. I believe the patches are ready to commit. -- components: IDLE files: config_name.diff keywords: patch messages: 190572 nosy: terry.reedy priority: normal severity: normal stage: commit review status: open title: idlelib.configSectionNameDialog: fix and add tests and mocks type: behavior versions: Python 2.7, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file30459/config_name.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18130 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18130] idlelib.configSectionNameDialog: fix and add tests and mocks
Changes by Terry J. Reedy tjre...@udel.edu: Added file: http://bugs.python.org/file30460/config_name27.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18130 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18104] Idle: make human-mediated GUI tests usable
Changes by Terry J. Reedy tjre...@udel.edu: Removed file: http://bugs.python.org/file30439/configSectionNameDialog.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18104] Idle: make human-mediated GUI tests usable
Terry J. Reedy added the comment: I opened #18130 for an updated configSectionNameDialog.py patch. It also adds to idle_tests two files, mock_tk.py and test_config_name.py. The latter uses the former for gui-free automated tests of some of the dialog methods. I plan to commit in a couple of days. The fixed human test is required for this issue. -- dependencies: +idlelib.configSectionNameDialog: fix and add tests and mocks ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18104 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18131] Tkinter Variables require a proper master
New submission from Terry J. Reedy: The signature for tkinter class Variable and its subclasses StringVar, IntVar, DoubleVar, BooleanVar is def __init__(self, master=None, value=None, name=None): However, the None default is invalid because of self._tk = master.tk The preceding lines if not master: master = _default_root might suggest that None is acceptible. But _default_root is set to None at the top of the file, so that just replaces None with None. If Variables must have a gui widget parent, then they cannot be used in gui-free tests, even though they have no graphic representation. Moveover, not everything is a proper master. configSectionNameDialog.py . GetCfgSectionNameDialog(Toplevel) . Create.Widgets(self) has these lines: self.name = StringVar(self) self.fontSize = StringVar(self) However, these are not (always) garbage collectable. After fixing the dialog test at the bottom of the file, and running it with 3.3 python_d -m idlelib.configSectionNameDialog (#18130), and adding the gc flag, I repeatedly got [sys:1: ResourceWarning: gc: 2 uncollectable objects at shutdown [tkinter.StringVar object at 0x02C597E0, tkinter.StringVar ...]] (This only showed when running from the console, not when running within Idle started within the interactive debug interpreter.) Running the test multiple times within a session, by repeatedly creating new dialogs with the [dialog] button in the test window, multiplied the uncollected objects. Replacing 'self' with 'self.parent' solved the problem, at least in the test situation. -- components: Tkinter messages: 190574 nosy: gpolo, terry.reedy priority: normal severity: normal stage: needs patch status: open title: Tkinter Variables require a proper master type: behavior versions: Python 2.7, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18131 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Raymond Hettinger added the comment: I still think complicating the API isn't worth it. Of late, we've gotten in the habit of a complexity to even the simplest of things. In the case of sequences, we already have a reasonable solution: low = min(seq) if seq else default In the rarer case of non-sequence iterables, catching a Value error is the traditional solution -- not pretty, but not difficult either. In the past, Guido has rejected that notion of add a default value to every function than can raise an exception. For example, someone wanted to add a get() method to lists so they could avoid catching an IndexError, something like s.get(index, default). IIRC, his motivation was that avoiding API clutter was more important than supporting an uncommon use case that already had viable solutions using plain Python. My own principle is that it is okay to add an initial extra feature to function, but not multiple extra features. This becomes more important when the function already has API issues. The min() / max() functions started-out with an API problem because of their dual signature: min(s) versus min(a, b, c). That creates an ambiguity in that case of min(*t) where the result depends on the length of the input. IMO, that issue would be exacerbated by the addition of a default argument (i.e. it would tend to hide the error from test cases): for t in [(10, 20, 30), (10, 20), (10,), ()]: print min(*t, default=100) Also, I don't think we should forget the lessons learned about adding unnecessary arguments to functions. For example, we let someone add start and end arguments to str.startswith() and str.endswith() because it seemed more parallel with str.find() and because someone wanted it once a piece of code somewhere. The downside only became apparent later when there was a legitimate real use case for another feature request: searching multiple prefixes and suffixes. Because we had wasted the positional arguments, we ended-up with the awkward str.startswith(str-or-tuple [,start [,end]]) signature. That is why we have to write, filename.endswith(('.py', '.pyc')). The double parens are part of the cost of API bloat. Lastly, when it comes to common-place functions like min() and max(), we can assess needs easily by looking at what other languages have done. Looking at Excel, SQL, Java, Haskell, C# etc, I don't see a precedent for this feature request. Grepping for min/max in my own code and third-party libraries, I don't see any cases where the code had a need for this feature. If the need arises, it certainly doesn't come of very often. If you guys all think this is an good feature request, then by all means, go ahead and add it. My recommendation is to show design restraint and refuse the temptation to grow this already awkward API when you don't have to. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18103] Create a GUI test framework for Idle
Terry J. Reedy added the comment: My experiments and some web postings indicate that if a tkinter class has a master or parent option, it may not really be an option, regardless of what our docs imply. If tkinter.Tk is called either directly or indirectly, the graphics system is initiated and something is displayed. This appears to includes the seemingly non-graphics Variable (Var) classes such as IntVar (#18131). I started idle_lib/mock_tk.py as part of #18130. This will allow non-gui unit testing of any method whose tkinter use is limited to Vars and message boxes. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18103 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Julian Berman added the comment: Raymond, I respect that in your opinion this seems to be overcomplexity, but you haven't addressed any of the arguments made, nor responded to any of the arguments against this being added complexity. I really don't understand the parallels you're making to str.*with, but as for other languages, as David pointed out already, you are looking at things in a vacuum. This is needed because min and max are already silly. In languages like Ruby and Clojure, which were the quickest I had handy, of course you don't need this, because calling min and max *by default* returns None. I'd bet Python 2's silly type comparison history had something to do with the return value not defaulting to None, but what's done is done. I don't like hard-fast rules, but I don't think APIs should ever be penalized for their own mistakes. We should make sane things possible in pleasant ways. If it's OK then (turning back to the patch), unless anyone has something additional to add I'm going to carve up some tests. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18021] Update broken link to Apple Publication Style Guide
Madison May added the comment: I actually had a bit of a hard time even locating a copy of the 2009 version. Thanks to the Wayback Machine, here's the 2009 version of the pdf for reference: http://web.archive.org/web/20121221004340/https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18021 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Nick Coghlan added the comment: To me, the Python-specific difference that makes this useful for us but not for others is *precisely* the fact that the simple idiom: x = min(seq) if seq else default is broken for iterators that don't provide __len__ or __bool__, while the even simpler: x = min(seq) is broken for the empty iterable. However, I think we should explicitly disallow the combination of multiple positional arguments *and* the new default argument. If you don't know the length of the input iterable, you should *not* be using the multiple argument form. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Julian Berman added the comment: Personally I don't care either way, I basically never use the multiple positional arg form, but what are we trying to prevent exactly? It's bad code, but it (would) do what the person was expecting. Am I not getting the point that's being made about that case? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18054] Add more exception related assertions to unittest
Julian Berman added the comment: Can I throw in, and hopefully not in a way that's too out of place, that I think that unittest might want to rethink it's strategy re: assertion methods? The fact that the object that has all the assertions and the object that has the logic for running a test, and the thing that holds all the tests on it, makes things difficult. For a concrete example, subclasses of unittest.TestCase like e.g. trial.unittest.TestCase do not have easy ways of allowing pluggable assertions, by which I mean you can't show up and say Here I have a thing with some assertions, use this. So, for trial, if we want to support unittest2 assertions (which I'd personally like), we have to put code in trial to do so. It would seem to me that it'd be nicer to (obviously keep what we have for backwards compatibility) but rather than adding a bunch of mixins, have an API that decouples things holding assertion methods from a TestCase, and mix those in by calling a method on the TestCase rather than mixing in a bunch of assertion mixins. (also, in a slightly lighter note, I might like an assertEqualAndAlsoNotUnequal method :D) -- nosy: +Julian ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18054 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Raymond Hettinger added the comment: Guido, this is your language. What would you like to do? The OP wants a default argument on min() and max() so he won't have to use an except ValueError for non-sequence iterables that are potentially empty. At first, I thought the functions were already as complex as we would want to get, but several proponents have emerged, so I'm stepping aside. The proposed patch would allow: max(iterable, key=somefunc, default=sentinel) and would return sentinel_value when len(list(iterable))==0. It would not allow: max(*iterable, key=somefunc, default=sentinel_value) where s is an empty iterable. -- assignee: - gvanrossum nosy: +gvanrossum ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17810] Implement PEP 3154 (pickle protocol 4)
Stefan Mihaila added the comment: On 6/3/2013 9:33 PM, Alexandre Vassalotti wrote: Alexandre Vassalotti added the comment: Stefan, could you address my review comments soon? The improved support for globals is the only big piece missing from the implementation of PEP, which I would like to get done and submitted by the end of the month. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17810 ___ Yes, I apologize for the delay again. Today is my last exam this semester, so I'll do my best to get it done as soon as possible (hopefully this weekend). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17810 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Guido van Rossum added the comment: +1 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Changes by Guido van Rossum gu...@python.org: -- assignee: gvanrossum - ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Nick Coghlan added the comment: Just one final design philosophy comment from me (I know it isn't needed since Guido already ack'ed the suggestion): As far as the lessons learned from the historical startswith() case go, avoiding taking up the positional slots with optional flags and configuration parameters is one of the big reasons we added keyword only arguments (with the other being readability at the call site). I agree we need to be cautious with API complexity, I just think in this case clean handling of empty iterators is a net win (so long as we rule out the conceptually broken case of combining the new parameter with multiple positional arguments). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18111] Add a default argument to min max
Raymond Hettinger added the comment: Julian, when your tests are ready, I'll be happy to review and apply the patch. -- assignee: - rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18111 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18054] Add more exception related assertions to unittest
Raymond Hettinger added the comment: +1 to what Michael said. The current API is way too big, but these proposed methods aren't trivially easy to get right. It would be nice to have them done once and done well. -- nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18054 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue18109] os.uname() crashes if hostname contains non-ascii characters
Dominik Richter added the comment: Thank you all for your help, works great! @Victor: fully agree on the ascii hostname ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18109 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13647] Python SSL stack doesn't securely validate certificate (as client)
Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com: -- nosy: +Arfrever ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13647 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com