[issue17080] A better error message for float()

2013-01-30 Thread Jonathan Livni

New submission from Jonathan Livni:

These lines of Python (2.7):

y = float(x)

gives the error:

TypeError: float() argument must be a string or a number.

In various cases such as:

x = [0]
x = None
x = SomeClass()

In addition to the information given in the error message, it could help, for 
debugging purposes, to state the type of the object given.

--
components: Interpreter Core
messages: 180967
nosy: Jonathan.Livni
priority: normal
severity: normal
status: open
title: A better error message for float()
type: enhancement
versions: Python 2.7

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



[issue17080] A better error message for float()

2013-01-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Sounds reasonable to me.

--
nosy: +ezio.melotti
stage:  - needs patch
versions: +Python 3.4 -Python 2.7

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



[issue17080] A better error message for float()

2013-01-30 Thread Kushal Das

Changes by Kushal Das kushal...@gmail.com:


--
nosy: +kushaldas

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



[issue17080] A better error message for float()

2013-01-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Here's an initial patch, still needs tests.
The same should be done for complex() too.
Maybe it could be applied to older branches too.

--
assignee:  - ezio.melotti
keywords: +patch
Added file: http://bugs.python.org/file28907/issue17080.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17080
___
___
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-30 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I meant to comment on the patch earlier.

The fix here isn't as simple as I had originally suggested.  The patch has to 
be constructed more carefully to be more fully backwards compatible.  For 
example, it shouldn't break code that imports DEBUG from modules, or that sets 
DEBUG on other modules.  The test case you found is an example of the former.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16989
___
___
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-30 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


--
keywords:  -easy

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



[issue17081] documentation

2013-01-30 Thread wohugb

Changes by wohugb woh...@qq.com:


--
assignee: docs@python
components: Documentation
nosy: docs@python, wohugb
priority: normal
severity: normal
status: open
title: documentation
versions: Python 3.3

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



[issue17080] A better error message for float()

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

You should put single quotes around the type name, i.e.:

float() argument must be a string or a number, not '%.200s'

--
nosy: +pitrou
stage: needs patch - patch review

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



[issue17080] A better error message for float()

2013-01-30 Thread Ezio Melotti

Ezio Melotti added the comment:

I was thinking about that but in other places they are not used.  Adding them 
is OK though.

--

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



[issue17081] documentation

2013-01-30 Thread Chris Jerdonek

Changes by Chris Jerdonek chris.jerdo...@gmail.com:


--
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue17056] Support Visual Studio 2012

2013-01-30 Thread Trent Nelson

Changes by Trent Nelson tr...@snakebite.org:


--
nosy: +trent

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



[issue17077] Fix test_tools hangs

2013-01-30 Thread Jeremy Kloth

Jeremy Kloth added the comment:

It hangs on both my Windows buildbot and development machine.

The patch is tested and works correctly on Windows.

--

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



[issue16903] subprocess.Popen.communicate with universal_newlines=True doesn't accept strings on 3.2

2013-01-30 Thread Jeremy Kloth

Jeremy Kloth added the comment:

I would suggest that this be bumped to release blocker as currently passing 
bytes to communicate with universal_newlines=True on Windows causes the process 
to hang (see issue17077).

The backported test case passes on Windows without any changes to subprocess.py 
so this is a POSIX-only bug.

--
nosy: +jkloth

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



[issue17077] Fix test_tools hangs

2013-01-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue16903] subprocess.Popen.communicate with universal_newlines=True doesn't accept strings on 3.2

2013-01-30 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue17077] Fix test_tools hangs

2013-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
dependencies: +subprocess.Popen.communicate with universal_newlines=True 
doesn't accept strings on 3.2
stage:  - patch review
type:  - behavior

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



[issue16903] subprocess.Popen.communicate with universal_newlines=True doesn't accept strings on 3.2

2013-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Indeed, Popen.communicate() is incompatible not only between 3.2 and 3.3, but 
between Windows and POSIX too.

