[issue8635] enumerate() docstring doesn't cover optional start argument

2010-05-09 Thread Daniel Urban
Daniel Urban added the comment: Attached a patch. It changes the docstring to: "enumerate(iterable[, start]) -> iterator for index, value of iterable Return an enumerate object. iterable must be another object that supports iteration, start must be an integer (defaults to 0). The e

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sat, May 8, 2010 at 8:07 AM, Martin v. Löwis wrote: > 1. add a flag to PyModuleDef, indicating whether the module was built in > UCS-2 or UCS-4 mode. Then let the interpreter refuse the load the module, > instead of having the dynamic linker

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Sun, May 9, 2010 at 10:12 AM, Marc-Andre Lemburg wrote: > I'm just not sure how you could check for optimization > compiler bugs/features using the buildbots. > Once I have a patch that I'm modestly confident in, I'll write autom

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17273/unnamed ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list mailin

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17274/unnamed ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list mailin

[issue7584] datetime.rfcformat() for Date and Time on the Internet

2010-05-09 Thread Daniel Urban
Daniel Urban added the comment: Here is a new patch. The name of the optional argument is "default_utcoffset" which is obviously too long, but I can't think a better name. Any suggestions? (I think simply "utcoffset" would be misleading, because the value of the a

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17248/unicode.patch ___ Python tracker <http://bugs.python.org/issue8654> ___ ___ Python-bugs-list m

[issue8654] Improve ABI compatibility between UCS2 and UCS4 builds

2010-05-09 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Here is a new patch. Usage, short version: By default, modules compile in Unicode-agnostic mode, where Py_UNICODE is an incomplete type. Unicode-agnostic modules will load in both UCS2 and UCS4 interpreters. If a module defines PY_REAL_PY_UNICODE

[issue8676] Py3k Built-in Exceptions documentation mentions the raise statement of 2.x

