[issue13922] argparse handling multiple "--" in args improperly

2012-03-18 Thread Jeff Knupp

Jeff Knupp  added the comment:

I don't know that this is a bug. Rather, the string '--' means different things 
to argparse and optparse. In argparse, '--' is a psuedo-argument taken to mean 
"everything after this is a postional argument" and not "stop processing 
arguments", which is the optparse meaning. In that context it doesn't seem like 
removing additional '--' is a bug in argparse, since additional '--' would 
merely be restating the same thing.

--
nosy: +Jeff.Knupp

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



[issue13922] argparse handling multiple "--" in args improperly

2012-03-18 Thread Jeff Knupp

Jeff Knupp  added the comment:

In that case, wouldn't you use 'parse_known_args' instead of 'parse_args'
and pass the remaining arguments to the next script? This case is
explicitly mentioned in the argparse documentation. Again it seems to me
that the meaning of '--' has changed slightly between optparse and
argparse. Whether or not that was correct or intended is perhaps another
isssue.

On Sun, Mar 18, 2012 at 1:32 PM, Eric V. Smith wrote:

>
> Eric V. Smith  added the comment:
>
> I agree with David. It's a bug. I have programs (not using argparse yet)
> that do exactly what he describes.
>
> --
>
> ___
> Python tracker 
> <http://bugs.python.org/issue13922>
> ___
>

--

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



[issue13922] argparse handling multiple "--" in args improperly

2012-03-18 Thread Jeff Knupp

Jeff Knupp  added the comment:

Added patch so that only the first '--' is removed by an argparse.PARSE or 
argparse.REMAINDER argument. Note that, as Steven said, argparse.REMAINDER 
should be used in the OP's issue (and the added test makes sure all remaining 
arguments are preserved even if they appear in the parent parser).

--
keywords: +patch
Added file: http://bugs.python.org/file24936/argparse.patch

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Jeff Knupp  added the comment:

Patch to default character set to utf8 if non-ascii characters are found in the 
input string. Please let me know if this is what you had in mind.

--
nosy: +Jeff.Knupp

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Changes by Jeff Knupp :


--
keywords: +patch
Added file: http://bugs.python.org/file24997/mailutf8.patch

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Jeff Knupp  added the comment:

Understood. Please take a look at the updated patch. Also, removed the 
unrelated diffs that somehow were hanging around in my hg mq.

--
Added file: http://bugs.python.org/file24999/mimeutf8.patch

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



[issue14399] zipfile and creat/update comment

2012-03-26 Thread Jeff Knupp

Jeff Knupp  added the comment:

I'm unable to reproduce on either 2.7 or 3.3. Running the following:

from zipfile import ZipFile

z=ZipFile('test.zip','a')
z.comment='Create a new comment'
z.close()

produces the output:

Archive:  test.zip
Create a new comment

with the comment changed to b'...' for 3.3. Note that in 3.3 if you set the 
comment to a string and try to close, an exception will be raised and the 
test.zip file will not have a comment. 

Odd that I don't see the bug on either branch. Can someone else confirm?

--
nosy: +Jeff.Knupp

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



[issue14421] Avoid ResourceWarnings in ccbench

2012-03-26 Thread Jeff Knupp

New submission from Jeff Knupp :

ccbench.py warns about unclosed sockets in the bandwidth test. Fix to close 
socket properly at end of test.

--
components: Demos and Tools
files: ccbench.patch
keywords: patch
messages: 156891
nosy: Jeff.Knupp
priority: normal
severity: normal
status: open
title: Avoid ResourceWarnings in ccbench
type: behavior
Added file: http://bugs.python.org/file25035/ccbench.patch

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



[issue15166] Implement imp.get_tag() using sys.implementation

2012-06-26 Thread Jeff Knupp

Jeff Knupp  added the comment:

Adding patch. If I misunderstood the issue, let me know.

--
keywords: +patch
nosy: +Jeff.Knupp
Added file: http://bugs.python.org/file26170/imp.patch

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



[issue15033] Different exit status when using -m

2012-07-03 Thread Jeff Knupp

Jeff Knupp  added the comment:

Fixed for 3.3. Does this need to be back ported as well?

--
keywords: +patch
nosy: +Jeff.Knupp
Added file: http://bugs.python.org/file26244/exit_code.patch

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



[issue15033] Different exit status when using -m

2012-07-03 Thread Jeff Knupp

Jeff Knupp  added the comment:

And by 'Fixed' I of course meant 'Patched, awaiting review'.

--

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



[issue15702] Multiprocessing Pool deadlocks on join after empty map operation

2012-08-16 Thread Jeff Knupp

Jeff Knupp added the comment:

