[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Manuel Jacob

New submission from Manuel Jacob:

When evaluating, signed zero complex numbers aren't recovered correctly.
 -0j
(-0-0j)
 (-0-0j)
0j
 0j
0j

According to 
http://docs.python.org/dev/reference/datamodel.html#object.__repr__ the 
representation can be used to recreate an object with the same value. Shouldn't 
this also be possible with complex numbers?

When using complex('...'), round-trip works correctly. While this can be used 
to recover the exact number, i find it confusing that complex('...') isn't the 
same as eval('...').
 complex('-0j')
-0j
 complex('(-0-0j)')
(-0-0j)
 complex('0j')
0j

--
messages: 183313
nosy: mjacob
priority: normal
severity: normal
status: open
title: Complex number representation round-trip doesn't work with signed zero 
values
type: behavior
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti, mark.dickinson, skrah

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

 For one thing, I think resources could be implemented in terms of skips

While working on #17333 I noticed a related problem.  Most of the tests in 
test_imaplib are skipped if the 'network' resource is not specified.  The test 
contains the following lines to enable those tests when the file is executed 
directly:

if __name__ == __main__:
support.use_resources = ['network']
unittest.main()

but this clearly doesn't work while using unittest discovery, so those tests 
are skipped.

Implementing resources as skips makes sense, but we might also need a way to 
specify what resources are needed that works with unittest discovery.  Running 
these tests only when the test file is executed directly or through `regrtest 
-u` is also an option.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17333] Fix test discovery for test_imaplib.py

2013-03-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 02bbc5375a56 by Ezio Melotti in branch '3.3':
#17333: test_imaplib now works with unittest test discovery.  Patch by Zachary 
Ware.
http://hg.python.org/cpython/rev/02bbc5375a56

New changeset b8bafae4a15a by Ezio Melotti in branch 'default':
#17333: merge with 3.3.
http://hg.python.org/cpython/rev/b8bafae4a15a

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17333
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17333] Fix test discovery for test_imaplib.py

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!
As noted in msg183314, several tests are not included while using unittest 
discovery, but that's a separate issue.

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17333
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17334] Fix test discovery for test_index.py

2013-03-02 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 886df716cd09 by Ezio Melotti in branch '3.3':
#17334: test_index now works with unittest test discovery.  Patch by Zachary 
Ware.
http://hg.python.org/cpython/rev/886df716cd09

New changeset 1c71882938eb by Ezio Melotti in branch 'default':
#17334: merge with 3.3.
http://hg.python.org/cpython/rev/1c71882938eb

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17334
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17334] Fix test discovery for test_index.py

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

--
assignee:  - ezio.melotti
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17334
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Eric V. Smith

Changes by Eric V. Smith e...@trueblade.com:


--
nosy: +eric.smith

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10716] Modernize pydoc to use better HTML and separate CSS

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

 Is there a prefered style guide for css that we should use?

If you mean indentation/spacing, my preferred style is:

selector {
property1: value1;
property2: value2;
...
}

FWIW I agree an HTML5 doctype should be used.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10716
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12301] Use :role:`sys.thing` instead of ``sys.thing`` throughout

2013-03-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
type:  - enhancement
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12301
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7855] Add test cases for ctypes/winreg for issues found in IronPython

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Dino, what's the status of this?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7855
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10712] 2to3 fixer for deprecated unittest method names

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Can this still go on 2.7/3.2/3.3?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10712
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11787] File handle leak in TarFile lib

2013-03-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11787
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15866] encode(..., 'xmlcharrefreplace') produces entities for surrogate pairs

2013-03-02 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15866
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-02 Thread karl

karl added the comment:

http://hg.python.org/cpython/file/3.3/Lib/urllib/request.py#l359

def add_header(self, key, val):
# useful for something like authentication
self.headers[key.capitalize()] = val

