[issue15219] Leak in _hashlib.new() if argument is not a string

2012-06-28 Thread Michael Fötsch
New submission from Michael Fötsch foet...@yahoo.com: If the name argument to _hashlib.new() is not a string, the reference count for the string argument is not decremented. In the file Modules/_hashopenssl.c, function EVP_new(), a call to PyBuffer_Release() is missing: if (!PyArg_Parse

[issue15219] Leak in _hashlib.new() if argument is not a string

2012-06-28 Thread Michael Fötsch
Michael Fötsch foet...@yahoo.com added the comment: The change is against the 2.7 branch. The 3.2 branch is not affected. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15219

Re: Is it possible to get the erroneous variable when getting a NameError exception?

2009-12-26 Thread Michael Fötsch
Stephen Hansen wrote: Dotan Barak wrote: snip ... eval(my_number 10, {__builtins__:None}, {}) snip Hm, is this true, though? Is there anything subtle or dangerous possible here? He's using eval-- so no statements, its only an expression. He's passing in a

Re: flatten a list of list

2009-08-16 Thread Michael Fötsch
Terry wrote: Is there a simple way (the pythonic way) to flatten a list of list? This is probably the shortest it can get: sum(list_of_lists, []) Kind Regards, M.F. -- http://mail.python.org/mailman/listinfo/python-list

Re: unicode() vs. s.decode()

2009-08-08 Thread Michael Fötsch
Michael Ströder wrote: timeit.Timer(unicode('äöüÄÖÜß','utf-8')).timeit(1000) 17.23644495010376 timeit.Timer('äöüÄÖÜß'.decode('utf8')).timeit(1000) 72.087096929550171 That is significant! So the winner is: unicode('äöüÄÖÜß','utf-8') Which proves that benchmark results can be