This is a duplicate of http://bugs.python.org/issue12157, which was fixed.

--
nosy: +Jeff.Knupp

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

New submission from Jeff Knupp:

urllib was updated to deprecate a number of Request methods for 3.3. The 
test_urllib2 and test_urllib tests still use some of the deprecated methods.

--
components: Tests
messages: 168692
nosy: Jeff.Knupp
priority: normal
severity: normal
status: open
title: test_urllib2/test_urllib use deprecated urllib.Request methods
type: behavior
versions: Python 3.3

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

Jeff Knupp added the comment:

Attaching patch.

--
keywords: +patch
Added file: http://bugs.python.org/file26935/test_urllib.patch

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

Changes by Jeff Knupp :


Removed file: http://bugs.python.org/file26935/test_urllib.patch

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

Jeff Knupp added the comment:

Updated with correct patch file.

--
Added file: http://bugs.python.org/file26936/test_urllib.patch.2

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

Jeff Knupp added the comment:

Senthil, sorry, missed your comment and hadn't realized anyone had seen the 
patch yet. I replaced it with an updated version (had missed a few places 
deprecated functions were used). Could you review the new patch instead?

--

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-08-20 Thread Jeff Knupp

Jeff Knupp added the comment:

Yes, that was part of the original patch which was incorrectly uploaded. The 
current patch (2) should be correct wrt get_method.

--

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



[issue15752] change test_json's use of deprecated unittest function

2012-08-21 Thread Jeff Knupp

New submission from Jeff Knupp:

patch to test_json to not use assert(Raises)Regexp, which has been deprecated 
in favor of assert(Raises)Regex.

--
components: Tests
files: json_deprecated.patch
keywords: patch
messages: 168750
nosy: Jeff.Knupp
priority: normal
severity: normal
status: open
title: change test_json's use of deprecated unittest function
versions: Python 3.3
Added file: http://bugs.python.org/file26944/json_deprecated.patch

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



[issue15316] runpy swallows ImportError information with relative imports

2012-08-22 Thread Jeff Knupp

Changes by Jeff Knupp :


--
nosy: +Jeff.Knupp

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



[issue16687] Fix small gramatical error and add reference link in hashlib documentation

2012-12-14 Thread Jeff Knupp

New submission from Jeff Knupp:

Original text is: 

> Feeding string objects is to update is not supported

Should be "... objects in to update" instead of "is to"

Also, mark "GIL" as a :term: to provide a link to its definition, as it's used 
without much context in the following note:

> .. note::
>
>   For better multithreading performance, the Python :term:`GIL` is 
>   released for strings of more than 2047 bytes at object creation or
>   on update.

--
assignee: docs@python
components: Documentation
files: patch.txt
messages: 177507
nosy: Jeff.Knupp, docs@python
priority: normal
severity: normal
status: open
title: Fix small gramatical error and add reference link in hashlib 
documentation
versions: Python 3.5
Added file: http://bugs.python.org/file28318/patch.txt

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



[issue15743] test_urllib2/test_urllib use deprecated urllib.Request methods

2012-12-14 Thread Jeff Knupp

Changes by Jeff Knupp :


--
resolution:  -> fixed
status: open -> closed

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



[issue16702] Force urllib2_localnet test not to use http proxies

2012-12-17 Thread Jeff Knupp

New submission from Jeff Knupp:

test_urllib2_localnet is concerned with testing connections only using 
'localhost' or '127.0.0.1' hosts. If a user has the "http_proxy" environment 
variable set, these test will likely fail as the proxy won't have any idea 
where to send a request for 'localhost'.

Patch makes urllib.request.urlopen ignore proxies set in the environment. Note 
that this only works for http proxies. https proxies are trickier and require 
more work.

--
components: Tests
files: test_proxy.patch
keywords: patch
messages: 177654
nosy: Jeff.Knupp
priority: normal
severity: normal
status: open
title: Force urllib2_localnet test not to use http proxies
type: behavior
versions: Python 3.4
Added file: http://bugs.python.org/file28343/test_proxy.patch

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



[issue16658] Missing "return" in HTTPConnection.send()

2012-12-17 Thread Jeff Knupp

Jeff Knupp added the comment:

I'm assuming this is the patch you were looking for. However, there are a 
couple of unrelated issues with http.client.send that jumped out at me:

1. Encoding a file handed directly to send() seems wrong. If a client wants to 
send a file encoded using something other than iso-8859-1, we've effectively 
short-circuited that. Since the normal request() calls take care of encoding, 
it seems send() should be for those that 'know what they're doing'. 

Also, nowhere in the send() documentation does it state that send() will 
perform this encoding (and only on a file, but not on a string?).

Removing the burden of encoding if a file-like object is passed seems more 
reasonable and would make the code considerably clearer. If anyone agrees, I'll 
open a new ticket with patch for this issue.

--
keywords: +patch
nosy: +Jeff.Knupp
Added file: http://bugs.python.org/file28345/http_client.patch

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



[issue16687] Fix small gramatical error and add reference link in hashlib documentation

2012-12-20 Thread Jeff Knupp

Jeff Knupp added the comment:

Previous patch had unintentional local changes. Uploaded correct patch.

--
Added file: http://bugs.python.org/file28382/new_patch.txt

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



[issue16687] Fix small gramatical error and add reference link in hashlib documentation

2012-12-20 Thread Jeff Knupp

Changes by Jeff Knupp :


Removed file: http://bugs.python.org/file28318/patch.txt

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



[issue16988] argparse: PARSER option for nargs not documented

2013-01-18 Thread Jeff Knupp

Jeff Knupp added the comment:

This is not a bug.

The 'PARSER' nargs choice is an implementation detail as a way to handle 
subparsers. The parser needs to know that the first value should be handled, 
but everything that follows will be handled by the subparser.

By using a subparser, you're effectively using 'PARSER', but it wouldn't make 
sense to allow 'PARSER' to be set directly as it only makes sense when used in 
conjunction with a subparser.

--
nosy: +jeffknupp

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



[issue16977] argparse: mismatch between choices parsing and usage/error message

2013-01-18 Thread Jeff Knupp

Jeff Knupp added the comment:

Attached a patch. Rather than altering choices or making a special check for 
string instances, I just changed the if statement to

if action.choices is not None and value not in list(action.choices):

from 

if action.choices is not None and value not in action.choices:

It has the added benefit of handling all sequence types correctly (rather than 
just strings). I tried to think of a case where this wouldn't work as expected, 
but wasn't able to.

--
keywords: +patch
nosy: +jeffknupp
Added file: http://bugs.python.org/file28769/argparse.patch

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



[issue16989] allow distutils debug mode to be enabled more easily

2013-01-18 Thread Jeff Knupp

Jeff Knupp added the comment:

Patch uploaded. 

Note that updating the test_distutils.core test revealed that the test was 
importing DEBUG from the wrong module (which only existed because 
distutils.core use the 'from ... import DEBUG' form). I've corrected the import 
and updated the test case.

Also updated the documentation to reflect the change.

--
keywords: +patch
nosy: +jeffknupp
Added file: http://bugs.python.org/file28770/distutils.patch

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



[issue16977] argparse: mismatch between choices parsing and usage/error message

2013-01-18 Thread Jeff Knupp

Jeff Knupp added the comment:

The only time this would be an issue is for infinite sequences via range or a 
generator, which doesn't work anyway.

>>> p = argparse.ArgumentParser()
>>> a = p.add_argument('a', choices=itertools.count(0), type=int)
>>> p.parse_args(['1'])
... hangs

Are there any other cases where coercing to a list wouldn't work?

--

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



[issue17383] Error in documentation /2/tutorial/modules.html#more-on-modules

2013-03-08 Thread Jeff Knupp

Jeff Knupp added the comment:

I think Piotr's point is the wording of the last sentence is ambiguous. The 
second statement reads "It is customary *but not required* to place all import 
statements at the beginning of a module...". The third seems to state that 
regardless of whether or not you followed the custom, module names are always 
placed in the global symbol table.

I think the last two sentences need to be rewritten to remove ambiguity. If, at 
this point, we only want to explain that importing a module makes that modules 
names available then that's what the documentation should say (even more so if 
the term "symbol table" hasn't been introduced yet, which would effectively 
render the entire block useless).

--
nosy: +jeffknupp

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



[issue17383] Possibly ambiguous phrasing in tutorial/modules#more-on-modules

2013-03-08 Thread Jeff Knupp

Jeff Knupp added the comment:

Of the "two different things", the first (the scope of imported names) is never 
covered in the documentation. As a result, the text in question seems to imply 
an import statement can *only* be in module scope. 

>From the reader's perspective: "If I wanted to import something in a class or 
>function it obviously can't be at the top of the file, so I guess I can't do 
>that." The tutorial doesn't disabuse them of this notion.

--

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



[issue17483] In urlopen the check_hostname variable can never be False.

2013-03-19 Thread Jeff Knupp

Jeff Knupp added the comment:

Was this discovered when you were trying "to tell urlopen not to check the 
hostname for https connections?" If so, that should be reflected in the title 
so others know what the observable effect is. Referencing specific variables is 
less useful both for searching later and because the fix may not touch that 
part at all (as you alluded to, it may require refactoring).

--
nosy: +jeffknupp

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