and http://hg.python.org/cpython/file/3.3/Lib/urllib/request.py#l271
in __init__ of class Request:

for key, value in headers.items():
self.add_header(key, value)

Tests seem to be there, but there are none. Is there a reason why there are no 
tests?
http://hg.python.org/cpython/file/3.3/Lib/test/test_urllib2.py#l98

Or should I add a test in
http://hg.python.org/cpython/file/3.3/Lib/test/test_urllib.py

I'm confused :) 
I need guidance.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17337] input() and raw_input() do not work correctly with colored prompts

2013-03-02 Thread mic_e

New submission from mic_e:

With a prompt that uses ANSI color escape codes, python3 input() and python2 
raw_input() behave incorrectly when it comes to the wrapping of the first line 
- almost certainly due to the wrong string length calculation.
The line breaking occurs k characters early, where k is the number of 
characters in the ANSI escape sequence.
Even worse, the line break does not switch to the next line, but instead jumps 
back to the beginning, overwriting the prompt and the previously written input.

How to reproduce:
Call input() with a color-coded string as argument, and type until you would 
expect the usual line break.

Example:

mic@mic-nb ~ $ python3
Python 3.3.0 (default, Dec 22 2012, 21:02:07) 
[GCC 4.7.2] on linux
Type help, copyright, credits or license for more information.
 prompt=\x1b[31;1mthis is a bold red prompt \x1b[m
 len(prompt)
37
 input(prompt)
uvwxyzs a bold red prompt abcdefghijklmnopqrst 
'abcdefghijklmnopqrstuvwxyz'
 
mic@mic-nb ~ $ python2
Python 2.7.3 (default, Dec 22 2012, 21:14:12) 
[GCC 4.7.2] on linux2
Type help, copyright, credits or license for more information.
 prompt=\x1b[31;1mthis is a bold red prompt \x1b[m
 len(prompt)
37
 raw_input(prompt)
uvwxyzs a bold red prompt abcdefghijklmnopqrst 
'abcdefghijklmnopqrstuvwxyz'
 
mic@mic-nb ~ $ tput cols
57

I have typed directly after the prompt the string 'abcdefghijklmnopqrstuvwxyz',
so the expected result would be be
this is a bold red prompt abcdefghijklmnopqrstuvwxyz
with four more characters of space before the line break

Note that the break occurs exactly 8 characters early, which is the total 
amount of ANSI escape sequence characters.
Also note that the readline module is impored in my .pyrc file.

--
components: Library (Lib)
messages: 183323
nosy: mic_e
priority: normal
severity: normal
status: open
title: input() and raw_input() do not work correctly with colored prompts
type: behavior
versions: Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17337] input() and raw_input() do not work correctly with colored prompts

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

I can reproduce the issue, but only from the interactive interpreter while 
using input() directly (Linux/py3).
I tried the following things:

$ ./python -c 'print(\x1b[31;1mthis is a bold red prompt \x1b[m, end=); 
input()'
$ ./python -c 'input(\x1b[31;1mthis is a bold red prompt \x1b[m);'
 print(\x1b[31;1mthis is a bold red prompt \x1b[m, end=); input()
 input(\x1b[31;1mthis is a bold red prompt \x1b[m)

In the first 3 cases once I reach the end of the line, the text went on a new 
line.  In the last case it started writing over the prompt instead of going on 
a newline, and once it reached the end of line again it went on a newline 
correctly.

--
nosy: +ezio.melotti
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Not yet, I wanted to make sure that everyone agrees on the change.
If I don't get other replies I'll commit it soon.

--
stage:  - patch review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-02 Thread Ram Rachum

Ram Rachum added the comment:

(I fixed the patch to not have a typo.)

--
Added file: 
http://bugs.python.org/file29290/cpython_patch1of1_8e9346e7ae87.patch.txt

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-02 Thread Ram Rachum

Changes by Ram Rachum r...@rachum.com:


Removed file: 
http://bugs.python.org/file29006/cpython_patch1of1_8e9346e7ae87.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17337] input() and raw_input() do not work correctly with colored prompts

2013-03-02 Thread Michael Enßlin

Michael Enßlin added the comment:

The issue might very well be strictly related to GNU readline.

I have both successfully reproduced it in a C program:

#include stdio.h
#include readline/readline.h
int main() {
readline(\x1b[31;1mthis is a bold red prompt\x1b[m );
}

gcc -lreadline test.c

and found a fix, hinted at by this stackoverflow post:
http://stackoverflow.com/questions/9468435/look-how-to-fix-column-calculation-in-python-readline-if-use-color-prompt

Readline uses the characters \x01 and \x02 to mark invisible portions of the 
prompt, so I am now pre-processing the prompt with this function:

def surround_ansi_escapes(prompt, start = \x01, end = \x02):
escaped = False
result = 

for c in prompt:
if c == \x1b and not escaped:
result += start + c
escaped = True
elif c.isalpha() and escaped:
result += c + end
escaped = False
else:
result += c

return result

However, in my opionion this fact deserves at least to be mentioned in the 
readline documentation.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17337
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread R. David Murray

R. David Murray added the comment:

We have previously discussed adding resource-awareness to unittest, but that is 
a much bigger project (API design, scope considerations, etc etc).  In the 
meantime, what we could do is modify the current resource-skip logic slightly: 
make it so that tests are *not* skipped for resource reasons *unless* some flag 
in support is set indicating that resource enforcement is in effect *and* the 
specified resource is not in the list of currently-asserted resources.  That 
way tests are only skipped for resource reasons if run via regrtest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10712] 2to3 fixer for deprecated unittest method names

2013-03-02 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Yes! 2to3 features are allowed in stable releases.
On Mar 2, 2013 5:17 AM, Ezio Melotti rep...@bugs.python.org wrote:


 Ezio Melotti added the comment:

 Can this still go on 2.7/3.2/3.3?

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue10712
 ___


--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10712
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

There are actually three separate issues here:
1) The resources don't use unittest skip (or at least not always), so while 
running the tests without regrtests there are no indication that some tests 
have been skipped.  This could be addressed by converting the current resources 
to proper skips (with something like @skip_unless_resource('network')) and 
shouldn't be too difficult.

2) The network resource could be enabled by default, given that network 
connectivity is nowadays fairly common (it would be even better if that was 
detected automatically at runtime).  This would enable more tests and shouldn't 
have negative side-effects (unless the network is not available and the tests 
have no way to realize that and fail).

3) unittest could have a resource API, but that's not strictly necessary if 
we still provide a way to run the skipped tests through regrtest and/or while 
running the test file individually.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Alex Gaynor

New submission from Alex Gaynor:

Following the length_hint PEP, we should expose this facility to end-python 
programmers. The semantics would be basically: the list has behavior identical 
to if you hadn't provided length_hint, except the VM is free to preallocate 
efficiently.

CPython (and PyPy) use this kind of logic internally all over the place when 
lists are to be returned (including, but not limited to, list() with a single 
argument!)

If this is considered to be a good idea I'll whip up a patch.

--
messages: 183332
nosy: alex
priority: normal
severity: normal
status: open
title: Add length_hint parameter to list, dict, set constructors to allow 
efficient presizing
type: performance
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue9334] argparse does not accept options taking arguments beginning with dash (regression from optparse)

2013-03-02 Thread Evgeny Kapun

Changes by Evgeny Kapun abacabadabac...@gmail.com:


--
nosy: +abacabadabacaba

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9334
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17331] namedtuple raises a SyntaxError instead of ValueError on invalid identifier

2013-03-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Thanks for the suggestion.  isidentifier() was exactly what was needed.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17331
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread R. David Murray

R. David Murray added the comment:

No controversy on (1), we should just do that.

I don't see a strong reason to change (2).  I always run the test suite with 
-uall, but if I were running a restricted set I'd rather not have resources 
outside the local machine be accessed.

My proposal is a way to provide (3): running the regrtest-resource-skipped 
tests when not running them through regrtest.  If you *also* want a way to skip 
tests based on resource when running them outside regrtest, then unittest would 
have to grow a resource API.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

 I'd rather not have resources outside the local machine be accessed.

Fair enough.

 If you *also* want a way to skip tests based on resource when running 
 them outside regrtest, then unittest would have to grow a resource API.

This can already be done though -- adding a resource API to unittest would just 
provide an additional way to do it without going through regrtest.

I don't think we will ever get rid of regrtest.  It would be nice if most of 
the code could be removed and standard unittest features were used instead, but 
regrtest will always have more advanced/customized feature built on top of 
unittest (which is not to say that a resource API for unittest is useless, but 
that's not a blocker for this issue :).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread R. David Murray

R. David Murray added the comment:

So you are agreeing with my proposal?

And no, I don't think the goal is to get rid of regrtest, it is just to make it 
as small as practical.  Or to put it another way, to add the features of 
regrtest that are generally useful to unittest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread R. David Murray

R. David Murray added the comment:

My proposal is how to do this without adding anything to unittest.  It is about 
how to implement the skips so that all tests are run when run under unittest, 
but resource control still happens when the tests run under regrtest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

 So you are agreeing with my proposal?

I will have to see a concrete proposal first.  If a resource API is useful 
enough to be added to unittest, and we can come up with a decent API we can 
move it there, otherwise it can just stay in regrtest.  There's also the issue 
that the unittest API is already quite big, and adding even more things there 
might do more harm than good.

There are several other parts of regrtest that can take advantage of already 
existing unittest features first, and convert them might be enough to close 
this issue even if the existing resource infrastructure is kept in regrtest.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Definitely needs to be discussed on python-ideas/python-dev.

--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17309] __bytes__ doesn't work in subclass of int and str

2013-03-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

This has been fixed recently:

 $ ./python bytes.py 
b'\x00'
b'hello'

--
nosy: +benjamin.peterson
resolution:  - out of date
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17309
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

Yes, that could be done as well, but even if they are not run by default under 
unittest, I'd be already happy to see them marked as skipped.  If I see that 
they are skipped I can always switch to regrtest to enable the necessary 
resource, or just execute the file directly if the resource is enabled just 
before unittest.main() (like the example in msg183314).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Mark Dickinson

Mark Dickinson added the comment:

This is not easy to avoid, I'm afraid, and it's a consequence of Python's usual 
rules for mixed-type arithmetic:  (-0-0j) is interpreted as 0 - (0.0 + 0.0j) 
--- that is, the 0j is promoted to a complex instance (by giving it zero real 
part) before the subtraction is performed.  Then the real part of the result is 
computed as 0.0 - 0.0, which is 0.0.  Note that the first 0.0 comes from 
converting the *integer* 0 to a complex number.  If you do -0.0-0.0j you'll see 
a different result:

 -0.0-0.0j
(-0+0j)

--
resolution:  - invalid
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17336] Complex number representation round-trip doesn't work with signed zero values

2013-03-02 Thread Mark Dickinson

Mark Dickinson added the comment:

An aside:  C99 gets around this problem by allowing an (optional) Imaginary 
type, separate from Complex.  Very few compilers support it, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17336
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-02 Thread Terry J. Reedy

Changes by Terry J. Reedy tjre...@udel.edu:


--
stage: patch review - commit review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10967] move regrtest over to using more unittest infrastructure

2013-03-02 Thread R. David Murray

R. David Murray added the comment:

Ah, but for me the point of running directly under unit test (and unittest 
discovery) it to be able to use the standard unittest facilities for running a 
single testcase or individual test.  Converting them to skips without making 
them run if regrtest isn't active might make things worse for that use case.  
If we are going to convert them to skips, why not do it right to start with?  
It won't any harder, since the logic will be baked into the skip decorators.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue10967
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17339] bytes() TypeError message is misleadingly narrow