Documentation says the input argument should be a bytes string and 3.2 on POSIX 
works only with bytes strings. 3.2 on Windows and 3.3 on both platforms require 
an unicode string, as 3.3 documentation says. 3.2 on Windows hangs with a bytes 
string.

Patch updated with the documentation change (copied from 3.3).

--
priority: normal - critical
Added file: 
http://bugs.python.org/file28908/subprocess_communicate_string-3.2_2.patch

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



[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Michael Foord

Michael Foord added the comment:

Wow, impressive work Antoine - thanks. I am a little concerned that this relies 
on Python 3 only features of inspect, and *in fact* relies on bug fixes in 
Python 3.4 to work. That means it would be hard / impossible for the backport 
mock to have the new feature. That may be solveable (there is a backport of 
function signatures which mock could use for example).

--

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



[issue16997] subtests

2013-01-30 Thread Michael Foord

Michael Foord added the comment:

I am concerned that this feature changes the TestResult API in a backwards 
incompatible way. There are (quite a few) custom TestResult  objects that just 
implement the API and don't inherit from TestResult. I'd like to try this new 
code with (for example) the test result provided by the junitxml project and 
see what happens.

I have a broader concern too. I have seen lots of requests for test 
parameterization and none *specifically* for sub tests. They are very similar 
mechanisms (with key differences), so I don't think we want *both* in unittest. 
If test parameterization is more powerful / flexible then I would rather see 
that *instead*. 

On the other hand if subtests are *better* then lets have them instead - but 
I'd like to see that discussion happen before we just jump into subtests.

--

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



[issue16997] subtests

2013-01-30 Thread Michael Foord

Michael Foord added the comment:

Note, some brief discussion on the testing in python mailing list:

http://lists.idyll.org/pipermail/testing-in-python/2013-January/005356.html

--

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



[issue17082] Fix test discovery for test_dbm*.py

2013-01-30 Thread Zachary Ware

New submission from Zachary Ware:

This patch fixes discovery for test_dbm.py and removes test_main() from 
test_dbm, test_dbm_dumb, test_dbm_gnu, and test_dbm_ndbm.

It also removes unnecessary __init__ methods from DumbDBMTestCase and 
WhichDBTestCase, which only called unittest.TestCase.__init__ with all supplied 
arguments.

--
components: Tests
files: test_dbm-s_discovery.diff
keywords: patch
messages: 180979
nosy: brett.cannon, ezio.melotti, zach.ware
priority: normal
severity: normal
status: open
title: Fix test discovery for test_dbm*.py
type: behavior
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file28909/test_dbm-s_discovery.diff

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



[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I am a little concerned that this relies on Python 3 only features of
 inspect, and *in fact* relies on bug fixes in Python 3.4 to work.

The bug fix has landed in 3.3 as well ;-)
(see 49fd1c8aeca5)
I guess a backport of inspect.signature() would allow it to work on previous 
Pythons, too.

--

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



[issue17015] mock could be smarter and inspect the spec's signature

2013-01-30 Thread Michael Foord

Michael Foord added the comment:

Ah, well if the bugfix exists everywhere that function signatures exist then it 
shouldn't be a problem. (I think there is already a backport of 
inspect.signature() by Nick Coghlan.)

--

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



[issue16997] subtests

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I am concerned that this feature changes the TestResult API in a
 backwards incompatible way. There are (quite a few) custom TestResult
 objects that just implement the API and don't inherit from TestResult.
 I'd like to try this new code with (for example) the test result
 provided by the junitxml project and see what happens.

Feel free to do it, of course :-)
In any case, we can add a hook to the TestCase subclass so that
specialized reporters can get at the parent TestCase.

(and I'm not sure how it's backwards incompatible: as long as you don't
use subtests, nothing should break - so existing software shouldn't be
affected)

 I have a broader concern too. I have seen lots of requests for test
 parameterization and none *specifically* for sub tests. They are very
 similar mechanisms (with key differences), so I don't think we want
 *both* in unittest. If test parameterization is more powerful /
 flexible then I would rather see that *instead*. 

