[issue8054] "as_string" method in email's mime objects encode text segmentedly

2010-03-04 Thread Dongying Zhang
Dongying Zhang added the comment: Hello R. David Murray: Thanks for your care. The examples I given both in message and file is just the same. You got the 'UnicodeEncodeError' because your system default encoding is ascii. The declaration of encoding at the top didn't help with this situatio

[issue887237] Machine integers

2010-03-04 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I would like to hear from Thomas before introducing macros in this code. I tried to follow the style of cfield.c which shows similar code duplication. There are also some questions that need to be answered before polishing the code. 1. Should mixed arit

[issue887237] Machine integers

2010-03-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le Fri, 05 Mar 2010 02:21:30 +, Alexander Belopolsky a écrit : > > Code duplication is unavoidable because the goal is to give access to > machine arithmetics which means (# types) x (# operations) of very > similar looking functions. I considered reducing

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Ezio Melotti
Ezio Melotti added the comment: This is a proof that you can have an equivalent regex without including all the 'letter chars' (tested on both narrow and wide builds): >>> s = u''.join(unichr(c) for c in range(sys.maxunicode)) >>> diff = set(re.findall(u'[^\W\d]', s, re.U)) ^ set(re.findall(u'[

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: Fix for _ssl module: replace _PyUnicode_AsString() by PyArg_ParseTuple() with PyUnicode_FSConverter. This change fixes also ssl for file system encoding different than utf8. I added a test on surrogates. The test fails if surrogates can be encoded to the file

[issue6697] Check that _PyUnicode_AsString() result is not NULL

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: Here is a fix for object.c (object_pyunicode_asstring-py3k.patch): - PyObject_GenericGetAttr(): Replace PyErr_Format("... %.400s", ..., _PyUnicode_AsString(name)) by PyErr_Format("... %U", ..., name), as done in PyObject_GenericSetAttr(). Note that the string

[issue444582] Finding programs in PATH, addition to os

2010-03-04 Thread Jan Killian
Jan Killian added the comment: Adapted Brian Curtin's http://bugs.python.org/file15381/ shutil_which.patch and made another reference implementation as a standalone module including the following fixes: * uses ``PATHEXT`` on Windows * searches current directory before ``PATH`` on Windows, but

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Ezio Melotti
Ezio Melotti added the comment: A workaround could be using [^\W\d], but this includes some extra chars in the categories Pc, Nl, and No that maybe you don't want. Generate a list of chars in these 3 categories and add them in the regex should be cheaper though. Since this is not a bug of Pyth

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: > So is it reasonable / unavoidable that UCS4 builds should be 1200 times > slower at regex handling? No, but it's probably reasonable / unavoidable that a more complex regex should be some number of times slower than a simpler regex. On Linux, the rege

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Michael Foord
Michael Foord added the comment: So is it reasonable / unavoidable that UCS4 builds should be 1200 times slower at regex handling? -- ___ Python tracker ___

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: Ooops, my benchmark was wrong. It looks like the result depends sys.maxunicode: $ python2.4 -c "import sys; print sys.maxunicode" 1114111 $ python2.5 -c "import sys; print sys.maxunicode" 1114111 $ python2.6 -c "import sys; print sys.maxunicode" 1114111 $ ./pyt

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: Results on Linux (Debian Sid) with different Python versions: * Python 2.4.6: 14112.8 ms * Python 2.5.5: 14246.7 ms * Python 2.6.4+: 14753.4 ms * Python trunk (2.7a3+): 69.3 ms It looks like re engine was optimized in trunk :-) Note: I replaced stopwatch b

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Jean-Paul Calderone
Jean-Paul Calderone added the comment: I think it's likely that the test program does drastically different things on Linux than it does on OS X: Python 2.6.4 (r264:75706, Dec 7 2009, 18:45:15) [GCC 4.4.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> im

[issue8064] Large regex handling very slow on Linux

2010-03-04 Thread Oliver Sturm
New submission from Oliver Sturm : The code in regextest.py (attached) uses a large regex to analyze a piece of text. I have tried this test program on two Macs, using the standard Python distributions. On a MacBook, 2.4 GHz dual core, Snow Leopard with Python 2.6.1, it takes 0.08 seconds On

[issue8063] Call _PyGILState_Init() earlier in Py_InitializeEx()

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: haypo> I already hitted this bug some weeks ago when I was working haypo> on the thread state preallocation when creating a new thread: haypo> #7544. According to msg97715: it was indirectly the same issue, call _PyObject_Dump() while the GIL is not initializ

[issue8063] Call _PyGILState_Init() earlier in Py_InitializeEx()

2010-03-04 Thread STINNER Victor
New submission from STINNER Victor : _PyGILState_Init() initialize autoInterpreterState variable. This variable have to be set before the first call to PyGILState_Ensure(). The problem is that _PyGILState_Init() is called late: at the end of Py_InitializeEx(). It's called after initsite(), whe

[issue7805] test_multiprocessing failure

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: Sometimes it triggers a different issue, with patch applied (ia64 Ubuntu trunk): test_multiprocessing test test_multiprocessing failed -- Traceback (most recent call last): File "/home/pybot/buildarea/trunk.klose-debian-ia64/build/Lib/test/test_multiprocess

[issue7143] get_payload(decode=True) eats last newline in base64 encoded payload

2010-03-04 Thread Joaquin Cuenca Abela
Joaquin Cuenca Abela added the comment: I added a new subpart to msg_10.txt, that keeps the previous test and also tests the new behavior. Let me know if it's ok like this or if you still prefer to create a different msg file for testing this. Thanks, -- versions: +Python 2.5 Added f

[issue2777] subprocess unit tests for kill, term and send_signal flaky

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: Re-enabled on r78662 and r78663. Buildbots seems happy, except Windows XP + Cygwin buildbot: == FAIL: test_kill (test.test_subprocess.Win32ProcessTestCase)

[issue8048] doctest assumes sys.displayhook hasn't been touched

2010-03-04 Thread Noam Yorav-Raphael
Noam Yorav-Raphael added the comment: Ok, here's a patch (against current svn of Python 2) with a test case. I had to fix three tests which combined pdb and doctest, since now, when run under doctest, pdb steps into the displayhook because it's a Python function and not a built-in function. T

[issue8062] PEP 3101 string formatting missing hexadecimal separator _ for every 4 hex digits

2010-03-04 Thread steven Michalske
New submission from steven Michalske : It is a common practice to separate hex digits with a "thousands" separator every 4 hex digits. 0x1234_abcd Although python does not accept the _ as a thousands separator in hex notation, neither is the thousands separator in base 10 Snippet that print

[issue2777] subprocess unit tests for kill, term and send_signal flaky

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: I experienced this hang with Linux AMD64. It occurs in test_send_signal. It is because signal.SIGINT is not always handled (see #3137). As a workaround, there's 2 choices: add a delay between Popen and send_signal, or retry SIGINT 2 or 3 times. Windows shou

[issue8060] PEP 3101 string formatting missing engineering presentation type for floating point

2010-03-04 Thread Ezio Melotti
Ezio Melotti added the comment: Before 2010-04-03, see http://www.python.org/dev/peps/pep-0373/. New features can be added only in alpha versions. -- ___ Python tracker ___

[issue8060] PEP 3101 string formatting missing engineering presentation type for floating point

2010-03-04 Thread R. David Murray
R. David Murray added the comment: Not likely to make 2.7, either, unless someone comes forward with a patch real quick. -- nosy: +r.david.murray ___ Python tracker ___

[issue8060] PEP 3101 string formatting missing engineering presentation type for floating point

2010-03-04 Thread Eric Smith
Eric Smith added the comment: This would be a new feature, so it can't be added to 2.6 or 3.2. It's an interesting idea, though. -- assignee: -> eric.smith nosy: +mark.dickinson ___ Python tracker ___

[issue7755] copyright clarification for audiotest.au

2010-03-04 Thread Barry A. Warsaw
Barry A. Warsaw added the comment: Let's go back to using this file. It's taken from Python 1.5.1 and it's me saying "My hovercraft is full of eels". I've already signed the contributor agreement. -- Added file: http://bugs.python.org/file16434/audiotest.au

[issue8060] PEP 3101 string formatting missing engineering presentation type for floating point

2010-03-04 Thread steven Michalske
New submission from steven Michalske : I started using the .format() on strings and was surprised that it was lacking an built in format specifier for engineering notation. For those unfamiliar with engineering notation it puts the exponent of the number in modulo 3 so that it is in alignment

[issue1537721] csv module: add header row to DictWriter

2010-03-04 Thread Dirkjan Ochtman
Dirkjan Ochtman added the comment: Committed in r78660 after positive comment from briancurtin re Windows. Hopefully this fixes Solaris, as well. -- ___ Python tracker ___ __

[issue7540] urllib2 request does not update content length after new add_data

2010-03-04 Thread Fred L. Drake, Jr.
Fred L. Drake, Jr. added the comment: Reopening; per discussion on IRC, the change needs to be reverted on the other three branches to which it was applied. If code changes are needed to make unsupported usage fail early, they need to be considered carefully and only applied as a new feature.

[issue1537721] csv module: add header row to DictWriter

2010-03-04 Thread Dirkjan Ochtman
Dirkjan Ochtman added the comment: Testing on Windows with this: Index: Lib/test/test_csv.py === --- Lib/test/test_csv.py(revision 78430) +++ Lib/test/test_csv.py(working copy) @@ -9,6 +9,7 @@ import tempfile impo

[issue8053] test_thread fails on Windows

2010-03-04 Thread Gregory P. Smith
Gregory P. Smith added the comment: right that logic is inverted. my bad. its fine in trunk already as it uses @unittest.skipIf there. that decorator doesn't exist in 2.6. fixed in r78659 -- resolution: -> fixed status: open -> closed ___ Pytho

[issue1537721] csv module: add header row to DictWriter

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: according to the buidbots, it hurts some platforms: Windows XP, Windows 7 and sparc Solaris10 * sparc solaris10 test_writerows (test.test_csv.Test_Csv) ... ok == FAIL: test_write_simple_d

[issue7143] get_payload(decode=True) eats last newline in base64 encoded payload

2010-03-04 Thread R. David Murray
R. David Murray added the comment: Thanks for working on this. For the most part your patch looks fine. Two comments: (1) it concerns me that by co-opting the existing test, we are no longer testing that decoding does not introduce a spurious newline :). (2) I think we should add a comment

[issue2973] _ssl compiler warnings

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: On Gentoo buildbots (2.x and 3.x), there's still the same compiler warnings: http://www.python.org/dev/buildbot/all/builders/x86%20gentoo%20trunk/builds/5899 /home/buildslave/python-trunk/trunk.norwitz-x86/build/Modules/_ssl.c:706: warning: passing arg 2 of `

[issue8058] incorrect behavior of get_filename() method in email pkg

2010-03-04 Thread R. David Murray
R. David Murray added the comment: Duplicate of issue 7082. However, I fixed the documentation in r78656. -- nosy: +r.david.murray priority: -> normal resolution: -> duplicate stage: -> committed/rejected status: open -> closed superseder: -> Patch for get_filename in email.message

[issue8058] incorrect behavior of get_filename() method in email pkg

2010-03-04 Thread daz
New submission from daz : get_filename() does not parse the Content-Type header for a "name" parameter. This is the old-style RFC 1341 header. Example: Content-Type: application/octet-stream; name="somefile.pdf" Content-Transfer-Encoding: base64 The email package documentation states: get_fi

[issue8057] Impreciseness in bz2 module documentation?

2010-03-04 Thread Andreas Poisel
New submission from Andreas Poisel : A string in Python 3 is a sequence of unicode characters, right? The documentation of the bz2 module says: 8<-- class bz2.BZ2File(filename, mode='r', buffering=0, compresslevel=9) [...] write(da

[issue6792] Distutils-based installer does not detect 64bit versions of Python

2010-03-04 Thread Stephen White
Stephen White added the comment: 32bit apps can query the 64bit registry, using the appropriate security and access rights options such as KEY_WOW64_64KEY (0x0100). Similarly KEY_WOW64_32KEY can be used for 64bit apps to read/write the 32bit registry without having to have knowledge of how th

[issue7143] get_payload(decode=True) eats last newline in base64 encoded payload

2010-03-04 Thread Joaquin Cuenca Abela
Joaquin Cuenca Abela added the comment: Hi, I've never before made a patch to Python, so take it with care. A couple of comments, I reused a test where all the attachments contained an ending newline, except for the base64 one (conveniently...) I think the comment in _bdecode that Andreas qu

[issue8055] Sleeping after acquiring RLock causes acquire to block in other thread

2010-03-04 Thread Antoine Pitrou
Antoine Pitrou added the comment: You are just having wrong expectations. Releasing a lock doesn't guarantee that any other thread waiting on it will be scheduled preemptively. So, if you re-acquire the lock immediately, the other thread will not necessarily have had the opportunity of runnin

[issue8056] Piped parent's multiprocessing.Process children cannot write to stdout

2010-03-04 Thread Vilnis Termanis
New submission from Vilnis Termanis : Affects Win32 only (tested under Ubuntu 9.10-64 and XP-32 with v2.6.4). If script output is piped, child processes created via multiprocessing.Process cannot write to stdout. Also, trying to call stdout.flush() in child processes causes IOError. Normal be

[issue8054] "as_string" method in email's mime objects encode text segmentedly

2010-03-04 Thread R. David Murray
R. David Murray added the comment: Using python 2.6.4, your first example gives me an error: UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-18: ordinal not in range(128) while your second example works, as you indicated. So, at the moment I can not reproduce the bug

[issue7540] urllib2 request does not update content length after new add_data

2010-03-04 Thread R. David Murray
R. David Murray added the comment: Fred, I think your report of observed breakage is sufficient to warrant rolling back the change, especially since this isn't an actual bug fix. That is, no code that was failing to work before would be enabled to work by this fix. (Rather, it aims to preve

[issue8055] Sleeping after acquiring RLock causes acquire to block in other thread

2010-03-04 Thread Knut Eldhuset
New submission from Knut Eldhuset : In essence I have the following loop running in thread A: while True: with self.lock: time.sleep(0.1) I then try to acquire the lock in thread B. This blocks forever on Linux, but runs fine on Windows XP. The following modification makes the cod

[issue1054943] Python may contain NFC/NFKC bug per Unicode PRI #29

2010-03-04 Thread STINNER Victor
STINNER Victor added the comment: Commited: r78646 (trunk), r78647 (py3k), r78648 (3.1). Leave the issue open to remember me that I have to backport to 2.6 (after the 2.6.5 release). -- ___ Python tracker

[issue7805] test_multiprocessing failure

2010-03-04 Thread Florent Xicluna
Florent Xicluna added the comment: Thanks Stefan for the analysis. This patch should fix the issue, and make the buildbots happy. -- stage: needs patch -> patch review Added file: http://bugs.python.org/file16429/issue7805_process_is_alive_py3.diff _

[issue8054] "as_string" method in email's mime objects encode text segmentedly

2010-03-04 Thread Dongying Zhang
New submission from Dongying Zhang : The as_string method in mime classes in module email.mime use base64 to encode the text, but segmentedly while the text contents non-acsii characters and is in type of unicode. This behavior confuse some of the email servers. For example: ===

[issue6538] MatchObject is not a hyperlink in the 're' module documentation

2010-03-04 Thread Ryan Arana
Ryan Arana added the comment: Added .. class:: MatchObject and .. class:: RegexObject directives. -- Added file: http://bugs.python.org/file16427/MatchObjectLinksFix.diff ___ Python tracker