[issue17111] test_surrogates of test_fileio fails sometimes on OS X 10.4

2013-02-03 Thread Ned Deily

New submission from Ned Deily:

Seen on X86 Tiger 2.7 buildbot 
(http://buildbot.python.org/all/builders/x86%20Tiger%202.7)

test_surrogates (test.test_fileio.OtherFileTests) ... test test_fileio failed 
-- Traceback (most recent call last):
  File /Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/test/test_fileio.py, 
line 455, in test_surrogates
self.fail('Bad output: %r' % out)
AssertionError: Bad output: 'Traceback (most recent call last):\n  File 
string, line 1, in module\nIOError: [Errno 22] Invalid argument: 
\'\\xed\\xb2\\x80.txt\'\n[20282 refs]\n'

Looking into it a bit, the test attempts to open a file with a filename 
containing surrogates.  On OS X 10.4 (Tiger), an attempt to open such a file on 
a standard HFS+ file system appears to always fail with the above error 22 
(EINVAL), rather than error 2 (ENOENT) No such file or directory as the test 
expects and as more recent versions of OS X do.  So the test should probably be 
changed to expect either error code.  I'm attaching a patch that should do that.

However, there is another issue.  The test does not always fail on 10.4 as one 
would expect.  The test on the buildbot sometimes succeeds.  On my own 10.4 
system, while I predictably receive an EINVAL when attempting to open the file, 
running test_fileio in isolation seems to always pass and it's not obvious why 
it does.  The first part of the test, the local open fails as expected but, 
without the patch, the test of an open in a subprocess passes when it should be 
failing.  But I was able to reproduce the Error 22 failure, as seen on the 
buildbot failures, with the same interpreter build by using a --randseed value 
from one of the buildbot failures.  So there appears to be a test interaction 
problem here as well (environment variables?).

/python.exe -Wd -3 -E -tt  -R ./Lib/test/regrtest.py -uall -rwW 
--randseed=2535964

--
components: Tests
files: issue_X_test_fileio.patch
keywords: buildbot, needs review, patch
messages: 181246
nosy: ned.deily
priority: normal
severity: normal
stage: patch review
status: open
title: test_surrogates of test_fileio fails sometimes on OS X 10.4
versions: Python 2.7
Added file: http://bugs.python.org/file28937/issue_X_test_fileio.patch

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Crash is possible not only when reading from text files, but also when decoder 
returns a non-string or when decoder's state is not a bytes object. This is 
possible with malicious decoder and perhaps with some old not bytes-to-string 
decoder in stdlib codecs registry.

Here are patches for different versions.

--
keywords: +patch
Added file: http://bugs.python.org/file28938/textio_type_check-2.7.patch
Added file: http://bugs.python.org/file28939/textio_type_check-3.3.patch
Added file: http://bugs.python.org/file28940/textio_type_check-3.2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17106
___diff -r c37ac05119ff Modules/_io/textio.c
--- a/Modules/_io/textio.c  Sat Feb 02 15:06:45 2013 -0800
+++ b/Modules/_io/textio.c  Sun Feb 03 10:41:09 2013 +0200
@@ -269,8 +269,9 @@
 return NULL;
 
 if (!PyUnicode_Check(output)) {
-PyErr_SetString(PyExc_TypeError,
-decoder should return a string result);
+PyErr_Format(PyExc_TypeError,
+ decoder should return a string result, not '%.200s',
+ Py_TYPE(output)-tp_name);
 goto error;
 }
 
@@ -1417,7 +1418,12 @@
 Py_DECREF(chunk_size);
 if (input_chunk == NULL)
 goto fail;
-assert(PyBytes_Check(input_chunk));
+if (!PyBytes_Check(input_chunk)) {
+PyErr_Format(PyExc_IOError,
+ underlying read1() should have returned a bytes object, 
+ not '%.200s', Py_TYPE(input_chunk)-tp_name);
+goto fail;
+}
 
 eof = (PyBytes_Size(input_chunk) == 0);
 
@@ -1444,7 +1450,14 @@
 PyObject *next_input = PyNumber_Add(dec_buffer, input_chunk);
 if (next_input == NULL)
 goto fail;
-assert (PyBytes_Check(next_input));
+if (!PyBytes_Check(next_input)) {
+PyErr_Format(PyExc_TypeError,
+ decoder getstate() should have returned a bytes 
+ object, not '%.200s',
+ Py_TYPE(next_input)-tp_name);
+Py_DECREF(next_input);
+goto fail;
+}
 Py_DECREF(dec_buffer);
 Py_CLEAR(self-snapshot);
 self-snapshot = Py_BuildValue(NN, dec_flags, next_input);
@@ -2110,7 +2123,14 @@
 if (input_chunk == NULL)
 goto fail;
 
-assert (PyBytes_Check(input_chunk));
+if (!PyBytes_Check(input_chunk)) {
+PyErr_Format(PyExc_IOError,
+ underlying read() should have returned a bytes 
+ object, not '%.200s',
+ Py_TYPE(input_chunk)-tp_name);
+Py_DECREF(input_chunk);
+goto fail;
+}
 
 self-snapshot = Py_BuildValue(iN, cookie.dec_flags, input_chunk);
 if (self-snapshot == NULL) {
@@ -2247,7 +2267,13 @@
 self-decoder, decode, s#, input, 1);
 if (decoded == NULL)
 goto fail;
-assert (PyUnicode_Check(decoded));
+if (!PyUnicode_Check(decoded)) {
+PyErr_Format(PyExc_TypeError,
+ decoder should return a string result, not '%.200s',
+ Py_TYPE(decoded)-tp_name);
+Py_DECREF(decoded);
+goto fail;
+}
 chars_decoded += PyUnicode_GET_SIZE(decoded);
 Py_DECREF(decoded);
 
@@ -2281,7 +2307,13 @@
 self-decoder, decode, si, , /* final = */ 1);
 if (decoded == NULL)
 goto fail;
-assert (PyUnicode_Check(decoded));
+if (!PyUnicode_Check(decoded)) {
+PyErr_Format(PyExc_TypeError,
+ decoder should return a string result, not '%.200s',
+ Py_TYPE(decoded)-tp_name);
+Py_DECREF(decoded);
+goto fail;
+}
 chars_decoded += PyUnicode_GET_SIZE(decoded);
 Py_DECREF(decoded);
 cookie.need_eof = 1;
@@ -2440,7 +2472,7 @@
 Py_DECREF(res);
 if (r  0)
 return NULL;
-
+
 if (r  0) {
 Py_RETURN_NONE; /* stream already closed */
 }
diff -r 3653d8174b0b Modules/_io/textio.c
--- a/Modules/_io/textio.c  Sat Feb 02 15:12:59 2013 -0800
+++ b/Modules/_io/textio.c  Sun Feb 03 10:42:13 2013 +0200
@@ -290,8 +290,9 @@
 return NULL;
 
 if (!PyUnicode_Check(output)) {
-PyErr_SetString(PyExc_TypeError,
-decoder should return a string result);
+PyErr_Format(PyExc_TypeError,
+ decoder should return a string result, not '%.200s',
+ Py_TYPE(output)-tp_name);
 goto error;
 }
 
@@ -1458,7 +1459,13 @@
 Py_DECREF(chunk_size);
 if (input_chunk == NULL)
 goto fail;
-assert(PyBytes_Check(input_chunk));
+if (!PyBytes_Check(input_chunk)) 

[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Georg Brandl

Changes by Georg Brandl ge...@python.org:


--
nosy: +larry
priority: normal - release blocker

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Georg Brandl

Georg Brandl added the comment:

Blocker for 3.2.4.

--

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



[issue14340] Update embedded copy of expat - fix security crash issues

2013-02-03 Thread Georg Brandl

Georg Brandl added the comment:

Greg, if you are fine please apply to 3.2 or indicate if it is enough to apply 
the same patch as on 3.3/default.

--

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



[issue4011] Create DAG for PEP 101

2013-02-03 Thread Georg Brandl

Georg Brandl added the comment:

While it's nice to look at a graphical representation, clearly there is no deep 
interest (and PEP 101 has so many little steps that you couldn't possibly fit 
them all into a graph, so you have to consult the text anyway).  I see no 
reason to keep this open.

--
resolution:  - wont fix
status: open - closed

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This bug exists also in 2.7.

I doubt about an exception type. On one hand, TypeError looks naturally here 
and exception of this type implicitly raised by Python implementation. On other 
hand, there is a precedent in __iter__() which raises IOError when readline() 
returns non-string.

--
nosy: +benjamin.peterson
versions: +Python 2.7

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

TypeError should be the right exception here.

--

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



[issue17112] Some doctest-based tests fail when run with python -OO

2013-02-03 Thread Ned Deily

New submission from Ned Deily:

Seen on the AMD64 Mountain Lion Optimized [SB] 2.7 buildbot
(http://buildbot.python.org/all/builders/AMD64%20Mountain%20Lion%20Optimized%20%5BSB%5D%202.7):

test test_doctest crashed -- type 'exceptions.AssertionError': filter 
('backquote not supported', SyntaxWarning) did not catch any warning
Traceback (most recent call last):
  File ./Lib/test/regrtest.py, line 896, in runtest_inner
  File 
/Users/cpython/buildslave/optimized/2.7.snakebite-mountainlion-amd64-optimized/build/Lib/test/test_doctest.py,
 line 2684, in test_main
test_support.run_doctest(test_doctest, verbosity=True)
  File 
/Users/cpython/buildslave/optimized/2.7.snakebite-mountainlion-amd64-optimized/build/Lib/contextlib.py,
 line 24, in __exit__
self.gen.next()
  File 
/Users/cpython/buildslave/optimized/2.7.snakebite-mountainlion-amd64-optimized/build/Lib/test/test_support.py,
 line 641, in _filterwarnings
missing[0])
AssertionError: filter ('backquote not supported', SyntaxWarning) did not catch 
any warning

The same failure is seen in test_syntax and test_zipimport_support.

That buildbot builds the interpreter --with-pydebug but runs the test suite 
with -OO:

./python.exe -Wd -3 -E -tt -OO -R ./Lib/test/regrtest.py -uall -rwW

I am able to reproduce the buildbot failures when run as above.  Without -OO, 
the tests no longer fail.

--
components: Tests
keywords: buildbot
messages: 181253
nosy: ned.deily
priority: normal
severity: normal
status: open
title: Some doctest-based tests fail when run with python -OO
versions: Python 2.7

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



[issue17112] Some doctest-based tests fail when run with python -OO

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Without -3 option tests passed.

--
nosy: +serhiy.storchaka

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-02-03 Thread anatoly techtonik

anatoly techtonik added the comment:

Any progress on that? After a month I am inclined that this behavior should be 
fixed, not only documented. The correct documentation is:

NOTE: The variable returned by locals() is sporadically updated by core 
interpreter.

--
versions: +Python 3.2, Python 3.3, Python 3.4, Python 3.5

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-02-03 Thread Ezio Melotti

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


--
versions:  -Python 2.4, Python 2.5, Python 2.6, Python 3.1, Python 3.2, Python 
3.5

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yet one crasher, not fixed by my patch yet.

io.TextIOWrapper(io.BytesIO(b'a'), newline='\n', 
encoding='quopri_codec').read(1)

Sometimes it crashes (on non-debug build), sometimes raises an exception: 
ValueError: character U+82228c0 is not in range [U+; U+10].

--

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 72aee7ee2299 by Georg Brandl in branch '3.3':
Closes #17109: fix heading levels in mock doc.
http://hg.python.org/cpython/rev/72aee7ee2299

--
nosy: +python-dev
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

unittest.mock-examples.rst also needs fixing.

--

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is an updated patch for 3.3+. An exception type changed to TypeError, 
fixed some new crashes, added tests. If it is good, I'll backport it to 3.2 and 
2.7.

--
Added file: http://bugs.python.org/file28941/textio_type_check-3.3_2.patch

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Here is an updated patch for 3.3+. An exception type changed to
 TypeError, fixed some new crashes, added tests. If it is good, I'll
 backport it to 3.2 and 2.7.

Looks ok to me.

--

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



[issue12502] 100% cpu usage when using asyncore with UNIX socket

2013-02-03 Thread Charles-François Natali

Charles-François Natali added the comment:

I'm unable to reproduce it.
Are you using the attached script?
Did you apply the patch by hand, or are you using a recent Python version?

--

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



[issue16997] subtests

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This new patch adds some documentation.

--
Added file: http://bugs.python.org/file28942/subtests4.patch

___
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



[issue16686] audioop overflow issues

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Terry.

 Is whatever the case in 2.6 only (if so, drop obsolete) or since 2.6. If the 
 latter, I would rewrite as this is the case since Python 2.6..
 The addition is not clear to me. Are you implying that something should be 
 made true for memory view (in a future patch)?

In 2.6 the sentence possible was true and the code was correct. But it is wrong 
for currently supported versions when we pass memoryview as an argument. This 
is a bug (possible even a crash) and should be fixed. But on x86 or when we 
don't use unaligned memoryview (most peoples don't do this) it is never 
occurred. Due to this I left this bug unfixed yet. There are other minor bugs 
which I left for different issues. This patch fixes most critical bugs and 
creates a solid basis for testing.

I see unstable AIX buildbots failed on test_aifc. Perhaps this patch will fix 
it or expose an issue in audioop module (current audioop testing too poor).

--

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



[issue16643] Wrong documented default value for timefunc parameter in sched.scheduler()

2013-02-03 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Here's a patch.

--
keywords: +patch
nosy: +ramchandra.apte
Added file: http://bugs.python.org/file28943/issue16643.patch

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



[issue16643] Wrong documented default value for timefunc parameter in sched.scheduler()

2013-02-03 Thread Serhiy Storchaka

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


--
stage: needs patch - patch review

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9040b3714207 by Georg Brandl in branch '3.3':
#17109: fix headings in mock example doc.
http://hg.python.org/cpython/rev/9040b3714207

--

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



[issue17025] reduce multiprocessing.Queue contention

2013-02-03 Thread Charles-François Natali

Charles-François Natali added the comment:

 For the record, I tried the Connection approach and here is what I ended up 
 with.

I don't really like the API.
Having to pass an external lock is IMO a bad idea, it should be a
private instance field.
Also, for consistency we'd probably need send_bytes/recv_bytes.

--

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



[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2013-02-03 Thread Roy Smith

New submission from Roy Smith:

The following code, when run with --help, omits the trailing newlines from 
the epilog.  It should just emit the string verbatim.  If the developer didn't 
want the extra newlines, he/she wouldn't have put them there.


import argparse
parser = 
argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,
 epilog=foo\n\n)
parser.parse_args()

--
components: Library (Lib)
messages: 181267
nosy: roysmith
priority: normal
severity: normal
status: open
title: argparse.RawDescriptionHelpFormatter should not delete blank lines
type: behavior
versions: Python 2.7

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



[issue17108] import silently prefers package over module when both available

2013-02-03 Thread R. David Murray

R. David Murray added the comment:

Ah, yes.

To clarify for Shai, by the way, the reason this stuff can't change (and the 
reason there is a new step 3 instead of changing the whole algorithm to be 
something more sensible) is because of the requirement of maintaining backward 
compatibility.

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python

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



