[issue10044] small int optimization

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: Zitat von Serhiy Storchaka : >> I recommend to close the issue as rejected. > > I think _PyLong_IS_SMALL_INT can be rewritten in a safe style. For > example, using a checking of several fields > ((sdigit)(x)->ob_digit[0] < _MAX_SMALL_INT && PySIZE(x) <= 1)

[issue15997] NotImplemented needs to be documented

2012-09-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: I was wrong about TypeError; forget that. The seeming equivalent to 'return NotImplement' is not defining the method. My confusion stemed from the fact that NotImplemented returned from special methods gets intercepted and converted to TypeError exceptions by

[issue10044] small int optimization

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: > Why is that permissible but _PyLong_IS_SMALL_INT is not? It's *permissable* primarily because it is there. There are many places in Python which invoke undefined behavior already (most notably wrt. signed integers); we should strive to eliminate them. OTOH

[issue16002] AIX buildbot compile errors

2012-09-22 Thread Stefan Krah
New submission from Stefan Krah: According to issue #9799 configuring --without-computed-gotos might solve the AIX compile error. -- components: Build keywords: buildbot messages: 171013 nosy: skrah, trent priority: normal severity: normal status: open title: AIX buildbot compile errors

[issue12067] Doc: remove errors about mixed-type comparisons.

2012-09-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: You are right, I did not look deep enough. I was fooled by the conversion of NotImplemented, returned from object.__le__, etc, to TypeError. Sorry for that noise. For comparison and arithmetic, the actual alternative to defining a function that returns NotImp

[issue15276] unicode format does not really work in Python 2.x

2012-09-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: I have a brief documentation patch in mind for this, but it relies on documentation issue 15952 being addressed first (e.g. to say that format(value) returns Unicode when format_spec is Unicode and that value.__format__() can return a string of type str). So

[issue9720] zipfile writes incorrect local file header for large files in zip64

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: No, on the contrary, it is not such easy to fix, and the patch is incorrect. Sorry that it is not clear either. The size of the header with extra args depends on the size of the file. The file size can be changed in the process of compressing, and compressed

[issue15996] pow() for complex numbers is rough around the edges

2012-09-22 Thread Mark Dickinson
Mark Dickinson added the comment: > (1.0+0j)**(float('inf') + 0j) Oddly enough, this is nan+nanj on OS X. I haven't investigated what the difference is due to---probably something to do with the errno results. -- ___ Python tracker

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I think you should keep the > Py_buffers alive in an array, and only release them at the end (it may > also be slightly faster to do so). However allocation of this array may considerably slow down the function. We may need the special-case for bytes and by

[issue10044] small int optimization

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > I recommend to close the issue as rejected. I think _PyLong_IS_SMALL_INT can be rewritten in a safe style. For example, using a checking of several fields ((sdigit)(x)->ob_digit[0] < _MAX_SMALL_INT && PySIZE(x) <= 1) or a special flag. It is possible howe

[issue15978] asyncore: included batteries don't fit

2012-09-22 Thread chrysn
chrysn added the comment: i've redirected my request to python-ideas as suggested. for future reference, my email can be found at http://mail.python.org/pipermail/python-ideas/2012-September/016185.html -- ___ Python tracker

[issue10044] small int optimization

2012-09-22 Thread Mark Dickinson
Mark Dickinson added the comment: Ah: nice catch, Larry. I would say that the obmalloc case *shouldn't* be permissible; however, it's already there, and changing that would be an involved task that would also likely risk introducing new bugs. So I guess practicality beats purity on that one

[issue10044] small int optimization

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > Why is that permissible but _PyLong_IS_SMALL_INT is not? Touchér! -- ___ Python tracker ___ ___

[issue15969] faulthandler: drop S from dump_tracebacks_later() function name to have consistent names

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: Added to release clone as eede0bf3ceac. -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___

[issue15925] email.utils.parsedate() and email.utils.parsedate_tz() should return None when date cannot be parsed

2012-09-22 Thread Georg Brandl
Changes by Georg Brandl : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail

[issue15925] email.utils.parsedate() and email.utils.parsedate_tz() should return None when date cannot be parsed

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: This was committed to the release clone as c1e9a1fc6931. -- ___ Python tracker ___ ___ Python-bugs-lis

[issue15964] SyntaxError in asdl when building 2.7 with system Python 3

2012-09-22 Thread Nick Coghlan
Nick Coghlan added the comment: We should be able to add the "make touch" target to the 2.7 Makefile without running afoul of the "no new features" rule. However, agreed this is mostly a docs problem. We're seeing a couple of common traps that people run into when first getting started, so it

[issue15987] Provide a way to compare AST nodes for equality recursively

2012-09-22 Thread Benjamin Peterson
Benjamin Peterson added the comment: Yes, though some things like what to return if one has an entire subtree that the other doesn't have will have to be worked out. -- ___ Python tracker _

[issue1602] windows console doesn't print or input Unicode