2013-03-02 Thread Terry J. Reedy

New submission from Terry J. Reedy:

If an object ob does not have a __bytes__ method or buffer interface and is not 
a string, integer, or iterable, bytes(ob) fails with 

TypeError: 'object' object is not iterable

This is misleadingly narror (similar to #17032). We should either list *all* 
the things that ob is not

'object' object is not a string, integer, or iterable and does not have a 
__bytes__ method or buffer interface

or simply say

'object' object cannot be converted to bytes

and let the programmer recheck what can be.

--
components: Interpreter Core
messages: 183345
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: bytes() TypeError message is misleadingly narrow
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17339
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17032] Misleading error message: global name 'X' is not defined

2013-03-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I just opened #17339 about another situation where the error message references 
only the last of several checks that failed.

bytes(object())  # raises
TypeError: 'object' object is not iterable  # or 4 other possibilities

I think any message like this should be fixed as noticed.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17032
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17267] datetime.time support for '+' and 'now'

2013-03-02 Thread Francisco Martín Brugué

Francisco Martín Brugué added the comment:

Hi Joar,
just a detail: is there a reason for the asymmetric check for timedelta 
isinstance (and raising NotImplemented)? And BTW. isn't a double check for the 
__sub__ case (or have I missed something)?

+def __add__(self, other):
+Add a time and a timedelta
+if not isinstance(other, timedelta):
+return NotImplemented