[issue17108] import silently prefers package over module when both available

2013-02-03 Thread Shai Berger

Shai Berger added the comment:

Hi,

 the reason this stuff can't change [... is] backward compatibility.

Thanks, but this is still unclear to me. The required fix for code that would 
break because of the change I propose, is removal of dead code which looks 
misleadingly alive. 

Is the backward-compatibility requirement really that strict?

--

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are patches for 3.2 and 2.7.

Note that due to unicode-str autoconversions 2.7 not always raises TypeError 
(sometimes it can do nor raise an exception, sometimes it raises 
UnicodeEncodeError). 2.7 tests are not so strong as 3.x tests.

--
Added file: http://bugs.python.org/file28944/textio_type_check-3.2_2.patch
Added file: http://bugs.python.org/file28945/textio_type_check-2.7_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17106
___diff -r 6c9f4c22fd81 Lib/test/test_io.py
--- a/Lib/test/test_io.py   Sat Feb 02 15:08:52 2013 -0800
+++ b/Lib/test/test_io.py   Sun Feb 03 15:02:34 2013 +0200
@@ -2481,6 +2481,30 @@
 txt.write('5')
 self.assertEqual(b''.join(raw._write_stack), b'123\n45')
 
+def test_read_nonbytes(self):
+# Issue #17106
+# Crash when underlying read() returns non-bytes
+t = self.TextIOWrapper(self.StringIO('a'))
+self.assertRaises(TypeError, t.read, 1)
+t = self.TextIOWrapper(self.StringIO('a'))
+self.assertRaises(TypeError, t.readline)
+t = self.TextIOWrapper(self.StringIO('a'))
+self.assertRaises(TypeError, t.read)
+
+def test_illegal_decoder(self):
+# Issue #17106
+# Crash when decoder returns non-string
+t = self.TextIOWrapper(self.BytesIO(b'aa'), newline='\n',
+   encoding='quopri_codec')
+self.assertRaises(TypeError, t.read, 1)
+t = self.TextIOWrapper(self.BytesIO(b'aa'), newline='\n',
+   encoding='quopri_codec')
+self.assertRaises(TypeError, t.readline)
+t = self.TextIOWrapper(self.BytesIO(b'aa'), newline='\n',
+   encoding='quopri_codec')
+self.assertRaises(TypeError, t.read)
+
+
 class CTextIOWrapperTest(TextIOWrapperTest):
 
 def test_initialization(self):
