Re: [Python-Dev] C Decimal - is there any interest?
On 10/19/07, Facundo Batista <[EMAIL PROTECTED]> wrote: > 2007/10/16, Daniel Stutzbach <[EMAIL PROTECTED]>: > > I agree. A basic subquadratic radix conversion algorithm isn't much > > more complex than the existing quadratic code. I just whipped > > together a Python prototype and it's only 15 lines. > > Do you have a patch for decimal.py of current trunk? I don't, though I could make one. However, currently the int->Decimal conversion takes place in C via str(). Here's the relevant line from decimal.py: self._int = tuple(map(int, str(abs(value Doing some simple experiments, a Python subquadratic routine doesn't make a big pay off until around 25,000 decimal digits. On the plus side, the extra overhead of the additional routine is small and I didn't observe a noticeable performance penalty for small inputs (my routine calls str() as a base case for values less than 2**31-1). So... would the community rather have a Python patch for decimal.py or a patch for subquadratic versions of long_format and PyLong_FromString in longobject.c? The later will be faster and will speed up some non-Decimal operations as well. -- Daniel Stutzbach, Ph.D. President, Stutzbach Enterprises LLC ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
[Python-Dev] Bug in smtpd.SMTPChannel.smtp_MAIL
smtpd.SMTPChannel contains a bug such that when connected to an SMTPServer (or any subclass thereof), issuing a MAIL command with no argument closes the socket and gives this error on the server: error: uncaptured python exception, closing channel (:'NoneType' object is unsubscriptable [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|read|68] [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|handle_read_event|390] [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asynchat.py|handle_read|137] [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|found_terminator|158] [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|smtp_MAIL|224] [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|__getaddr|212]) The desired result is of course is to respond with a 501 Syntax error. The problem arises because the arg parameter passed to each smtp_* command handler function is None when there is no argument. arg is passed on to __getaddr which attempts a slice on the None object. I think the most elegant solution would be to insert a "if not arg" check in __getaddr and return. The existing smtp_MAIL code will then issue the 501 Syntax error. -Derek Shockey ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Bug in smtpd.SMTPChannel.smtp_MAIL
Could you submit a patch to the bug tracker (bugs.python.org)? 2007/10/20, Derek Shockey <[EMAIL PROTECTED]>: > smtpd.SMTPChannel contains a bug such that when connected to an SMTPServer > (or any subclass thereof), issuing a MAIL command with no argument closes > the socket and gives this error on the server: > > error: uncaptured python exception, closing channel < smtpd.SMTPChannel > connected 127.0.0.1:58587 at 0x847d8> ( 'exceptions.TypeError'>:'NoneType' object is unsubscriptable > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|read|68] > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|handle_read_event|390] > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asynchat.py|handle_read|137] > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|found_terminator|158] > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|smtp_MAIL|224] > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|__getaddr|212]) > > The desired result is of course is to respond with a 501 Syntax error. The > problem arises because the arg parameter passed to each smtp_* command > handler function is None when there is no argument. arg is passed on to > __getaddr which attempts a slice on the None object. > > I think the most elegant solution would be to insert a "if not arg" check in > __getaddr and return. The existing smtp_MAIL code will then issue the 501 > Syntax error. > > > -Derek Shockey > > ___ > Python-Dev mailing list > Python-Dev@python.org > http://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: > http://mail.python.org/mailman/options/python-dev/guido%40python.org > > -- --Guido van Rossum (home page: http://www.python.org/~guido/) ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] Bug in smtpd.SMTPChannel.smtp_MAIL
I did actually submit a patch last night after I emailed the list. The issue ID is 1307. I used the ternary operator (because I like it and because it was the shortest solution), but if this is not desirable for backwards compatibility, I could obviously rewrite it another way. -Derek Shockey On 10/21/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Could you submit a patch to the bug tracker (bugs.python.org)? > > 2007/10/20, Derek Shockey <[EMAIL PROTECTED]>: > > smtpd.SMTPChannel contains a bug such that when connected to an > SMTPServer > > (or any subclass thereof), issuing a MAIL command with no argument > closes > > the socket and gives this error on the server: > > > > error: uncaptured python exception, closing channel < smtpd.SMTPChannel > > connected 127.0.0.1:58587 at 0x847d8> ( > 'exceptions.TypeError'>:'NoneType' object is unsubscriptable > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|read|68] > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asyncore.py|handle_read_event|390] > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/asynchat.py|handle_read|137] > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|found_terminator|158] > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|smtp_MAIL|224] > > > [/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/smtpd.py|__getaddr|212]) > > > > The desired result is of course is to respond with a 501 Syntax error. > The > > problem arises because the arg parameter passed to each smtp_* command > > handler function is None when there is no argument. arg is passed on to > > __getaddr which attempts a slice on the None object. > > > > I think the most elegant solution would be to insert a "if not arg" > check in > > __getaddr and return. The existing smtp_MAIL code will then issue the > 501 > > Syntax error. > > > > > > -Derek Shockey > > > > ___ > > Python-Dev mailing list > > Python-Dev@python.org > > http://mail.python.org/mailman/listinfo/python-dev > > Unsubscribe: > > http://mail.python.org/mailman/options/python-dev/guido%40python.org > > > > > > > -- > --Guido van Rossum (home page: http://www.python.org/~guido/) > ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com