vs.
…
+def __sub__(self, other):
+Subtract a time and a timedelta.
+if isinstance(other, timedelta):
+return self + -other
+return NotImplemented

regards,
francis

--
nosy: +francismb

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17267
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17339] bytes() TypeError message is misleadingly narrow

2013-03-02 Thread Ezio Melotti

Ezio Melotti added the comment:

See also #16518.

--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17339
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Guido has previously rejected any kind of user specified presizing parameter 
for dictionaries.  He felt that it was breaking the abstraction in a way that 
caused people to focus on implementation specific details.

Also, set() and dict() use presizing (and hash value reuse) only in the limited 
case of the input iterable being an exact dictionary or set.  Otherwise, it 
makes no assumptions about the input iterable and grows as needed.  For sets, 
even when the __len__ is known for a general iterable, we don't know how many 
unique elements are the input -- consider for example: set([None] * 100).  
In typical use cases for sets, a user also doesn't know in advance how many 
unique elements will be present -- and to the extent they try to add estimation 
logic, it would only complicate their programs.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13477] tarfile module should have a command line

2013-03-02 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
keywords: +patch
nosy: +berker.peksag
Added file: http://bugs.python.org/file29291/issue13477.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13477
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17339] bytes() TypeError message is misleadingly narrow

2013-03-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Do you prefer the long or short form?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17339
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17330] Stop checking for directory cache invalidation in importlib