diff -r 6c9f4c22fd81 Modules/_io/textio.c
--- a/Modules/_io/textio.c  Sat Feb 02 15:08:52 2013 -0800
+++ b/Modules/_io/textio.c  Sun Feb 03 15:02:34 2013 +0200
@@ -236,6 +236,21 @@
 Py_TYPE(self)-tp_free((PyObject *)self);
 }
 
+static int
+check_decoded(PyObject *decoded)
+{
+if (decoded == NULL)
+return -1;
+if (!PyUnicode_Check(decoded)) {
+PyErr_Format(PyExc_TypeError,
+ decoder should return a string result, not '%.200s',
+ Py_TYPE(decoded)-tp_name);
+Py_DECREF(decoded);
+return -1;
+}
+return 0;
+}
+
 #define SEEN_CR   1
 #define SEEN_LF   2
 #define SEEN_CRLF 4
@@ -265,15 +280,9 @@
 Py_INCREF(output);
 }
 
-if (output == NULL)
+if (check_decoded(output)  0)
 return NULL;
 
-if (!PyUnicode_Check(output)) {
-PyErr_SetString(PyExc_TypeError,
-decoder should return a string result);
-goto error;
-}
-
 output_len = PyUnicode_GET_SIZE(output);
 if (self-pendingcr  (final || output_len  0)) {
 Py_UNICODE *out;
@@ -1454,7 +1463,13 @@
 Py_DECREF(chunk_size);
 if (input_chunk == NULL)
 goto fail;
-assert(PyBytes_Check(input_chunk));
+if (!PyBytes_Check(input_chunk)) {
+PyErr_Format(PyExc_TypeError,
+ underlying %s() should have returned a bytes object, 
+ not '%.200s', (self-has_read1 ? read1: read),
+ Py_TYPE(input_chunk)-tp_name);
+goto fail;
+}
 
 eof = (PyBytes_Size(input_chunk) == 0);
 
@@ -1467,8 +1482,7 @@
 _PyIO_str_decode, input_chunk, eof ? Py_True : Py_False, NULL);
 }
 