2012-09-22 Thread Drekin
Drekin added the comment: I have finished a solution working for me. It bypasses standard Python interactive interpreter and uses its own repl based on code.interact(). This repl is activated by an ugly hack since PYTHONSTARTUP doesn't apply when some file is run (python -i somefile.py). Why i

[issue15935] clarify argparse docs re: add_argument() type and default arguments

2012-09-22 Thread Chris Jerdonek
Changes by Chris Jerdonek : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue15951] string.Formatter returns str for empty unicode template

2012-09-22 Thread Chris Jerdonek
Changes by Chris Jerdonek : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue10044] small int optimization

2012-09-22 Thread Larry Hastings
Larry Hastings added the comment: I must be missing something--because I thought Python *already* depended on this apparently-undefined behavior. The small-block object allocator in Objects/obmalloc.c determines whether a pointer belongs to a particular arena using exactly this trick. I quot

[issue15952] format(value) and value.__format__() behave differently with unicode format

2012-09-22 Thread Chris Jerdonek
Changes by Chris Jerdonek : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.

[issue15925] email.utils.parsedate() and email.utils.parsedate_tz() should return None when date cannot be parsed

2012-09-22 Thread R. David Murray
R. David Murray added the comment: I don't think it is worth the extra code to convert the TypeError into a ValueError. We aren't very strict about the distinction between those two. Leaving this open for Georg to transplant it to 3.3.0. -- assignee: -> georg.brandl resolution: -> f

[issue15925] email.utils.parsedate() and email.utils.parsedate_tz() should return None when date cannot be parsed

2012-09-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3b03d31f6a79 by R David Murray in branch 'default': #15925: fix regression: return None for null and non-date strings. http://hg.python.org/cpython/rev/3b03d31f6a79 -- nosy: +python-dev ___ Python tracker

[issue15978] asyncore: included batteries don't fit

2012-09-22 Thread Benjamin Peterson
Changes by Benjamin Peterson : -- resolution: -> rejected status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing

[issue16000] test_curses should use unittest

2012-09-22 Thread Ezio Melotti
Changes by Ezio Melotti : -- nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: > The distinction between ? vs. � for encode() and decode() > is in the Python docs, but it's not prominent. The point is that I'm not even sure we make any guarantees about the replacement characters that we use. I should check again what the Unicode standard

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: The distinction between ? vs. � for encode() and decode() is in the Python docs, but it's not prominent. It's mentioned in codecs's "Codec Base Classes" but not in the encode() and decode() docs themselves: http://docs.python.org/dev/library/codecs.html#codec

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: > I usually get the result of the cronjob via email if there's a failure; Maybe it should go to python-committers or some other public ML, so that other devs can see and possibly fix the issue. > I wonder if `make patchcheck` could be enhanced to check > for un

[issue15964] SyntaxError in asdl when building 2.7 with system Python 3

2012-09-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: Adding Nick because he is the one that suggested adding a "Build Troubleshooting" section to the devguide FAQ (meant to add him above). -- nosy: +ncoghlan ___ Python tracker _

[issue15964] SyntaxError in asdl when building 2.7 with system Python 3

2012-09-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: Attaching patch. I started a new section in the FAQ called "Build Troubleshooting" which is something Nick suggested in the context of addressing this issue. I'm sure we could add a couple more questions to this section right now if we wanted to. --

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Chris Jerdonek
Chris Jerdonek added the comment: In the future, now that a few more people know, we could always look to see what doc changes were made since the last "publication" of the docs (or run the other `make` commands locally, or ideally, beforehand in cases that warrant it). The fact that 2.7 publ

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: Hmm, the bug is in the 32-bit build. The 64-bit build is fine. Or do you mean MMX registers? -- ___ Python tracker ___

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: It's interesting that the compiler uses ecx:edx to represent a __int64 quantity when 64-bit registers are available... -- ___ Python tracker _

[issue10044] small int optimization

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: > "x+1 > x" and "v >= &array[0]" are not the same checks. > In the first test, x is used in both parts. I don't understand. The consequences of "undefined behavior" are really difficult to understand, it seems. A compiler which evaluates both relational expre

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: I usually get the result of the cronjob via email if there's a failure; for a few weeks now this went to my spam folder, so I didn't immediately see something was wrong. -- ___ Python tracker

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: > Given all the problems, I'll stop using PGO on all branches and > as the compiler apparently generates bad code. That is probably the best solution. The problem in memoryview.c:pack_single() is that Visual Studio optimizes the memcpy() to mov instructions, but

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Attached new refleakless patch. Your approach is dangerous, because the buffers may change size between two calls to PyObject_GetBuffer(). I think you should keep the Py_buffers alive in an array, and only release them at the end (it may also be slightly faste

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: Attached new refleakless patch. -- Added file: http://bugs.python.org/file27259/issue15958-3.diff ___ Python tracker ___ _

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, given the following works: >>> import array >>> a = array.array('d', [1.2345]) >>> b'' + a b'\x8d\x97n\x12\x83\xc0\xf3?' It should also work for bytes.join(). I guess that means I'm against the strict-typedness of memoryviews. As the name suggests, it pr

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Martin v . Löwis
Changes by Martin v. Löwis : -- resolution: -> fixed status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: Unfortunately (?) I now cannot produce this myself, anymore, either. Given all the problems, I'll stop using PGO on all branches and targets, as the compiler apparently generates bad code. Anybody curious to investigate the issue further who is able to reprod

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: Also, perhaps we can keep a fast path for bytes and bytearray, but I didn't time the difference. -- ___ Python tracker ___

[issue15988] Inconsistency in overflow error messages of integer argument

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: 1) Use PyLong_AsLongAndOverflow instead PyLong_AsLong in PyArg_ParseTuple and in some other functions. 2) Unify an integer overflow error messages in different functions. -- ___ Python tracker

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: We would need to release the buffers and also check for format 'B'. With issue15958-2.diff this is possible: >>> import array >>> a = array.array('d', [1.2345]) >>> b''.join([b'ABC', a]) b'ABC\x8d\x97n\x12\x83\xc0\xf3?' It is unfortunate that a PyBUF_SIMPLE reque