2010-05-10 Thread Daniel Urban
New submission from Daniel Urban : In the documentation of the exceptions (http://docs.python.org/dev/py3k/library/exceptions) there is a sentence: "The associated value is the second argument to the raise statement." But in py3k there is a different raise statement t

[issue1641] asyncore delayed calls feature

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 11:55 AM, Giampaolo Rodola' wrote: > Moreover, reset() and delay() methods are not implemented in sched. > > Other problems which comes to mind are: you can't easily know whether a call > has already bee

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : (Making an educated guess about who to add to the Nosy list) Attached is a patch to improve math.factorial by using a divide-and-conquer algorithm. The old algorithm performs n-1 multiplications, mostly on numbers with a very large number of digits

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 4:18 PM, Alexander Belopolsky wrote: > While the error message is wrong in both cases, I think OverflowError is a > better exception in this case and there should not be a difference between > math.factorial(2.

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 5:33 PM, Alexander Belopolsky wrote: > It seems to me that the value of n for which number of digits will exceed > sys.maxsize can be estimated fairly accurately using Stirling formula.  Only > two values are relevant in

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 7:15 PM, Alexander Belopolsky wrote: > The main value in setting a theoretically justified limit is that > overflow exception can carry a meaningful message, e.g. "factorial > result would have too many digits&qu

[issue8692] Use divide-and-conquer for faster factorials

2010-05-11 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Tue, May 11, 2010 at 7:38 PM, Alexander Belopolsky wrote: > Speaking of micro-optimizations, did you consider a better than naive > algorithm for "Count the number of set bits in n" in your patch? > HAKMEM 169 comes to mind and being a

[issue8699] Equality and hashing for functools.partial

2010-05-12 Thread Daniel Urban
New submission from Daniel Urban : On python-dev came up an idea [1] to support equality (== and !=) and hashing by functools.partial instances. Van Lindberg provided an implementation written in Python [2]. I've made a very similar implementation in C (in Modules/_functoolsmodule.c).

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Thank you both for the valuable feedback. I'm working on a revised patch that incorporates your many suggestions. I decided to use an iterative version for two reasons: - the reference has a note at the bottom in a tiny font suggesting it - I fou

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 10:31 AM, Alexander Belopolsky wrote: > if ((k & 1) != 1) >          k = k - 1; > > looks odd to me. Maybe k += (k & 1) - 1? If we change the logic slightly to put the odd entry on the right instead of the left, w

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 12:59 PM, Mark Dickinson wrote: > (4) And please do restore the PyLong_FromDouble line in the main routine, > rather than using a C double-to-long cast.  The direct conversion again leads > to undefined behaviour for larg

[issue8692] Use divide-and-conquer for faster factorials

2010-05-12 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: On Wed, May 12, 2010 at 3:34 PM, Alexander Belopolsky wrote: > I wonder if one could write an elegant recursive version that would > multiply first by last in partial_product. That could be done with a three-parameter partial_product, where the

[issue8699] Equality and hashing for functools.partial

2010-05-13 Thread Daniel Urban
Daniel Urban added the comment: Sorry, I realized I made a stupid mistake. (I didn't use PyList_Sort to sort the list in partial_hash.) Here is the corrected patch. -- Added file: http://bugs.python.org/file17315/partial_eq_hash_2.diff ___ P

[issue8703] Py3k PyList_Type documentation mentions types.ListType

2010-05-13 Thread Daniel Urban
New submission from Daniel Urban : The Py3k documentation of PyList_Type [1] contains the sentence: "This is the same object as list and types.ListType in the Python layer." But there is no types.ListType object in py3k. [1] http://docs.python.org/dev/py3k/c-api/list.html#P

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-13 Thread Daniel Stutzbach
New submission from Daniel Stutzbach : If the CGI script crashes before finishing the headers, cgitb will emit invalid HTTP headers before showing the error message. Below are HTTP headers I received, captured with a packet sniffer. Note the "<--: spam". HTTP/1.1 200 OK Date

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-13 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : -- keywords: +easy ___ Python tracker <http://bugs.python.org/issue8704> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue8699] Equality and hashing for functools.partial

2010-05-13 Thread Daniel Urban
Daniel Urban added the comment: On python-dev Yaniv Aknin pointed out that the keywords dictionary of a partial object is mutable [1]. This causes problems with hashing and equality. The new patch replaces the keywords dictionary with a read-only proxy of that dictionary. This seems to

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: After experimenting with changing the order of the multiplications and not having much luck, I went back and looked for other differences in Alexander's Python functions that might cause the speed difference. I believe partial_product2 is fast becau

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Isn't it amazing how fast one can make incorrect code? ;-) Here is a fixed version of my partial_product3, but now it is no faster than partial_product. def partial_product3(j, i): a = [l << 1 | 1 for l in range(j, i + 1)] n = len(a)

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Speaking of getting side-tracked, I didn't see an answer to a question I asked earlier. I'd like to get some feedback before I proceed with revising the patch. For the find-last-set-bit (to replace log2) and count-set-bits operations, w

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: That's a clever idea. Do you have a Python script that generates the precomputed values? -- ___ Python tracker <http://bugs.python.org/i

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It's a little too clever though. It gives the wrong answer for 29!. I'll have a revised version of my patch done sometime tomorrow. -- ___ Python tracker <http://bugs.python.

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Attached is a patch to improve the unit tests for the factorial function. To compute the check value, it keeps a running total instead of recomputing the factorial from scratch inside the loop. It checks up to range(999) and is quite fast. The previous

[issue8692] Use divide-and-conquer for faster factorials

2010-05-13 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Attached is a simple bash script to run math.factorial(n) through timeit for several values of n. It makes comparing the speed of different builds MUCH easier. -- Added file: http://bugs.python.org/file17329/factorial-speed.sh

[issue8704] cgitb sends a bogus HTTP header if the app crashes before finishing headers

2010-05-14 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: It displays correctly in some browsers, yes, but not everything that speaks HTTP is a browser. For example, the invalid header makes C#'s WebRequest throw an exception. I hadn't noticed the 'Content-Type' on the next line of the str

[issue8692] Use divide-and-conquer for faster factorials

2010-05-14 Thread Daniel Stutzbach
Changes by Daniel Stutzbach : Removed file: http://bugs.python.org/file17300/factorial.patch ___ Python tracker <http://bugs.python.org/issue8692> ___ ___ Python-bug

[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2007-12-06 Thread Daniel Arbuckle
New submission from Daniel Arbuckle: [EMAIL PROTECTED] is working up a patch for this. -- components: Library (Lib) messages: 58251 nosy: djarb severity: normal status: open title: asyncore and asynchat incompatible with Py3k str and bytes type: behavior versions: Python 3.0

[issue1641] asyncore delayed calls feature

2007-12-18 Thread Daniel Arbuckle
Changes by Daniel Arbuckle: -- nosy: +djarb __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1641> __ ___ Python-bugs-list mailing list Unsubs

[issue1124861] subprocess fails on GetStdHandle in interactive GUI

2008-01-08 Thread Daniel Serodio
Daniel Serodio added the comment: I found this bug via this post: http://mail.python.org/pipermail/python-list/2007-April/436275.html And I think 2.5.1 still has this bug. I'm not familiar with Python bugtracker's "ettiquete", should I reopen this bug? --

[issue1815] Distutils add ability to skip build [Feature Request]

2008-01-12 Thread Daniel Eloff
New submission from Daniel Eloff: There seems to be no way to skip the build step when running "setup.py install" The behavior in such a case should be to skip build and use the existing binaries as created in a separate build step or else print an error. That way you can do "

[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2008-02-13 Thread Daniel Arbuckle
Changes by Daniel Arbuckle: Added file: http://bugs.python.org/file9428/asyn_py3k_restructured.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1563> __ ___

[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2008-02-13 Thread Daniel Arbuckle
Changes by Daniel Arbuckle: Added file: http://bugs.python.org/file9427/asyn_py3k.diff __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1563> __ ___ Python-bugs-

[issue1736190] asyncore/asynchat patches

2008-02-14 Thread Daniel Arbuckle
Changes by Daniel Arbuckle: -- nosy: +djarb _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1736190> _ ___ Python-bugs-list mailing list Unsubs

[issue1124861] subprocess fails on GetStdHandle in interactive GUI

2008-02-16 Thread Daniel Serodio
Daniel Serodio added the comment: Is there any chance of having this fixed for 2.5.2 ? _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1124861> _ ___ Pyth

[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: The resolution on this bug reads, "In future versions of Python, Guido would like to change the design to hide the induction variable. So, someday, you'll get your wish." Can this bug be re-opened and the wart removed in 3.0? -- n

[issue1110705] list comprehension scope

2008-02-21 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Wonderful! _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1110705> _ ___ Python-bugs-list mailing list Unsubs

[issue2235] __eq__ / __hash__ check doesn't take inheritance into account

2008-03-16 Thread Daniel Krech
Changes by Daniel Krech <[EMAIL PROTECTED]>: -- nosy: +eikeon __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2235> __ ___ Python-bugs-list mailing

[issue1641] asyncore delayed calls feature

2008-03-19 Thread Daniel Arbuckle
Daniel Arbuckle <[EMAIL PROTECTED]> added the comment: Unfortunately, it appears that asyncore and asynchat are caught in a deadlock, in which it is demanded that certain patches be applied before any further work is done, but nobody (even among those making the demands) is both willing an

[issue2480] pickling of recursive sets of objects fails

2008-03-25 Thread Daniel Darabos
New submission from Daniel Darabos <[EMAIL PROTECTED]>: In the attached demo I create a graph of 250 nodes, all of which are connected to every other node, and this is represented by a set attribute of the Node objects. When I try to pickle this graph, it fails in various ways. In r

[issue2480] pickling of large recursive structures fails

2008-03-25 Thread Daniel Darabos
Daniel Darabos <[EMAIL PROTECTED]> added the comment: So now I've learned that this is a result of the way Pickler is implemented. I think that it would make sense to create an implementation that is not that recursive and that would handle such structures better. I have now writt

[issue2480] pickling of large recursive structures fails

2008-03-25 Thread Daniel Darabos
Changes by Daniel Darabos <[EMAIL PROTECTED]>: Added file: http://bugs.python.org/file9851/picklertest.py __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2480> __

[issue2480] pickling of large recursive structures fails

2008-03-25 Thread Daniel Darabos
Daniel Darabos <[EMAIL PROTECTED]> added the comment: Sidenote: If I click "edit" for nonrecursivepickler.py, I get told that "File has been classified as spam." Strange. Should I not use Viagra as a classname? :) (j/k I didn't do anything like that) However I

[issue2536] itertools.permutations docstring is misleading

2008-04-02 Thread Daniel Diniz
New submission from Daniel Diniz <[EMAIL PROTECTED]>: Currently, Modules/itertoolsmodule.c lines 2471-2475 are: PyDoc_STRVAR(permutations_doc, "permutations(iterables[, r]) --> permutations object\n\ \n\ Return successive r-length permutations of elements in the iterable.\n\n

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: This patch updates the behavior as per "The Energy Policy Act of 2005": Start: Second Sunday in March End: First Sunday in November Time: 2 am local time -- keywords: +patch nosy: +ajaksu2

[issue2210] Nested module import clutters package namespace

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Not a bug IMHO, but a gotcha. Change x.py to "from pack import y as q" and you get the desired result. Check http://effbot.org/zone/import-confusion.htm -- nosy: +ajaksu2 __ Tracker &

[issue2534] Speed up isinstance and issubclass

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: The test fails on this: def g(): try: return g() except ValueError: return -1 self.assertRaises(RuntimeError, g) Changing that "return -1" to "return sys.exc_info()" shows that a RuntimeErr

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: That was a such silly mistake, sorry :) Updated patch tries to keep the old behavior, but I just found out it's mostly wrong too (DST start and end days changed a bit in the last 80 years). >From http://aa.usno.nav

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Er... 2007- : from the second Sunday in March to the first Sunday in November. :/ __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-02 Thread Daniel Diniz
Changes by Daniel Diniz <[EMAIL PROTECTED]>: Removed file: http://bugs.python.org/file9926/tzinfo-examples.patch __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2534] Speed up isinstance and issubclass

2008-04-02 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Thomas: I confirm your patch triggers this behavior. I can reliably get a __subclasscheck__ error by trying to "import sys" after the bogus catching happens: >>> def g(): ... try: ... return g() ... except V

[issue2542] PyErr_ExceptionMatches must not fail

2008-04-03 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: The tests pass and prints the ignores. But I still see an issue: import sys def g(): try: return g() except: return sys.exc_info() >>> g() (, 'maximum recursion depth exceeded while cal

[issue2548] Undetected error in exception handling

2008-04-04 Thread Daniel Diniz
Changes by Daniel Diniz <[EMAIL PROTECTED]>: -- nosy: +ajaksu2 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2548> __ ___ Python-bugs-list mailing

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-05 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: New patch. I added the new rule and changed the old behavior to be wrong (a bit) less often. It may mess with code that depended on the previous wrong results. Given the (AFAIK) exemplificative nature of this file, this should not be

[issue508157] urllib.urlopen results.readline is slow

2008-04-05 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Well, this issue is still hurting performance, the most recent example was with a developer of a download manager. I suggest adding a buffer size argument to HTTPResponse.__init__ (defaulting to zero), along with docs that explain the pr

[issue2548] Undetected error in exception handling

2008-04-06 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: I've identified rev58032 [1] as the one introducing this issue. It's Brett's code, fixing a nasty crasher and adding a pre-built exception (PyExc_RecursionErrorInst). [1] http://svn.python.org/view?rev=58032&view=rev

[issue2525] class USTimeZone in Doc/includes/tzinfo-examples.py is out of date

2008-04-07 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Changed the local dststart, dstend variables to lowercase, "dates" to "times" (in "find start and end times") and the diff was created from trunk/ this time (as opposed to trunk/Doc/includes/). Added f

[issue2571] cmd.py always uses raw_input, even when another stdin is specified

2008-04-07 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: I don't think it should stop using raw_input just because you changed stdin, as you can change it to something that will work with raw_input. Consider: >>> import sys >>> sys.stdin = open("/dev/tty") >&

[issue2576] httplib read() very slow due to lack of socket buffer

2008-04-07 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: The code patch is trivial. I believe it needs docs (both explaining how to use and warning against the problems it may cause), a NEWS entry and tests (at least to check what happens when an invalid value lands). I can work on those chan

[issue1285086] urllib.quote is too slow

2008-04-08 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: This is what I found doing some timings: For the short-circuit path, the regexp can make quote 10x as fast in exceptional cases, even comparing to the faster version in trunk. The average win for short-circuit seems to be twice as fast

[issue2576] httplib read() very slow due to lack of socket buffer

2008-04-08 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: "The code patch is trivial", he said, only to find out it was not :) Facundo, thanks in advance for taking a look at this! This patch tries to implement, document and test an optional argument to HTTPConnection, wh

[issue902061] pydoc insists upon producing file: URLs

2008-04-12 Thread Daniel Diniz
Changes by Daniel Diniz <[EMAIL PROTECTED]>: -- versions: +Python 2.6 Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue902061> ___ Python-bugs

[issue2600] BindingHTTPConnectionWithTimeout and BindingHTTPHandlerWithTimeout

2008-04-12 Thread Daniel Diniz
Changes by Daniel Diniz <[EMAIL PROTECTED]>: -- versions: +Python 2.6 -Python 2.4, Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2600> __ _

[issue836088] Update htmllib to HTML 4.01

2008-04-12 Thread Daniel Diniz
Changes by Daniel Diniz <[EMAIL PROTECTED]>: -- versions: +Python 2.6 -Python 2.5 Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue836088> __

[issue2576] httplib read() very slow due to lack of socket buffer

2008-04-12 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Also reported in #1542407 __ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2576> __ ___ Python-bugs

[issue1156280] cmd.Cmd().cmdloop() can't read from file

2008-04-12 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Superseded by #2571 The user can change cmd.Cmd.use_rawinput to False and get the desired behaviour. -- nosy: +ajaksu2 _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue1721241] code that writes the PKG-INFO file doesnt handle unicode

2008-04-12 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Currently tracked in #2562 -- nosy: +ajaksu2 versions: +Python 2.6 _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue1779700] urlparse.urljoin does not obey current uri rfc (rfc 3986)

2008-04-12 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Duplicate of #1591035 -- nosy: +ajaksu2 _ Tracker <[EMAIL PROTECTED]> <http://bugs.python.o

[issue2195] urlparse() does not handle URLs with port numbers properly

2008-04-12 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Discussed in #754016 -- nosy: +ajaksu2 versions: +Python 2.6 -Python 2.5 __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2676] email/message.py [Message.get_content_type]: Trivial regex hangs on pathological input

2008-04-23 Thread Daniel Diniz
New submission from Daniel Diniz <[EMAIL PROTECTED]>: [Reported by Alberto Casado Martín [1]] Message.get_content_type() hangs when very large values are split by the regex: ctype = paramre.split(value)[0].lower().strip() #line 439 paramre comes from line 26: paramre = re.compile(r&

[issue2702] pickling of large recursive structures crashes cPickle

2008-04-27 Thread Daniel Darabos
New submission from Daniel Darabos <[EMAIL PROTECTED]>: The documentation[1] says: Trying to pickle a highly recursive data structure may exceed the maximum recursion depth, a RuntimeError will be raised in this case. You can carefully raise this limit with sys.setrecursionlimit()

[issue2480] eliminate recursion in pickling

2008-04-27 Thread Daniel Darabos
Daniel Darabos <[EMAIL PROTECTED]> added the comment: I have also described the crash, but it makes sense to handle it separately. So I have created issue 2702, and changed the title of this issue. -- title: pickling of large recursive structures fails -> eliminate rec

[issue2702] pickling of large recursive structures crashes cPickle

2008-04-27 Thread Daniel Darabos
Daniel Darabos <[EMAIL PROTECTED]> added the comment: Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] on win32 (Windows XP Professional 32 bits) __ Tracker <[EMAIL PROTECTED]> <http://bugs.pytho

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-10 Thread Daniel Stutzbach
New submission from Daniel Stutzbach <[EMAIL PROTECTED]>: _winreg.EnumValue raises a WindowsError ("More data is available") if the registry data includes multibyte unicode characters. Inspecting PyEnumValue in _winreg.c, I believe I see the problem. The function uses Re

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-10 Thread Daniel Stutzbach
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment: The bug is in both. On Sat, May 10, 2008 at 12:52 PM, Martin v. Löwis <[EMAIL PROTECTED]> wrote: > > Martin v. Löwis <[EMAIL PROTECTED]> added the comment: > > Is that for Python 2.5 or 3.0?

[issue2810] _winreg.EnumValue fails when the registry data includes multibyte unicode characters

2008-05-11 Thread Daniel Stutzbach
Daniel Stutzbach <[EMAIL PROTECTED]> added the comment: After several failed attempts at making a test case, and stepping through C code with a debugger, I see that my initial diagnose is quite wrong. RegQueryInfoKey *does* return the sizes in units of bytes (even though the Mic

[issue4297] Add error_log attribute to optparse.OptionParser

2008-11-11 Thread Daniel Watkins
New submission from Daniel Watkins <[EMAIL PROTECTED]>: I've recently had to subclass optparse.OptionParser, and copy-paste the exit method, just to change where errors were printed to (I needed stdout rather than stderr). I've also had a request from a client to log errors w

[issue4631] urlopen returns extra, spurious bytes

2008-12-11 Thread Daniel Diniz
Daniel Diniz <[EMAIL PROTECTED]> added the comment: Confirmed: Python 3.1a0 (py3k:67702, Dec 11 2008, 11:09:14) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>>

[issue4631] urlopen returns extra, spurious bytes

2008-12-14 Thread Daniel Diniz
Daniel Diniz added the comment: Jeremy: no, it doesn't. Python 2.6.1+ (release26-maint:67716M, Dec 13 2008, 10:30:52) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 ~/release26-maint$ ./python -c "import urllib; print urllib.urlopen('http://bugs.debian.org/cgi-bin/bugreport.c

[issue4631] urlopen returns extra, spurious bytes

2008-12-14 Thread Daniel Diniz
Daniel Diniz added the comment: Took me a bit of Wiresharking to find this out, the problem is that we are asking for the page using HTTP 1.1 in 3.0. Here's a workaround patch for those who need it quick, I have yet to look at urllib to see what can be fixed there. --- Index: Lib

[issue4631] urlopen returns extra, spurious bytes

2008-12-14 Thread Daniel Diniz
Daniel Diniz added the comment: Clarifying the diagnosis, the offending spurious bytes are only present when we use 3.0's GET above. That's because urllib.request.HTTPHandler asks for a vanilla http.client.HTTPConnection, which uses HTTP 1.1. IIUC, either we change the request versi

[issue4631] urlopen returns extra, spurious bytes

2008-12-15 Thread Daniel Diniz
Daniel Diniz added the comment: I think your patch is good, but there may be another bug around: I wrote a script to check results of 3.x against 2.x, but many pages (http://groups.google.com/, http://en.wikipedia.org/) give 403: Forbidden for 3.x... but work with 2.x! If you think of this as

[issue4688] GC optimization: don't track simple tuples and dicts

2008-12-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: I've looked very quickly over your patches to try to figure what rule qualifies a tuple or dict as simple enough to be untracked, out of curiosity. For tuples, I think the rule is: If an object is immutable, and it points only to untracked objects

[issue4688] GC optimization: don't track simple tuples and dicts

2008-12-17 Thread Daniel Stutzbach
Daniel Stutzbach added the comment: Unfortunately, the check is O(n), so it can get a little expensive. I suppose that's no worse than traversing the tuple to look for a cycle, though. Perhaps it could be done at the same time? Can _PyObject_GC_UNTRACK() be safely called from tp_tra

[issue4683] urllib2.HTTPDigestAuthHandler fails on third hostname?

2008-12-18 Thread Daniel Diniz
Daniel Diniz added the comment: Chris, Is there a chance that this is some sort of protection on LJ's side? Does a given instance mean the same connection being reused? What happens with longer sleeps? -- nosy: +ajaksu2 ___ Python tracker

[issue4683] urllib2.HTTPDigestAuthHandler fails on third hostname?

2008-12-18 Thread Daniel Diniz
Daniel Diniz added the comment: Hmm, notice that AbstractDigestAuthHandler handles retries: class AbstractDigestAuthHandler: def __init__(self, passwd=None): ... self.retried = 0 ... def reset_retry_count(self): self.retried = 0 def

[issue4707] round() shows undocumented behaviour

2008-12-21 Thread Daniel Diniz
Daniel Diniz added the comment: Hi Mark, I think there's an overflow for ndigits that predates your patch: >>> round(2, -2**31 +1) 2 >>> round(2, -2**31 +2) nan (it looks like these lines above make 2.6 hang :/) Now, I'm getting a segfault in 3.0 when Ctrl + C-ing

[issue4707] round() shows undocumented behaviour

2008-12-21 Thread Daniel Diniz
Daniel Diniz added the comment: Mark Dickinson wrote: > I don't think the hang itself should be considered a bug, any more > than the hang from "10**(2**31-1)" is a bug. Well, besides the fact that you can stop "10**(2**31-1)" with Ctrl+C but not round(2, -2**31

[issue4733] Add a "decode to declared encoding" version of urlopen to urllib

2008-12-23 Thread Daniel Diniz
New submission from Daniel Diniz : This patch adds a version of urlopen that uses available encoding information to return strings instead of bytes. The main goal is to provide a shortcut for users that don't want to handle the decoding in the easy cases[1]. One added benefit it tha

[issue4791] retrlines('LIST') and dir hang at end of listing in ftplib (python3.0)

2009-01-01 Thread Daniel Diniz
Daniel Diniz added the comment: Hi Chris Since dir calls retrlines and retrlines has a 'while 1:' loop, the bug probably comes from there. Either it hangs in the fp.readline call or the break condition is never met. Can you put some print diagnostics inside Lib/ftplib.py->

[issue4753] Faster opcode dispatch on gcc

2009-01-03 Thread Daniel Diniz
Daniel Diniz added the comment: IIUC, this is what gcc 4.2.4 generates on a Celeron M for the code Alexandre posted: movl-272(%ebp), %eax movl8(%ebp), %edx subl-228(%ebp), %eax movl%eax, 60(%edx) movl-272(%ebp), %ecx movzbl

[issue4753] Faster opcode dispatch on gcc

2009-01-03 Thread Daniel Diniz
Daniel Diniz added the comment: Paolo 'Blaisorblade' Giarrusso wrote: > > 1st note: is that code from the threaded version? [...] It is vital to > this patch that the jump is not shared, something similar to > -fno-crossjumping should be found. Yes, threaded vers

[issue4676] python3 closes + home keys

2009-01-04 Thread Daniel Diniz
Daniel Diniz added the comment: I can't reproduce this with py3k on linux, but I do get a traceback in the terminal used to launch idle: Exception in Tkinter callback Traceback (most recent call last): File "/home/ajaksu/py3k/Lib/tkinter/__init__.py", line 1399, in __ca

<    3   4   5   6   7   8   9   10   11   12   >