-/* TODO sanity check: isinstance(decoded_chars, unicode) */
-if (decoded_chars == NULL)
+if (check_decoded(decoded_chars)  0)
 goto fail;
 textiowrapper_set_decoded_chars(self, decoded_chars);
 if (PyUnicode_GET_SIZE(decoded_chars)  0)
@@ -1481,7 +1495,14 @@
 PyObject *next_input = PyNumber_Add(dec_buffer, input_chunk);
 if (next_input == NULL)
 goto fail;
-assert (PyBytes_Check(next_input));
+if (!PyBytes_Check(next_input)) {
+PyErr_Format(PyExc_TypeError,
+ decoder getstate() should have returned a bytes 
+ object, not '%.200s',
+ Py_TYPE(next_input)-tp_name);
+Py_DECREF(next_input);
+goto fail;
+}
 Py_DECREF(dec_buffer);
 Py_CLEAR(self-snapshot);
 self-snapshot = Py_BuildValue(NN, dec_flags, next_input);
@@ -1525,7 +1546,7 @@
 decoded = PyObject_CallMethodObjArgs(self-decoder, _PyIO_str_decode,
  bytes, Py_True, NULL);
 Py_DECREF(bytes);
-if (decoded == NULL)
+if (check_decoded(decoded)  0)
 goto fail;
 
 result = 