The underlying idea of subtests is if you want to parameterize a test,
here is a useful building block. Generic parameterization APIs are
cumbersome and actually *harder* to write (and read!) than the
corresponding `for` loop. With subtests, you just write your `for` loop
and use a subtest to isolate each iteration's failures.

--

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



[issue1783] nonexistent data items declared as exports in sysmodule.h

2013-01-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file28910/sysmodule_h_cleanup-2.7.patch

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



[issue1783] nonexistent data items declared as exports in sysmodule.h

2013-01-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are patches.

--
assignee:  - serhiy.storchaka
keywords: +easy
nosy: +serhiy.storchaka
stage: needs patch - patch review
versions: +Python 3.2, Python 3.3, Python 3.4 -Python 3.1
Added file: http://bugs.python.org/file28911/sysmodule_h_cleanup-3.x.patch

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



[issue17083] can't specify newline string for readline for binary files

2013-01-30 Thread Bryant

New submission from Bryant:

When opening binary files in Python 3, the newline parameter cannot be set. 
While this kind of makes sense, readline() can still be used on binary files. 
This is great for my usage, but it is doing universal newline mode, I believe, 
so that any \r, \n, or \r\n triggers an EOL.

The data I'm working with is mixed ASCII/binary, with line termination 
specified by \r\n. I can't read a line (even though that concept occurs in my 
file) because some of the binary data includes \r or \n even though they aren't 
newlines in this context.

The issue here is that if the newline string can't be specified, readline() is 
useless on binary data, which often uses custom EOL strings. So would it be 
reasonable to add the newline parameter support to binary files? If not, then 
shouldn't readline() throw an exception when used on binary files?

I don't know if it's helpful here, but I've written a binary_readline() 
function supporting arbitrary EOL strings:

def binary_readline(file, newline=b'\r\n'):
line = bytearray()
newlineIndex = 0
while True:
x = file.read(1)
if x:
line += x
else:
if len(line) == 0:
return None
else:
return line
# If this character starts to match the newline string, start that 
comparison til it matches or doesn't.
while line[-1] == newline[newlineIndex]:
x = file.read(1)
if x:
line += x
else:
return line
newlineIndex += 1
if newlineIndex == len(newline):
return line
   
# We failed checking for the newline string, so reset the checking index
newlineIndex = 0

--
components: Library (Lib)
messages: 180984
nosy: susurrus
priority: normal
severity: normal
status: open
title: can't specify newline string for readline for binary files
type: behavior
versions: Python 3.3

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



[issue16997] subtests

2013-01-30 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 I am concerned that this feature changes the TestResult API in a backwards 
 incompatible way.

My suggestion to add the original TestCase object to TestResult.errors, etc. 
instead and add the extra failure data to the longDescription would address 
this concern, which is why I suggested it.  The former is what currently 
happens with multiple failures per TestCase (e.g. in runTest() and tearDown()).

 The underlying idea of subtests is if you want to parameterize a test,
here is a useful building block.

The current API doesn't seem like a good building block because it bundles 
orthogonal features (i.e. to add loop failure data to a block of asserts you 
have to use the continuance feature).  Why not expose *those* as the building 
blocks?  The API can be something like--

with self.addMessage(msg):
# Add msg to the longDescription of any assertion failure within.

with self.continueTest(msg=''):
# Keep running the TestCase on any assertion failure within.

(The current subTest() is basically equivalent to continueTest() with a 
specialized message.  It could be added, too, if desired.)  Accepting a string 
message is more basic and flexible than allowing only a **kwargs dict, which 
seems a bit cute and specialized to me.

--

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



