From report at bugs.python.org Thu Jan 1 06:06:10 2009 From: report at bugs.python.org (Hirokazu Yamamoto) Date: Thu, 01 Jan 2009 05:06:10 +0000 Subject: [New-bugs-announce] [issue4797] test_fileio error (windows) In-Reply-To: <1230786370.88.0.170386258104.issue4797@psf.upfronthosting.co.za> Message-ID: <1230786370.88.0.170386258104.issue4797@psf.upfronthosting.co.za> New submission from Hirokazu Yamamoto : This patch fixes this error. http://www.python.org/dev/buildbot/trunk.stable/x86%20XP-4% 20trunk/builds/1727/step-test/0 ====================================================================== FAIL: testOpendir (test.test_fileio.AutoFileTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen- windows\build\lib\test\test_fileio.py", line 112, in testOpendir self.assertEqual(e.filename, ".") AssertionError: None != '.' This error doesn't occur on py3k (because wide string is passed) but I think It's better to merge the patch into py3k too. ---------- components: Windows files: fix_test_fileio_error.patch keywords: patch messages: 78690 nosy: ocean-city severity: normal status: open title: test_fileio error (windows) type: behavior versions: Python 2.6, Python 2.7 Added file: http://bugs.python.org/file12515/fix_test_fileio_error.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 1 08:47:41 2009 From: report at bugs.python.org (Vikram U Shenoy) Date: Thu, 01 Jan 2009 07:47:41 +0000 Subject: [New-bugs-announce] [issue4798] Update deprecation of 'new' module in PEP 4. In-Reply-To: <1230796061.0.0.856185746745.issue4798@psf.upfronthosting.co.za> Message-ID: <1230796061.0.0.856185746745.issue4798@psf.upfronthosting.co.za> New submission from Vikram U Shenoy : Attached are two patches: * Update PEP 4 about 'new' module which is deprecated since python 2.6 in favour of using types module. * Update documentation for 'new' module. Not sure about the exact date of proposal for deprecating 'new' module, but closest that I was able to find was this python-dev mail thread after it had been removed from py3k branch: http://mail.python.org/pipermail/python-dev/2007-November/075386.html ---------- assignee: georg.brandl components: Documentation files: doc_update_for_new_module_dec_31_2008.patch keywords: patch messages: 78692 nosy: georg.brandl, loewis, vshenoy severity: normal status: open title: Update deprecation of 'new' module in PEP 4. versions: Python 2.6 Added file: http://bugs.python.org/file12516/doc_update_for_new_module_dec_31_2008.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 1 08:52:47 2009 From: report at bugs.python.org (Cournapeau David) Date: Thu, 01 Jan 2009 07:52:47 +0000 Subject: [New-bugs-announce] [issue4799] handling inf/nan in '%f' In-Reply-To: <1230796367.25.0.681154044554.issue4799@psf.upfronthosting.co.za> Message-ID: <1230796367.25.0.681154044554.issue4799@psf.upfronthosting.co.za> New submission from Cournapeau David : On windows, with python 2.6, s = '%s' % float('inf') is 'inf', but s = '%f' % float('inf') is equal to '1.#INF'. This patch fixes the inconsistency, by using the code from floatobject.f format_float into stringobject.c formatfloat. I think it would be better to use the same underlying implementations for both functions, but it is not so easy, because format_float cannot fail (return void), whereas formatfloat can (return error code). ---------- components: Interpreter Core files: nan.patch keywords: patch messages: 78693 nosy: cdavid severity: normal status: open title: handling inf/nan in '%f' versions: Python 2.6 Added file: http://bugs.python.org/file12518/nan.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 1 11:32:35 2009 From: report at bugs.python.org (Kandalintsev Alexandre) Date: Thu, 01 Jan 2009 10:32:35 +0000 Subject: [New-bugs-announce] [issue4800] little inaccuracy in Py_ssize_t explanation In-Reply-To: <1230805955.17.0.970467276629.issue4800@psf.upfronthosting.co.za> Message-ID: <1230805955.17.0.970467276629.issue4800@psf.upfronthosting.co.za> New submission from Kandalintsev Alexandre : Documentation says that ======== There?s no chance that the reference count can overflow; at least as many bits are used to hold the reference count as there are distinct memory locations in virtual memory (assuming sizeof(Py_ssize_t) >= sizeof(void*)). Thus, the reference count increment is a simple operation. ======== But Py_ssize_t is a signed type so in case of sizeof(Py_ssize_t) == sizeof (void*)) it can only reference a half of memmory :). But because any python object consumes much more than 2bytes this is not a problem. ---------- assignee: georg.brandl components: Documentation messages: 78695 nosy: exe, georg.brandl severity: normal status: open title: little inaccuracy in Py_ssize_t explanation versions: Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 1 21:03:39 2009 From: report at bugs.python.org (Roumen Petrov) Date: Thu, 01 Jan 2009 20:03:39 +0000 Subject: [New-bugs-announce] [issue4801] _collections module fail to build on cygwin In-Reply-To: <1230840219.24.0.00127311298202.issue4801@psf.upfronthosting.co.za> Message-ID: <1230840219.24.0.00127311298202.issue4801@psf.upfronthosting.co.za> New submission from Roumen Petrov : make log: gcc -shared -Wl,--enable-auto-image-base .../Modules/_collectionsmodule.o -L/usr/local/lib -L. -lpython2.7 -o build/lib.cygwin-1.5.25-i686-2.7/_collections.dll .../Modules/_collectionsmodule.o: In function `deque_iter': .../Modules/_collectionsmodule.c:970: undefined reference to `__PyGC_generation0' .... ---------- components: Build files: py-trunk-incl-objimpl.h-patch messages: 78723 nosy: rpetrov severity: normal status: open title: _collections module fail to build on cygwin versions: Python 2.7 Added file: http://bugs.python.org/file12519/py-trunk-incl-objimpl.h-patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Thu Jan 1 21:08:30 2009 From: report at bugs.python.org (Roumen Petrov) Date: Thu, 01 Jan 2009 20:08:30 +0000 Subject: [New-bugs-announce] [issue4802] detect_tkinter for cygwin In-Reply-To: <1230840510.49.0.878061128691.issue4802@psf.upfronthosting.co.za> Message-ID: <1230840510.49.0.878061128691.issue4802@psf.upfronthosting.co.za> New submission from Roumen Petrov : Check for installed X on cygwin can't find X11/Xlib.h in detect_tkinter from setup.py ---------- files: py-trunk-detect_tkinter-cygwin.patch keywords: patch messages: 78724 nosy: rpetrov severity: normal status: open title: detect_tkinter for cygwin Added file: http://bugs.python.org/file12520/py-trunk-detect_tkinter-cygwin.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 03:57:06 2009 From: report at bugs.python.org (Manas) Date: Fri, 02 Jan 2009 02:57:06 +0000 Subject: [New-bugs-announce] [issue4803] Manas Thapliyal sent you a Friend Request on Yaari In-Reply-To: <94e386e8cd976bbe7d6eb5b217870508@localhost.localdomain> Message-ID: <94e386e8cd976bbe7d6eb5b217870508@localhost.localdomain> New submission from Manas : Manas Thapliyal wants you to join Yaari! Is Manas your friend? Yes, Manas is my friend! No, Manas isn't my friend. Please respond or Manas may think you said no :( Thanks, The Yaari Team ____ If you prefer not to receive this email tell us here. If you have any concerns regarding the content of this message, please email abuse at yaari.com. Yaari LLC, 358 Angier Ave, Atlanta, GA 30312 YaariNSF231MZA868MBK206SAQ399 ---------- files: unnamed messages: 78749 nosy: gravitywarrior1 severity: normal status: open title: Manas Thapliyal sent you a Friend Request on Yaari Added file: http://bugs.python.org/file12526/unnamed _______________________________________ Python tracker _______________________________________ -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: unnamed URL: From report at bugs.python.org Fri Jan 2 05:09:40 2009 From: report at bugs.python.org (Mark Hammond) Date: Fri, 02 Jan 2009 04:09:40 +0000 Subject: [New-bugs-announce] [issue4804] Python on Windows disables all C runtime library assertions In-Reply-To: <1230869380.06.0.720418986656.issue4804@psf.upfronthosting.co.za> Message-ID: <1230869380.06.0.720418986656.issue4804@psf.upfronthosting.co.za> New submission from Mark Hammond : This block in exceptions.c: #if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) ... /* turn off assertions in debug mode */ prevCrtReportMode = _CrtSetReportMode(_CRT_ASSERT, 0); #endif Does exactly what the comment says it does - disables all assertions. It disables *all* CRT assertions in the process, which includes some very useful ones related to memory corruption, and all 'assert' and 'ASSERT' statements in all Python extension modules. The change was introduced in: """ r46894 | kristjan.jonsson | 2006-06-13 01:45:12 +1000 (Tue, 13 Jun 2006) | 2 lines Fix the CRT argument error handling for VisualStudio .NET 2005. Install a CRT error handler and disable the assertion for debug builds. This causes CRT to set errno to EINVAL. This update fixes crash cases in the test suite where the default CRT error handler would cause process exit. """ which seems like a very large hammer to be using (ie, the problem causing the assertions to blow should probably have been fixed). I'd like to remove these 2 lines. Any objections, or should I upload the trivial patch? ---------- components: Windows messages: 78753 nosy: krisvale, mhammond severity: normal status: open title: Python on Windows disables all C runtime library assertions type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 05:56:46 2009 From: report at bugs.python.org (Alexander Belopolsky) Date: Fri, 02 Jan 2009 04:56:46 +0000 Subject: [New-bugs-announce] [issue4805] Make python code compilable with a C++ compiler In-Reply-To: <1230872206.73.0.47638283248.issue4805@psf.upfronthosting.co.za> Message-ID: <1230872206.73.0.47638283248.issue4805@psf.upfronthosting.co.za> New submission from Alexander Belopolsky : I am posting this patch mainly to support python-dev discussion on this topic. In the past (see r45330) it was possible to compile python core and standard library modules using a C++ compiler. According to Martin v. L?wis (issue4665), "It's not a requirement that the Python source code is compilable as C++. Only the header files should be thus compilable." However, I can see certain benefits from such requirement: 1. It is hard to verify that header files are compilable if source code is not. With compilable source code, CC=g++ ./configure; make will supply an adequate test that does not require anything beyond a standard distribution. 2. Arguably, C++ compliant code is more consistent and less error prone. For example, "new" is a really bad choice for a variable name regardless of being a C++ keyword, especially when used instead of prevailing "res" for a result of a function producing a PyObject. Even clearly redundant explicit casts of malloc return values arguably improve readability by reminding the type of the object that is being allocated. 3. Compiling with C++ may reveal actual coding errors that otherwise go unnoticed. For example, use of undefined PyLong_BASE_TWODIGITS_TYPE in Objects/longobject.c. 4. Stricter type checking may promote use of specific types instead of void* which in turn may help optimizing compilers. 5. Once achieved, C++ compilability is not that hard to maintain, but restoring it with patches like this one is hard because it requires review of changes to many unrelated files. ---------- files: c++-patch.diff keywords: patch messages: 78756 nosy: belopolsky severity: normal status: open title: Make python code compilable with a C++ compiler type: feature request versions: Python 2.6 Added file: http://bugs.python.org/file12527/c++-patch.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 13:46:04 2009 From: report at bugs.python.org (=?utf-8?q?Hagen_F=C3=BCrstenau?=) Date: Fri, 02 Jan 2009 12:46:04 +0000 Subject: [New-bugs-announce] [issue4806] Function calls taking a generator as star argument can mask TypeErrors in the generator In-Reply-To: <1230900364.95.0.0532833034138.issue4806@psf.upfronthosting.co.za> Message-ID: <1230900364.95.0.0532833034138.issue4806@psf.upfronthosting.co.za> New submission from Hagen F?rstenau : If we call some function f with a generator as star argument and this generator raises a TypeError, we get the following exception: >>> def f(x): pass ... >>> def broken(): raise TypeError ... >>> f(*(broken() for x in (0,))) Traceback (most recent call last): File "", line 1, in TypeError: f() argument after * must be a sequence, not generator This is a misleading error message, as it's usually no problem to use a generator as a star argument. Even just replacing the TypeError by some other exception leads to the expected result, i.e. the exception gets correctly propagated. The problem seems to be around line 3710 of Python/ceval.c where the generator is converted to a tuple. If this conversion raises a TypeError, then the error message is replaced, which will mask any TypeError raised by the generator. I'm not sure how to solve this. We probably can't distinguish a "good" TypeError from a "bad" TypeError at this point, so we might have to make a special case for the conversion of generators. ---------- components: Interpreter Core messages: 78788 nosy: hagen severity: normal status: open title: Function calls taking a generator as star argument can mask TypeErrors in the generator type: behavior versions: Python 2.6, Python 3.0 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 14:08:03 2009 From: report at bugs.python.org (Ulrich Eckhardt) Date: Fri, 02 Jan 2009 13:08:03 +0000 Subject: [New-bugs-announce] [issue4807] wrong wsprintf usage In-Reply-To: <1230901683.42.0.873273528074.issue4807@psf.upfronthosting.co.za> Message-ID: <1230901683.42.0.873273528074.issue4807@psf.upfronthosting.co.za> New submission from Ulrich Eckhardt : Note up front: there is a win32 function wsprintf() and an ISO C function swprintf(), these are different things in case you wonder. In _winreg.c, there are two functions that use wsprintf on a char buffer, while the function takes a TCHAR buffer instead. This leads to compile warning and runtime errors when _UNICODE is defined, like e.g. under MS Windows CE. The attached patch replaces the two calls to that function with calls to fprintf() and PyString_FromFormat(). ---------- components: Windows files: python-2.7-no-wsprint.0.patch keywords: patch messages: 78790 nosy: eckhardt severity: normal status: open title: wrong wsprintf usage type: compile error versions: Python 2.7 Added file: http://bugs.python.org/file12538/python-2.7-no-wsprint.0.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 15:55:13 2009 From: report at bugs.python.org (Corey Goldberg) Date: Fri, 02 Jan 2009 14:55:13 +0000 Subject: [New-bugs-announce] [issue4808] doc issue for threading module (name/daemon properties) In-Reply-To: <1230908113.29.0.280160311198.issue4808@psf.upfronthosting.co.za> Message-ID: <1230908113.29.0.280160311198.issue4808@psf.upfronthosting.co.za> New submission from Corey Goldberg : In the current 3.0 doc for threading: http://docs.python.org/dev/py3k/library/threading.htm it says: Thread.getName() Thread.setName() Old API for name. and Thread.isDaemon() Thread.setDaemon() Old API for daemon. 'name' and 'daemon' properties should be listed as defaults and the old getter/setter methods should be noted as "Old API". ---------- assignee: georg.brandl components: Documentation messages: 78807 nosy: cgoldberg, georg.brandl severity: normal status: open title: doc issue for threading module (name/daemon properties) versions: Python 3.0 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 17:18:15 2009 From: report at bugs.python.org (Randy Syring) Date: Fri, 02 Jan 2009 16:18:15 +0000 Subject: [New-bugs-announce] [issue4809] 2.5.4 release missing from python.org/downloads In-Reply-To: <1230913095.06.0.854632300097.issue4809@psf.upfronthosting.co.za> Message-ID: <1230913095.06.0.854632300097.issue4809@psf.upfronthosting.co.za> New submission from Randy Syring : http://www.python.org/download/ is missing a link to 2.5.4 in the standard releases section. ---------- assignee: georg.brandl components: Documentation messages: 78832 nosy: georg.brandl, rsyring severity: normal status: open title: 2.5.4 release missing from python.org/downloads _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 17:41:28 2009 From: report at bugs.python.org (Skip Montanaro) Date: Fri, 02 Jan 2009 16:41:28 +0000 Subject: [New-bugs-announce] [issue4810] timeit needs "official" '--' flag In-Reply-To: <18782.17333.839740.4416@montanaro-dyndns-org.local> Message-ID: <18782.17333.839740.4416@montanaro-dyndns-org.local> New submission from Skip Montanaro : Consider this timeit run: % python -m timeit '-1.0e-3 < -0.0001 < 1.0e-3' option -1 not recognized use -h/--help for command line help As it turns out this works: % python -m timeit -- '-1.0e-3 < -0.0001 < 1.0e-3' 10000000 loops, best of 3: 0.192 usec per loop but the output using the -h flag doesn't report it as a possibility. It probably should. ---------- messages: 78838 nosy: skip.montanaro severity: normal status: open title: timeit needs "official" '--' flag _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 21:15:19 2009 From: report at bugs.python.org (Gabriel Genellina) Date: Fri, 02 Jan 2009 20:15:19 +0000 Subject: [New-bugs-announce] [issue4811] invalid reST markup in several documents In-Reply-To: <1230927319.41.0.991139894945.issue4811@psf.upfronthosting.co.za> Message-ID: <1230927319.41.0.991139894945.issue4811@psf.upfronthosting.co.za> New submission from Gabriel Genellina : Several documents contain invalid reST markup that "leaks" into the html output (missing ``, incorrect indentation, etc.) This patch fixes the obvious ones. ---------- assignee: georg.brandl components: Documentation files: invalid-doc-markup.diff keywords: patch messages: 78866 nosy: gagenellina, georg.brandl severity: normal status: open title: invalid reST markup in several documents versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12543/invalid-doc-markup.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Fri Jan 2 23:31:05 2009 From: report at bugs.python.org (Raymond Hettinger) Date: Fri, 02 Jan 2009 22:31:05 +0000 Subject: [New-bugs-announce] [issue4812] Junk in the decimals namespace In-Reply-To: <1230935465.8.0.0565784557984.issue4812@psf.upfronthosting.co.za> Message-ID: <1230935465.8.0.0565784557984.issue4812@psf.upfronthosting.co.za> New submission from Raymond Hettinger : In r59144 , a bunch of internal-use constants were dumped in the main namespace. These all need to be prefixed with an underscore. They should be fixed right-away before people start using them. Since they are externally undocumented and since the internal notes describe them as being only for internal-use, I think this can go in as a bugfix. ---------- assignee: facundobatista components: Library (Lib) messages: 78893 nosy: facundobatista, rhettinger priority: high severity: normal status: open title: Junk in the decimals namespace versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 00:50:06 2009 From: report at bugs.python.org (Mitchell Model) Date: Fri, 02 Jan 2009 23:50:06 +0000 Subject: [New-bugs-announce] [issue4813] On OS-X the directories searched by setup.py for Tk are in the wrong order. In-Reply-To: <1230940206.74.0.201449731913.issue4813@psf.upfronthosting.co.za> Message-ID: <1230940206.74.0.201449731913.issue4813@psf.upfronthosting.co.za> New submission from Mitchell Model : In function detect_tkinter_darwin of setup.py framework_dirs should be the reverse of what it is: first the user's library should be searched, then /Library, and finally /System/Library. If Tk 8.5 is installed in /Library or ~/Library make will otherwise find the headers from 8.4 but the libraries from 8.5. Issue 4017 discusses this problem, among others, and is marked fixed, but it is still incorrect in the 2.6 and 3.0 downloads as well as in the trunk, 3.0, and 3.1 subversion repositories. It may have been "fixed" in so far as someone was able to make a .dmg by manually altering setup.py, and that's great, but it isn't fixed in the source and the problem will reappear with each new version. ---------- components: Build messages: 78904 nosy: MLModel severity: normal status: open title: On OS-X the directories searched by setup.py for Tk are in the wrong order. type: compile error versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 01:52:14 2009 From: report at bugs.python.org (Giampaolo Rodola') Date: Sat, 03 Jan 2009 00:52:14 +0000 Subject: [New-bugs-announce] [issue4814] ftplib does not honour "timeout" parameter for active data connections In-Reply-To: <1230943934.69.0.609460387197.issue4814@psf.upfronthosting.co.za> Message-ID: <1230943934.69.0.609460387197.issue4814@psf.upfronthosting.co.za> New submission from Giampaolo Rodola' : When using the optional ftplib.FTP()'s timeout parameter which specifies a timeout in seconds for blocking operations like the connection attempt, it is applied on both FTP control and passive data channel (if any). It is not applied for active (PORT/EPRT) data connections. The patch in attachment modifies ftplib so that when ntransfer method is called in active mode, timeout is applied on the resulting data connection. ---------- files: ftplib.patch keywords: patch messages: 78912 nosy: giampaolo.rodola severity: normal status: open title: ftplib does not honour "timeout" parameter for active data connections versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1 Added file: http://bugs.python.org/file12552/ftplib.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 05:56:21 2009 From: report at bugs.python.org (Pavel Kosina) Date: Sat, 03 Jan 2009 04:56:21 +0000 Subject: [New-bugs-announce] [issue4815] idle 3.1a1 utf8 In-Reply-To: <1230958581.39.0.288049654968.issue4815@psf.upfronthosting.co.za> Message-ID: <1230958581.39.0.288049654968.issue4815@psf.upfronthosting.co.za> New submission from Pavel Kosina : When you open file without encoding declaration, make changes and save, then IDLE changes without any question encodings to utf8. You can try it on attached file that is cp1250 now. It could be that at first saving we are asked to use *utf8 *current one. ---------- components: IDLE files: cp1250.py messages: 78932 nosy: geon severity: normal status: open title: idle 3.1a1 utf8 versions: Python 3.1 Added file: http://bugs.python.org/file12559/cp1250.py _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 11:51:15 2009 From: report at bugs.python.org (Thomas Finley) Date: Sat, 03 Jan 2009 10:51:15 +0000 Subject: [New-bugs-announce] [issue4816] Patch of itertools.{combinations, permutations} for empty combinations In-Reply-To: <1230979875.82.0.811611724155.issue4816@psf.upfronthosting.co.za> Message-ID: <1230979875.82.0.811611724155.issue4816@psf.upfronthosting.co.za> New submission from Thomas Finley : This is a patch for the Python 3.1 build checked out from http://svn.python.org/projects/python/branches/py3k The current behavior of itertools.combinations(iterable,r) and itertools.permutations(iterable,r) is to throw a ValueError if iterable yields fewer than r items. This changes these functions so the generator instead yields 0 items. As for my argument for acceptance, while the original behavior is not a bug insofar as its implementation was deliberate, I'd argue this is undesirable on grounds of mathematical consistency and functionality. In mathematics the "choose" function is defined as "(n choose r)=0" for r>n, so itertools.combinations' behavior is inconsistent with its obvious combinatorial analogy. (Similar for permutations and the combinatorial "P" function.) For functionality I'll cite my own case as anecdote. In writing regression tests I wanted to ensure that a group of items obeyed a certain "mutually consistent" property between all triples. (Something akin to the triangle inequality.) So: all(triangle_respected(*triple) for triple in itertools.combinations(group, 3)) If len(group)<=2, that's fine, since with no triangles there is no inconsistency, and all(())==True. However, the code failed with a ValueError when groups were that small. Working around this was fairly awkward, since I wanted to continue to fail noisily if my triangle_respected function threw a ValueError, and I wasn't sure at all that it wouldn't if my items were The patch modifies Modules/itertoolsmodule.c slightly, changing combinationsobject_new and permutationsobject_new. (Deleting the error throwing code, and have one line changes in both structures to handle the n>r case. One could handle this special case more efficiently than I do by not bothering to allocate certain structures in this case, but I didn't want to tempt fate.) The patch also changes the appropriate tests in Lib/test/test_itertools.py . Obviously, this would break code that depends upon Python throwing ValueError in the event of the combination or permutation sequence being empty. However, I hope given that combinations and permutations are a relative novelty that their behavior in this corner case is not yet etched in stone. Sorry if this belongs in a PEP -- it seems quite minor, but I don't quite have a feel what the threshold is. ---------- components: Library (Lib), Tests files: itertools-empty-combinations.diff keywords: patch messages: 78943 nosy: TFinley severity: normal status: open title: Patch of itertools.{combinations,permutations} for empty combinations type: behavior versions: Python 3.1 Added file: http://bugs.python.org/file12563/itertools-empty-combinations.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 12:09:46 2009 From: report at bugs.python.org (Ulrich Eckhardt) Date: Sat, 03 Jan 2009 11:09:46 +0000 Subject: [New-bugs-announce] [issue4817] PyOS_GetLastModificationTime is unused In-Reply-To: <1230980986.2.0.22709793272.issue4817@psf.upfronthosting.co.za> Message-ID: <1230980986.2.0.22709793272.issue4817@psf.upfronthosting.co.za> New submission from Ulrich Eckhardt : This is just to record that the above function is wrongly documented, inconsistently implemented, but fortunately unused, so it can be removed. In addition to the patch attached, there are two files that can be removed: Python/getmtime.c RISCOS/Python/getmtime_riscos.c ---------- components: Interpreter Core files: python-2.7-eradicate-getmtime.0.patch keywords: patch messages: 78945 nosy: eckhardt severity: normal status: open title: PyOS_GetLastModificationTime is unused type: resource usage versions: Python 2.7 Added file: http://bugs.python.org/file12564/python-2.7-eradicate-getmtime.0.patch _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 12:24:00 2009 From: report at bugs.python.org (ebfe) Date: Sat, 03 Jan 2009 11:24:00 +0000 Subject: [New-bugs-announce] [issue4818] Patch for thread-support in md5module.c In-Reply-To: <1230981840.09.0.761060151323.issue4818@psf.upfronthosting.co.za> Message-ID: <1230981840.09.0.761060151323.issue4818@psf.upfronthosting.co.za> New submission from ebfe : Here is another patch, this time for the fallback-md5-module. I know that situations are rare where openssl is not present but threading is. However they might occur out there and the md5module needed some love anyway: - The MD5 class from the fallback module can now also use threads with 'small locks' - The behaviour regarding unicode data input is now consistent as to what the openssl-driven classes do. - Some code cleanup. I might act on the sha modules as way the next days. sha256.c still accepts 's#'... Also see issue #4751 ---------- files: md5module_small_locks.diff keywords: patch messages: 78947 nosy: ebfe severity: normal status: open title: Patch for thread-support in md5module.c Added file: http://bugs.python.org/file12565/md5module_small_locks.diff _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 14:16:34 2009 From: report at bugs.python.org (Mark Dickinson) Date: Sat, 03 Jan 2009 13:16:34 +0000 Subject: [New-bugs-announce] [issue4819] Misc/cheatsheet needs updating In-Reply-To: <1230988594.32.0.497089911482.issue4819@psf.upfronthosting.co.za> Message-ID: <1230988594.32.0.497089911482.issue4819@psf.upfronthosting.co.za> New submission from Mark Dickinson : Misc/cheatsheet could do with an upgrade, both for the 2.x and 3.x branches. For 3.x, I guess the changes needed are quite extensive. I'm not sure how much needs to be changed or added for 2.x; at a quick glance, the 'with' statement, the 'x if b else y' construction, and the unified try-except-finally are missing. ---------- assignee: georg.brandl components: Documentation messages: 78955 nosy: georg.brandl, marketdickinson severity: normal status: open title: Misc/cheatsheet needs updating versions: Python 2.7, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 15:48:20 2009 From: report at bugs.python.org (David M. Beazley) Date: Sat, 03 Jan 2009 14:48:20 +0000 Subject: [New-bugs-announce] [issue4820] ctypes.util.find_library incorrectly documented In-Reply-To: <1230994100.6.0.728617029399.issue4820@psf.upfronthosting.co.za> Message-ID: <1230994100.6.0.728617029399.issue4820@psf.upfronthosting.co.za> New submission from David M. Beazley : In the "ctypes reference / Finding shared libraries" section of the ctypes documentation, the find_library() function is described as being located in ctypes.util. However, it's formal description right below that lists it as ctypes.find_library(). ---------- assignee: georg.brandl components: Documentation messages: 78964 nosy: beazley, georg.brandl severity: normal status: open title: ctypes.util.find_library incorrectly documented versions: Python 3.0 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 18:08:24 2009 From: report at bugs.python.org (Lukas Lueg) Date: Sat, 03 Jan 2009 17:08:24 +0000 Subject: [New-bugs-announce] [issue4821] Patches for thread-support in built-in SHA modules In-Reply-To: <1231002504.32.0.171592356443.issue4821@psf.upfronthosting.co.za> Message-ID: <1231002504.32.0.171592356443.issue4821@psf.upfronthosting.co.za> New submission from Lukas Lueg : Here is the follow-up to issue #4818. The patches attached allow the built-in SHA modules to release the GIL. Also the build-in SHA modules will now no longer accept "s#" as input. Input is parsed just as in the openssl-driven classes where unicode-objects are explicitly rejected. The built-in hash modules have been not quite beautiful before even more code is now copy & pasted between them. Is there any interest in refactoring all those modules? AFAIK _sha1 and such are only used by hashlib.py ... ---------- messages: 78975 nosy: ebfe severity: normal status: open title: Patches for thread-support in built-in SHA modules _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 18:14:13 2009 From: report at bugs.python.org (Antoine Pitrou) Date: Sat, 03 Jan 2009 17:14:13 +0000 Subject: [New-bugs-announce] [issue4822] Fix indentation in memoryobject.c In-Reply-To: <1231002853.44.0.302489681959.issue4822@psf.upfronthosting.co.za> Message-ID: <1231002853.44.0.302489681959.issue4822@psf.upfronthosting.co.za> New submission from Antoine Pitrou : The rules state new files should be indented with 4-spaces, but indentation has no consistent indentation: parts of it are indented with tabs, others with spaces. We could probably reindent it all with 4-spaces, especially since it hasn't been backported to trunk yet (and the versions in py3k and 3.0 should be identical). ---------- messages: 78978 nosy: pitrou priority: low severity: normal status: open title: Fix indentation in memoryobject.c type: behavior versions: Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sat Jan 3 19:02:21 2009 From: report at bugs.python.org (Pavel Kosina) Date: Sat, 03 Jan 2009 18:02:21 +0000 Subject: [New-bugs-announce] [issue4823] idle height and place In-Reply-To: <1231005741.18.0.260844388854.issue4823@psf.upfronthosting.co.za> Message-ID: <1231005741.18.0.260844388854.issue4823@psf.upfronthosting.co.za> New submission from Pavel Kosina : Nearly always (after opening) is IDLE window outside visible area. Mainly the status bar is hidden under bottom windows menu bar. Same situation happens when choosing Window-Zoom Height from IDLE menu. xpsp3, 1024x768, py2.x-3.x ---------- components: IDLE messages: 78983 nosy: geon severity: normal status: open title: idle height and place type: behavior versions: Python 2.5, Python 2.6, Python 2.7, Python 3.0, Python 3.1 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 4 00:30:39 2009 From: report at bugs.python.org (Skip Montanaro) Date: Sat, 03 Jan 2009 23:30:39 +0000 Subject: [New-bugs-announce] [issue4824] test_cmd_line failure on Mac OS X for py3k In-Reply-To: <18783.62745.773153.314589@montanaro.dyndns.org> Message-ID: <18783.62745.773153.314589@montanaro.dyndns.org> New submission from Skip Montanaro : test_cmd_line.test_run_code fails for me on Mac OS X: % ./python.exe -bb Lib/test/regrtest.py -v test_cmd_line test_cmd_line test_directories (test.test_cmd_line.CmdLineTest) ... ok test_optimize (test.test_cmd_line.CmdLineTest) ... ok test_q (test.test_cmd_line.CmdLineTest) ... ok test_run_code (test.test_cmd_line.CmdLineTest) ... FAIL test_run_module (test.test_cmd_line.CmdLineTest) ... ok test_run_module_bug1764407 (test.test_cmd_line.CmdLineTest) ... ok test_site_flag (test.test_cmd_line.CmdLineTest) ... ok test_usage (test.test_cmd_line.CmdLineTest) ... ok test_verbose (test.test_cmd_line.CmdLineTest) ... ok test_version (test.test_cmd_line.CmdLineTest) ... ok ====================================================================== FAIL: test_run_code (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/skip/src/python/py3k/Lib/test/test_cmd_line.py", line 143, in test_run_code 0) AssertionError: 1 != 0 ---------------------------------------------------------------------- Ran 10 tests in 1.282s Manually running what that test executes shows the problem: % ./python.exe Python 3.1a0 (py3k:68218, Jan 3 2009, 15:06:30) [GCC 4.0.1 (Apple Inc. build 5490)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.executable '/Users/skip/src/python/py3k/python.exe' >>> import subprocess >>> import sys >>> cmd_line = [sys.executable, '-E'] >>> cmd_line.extend(['-c', "assert(ord('\xe9') == 0xe9)"]) >>> cmd_line Traceback (most recent call last): File "", line 1, in File "/Users/skip/src/python/py3k/Lib/io.py", line 1488, in write b = encoder.encode(s) File "/Users/skip/src/python/py3k/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 68: ordinal not in range(128) >>> sys.getfilesystemencoding() 'utf-8' >>> subprocess.call(cmd_line, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 1 If I execute that command from the shell prompt I do get a zero exit code no matter what I try to mimic the scenario in the test: py3k% ./python.exe -E -c 'assert(ord("\xe9") == 0xe9)' py3k% echo $? 0 py3k% ./python.exe -E -c 'assert(ord("\xe9") == 0xe9)' > /tmp/trash 2>&1 py3k% echo $? 0 py3k% ./python.exe -E -c 'assert(ord("\xe9") == 0xe9)' 2>&1 | cat > /dev/null py3k% echo $? 0 I'm not sure where the problem lies. ---------- messages: 79023 nosy: skip.montanaro severity: normal status: open title: test_cmd_line failure on Mac OS X for py3k _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 4 01:12:35 2009 From: report at bugs.python.org (MagnetoHydroDynamics) Date: Sun, 04 Jan 2009 00:12:35 +0000 Subject: [New-bugs-announce] [issue4825] TypeError with complex.real() and complex.imag() In-Reply-To: <1231027955.73.0.619900873026.issue4825@psf.upfronthosting.co.za> Message-ID: <1231027955.73.0.619900873026.issue4825@psf.upfronthosting.co.za> New submission from MagnetoHydroDynamics : In both version 2.6.1 and 3.0 this issue exists: N and M can be two numbers of any type. >>> (N+Mj).real() Traceback (most recent call last): File "", line 1, in (N+Mj).real() TypeError: 'float' object is not callable >>> (N+Mj).imag() Traceback (most recent call last): File "", line 1, in (N+Mj).imag() TypeError: 'float' object is not callable ---------- components: None messages: 79024 nosy: MagnetoHydroDynamics severity: normal status: open title: TypeError with complex.real() and complex.imag() type: behavior versions: Python 3.0 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 4 05:16:14 2009 From: report at bugs.python.org (xverify) Date: Sun, 04 Jan 2009 04:16:14 +0000 Subject: [New-bugs-announce] [issue4826] exec() docstring bug about file objects In-Reply-To: <1231042574.98.0.745471149157.issue4826@psf.upfronthosting.co.za> Message-ID: <1231042574.98.0.745471149157.issue4826@psf.upfronthosting.co.za> New submission from xverify : exec() no longer accepts a file object but its docstring states otherwise. ---------- assignee: georg.brandl components: Documentation messages: 79036 nosy: georg.brandl, xverify severity: normal status: open title: exec() docstring bug about file objects versions: Python 3.0 _______________________________________ Python tracker _______________________________________ From report at bugs.python.org Sun Jan 4 07:50:43 2009 From: report at bugs.python.org (Jason Kankiewicz) Date: Sun, 04 Jan 2009 06:50:43 +0000 Subject: [New-bugs-announce] [issue4827] optparse: Callback example 1 is confusing In-Reply-To: <1231051843.8.0.720726802561.issue4827@psf.upfronthosting.co.za> Message-ID: <1231051843.8.0.720726802561.issue4827@psf.upfronthosting.co.za> New submission from Jason Kankiewicz : "Callback example 1: trivial callback" reads Here?s an example of a callback option that takes no arguments, and simply records that the option was seen: def record_foo_seen(option, opt_str, value, parser): parser.saw_foo = True parser.add_option("--foo", action="callback", callback=record_foo_seen) but the following paragraph Of course, you could do that with the store_true action. is wrong because parser.add_option("--foo", action="store_true", dest="saw_foo") would actually be duplicated by def record_foo_seen(option, opt_str, value, parser): parser.values.saw_foo = True parser.add_option("--foo", action="callback", callback=record_foo_seen) For example: >>> from optparse import OptionParser >>> parser = OptionParser() >>> def record_foo_seen(option, opt_str, value, parser): ... parser.saw_foo = True ... >>> parser.add_option("--foo", action="callback", callback=record_foo_seen)