[issue17114] Python IDLE GUI does not open in Ubuntu 12.04

2013-02-03 Thread Swarnkar Rajesh

New submission from Swarnkar Rajesh:

[Hello all. Just registered to ask this.]

I insatlled python 3.2 from Ubuntu Software Center. 
It created python Icon in launcher as expected. 

It was working fine until i customized the IDLE theme. I edited the 
config-highlight.cfg found in /home/user/.idlerc (hidden) directory. 
I copy pasted desert color theme into this file and pressed save.(I perfectly 
edited file with leaving one newline at end. So it is not issue with editing i 
believe.) 

Then i closed the editor. When i tried running by clicking 'IDLE (Using Python 
3.2)' in Ubuntu launcher, it glows for a while then nothing shows up. 
I could see a process name python running in system monitor, but no IDLE window.

I tried these issues : 
4049
15998
8099
7265

But all these issues are related to windows OS. 
I tried follwing the similar instruction but i see three directories in 
/usr/lib/ as python2.7, python3 and python3.2. I am stuck at this point. So i 
did not choose to proceed. :S

Can you please see into it? Thank you.

--
components: IDLE
messages: 181271
nosy: rjs.swarnkar
priority: normal
severity: normal
status: open
title: Python IDLE GUI does not open in Ubuntu 12.04
versions: Python 3.2

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

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


--
assignee:  - serhiy.storchaka

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



[issue17108] import silently prefers package over module when both available

2013-02-03 Thread R. David Murray

R. David Murray added the comment:

Yes.  Imagine you have a deployed application, and there happens to be an xx.py 
file that is masked by a package in it.  You upgrade from pythonX.Y.Z to 
X.Y.Z+1, and your application is suddenly throwing an error.  Yes it is easy to 
fix, but we prefer not to break things that way.

Now, could we throw an error in Python 3.4?  It could be discussed, at least.

--

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



[issue17108] import silently prefers package over module when both available

2013-02-03 Thread Shai Berger

Shai Berger added the comment:

Oh, sure, this was unclear of me. I thought you were talking about Python 3.4. 
I wasn't really expecting this to be fixed in the stable branches.

Thanks,
Shai.

--

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5655cdd3c010 by Serhiy Storchaka in branch '3.2':
Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
http://hg.python.org/cpython/rev/5655cdd3c010

New changeset 0c4cc967a733 by Serhiy Storchaka in branch '3.3':
Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
http://hg.python.org/cpython/rev/0c4cc967a733

New changeset 398bcdf55f92 by Serhiy Storchaka in branch 'default':
Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
http://hg.python.org/cpython/rev/398bcdf55f92

New changeset 19a33ef3821d by Serhiy Storchaka in branch '2.7':
Issue #17106: Fix a segmentation fault in io.TextIOWrapper when an underlying
http://hg.python.org/cpython/rev/19a33ef3821d

--
nosy: +python-dev

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



[issue17106] assertion error in IO reading text file as binary

2013-02-03 Thread Serhiy Storchaka

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


--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-02-03 Thread Éric Araujo

Éric Araujo added the comment:

On it.

--
priority: normal - release blocker

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d4dd297fedb1 by Éric Araujo in branch '2.7':
Add alias to restore 2.7.2 compatibility for setup scripts (#13994).
http://hg.python.org/cpython/rev/d4dd297fedb1

--

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-02-03 Thread Éric Araujo

Éric Araujo added the comment:

Benjamin, I don’t know if you are using a release clone or if you will just tag 
the main repo, so leaving this open for now.

--
resolution:  - fixed
stage: patch review - committed/rejected

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



[issue13994] incomplete revert in 2.7 Distutils left two copies of customize_compiler

2013-02-03 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Not yet tagged.

--
status: open - closed

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

New submission from Brett Cannon:

There is no reason __loader__ can't be set to None like __package__. That means 
having xml.parsers.expat.(model|errors) set the attribute to None by default 
(and thus removing the exemption for those modules from 
test_importlib.test_api.StartupTests), updating the decorators in 
importlib.util to set __loader__ when it is None, and make 
importlib.find_loader() treat None the same as if the attribute isn't set (e.g. 
unifying the raising of ValueError in both cases).

This will bring __loader__ back in alignment with __package__.

In all honesty I would like to tweak imp.new_module()/PyModule_Create() to set 
both __package__ and __loader__ to None by default, but I don't know how much 
code out there relies on the absence of these attributes and not on them being 
set to None (although fixing all of that code is simply transitioning from 
hasattr(module, '__loader__') to getattr(module, '__loader__', None)). Luckily 
PEP 302 was updated a couple versions back to state the loaders **must** set 
these attributes, so hopefully as time goes on this will be less of a worry.

--
assignee: brett.cannon
messages: 181279
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: __loader__ = None should be fine
type: behavior
versions: Python 3.4

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



[issue17116] xml.parsers.expat.(errors|model) don't set the __loader__ attribute

2013-02-03 Thread Brett Cannon

New submission from Brett Cannon:

A new test in test_importlib is discovering that pyexpat is creating both its 
errors and model modules by hand in pyexpat's initialization function. Should 
at least set __loader__ to None there.

--
assignee: brett.cannon
messages: 181280
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: xml.parsers.expat.(errors|model) don't set the __loader__ attribute
type: behavior
versions: Python 3.4

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +xml.parsers.expat.(errors|model) don't set the __loader__ 
attribute

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Raise ValueError when __loader__ not defined for 
importlib.find_loader()

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



[issue17117] Update importlib.util.module_for_loader/set_loader to set when __loader__ = None

2013-02-03 Thread Brett Cannon

New submission from Brett Cannon:

The various importlib.util decorators involved with __loader__ should reset the 
attribute when it is set to None, just like for __package__.

--
assignee: brett.cannon
components: Library (Lib)
messages: 181281
nosy: brett.cannon
priority: normal
severity: normal
stage: test needed
status: open
title: Update importlib.util.module_for_loader/set_loader to set when 
__loader__ = None
type: behavior
versions: Python 3.4

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



[issue17117] Update importlib.util.module_for_loader/set_loader to set when __loader__ = None

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
keywords: +easy

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



[issue17116] xml.parsers.expat.(errors|model) don't set the __loader__ attribute

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
keywords: +easy

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
dependencies: +Update importlib.util.module_for_loader/set_loader to set when 
__loader__ = None

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



[issue17114] Python IDLE GUI does not open in Ubuntu 12.04

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can you please provide your config-highlight.cfg?

--
nosy: +serhiy.storchaka

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



[issue17099] Raise ValueError when __loader__ not defined for importlib.find_loader()

2013-02-03 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
assignee:  - brett.cannon

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

Brett Cannon added the comment:

Screw it, forget the like and make that a will happen. A What's New entry 
telling people to update their code to use a getattr() with a None default 
value for transitioning should be enough (and a single line change for the few 
people who would care about this).

This will also require an updating of the importlib docs, language reference, 
and PEP 302 to say the language reference and importlib docs now supersede the 
PEP. For both attributes it should be stated that a value of None means I 
don't know what the values should be, but that loaders should continue to be 
required to set them.

--

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



[issue14340] Update embedded copy of expat - fix security crash issues

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d2f6f63e73af by Gregory P. Smith in branch '3.2':
Update the embedded copy of the expat XML parser to 2.1.0.  It brings
http://hg.python.org/cpython/rev/d2f6f63e73af

--

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



[issue14340] Update embedded copy of expat - fix security crash issues

2013-02-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

done.

btw, it looks like benjamin.peterson did it for 2.7 yesterday morning but when 
'hg graft' is used to apply a change from another branch the roundup 
notification mentions the original commit's author, not the person who did the 
push of the graft.

--
resolution:  - fixed
status: open - closed

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



[issue17118] Add tests for testing Python-Tcl interaction

2013-02-03 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds tests for testing how Python values converted when passed 
to Tkinter and back. This patch was a part of issue16840, but other issues need 
this tests.

--
assignee: serhiy.storchaka
components: Tests, Tkinter
files: tkinter_test_passing_values.patch
keywords: patch
messages: 181286
nosy: gpolo, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add tests for testing Python-Tcl interaction
type: enhancement
versions: Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file28946/tkinter_test_passing_values.patch

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



[issue17118] Add tests for testing Python-Tcl interaction

2013-02-03 Thread Serhiy Storchaka

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


--
versions: +Python 2.7
Added file: 
http://bugs.python.org/file28947/tkinter_test_passing_values-2.7.patch

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



[issue7358] cStringIO not 64-bit safe

2013-02-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Suggested workaround: use io.BytesIO instead of cStringIO.

comments on the patch... in short: your patch is changing an ABI and isn't 
suitable for a maintenance release.

I'm not sure how much we can usefully do to cStringIO in a maintenance release. 
 I'd be inclined to close as wontfix as io.BytesIO is available.

--
nosy: +gregory.p.smith

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



[issue17119] Integer overflow when passing large string to Tkinter

2013-02-03 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Second argument of Tcl_NewUnicodeObj() which specifies a number of characters 
has type int. When a large string with more than INT_MAX characters passed to 
Tkinter this value will overflow. If this parameter is negative, all characters 
up to the first null character are used (up to the end of string because 
current string implementation has null character after the end). When string 
length will be more than UINT_MAX, always only part of string will be converted.

I propose explicitly check a string length and raise an exception when the 
length overflows C int range.

--
components: Tkinter
messages: 181288
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Integer overflow when passing large string to Tkinter
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

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



[issue17119] Integer overflow when passing large string to Tkinter