[issue16997] subtests

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 The current API doesn't seem like a good building block because it
 bundles orthogonal features (i.e. to add loop failure data to a block
 of asserts you have to use the continuance feature).  Why not expose
 *those* as the building blocks?  The API can be something like--
 
 with self.addMessage(msg):
 # Add msg to the longDescription of any assertion failure
 within.
 
 with self.continueTest(msg=''):
 # Keep running the TestCase on any assertion failure within.
 
 (The current subTest() is basically equivalent to continueTest() with
 a specialized message.  It could be added, too, if desired.)
 Accepting a string message is more basic and flexible than allowing
 only a **kwargs dict, which seems a bit cute and specialized to me.

I've already replied to all this.

--

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



[issue17084] nntplib.NNTP.xover does not always return results as documented

2013-01-30 Thread David Holm

New submission from David Holm:

The response from NNTP.xover doesn't always match the format described in the 
documentation. It is supposed to return a (result, list) where the list 
contains entries of the format (article number, subject, poster, date, id, 
references, size, lines). However, I have found it to sometimes split the 
subject into two entries or only one of multiple references being in a list 
(see example below).

I am attempting to interpret the data using an enum-like structure to match the 
indices to the values but it fails very often because the date field contains 
part of the subject or the size field contains a cross reference entry.

Example using Python 2.7:

 import nntplib
 c = nntplib.NNTP(..)
 c.group('alt.binaries.linux')
('211 317334 3 317336 alt.binaries.linux', '317334', '3', '317336', 
'alt.binaries.linux')
 resp, lst = c.xover('114179', '114179')
 print resp
224 data follows
 print lst
[('114179', 'Re: Newsposter - The Linux Binary Posting Script Version 7.2', 
'Patriot americ...@shangri.la.org', 'Mon, 04 Jan 2010 17:36:44 -0600', 
'cu-dnfpxgcsr5t_wnz2dnuvz_rbi4...@giganews.com', 
['5aydnt9obm20bkrwnz2dnuvz_v2dn...@giganews.com'], 
'XGa0n.15891$0u1.11...@newsfe16.iad', '1443')]

In the example above 'XGa0n.15891$0u1.11...@newsfe16.iad' can be found at 
index 6 where the size is supposed to be.

--
components: Library (Lib)
messages: 180987
nosy: dholm
priority: normal
severity: normal
status: open
title: nntplib.NNTP.xover does not always return results as documented
type: behavior
versions: Python 2.7

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



[issue17083] can't specify newline string for readline for binary files

2013-01-30 Thread R. David Murray

R. David Murray added the comment:

If you are reading in binary mode, then all readline does is get you the next 
\n terminated chunk of data, which is a convenience in some circumstances.  You 
have to do all the newline handling yourself.  Otherwise it isn't a binary read.

I think the right way to do what you want is to write a custom subclass of 
one of the IO classes.  Should such a subclass be added to Python?  That's an 
interesting question.  A first step toward an answer might be to post it as a 
recipe on the ActiveState site and see how many people find it useful.

--
nosy: +r.david.murray
type: behavior - enhancement

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



[issue16997] subtests

2013-01-30 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 I've already replied to all this.

You didn't respond to the idea of exposing both features separately after 
saying you didn't understand what I meant and saying that they were pointless 
and didn't make sense.  So I explained and also proposed a specific API to make 
the suggestion clearer and more concrete.  These don't seem pointless to me at 
all.

--

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



[issue17044] Implement PEP 422: Simple class initialisation hook

2013-01-30 Thread Daniel Urban

Daniel Urban added the comment:

I'm attaching a new patch with some documentation and one additional test.

--
Added file: http://bugs.python.org/file28912/pep422_3.patch

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



[issue16997] subtests

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 You didn't respond to the idea of exposing both features separately
 after saying you didn't understand what I meant and saying that they
 were pointless and didn't make sense.  So I explained and also
 proposed a specific API to make the suggestion clearer and more
 concrete.

Well, suffice to say that I wasn't convinced at all. There are multiple
use cases for subtests in the Python test suite, but I can't think of
any for your proposed API separation. That's why I find it
uninteresting.

I'm making this proposal to solve a concrete issue, not in the interest
of minimalism. Building block was to be understood in that sense. Unit
testing is one of those areas where purity is a secondary concern.

--

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



[issue15633] httplib.response is not closed after all data has been read

2013-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch for 2.7.
Ideally, we would raise IncompleteRead in this situation, but this would break 
existing programs.

--
keywords: +patch
stage:  - patch review
versions: +Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file28913/http_truncated_body.patch

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



[issue17085] test_socket crashes the whole test suite

2013-01-30 Thread ddve...@ucar.edu

New submission from ddve...@ucar.edu:

While running make test on my build of python 2.7.3 the suite aborts with

[..omiss..]
test_socket
make: *** [test] Alarm clock

Trying to run individually the offending test reveals a little more


$ ./python Lib/test/regrtest.py -v test_socket
== CPython 2.7.3 (default, Jan 29 2013, 11:23:48) [GCC 4.7.2]
==   Linux-2.6.32-220.13.1.el6.x86_64-x86_64-with-redhat-6.2-Santiago 
little-endian
==   /glade/scratch/ddvento/build/Python-2.7.3-westmere/build/test_python_12171
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
test_socket
TIPC module is not loaded, please 'sudo modprobe tipc'
testCrucialConstants (test.test_socket.GeneralModuleTests) ... ok
testDefaultTimeout (test.test_socket.GeneralModuleTests) ... ok
testGetServBy (test.test_socket.GeneralModuleTests) ... ok
testGetSockOpt (test.test_socket.GeneralModuleTests) ... ok
testGetaddrinfo (test.test_socket.GeneralModuleTests) ... ok
testHostnameRes (test.test_socket.GeneralModuleTests) ... ok
testIPv4_inet_aton_fourbytes (test.test_socket.GeneralModuleTests) ... ok
testIPv4toString (test.test_socket.GeneralModuleTests) ... ok
testIPv6toString (test.test_socket.GeneralModuleTests) ... ok
testInterpreterCrash (test.test_socket.GeneralModuleTests) ... ok
testListenBacklog0 (test.test_socket.GeneralModuleTests) ... ok
testNewAttributes (test.test_socket.GeneralModuleTests) ... ok
testNtoH (test.test_socket.GeneralModuleTests) ... ok
testNtoHErrors (test.test_socket.GeneralModuleTests) ... ok
testRefCountGetNameInfo (test.test_socket.GeneralModuleTests) ... ok
testSendAfterClose (test.test_socket.GeneralModuleTests) ... ok
testSendtoErrors (test.test_socket.GeneralModuleTests) ... ok
testSetSockOpt (test.test_socket.GeneralModuleTests) ... ok
testSockName (test.test_socket.GeneralModuleTests) ... ok
testSocketError (test.test_socket.GeneralModuleTests) ... ok
testStringToIPv4 (test.test_socket.GeneralModuleTests) ... ok
testStringToIPv6 (test.test_socket.GeneralModuleTests) ... ok
test_flowinfo (test.test_socket.GeneralModuleTests) ... ok
test_getsockaddrarg (test.test_socket.GeneralModuleTests) ... ok
test_sendall_interrupted (test.test_socket.GeneralModuleTests) ... FAIL
test_sendall_interrupted_with_timeout (test.test_socket.GeneralModuleTests) ... 
FAIL
test_sock_ioctl (test.test_socket.GeneralModuleTests) ... skipped 'Windows 
specific'
test_weakref (test.test_socket.GeneralModuleTests) ... ok
testDup (test.test_socket.BasicTCPTest) ... ok
testFromFd (test.test_socket.BasicTCPTest) ... ok
testOverFlowRecv (test.test_socket.BasicTCPTest) ... ok
testOverFlowRecvFrom (test.test_socket.BasicTCPTest) ... ok
testRecv (test.test_socket.BasicTCPTest) ... ok
testRecvFrom (test.test_socket.BasicTCPTest) ... ok
testSendAll (test.test_socket.BasicTCPTest) ... ok
testShutdown (test.test_socket.BasicTCPTest) ... ok
testClose (test.test_socket.TCPCloserTest) ... Alarm clock