2013-03-02 Thread Brett Cannon

Brett Cannon added the comment:

So Nick Coghlan pointed out that this would require a deprecation warning which 
is doable using ImportWarning. But that also lowers my motivation to bother 
since there is no performance benefit.

I will, though, at least make it clearer in the What's New doc and in the 
importlib docs that it is more of a need than an optional thing to do.

--
assignee:  - brett.cannon
nosy: +ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17330
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17094] sys._current_frames() reports too many/wrong stack frames

2013-03-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

hi Charles-François,

 I'm attaching a patch doing the cleanup in PyEval_ReInitThreads(), with 
 test.

Did you forget to attach the patch?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17094
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think it is going a bit too far in the direction of exposing low-level 
optimizations. Python is not C++. I also agree with Raymond that it's rather 
rare to construct read-only containers (in the sense that they are allocated 
once and for all).

--
nosy: +pitrou

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13477] tarfile module should have a command line

2013-03-02 Thread Éric Araujo

Éric Araujo added the comment:

Patch looks good!  Some minor comments on Rietveld.

Could you add tests?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13477
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17339] bytes() TypeError message is misleadingly narrow

2013-03-02 Thread Éric Araujo

Éric Araujo added the comment:

Short form for me.

--
nosy: +eric.araujo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17339
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13477] tarfile module should have a command line