[issue10044] small int optimization

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Victor, the danger of this approach is that we can't verify that a particular compiler with certain options on a specific platform compiles the source code with undefined behavior in a certain way. If such a test were possible, if this aspect was guaranteed

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: Indeed. Attached new patch. Tests still need to be improved; bytearrays are still not changed. -- Added file: http://bugs.python.org/file27258/issue15958-2.diff ___ Python tracker _

[issue2281] Enhanced cPython profiler with high-resolution timer

2012-09-22 Thread Kristján Valur Jónsson
Kristján Valur Jónsson added the comment: >There is another major issue: you have to synchronize the counter of all >CPU >cores. Windows XP didn't synchronize the counters, and it was a major >issue >on QueryPerformanceCounter. >http://support.microsoft.com/?id=896256 I don't understand why yo

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I think memoryview here is example only, and Antoine had in mind arbitrary buffer objects. -- ___ Python tracker ___

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: Sorry, the line numbers are messed up. They should be: Objects/memoryobject.c:1569 Objects/memoryobject.c:1776 -- ___ Python tracker ___ _

[issue10044] small int optimization

2012-09-22 Thread Mark Dickinson
Mark Dickinson added the comment: Victor: so you want to *deliberately* introduce undefined behaviour for the sake of a minor optimization, while crossing your fingers and *hoping* that that doesn't cause issues with any existing or future compilers? -- ___

[issue15993] Windows: 3.3.0-rc2.msi: test_buffer fails

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: System: Windows 7 64-bit Build (unpatched): PCBuild\Win32-pgo\python.exe, trained with profile.bat In the unpatched version, I stepped through this test case in the debugger: import array a = array.array('Q', [1]) m = memoryview(a) m[0] = 1 At Objects/memoryobj

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: This should be fixed now. It would be nice if Sphinx could send a notification mail in case of failure, so that the next time we will notice and fix the problem earlier. -- assignee: docs@python -> ezio.melotti resolution: -> fixed stage: -> committed/

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Roundup Robot
Roundup Robot added the comment: New changeset 0799fd1f8887 by Ezio Melotti in branch '3.2': #15949, 15899: avoid using non-latin1 chars in the doc (they break `make all-pdf`). http://hg.python.org/cpython/rev/0799fd1f8887 New changeset 832999a97e59 by Ezio Melotti in branch 'default': #15949,

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: I'm working on it. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue15949] docs.python.org not getting updated

2012-09-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: I think the issue was #15899, and the change 8a40bc71c072. -- ___ Python tracker ___ ___ Python-bug

[issue12067] Doc: remove errors about mixed-type comparisons.

2012-09-22 Thread Mark Dickinson
Mark Dickinson added the comment: > I determined that 'raise TypeError' and 'return NotImplemented' both > result in the call of the reflected method Are you sure? raise TypeError *should* result in the operation being abandoned, with the reflected operation not tried. Python 3.3.0rc2+ (defa

[issue15958] bytes.join() should allow arbitrary buffer objects

2012-09-22 Thread Ezio Melotti
Ezio Melotti added the comment: Attached patch adds support for memoryviews to bytes.join: >>> b''.join([memoryview(b'foo'), b'bar']) b'foobar' The implementation currently has some duplication, because it does a first pass to calculate the total size to allocate, and another pass to create th

[issue15900] Memory leak in PyUnicode_TranslateCharmap()

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: Done as 89f62f143920. -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue15973] Segmentation fault on timezone comparison

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: Done as ec77f8fb9958. -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing li

[issue15973] Segmentation fault on timezone comparison

2012-09-22 Thread Stefan Krah
Stefan Krah added the comment: This one: 63cb0a642c84 -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue15926] Segmentation fault after multiple reinitializations

2012-09-22 Thread Georg Brandl
Georg Brandl added the comment: Picked as 6708224f8bee. -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing