[issue14177] marshal.loads accepts unicode strings

2012-03-02 Thread guilherme-pg

guilherme-pg  added the comment:

The attached patch attempts to solve the issue.

It makes sure marshal.loads only accepts objects conforming to the buffer 
protocol, updates the documentation for the method accordingly, adds a test 
case and updates existing test cases that rely on this issue.

Please excuse any obvious mistakes in the patch, this is my first contribution 
and I'll be glad to iterate until it's good.

--
keywords: +patch
nosy: +guilherme-pg
Added file: 
http://bugs.python.org/file24715/14177-marshal-loads-deny-strings.patch

___
Python tracker 
<http://bugs.python.org/issue14177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14177] marshal.loads accepts unicode strings

2012-03-02 Thread guilherme-pg

guilherme-pg  added the comment:

Oops, sorry, that was unintended.

I uploaded a new version of the patch with the correct documentation update, 
making it explicit that loads() expects a bytes object.

--
Added file: 
http://bugs.python.org/file24717/14177-marshal-loads-deny-strings-2.patch

___
Python tracker 
<http://bugs.python.org/issue14177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14177] marshal.loads accepts unicode strings

2012-03-02 Thread guilherme-pg

guilherme-pg  added the comment:

Guilherme Gonçalves 

Thanks for the quick review.

--

___
Python tracker 
<http://bugs.python.org/issue14177>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14191] argparse: nargs='*' doesn't get out-of-order positional parameters

2012-03-06 Thread guilherme-pg

guilherme-pg  added the comment:

I uploaded an incomplete patch that might address the issue so it can be 
discussed.

This patch introduces 'greedy_star', a new constructor parameter to 
ArgumentParser that makes "*" positional arguments behave as expected in the 
test case.

The patch doesn't yet update the documentation and doesn't include test cases, 
but I'll be glad to provide those changes in a next version.

It is admittedly hackish, but I haven't found a better solution so far. Looking 
forward for your comments.

------
keywords: +patch
nosy: +guilherme-pg
Added file: http://bugs.python.org/file24745/14191.diff

___
Python tracker 
<http://bugs.python.org/issue14191>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14233] argparse: "append" action fails to override default values

2012-03-08 Thread guilherme-pg

New submission from guilherme-pg :

Trying to set a default value to arguments whose action is "append" causes 
argparse to raise AttributeError when such arguments are provided in the 
command line (see attached test case t1.py).

This happens because _AppendAction doesn't expect the presence of a default 
value for the argument: when the command line is parsed and the argument is 
found, _AppendAction attempts to append the new value to the list of old 
values, if any, or the old list. In case there is already a non-list default 
value, it attempts to append the new value to it, which raises the exception.

Is this intended behavior? If so, shouldn't ArgumentError be raised instead? It 
should also be easy to fix this issue otherwise, making _StoreAction ensure the 
old values are stored in a list before appending.

--
components: Library (Lib)
files: t1.py
messages: 155195
nosy: bethard, guilherme-pg
priority: normal
severity: normal
status: open
title: argparse: "append" action fails to override default values
type: crash
versions: Python 3.3
Added file: http://bugs.python.org/file24761/t1.py

___
Python tracker 
<http://bugs.python.org/issue14233>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue14233] argparse: "append" action fails to override default values

2012-03-08 Thread guilherme-pg

Changes by guilherme-pg :


--
type: crash -> behavior

___
Python tracker 
<http://bugs.python.org/issue14233>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com