2013-03-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for adding a CLI and +1 for keeping it minimal.

--
nosy: +rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13477
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17322] urllib.request add_header() currently allows trailing spaces (and other weird stuff)

2013-03-02 Thread karl

karl added the comment:

I created 4 tests for testing trailing and leading spaces on

* add_unredirected_header()
* add_header()

and modified the functions.

Tests passed.

→ ./python.exe Lib/test/test_urllib2net.py 
[…]

test_headers_with_spaces (__main__.OtherNetworkTests) ... ok

[…]
--
Ran 16 tests in 17.148s

OK (skipped=1)
[137988 refs]

See the patch issue-17322-1.patch

--
keywords: +patch
Added file: http://bugs.python.org/file29292/issue-17322-1.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17322
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11448] docs for HTTPConnection.set_tunnel are ambiguous

2013-03-02 Thread karl

karl added the comment:

Ah thanks Eric, I will fix that.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11448
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11448] docs for HTTPConnection.set_tunnel are ambiguous

2013-03-02 Thread karl

karl added the comment:

ok made a proper patch on the rst file with hg diff.
See issue-11448-1.patch

--
Added file: http://bugs.python.org/file29293/issue-11448-1.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11448
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com




[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Alex Gaynor

Alex Gaynor added the comment:

python-dev/ideas may be a better place to have this discussion, but basically 
if you're going to insist that stuff like this doesn't go into Python because 
it isn't C++, people are going to have to write C++, and that makes me 
incredibly sad.

There's an obvious need for this, CPython uses optimizations like this 
internally, as does PyPy.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17338] Add length_hint parameter to list, dict, set constructors to allow efficient presizing

2013-03-02 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I think the emphasis is on internally :).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17338
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12455] urllib2 forces title() on header names, breaking some requests

2013-03-02 Thread karl

karl added the comment:

Are there issues related to removing the capitalize() and title() appears?

# title()

* http://hg.python.org/cpython/file/886df716cd09/Lib/urllib/request.py#l1239

# capitalize()

* http://hg.python.org/cpython/file/886df716cd09/Lib/urllib/request.py#l359
* http://hg.python.org/cpython/file/886df716cd09/Lib/urllib/request.py#l363
* http://hg.python.org/cpython/file/886df716cd09/Lib/urllib/request.py#l1206

Because the behavior is inconsistent, I would live to propose a patch removing 
them and be sure to be completely neutral with regards to them.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12455
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue13477] tarfile module should have a command line

2013-03-02 Thread Ankur Ankan

Ankur Ankan added the comment:

I was also working on this issue so thought I should also submit my patch.
Has a few extra features from berker.peksag's patch:
1) the name of the files to be extracted can be specified
2) output directory can be specified for extracting files.

--
Added file: http://bugs.python.org/file29294/issue_13477

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue13477
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12455] urllib2 forces title() on header names, breaking some requests

2013-03-02 Thread karl

karl added the comment:

tests in 
http://hg.python.org/cpython/file/886df716cd09/Lib/test/test_wsgiref.py#l370 
also checking that everything is case insensitive. 

And the method to get the headers in wsgiref, make sure they are lower-case
http://hg.python.org/cpython/file/886df716cd09/Lib/wsgiref/headers.py#l82

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12455
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2013-03-02 Thread Ankur Ankan

Changes by Ankur Ankan ankuran...@gmail.com:


--
nosy: +Ankur.Ankan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15542
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com