$ echo $?
142

Of course my installation has an issue (which I'm trying to identify), but the 
test suite should not crash on a failure of individual test. I believe this is 
related to Issue1326841 in that the test author forgot to install the signal 
handler, or maybe was expecting the behavior Paul Rubin suggested in said bug.

--
components: Tests
messages: 180993
nosy: ddve...@ucar.edu
priority: normal
severity: normal
status: open
title: test_socket crashes the whole test suite
versions: Python 2.7

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



[issue17083] can't specify newline string for readline for binary files

2013-01-30 Thread Bryant

Bryant added the comment:

I'm not terribly worried about the right way for me to deal with my code, but 
that Python, in this instance, is inconsistent. While it doesn't want you to 
apply the concept of a line to a binary file in that it prevents you from 
specifying an EOL string, it does allow you to read that file as lines.

So my question is why shouldn't I be able to specify a newline of b\r\n and 
then use readline() on my binary file? I don't see why that concept shouldn't 
be applied here when it's definitely applicable in a lot of cases (any binary 
log format).

To resolve this I really think there're two options to maintain the consistency 
of Python's approach:
 1) Have readline() error out for binary-mode files.
 2) Allow specifying a byte-string as the newline string for binary files that 
readline() would then use.

--

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



[issue17028] launcher does not read shebang line when arguments are given

2013-01-30 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

An entry in Misc/NEWS would be nice.

--
nosy: +amaury.forgeotdarc

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



[issue17028] launcher does not read shebang line when arguments are given

2013-01-30 Thread STINNER Victor

STINNER Victor added the comment:

A test would also be nice :-)

--
nosy: +haypo

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



[issue17028] launcher does not read shebang line when arguments are given

2013-01-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 58e72cb89848 by Vinay Sajip in branch 'default':
Updated NEWS with fix for #17028.
http://hg.python.org/cpython/rev/58e72cb89848

--

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



[issue17086] backport cross-build patches to the 2.7 branch

2013-01-30 Thread Matthias Klose

New submission from Matthias Klose:

I would like to check in a backport of the cross build patches on Thu or Fri, 
so that these can be checked for the upcoming 2.7.4 release.  The backport was 
made using the current state of the cross build support on the 3.3 branch.

The patch is tested with native builds on linux, and a cross build targeting 
arm-linux-gnueabihf.

--
assignee: doko
files: cross-2.7.diff
keywords: patch
messages: 180998
nosy: benjamin.peterson, doko
priority: normal
severity: normal
status: open
title: backport cross-build patches to the 2.7 branch
versions: Python 2.7
Added file: http://bugs.python.org/file28914/cross-2.7.diff

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



[issue17087] Improve the repr for regular expression match objects

2013-01-30 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Experience teaching Python has shown that people have a hard time learning to 
work with match objects.  A contributing cause is the opaque repr:

 import re
 s = 'On 3/14/2013, Python celebrate Pi day.'
 mo = re.search(r'\d+/\d+/\d+', s)
 mo
_sre.SRE_Match object at 0x100456100

They could explore the match object with dir() and help() and the matchobject 
methods and attributes:

 dir(mo)
['__class__', '__copy__', '__deepcopy__', ...
 'end', 'endpos', 'expand', 'group', ... ]
 
 mo.start()
3
 mo.end()
12
 mo.group(0)
'3/14/2013'

However, this gets old when experimenting with alternative regular expressions. 
 A better solution is to improve the repr:

 re.search(r'\d+/\d+/\d+', s)
SRE Match object: start=3, stop=12, group(0)='3/14/2013'

This would make the regular expression module much easier to work with.

--
components: Library (Lib)
messages: 180999
nosy: rhettinger
priority: normal
severity: normal
status: open
title: Improve the repr for regular expression match objects
type: enhancement
versions: Python 3.4

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



[issue17086] backport cross-build patches to the 2.7 branch

2013-01-30 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Did you mean to add that config.guess file?

--

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



[issue17087] Improve the repr for regular expression match objects

2013-01-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Showing start and stop would be OK, but there might be many groups and they 
might contain lot of text, so they can't simply be included in the repr as they 
are.
FWIW there was another issue about changing _sre.SRE_Match to something better, 
but I can't find it right now.

--
components: +Regular Expressions
nosy: +ezio.melotti, mrabarnett
stage:  - needs patch

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



[issue17087] Improve the repr for regular expression match objects

2013-01-30 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Is this a duplicate of issue 13592?

--
nosy: +chris.jerdonek

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



[issue16997] subtests

2013-01-30 Thread Nick Coghlan

Nick Coghlan added the comment:

Right. I have *heaps* of tests that would be very easy to migrate to
Antoine's subtest API. A separate addMessage API could conceivably be
helpful for debugging, but it's not the obvious improvement to my existing
looping tests that subtests would be.

--

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



[issue17087] Improve the repr for regular expression match objects

2013-01-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Just showing group(0) should be helpful.  And perhaps the number of groups.   
If a string is really long, we can truncate it like reprlib does.

The main goal is to make it easier to work with match objects at the 
interactive prompt.  They are currently too opaque.

--

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



[issue17011] ElementPath ignores different namespace mappings for the same path expression

2013-01-30 Thread Silverback Networks

Changes by Silverback Networks silverback...@gmail.com:


--
nosy: +silverbacknet

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



[issue17088] ElementTree incorrectly refuses to write attributes without namespaces when default_namespace is used

2013-01-30 Thread Silverback Networks

New submission from Silverback Networks:

ET reads a default-namespaced (xmnls=whatever) file correctly but won't write 
it back out.

The error given is:
ValueError: cannot use non-qualified names with default_namespace option

The XML reference is reasonably clear on this:
http://www.w3.org/TR/REC-xml-names/#defaulting
Default namespace declarations do not apply directly to attribute names;
The namespace name for an unprefixed attribute name always has no value.

Therefore, it is not an error to write non-qualified _attribute_ names with a 
default namespace; they're just considered un-namespaced anyway. The trivial 
case where a file is read in with a default namespace and written out with the 
same one should make it obvious:

from xml.etree.ElementTree import *
register_namespace('svg', 'http://www.w3.org/2000/svg')
svg = ElementTree(XML(
svg width=12cm height=4cm viewBox=0 0 1200 400 
xmlns=http://www.w3.org/2000/svg; version=1.1
rect x=1 y=1 width=1198 height=398 fill=none stroke=blue 
stroke-width=2 /
/svg
))
svg.write('simple_new.svg',encoding='UTF-8',default_namespace='svg')

Yet this will fail with the error above. By leaving off default_namespace, 
every element is pointlessly prefixed by 'svg:' in the resulting file, but it 
does work.

--
components: XML
messages: 181005
nosy: silverbacknet
priority: normal
severity: normal
status: open
title: ElementTree incorrectly refuses to write attributes without namespaces 
when default_namespace is used
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2013-01-30 Thread Ben Hoyt

Ben Hoyt added the comment:

Any update on this, Tim or other Windows developers?

--

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



[issue15207] mimetypes.read_windows_registry() uses the wrong regkey, creates wrong mappings

2013-01-30 Thread Brian Curtin

Brian Curtin added the comment:

I can't comment on what the change should be or how it should be done as I 
don't do anything with mimetypes, but nothing about how the patch was written 
jumps out at me for being incorrect (except I would not include ishimoto's name 
changes).

If there's a consensus that this is the appropriate change to be made, the 
patch still needs tests.

--

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



[issue12883] xml.sax.xmlreader.AttributesImpl allows empty string as attribute names

2013-01-30 Thread Chenguang Wang

Chenguang Wang added the comment:

I found this problem is still not fixed in the lastest hg version. Seriously?

This patch is for the latest v3.4.0a0.

--
keywords: +patch
nosy: +Chenguang.Wang
Added file: http://bugs.python.org/file28915/w.patch

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