2013-02-03 Thread Serhiy Storchaka

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


--
dependencies: +Add tests for testing Python-Tcl interaction

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



[issue7358] cStringIO not 64-bit safe

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Not making cStringIO 64-bit compatible is one thing. But we can still fix the 
crashes by detecting an overflow before it happens ;)

--

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




[issue7358] cStringIO not 64-bit safe

2013-02-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Suggested workaround: use io.BytesIO instead of cStringIO.

Well, maybe we can replace cStringIO by io.BytesIO in cPickle (and other 
places).

 comments on the patch... in short: your patch is changing an ABI and isn't 
 suitable for a maintenance release.

Isn't this a private API?

 I'm not sure how much we can usefully do to cStringIO in a maintenance 
release.  I'd be inclined to close as wontfix as io.BytesIO is available.

We can't just close this issue. cStringIO crashes Python. We can use another 
approach. Change cStringIO so that user can't write or read more than INT_MAX 
bytes at a time (an exception will be raised instead of crash), but can write 
more than INT_MAX bytes in sum and get all string with getvalue(). This will 
preserve an ABI.

--

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



[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2013-02-03 Thread Chris Jerdonek

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


--
nosy: +bethard, chris.jerdonek

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Never mind :)

--

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Chris Jerdonek

Chris Jerdonek added the comment:

How does the + level relate to the convention described here?

http://docs.python.org/devguide/documenting.html#sections

--
nosy: +chris.jerdonek

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Mmmh, what is the point of forcing people to adapt their module-like objects so 
that they have a __loader__ entry?
Couldn't importlib just interpret the absence of __loader__ as a None?

--
nosy: +pitrou

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I see why I was confused.  The ~'s are different from -'s.  The tilde level 
isn't listed in our devguide conventions.

--

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



[issue7358] cStringIO not 64-bit safe

2013-02-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Include/cStringIO.h is public and the name of the structure PycStringIO lacks 
an _ which implies that it is public.

There appear to be a few references to it in external projects doing some 
searching.  A (very old) version of twisted/protocols/_c_urlarg.c uses it for 
example.

Doing the latter and limiting writes to INT_MAX but allowing greater to 
accumulate makes sense.

--

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I see why I was confused.  The ~'s are different from -'s.  The tilde
 level isn't listed in our devguide conventions.

I think the conventions are just conventions, and docutils / sphinx
don't enforce any order. I may be wrong though.

--

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



[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords

2013-02-03 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Serhiy's patch looks good to me.

--
nosy: +gregory.p.smith

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-02-03 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Anatoly, please stop playing with the headers. It is meaningless and 
irritating, especially when you set them wrong. The 3.5 choice is for issues 
that will *not* apply before then. An example is actually making a change 
warned about in a deprecation warning. 3.2 will soon see its last regular 
bugfix release. The main purpose of the headers is to help developers develop 
and apply a patch. The secondary purpose is serve as history and to inform 
users.

As I explained in my email to you
1. The OP meant for this to be a code bug report.
2. This was properly closed as an invalid bug report. So there will be no code 
patch. So the headers have no use except as history.
3. I do believe the doc should be changed, *and* I believe it should be a new 
issue. If I do open one, I will try to remember to add it here as superseder.

--

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



[issue14103] argparse: add ability to create a bash completion script

2013-02-03 Thread Andrey Kislyuk

Andrey Kislyuk added the comment:

FYI: http://pypi.python.org/pypi/argcomplete

--
nosy: +Andrey.Kislyuk

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



[issue17107] test_sni in test_urllib2net could be enabled

2013-02-03 Thread Daniel Black

Daniel Black added the comment:

ask and you shall receive :-)

--
keywords: +patch
nosy: +grooverdan
versions: +Python 3.5
Added file: http://bugs.python.org/file28948/https_sni_test.patch

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



[issue17115] __loader__ = None should be fine

2013-02-03 Thread Brett Cannon

Brett Cannon added the comment:

It will interpret its absence as None, but I would rather get the very common 
case of actual module instances just setting None automatically. Not having it 
set when None is already an accepted default value for __package__ seems 
inconsistent; either the lack of attribute should signify that the value is 
unknown for both values, or having None should, but not both. I'm advocating 
for the latter as it has an easier compatibility path. Plus I'm not worrying 
about random objects people stash into sys.modules, just real modules created 
from imp.new_module()/PyModule_Create(); if you muck with sys.modules you are 
on your own.

--

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Georg Brandl

Georg Brandl added the comment:

Antoine is right.  It's probably ok to remove that suggestion completely.

--
nosy: +georg.brandl

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



[issue17109] unittest.mock has wrong heading levels

2013-02-03 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I think the guidance is still helpful.  I have referred to it often.  It can 
just be changed to being a suggestion as opposed to the convention that we 
use.

--

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



[issue14103] argparse: add ability to create a bash completion script

2013-02-03 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

thanks so much; will play with it soon enough

--

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



[issue5289] ctypes.util.find_library does not work under Solaris

2013-02-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d76fb24d79c3 by Benjamin Peterson in branch '2.7':
fix find_library on Solaris (closes #5289)
http://hg.python.org/cpython/rev/d76fb24d79c3

New changeset 73574de2068b by Benjamin Peterson in branch '3.3':
fix find_library on Solaris (closes #5289)
http://hg.python.org/cpython/rev/73574de2068b

New changeset 640a80adb9df by Benjamin Peterson in branch 'default':
merge 3.3 (#5289)
http://hg.python.org/cpython/rev/640a80adb9df

--
nosy: +python-dev
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

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



[issue17091] thread.lock.acquire docstring bug

2013-02-03 Thread Ian Cordasco

Ian Cordasco added the comment:

Was this already taken care of? 
http://docs.python.org/2/library/thread.html?highlight=thread.lock#thread.lock.acquire
 and 
http://docs.python.org/3.3/library/_thread.html?highlight=thread.lock#_thread.lock.acquire
 don't make any mention of returning None.

--
nosy: +icordasc

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



[issue17091] thread.lock.acquire docstring bug

2013-02-03 Thread R. David Murray

R. David Murray added the comment:

Armin is talking about the docstring, not the docs.  That is, what you get if 
you do help(x.acquire), where x is a Lock object, at the Python prompt.

--
nosy: +r.david.murray

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



[issue17091] thread.lock.acquire docstring bug

2013-02-03 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
versions: +Python 3.3, Python 3.4 -Python 3.5

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



[issue17091] thread.lock.acquire docstring bug

2013-02-03 Thread Ian Cordasco

Ian Cordasco added the comment:

Thanks. I couldn't find it in the source but I just found 
Modules/_threadmodule.c

I tested the method from the interpreter to confirm the changes I was making to 
the docstring. Attached is a diff that covers the change.

--
Added file: http://bugs.python.org/file28949/doc_fix.txt

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



[issue17120] Mishandled _POSIX_C_SOURCE and _XOPEN_SOURCE in pyconfig.h

2013-02-03 Thread RAW

New submission from RAW:

The header file pyconfig.h mishandles the _POSIX_C_SOURCE and _XOPEN_SOURCE 
preprocessor macros.

For older versions of Python, the pyconfig.h header specifies:

#define _POSIX_C_SOURCE 200112L

and:

#define _XOPEN_SOURCE 600

For newer versions of Python, the pyconfig.h header specifies:

#define _POSIX_C_SOURCE 200809L

and:

#define _XOPEN_SOURCE 700

The Open Group has documentation about these symbols:

http://pubs.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_02.html

In particular, the documentation states:

A POSIX-conforming application should ensure that the feature test macro 
_POSIX_C_SOURCE is defined before inclusion of any header.

So, having a header file attempting to set _POSIX_C_SOURCE violates this 
intention.

Yes, I am well aware that the Python documentation says to include Python.h 
before any standard headers are included.  However, this is still problematic.

In particular, it causes trouble for source code that wishes to include the 
Python headers and wishes to use declarations that are made visible by setting 
later values for _POSIX_C_SOURCE and _XOPEN_SOURCE.

I would suggest the pyconfig.h be updated to have something like this:

#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE  200112L
#ifdef _POSIX_C_SOURCE
#warning Python expects -D_POSIX_C_SOURCE=200112L or later
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 200112L
#endif

and this:

#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE  600
#ifdef _XOPEN_SOURCE
#warning Python expects -D_XOPEN_SOURCE=600 or later
#undef _XOPEN_SOURCE
#endif
#define _XOPEN_SOURCE 600
#endif

--
components: Library (Lib)
messages: 181309
nosy: RAW
priority: normal
severity: normal
status: open
title: Mishandled _POSIX_C_SOURCE and _XOPEN_SOURCE in pyconfig.h
type: compile error
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.4, Python 3.5

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



[issue10365] IDLE Crashes on File Open Dialog when code window closed before other file opened

2013-02-03 Thread Patrick

Patrick added the comment:

Forgive me if I'm not following the correct process. But I believe I have seen 
this issue again in 3.3. Not sure I captured exactly what is needed from the 
command line. The file being openeed is from the Python Hands On Class Examples 
http://anh.cs.luc.edu/python/hands-on/

c:\python33\python.exe -m idlelib.idle
Exception in Tkinter callback
Traceback (most recent call last):
  File c:\python33\lib\tkinter\__init__.py, line 1442, in __call__
return self.func(*args)
  File c:\python33\lib\idlelib\MultiCall.py, line 174, in handler
doafterhandler.pop()()
  File c:\python33\lib\idlelib\MultiCall.py, line 221, in lambda
doit = lambda: self.bindedfuncs[triplet[2]][triplet[0]].remove(func)
ValueError: list.remove(x): x not in list
Traceback (most recent call last):
  File c:\python33\lib\runpy.py, line 160, in _run_module_as_main
__main__, fname, loader, pkg_name)
  File c:\python33\lib\runpy.py, line 73, in _run_code
exec(code, run_globals)
  File c:\python33\lib\idlelib\idle.py, line 11, in module
idlelib.PyShell.main()
  File c:\python33\lib\idlelib\PyShell.py, line 1477, in main
root.mainloop()
  File c:\python33\lib\tkinter\__init__.py, line 1038, in mainloop
self.tk.mainloop(n)

--
nosy: +Patrick.Walters

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