[Python-bugs-list] [ python-Bugs-430849 ] binascii.a2b_base64(""): internal error

noreply@sourceforge.net noreply@sourceforge.net
Wed, 06 Jun 2001 22:54:03 -0700


Bugs item #430849, was updated on 2001-06-06 14:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=430849&group_id=5470

Category: Extension Modules
Group: None
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: Peter Schneider-Kamp (nowonder)
Assigned to: Peter Schneider-Kamp (nowonder)
>Summary: binascii.a2b_base64(""): internal error

Initial Comment:
On trying to decode an empty string with
binascii.a2b_base64 a SystemError is encountered:

>>> binascii.a2b_base64("")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
SystemError: Objects/stringobject.c:2589: bad argument
to internal function

The function that raises the SystemError is
_PyString_Resize of stringobject.c fame.

A quick&dirty fix is attached.

----------------------------------------------------------------------

>Comment By: Peter Schneider-Kamp (nowonder)
Date: 2001-06-06 22:54

Message:
Logged In: YES 
user_id=14463

checked in with "Cannot decode empty input"

----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2001-06-06 14:47

Message:
Logged In: YES 
user_id=31435

Accepted, although if the error condition is that the input 
is empty, it would be better to change the error msg to 
*say* that instead of the much vaguer "not enough data".  
That is, don't make the user guess what "not enough" means.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=430849&group_id=5470