[issue17106] assertion error in IO reading text file as binary
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
[issue17106] assertion error in IO reading text file as binary
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
[issue17106] assertion error in IO reading text file as binary
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
[issue17114] Python IDLE GUI does not open in Ubuntu 12.04
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
[issue17118] Add tests for testing Python-Tcl interaction
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
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
[issue17119] Integer overflow when passing large string to Tkinter
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
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
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
[issue7358] cStringIO not 64-bit safe
Serhiy Storchaka added the comment: Thank you for review and enlightenment Gregory. Here is an updated patch which doesn't change an ABI. -- Added file: http://bugs.python.org/file28951/cStringIO64_2.patch ___ 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
[issue17122] Fix and cleanup test_functools
New submission from Serhiy Storchaka: Since changeset fcfaca024160 (issue12428) subclassing of partial actually is not tested (subclassed partial overwritten in setUp() method). The proposed patch fixes this and some other minor issues and cleanup the code. -- assignee: serhiy.storchaka components: Tests files: test_functools.diff keywords: patch messages: 181319 nosy: pitrou, serhiy.storchaka, zach.ware priority: normal severity: normal stage: patch review status: open title: Fix and cleanup test_functools type: behavior versions: Python 3.4 Added file: http://bugs.python.org/file28952/test_functools.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17122 ___ ___ 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
Serhiy Storchaka added the comment: Run IDLE from command line and you will see: configparser.DuplicateOptionError: While reading from .../.idlerc/config-highlight.cfg [line 29]: option 'cursor-foreground' in section 'Rajesh_Python_Settings' already exists Your configuration is wrong. Just remove duplicated option 'cursor-foreground' (and other duplications if they exist). However 2.7 and 3.1 are tolerant for this. This is an IDLE bug, a regression in 3.2. -- keywords: +3.2regression stage: - needs patch type: - behavior versions: +Python 3.3, Python 3.4 ___ 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
[issue17114] Python IDLE GUI does not open in Ubuntu 12.04
Serhiy Storchaka added the comment: ConfigParser is more strong by default since 3.2. Here is a simple patch which made IDLE more tolerant for such kind of user errors. -- assignee: - serhiy.storchaka keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file28953/idle_nonstrict_config.patch ___ 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
[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords
Serhiy Storchaka added the comment: I do not have possibility and desires blind-repair a test on alien platform, so just temporarily disable a new test in Lib/ctypes/test/test_returnfuncptrs.py on Windows. If someone has a desire to fix it fell free to do this. I do not close this issue because committed patch only fix existing crashes in Python. There should be plenty of such bugs in third-party code. We have to deprecate this unsafe feature or reject any sequences except tuple as Alexander proposed. -- stage: patch review - needs patch versions: -Python 3.1 ___ 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
[issue6083] Reference counting bug in PyArg_ParseTuple and PyArg_ParseTupleAndKeywords
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: serhiy.storchaka - ___ 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
[issue16903] subprocess.Popen.communicate with universal_newlines=True doesn't accept strings on 3.2
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ 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
Serhiy Storchaka added the comment: Committed changeset 4be538a058a8. Thank you for the patch. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ 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
[issue2175] Expat sax parser silently ignores the InputSource protocol
Serhiy Storchaka added the comment: Here is a patch, which made xml.sax.xmlreader and related utilities to support character stream. A lot of new tests added (including Yitz Gale's tests from issue1483). Some old tests fixed (they were used text stream as byte stream, this doesn't work in general case). -- components: -Documentation, Extension Modules keywords: +patch nosy: +ezio.melotti stage: - patch review versions: +Python 3.4 Added file: http://bugs.python.org/file28954/sax_character_stream.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2175 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.
Serhiy Storchaka added the comment: 'Mon Jan 1 -01:00:00 2011\n' This is obviously wrong because trailing '\n' was not dropped. The issue is not about what is more wrong. The issue is about Python crash. At least we should add a warning in the documentation that incorrect data may crash Python on some platforms. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16137 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.
Serhiy Storchaka added the comment: A new patch uses asctime_s() on Windows (this crash was observed only on Windows). This should prevent a crash. In additional it drops '\n' from a result even if the result is longer than usually (this happened on Linux when an invalid time is used). Please run test_time on Windows. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16137 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file28958/asctime_s.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16137 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12983] byte string literals with invalid hex escape codes raise ValueError instead of SyntaxError
Serhiy Storchaka added the comment: Ping. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12983 ___ ___ 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
Serhiy Storchaka added the comment: I missed existing test_tcl. Patches updated, now they add new tests into test_tcl. -- Added file: http://bugs.python.org/file28959/tkinter_test_passing_values_2.patch Added file: http://bugs.python.org/file28960/tkinter_test_passing_values-2.7_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17118 ___diff -r 7ccdbd1cd213 Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py Tue Feb 05 08:25:24 2013 +0100 +++ b/Lib/test/test_tcl.py Tue Feb 05 15:10:21 2013 +0200 @@ -151,6 +151,26 @@ # exit code must be zero self.assertEqual(f.close(), None) +def test_passing_values(self): +def passValue(value): +return self.interp.call('set', '_', value) + +self.assertEqual(passValue(True), True) +self.assertEqual(passValue(False), False) +self.assertEqual(passValue('string'), 'string') +self.assertEqual(passValue('string\u20ac'), 'string\u20ac') +for i in (0, 1, -1, 2**31-1, -2**31): +self.assertEqual(passValue(i), i) +for f in (0.0, 1.0, -1.0, 1/3, + sys.float_info.min, sys.float_info.max, + -sys.float_info.min, -sys.float_info.max): +self.assertEqual(passValue(f), f) +for f in float('nan'), float('inf'), -float('inf'): +if f != f: # NaN +self.assertNotEqual(passValue(f), f) +else: +self.assertEqual(passValue(f), f) +self.assertEqual(passValue((1, '2', (3.4,))), (1, '2', (3.4,))) def test_main(): diff -r 7ccdbd1cd213 Lib/tkinter/test/test_tkinter/test_nogui.py --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/Lib/tkinter/test/test_tkinter/test_nogui.py Tue Feb 05 15:10:21 2013 +0200 @@ -0,0 +1,36 @@ +import unittest +import sys +import tkinter +from test import support + +class NoguiTest(unittest.TestCase): + +def setUp(self): +self.call = tkinter.Tcl().tk.call + +def test_passing_values(self): +def passValue(value): +return self.call('set', '_', value) +#self.assertEqual(passValue(()), True) +self.assertEqual(passValue(True), True) +self.assertEqual(passValue(False), False) +self.assertEqual(passValue('string'), 'string') +self.assertEqual(passValue('string\u20ac'), 'string\u20ac') +for i in (0, 1, -1, 2**31-1, -2**31): +self.assertEqual(passValue(i), i) +for f in (0.0, 1.0, -1.0, 1/3, + sys.float_info.min, sys.float_info.max, + -sys.float_info.min, -sys.float_info.max): +self.assertEqual(passValue(f), f) +for f in float('nan'), float('inf'), -float('inf'): +if f != f: # NaN +self.assertNotEqual(passValue(f), f) +else: +self.assertEqual(passValue(f), f) +self.assertEqual(passValue((1, '2', (3.4,))), (1, '2', (3.4,))) + + +tests_gui = (NoguiTest,) + +if __name__ == __main__: +support.run_unittest(*tests_gui) diff -r 20f0c5398e97 Lib/lib-tk/test/test_tkinter/test_nogui.py --- /dev/null Thu Jan 01 00:00:00 1970 + +++ b/Lib/lib-tk/test/test_tkinter/test_nogui.pyTue Feb 05 15:14:22 2013 +0200 @@ -0,0 +1,37 @@ +import unittest +import sys +import Tkinter as tkinter +import test.test_support as support + +class NoguiTest(unittest.TestCase): + +def setUp(self): +self.call = tkinter.Tcl().tk.call + +def test_passing_values(self): +def passValue(value): +return self.call('set', '_', value) +self.assertEqual(passValue(True), True) +self.assertEqual(passValue(False), False) +self.assertEqual(passValue('string'), 'string') +self.assertEqual(passValue('string\u20ac'), 'string\u20ac') +self.assertEqual(passValue(u'string'), u'string') +self.assertEqual(passValue(u'string\u20ac'), u'string\u20ac') +for i in (0, 1, -1, int(2**31-1), int(-2**31)): +self.assertEqual(passValue(i), i) +for f in (0.0, 1.0, -1.0, 1/3, + sys.float_info.min, sys.float_info.max, + -sys.float_info.min, -sys.float_info.max): +self.assertEqual(passValue(f), f) +for f in float('nan'), float('inf'), -float('inf'): +if f != f: # NaN +self.assertNotEqual(passValue(f), f) +else: +self.assertEqual(passValue(f), f) +self.assertEqual(passValue((1, '2', (3.4,))), (1, '2', (3.4,))) + + +tests_gui = (NoguiTest,) + +if __name__ == __main__: +support.run_unittest(*tests_gui) diff -r 20f0c5398e97 Lib/test/test_tcl.py --- a/Lib/test/test_tcl.py Mon Feb 04 10:29:38 2013 -0500 +++ b/Lib/test/test_tcl.py Tue Feb 05 15:14:22 2013 +0200 @@ -1,6 +1,7 @@ #!/usr/bin/env python import unittest +import sys import os from
[issue17118] Add tests for testing Python-Tcl interaction
Changes by Serhiy Storchaka storch...@gmail.com: Removed 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
Changes by Serhiy Storchaka storch...@gmail.com: Removed 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
Changes by Serhiy Storchaka storch...@gmail.com: Removed 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
[issue17118] Add tests for testing Python-Tcl interaction
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28959/tkinter_test_passing_values_2.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
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28960/tkinter_test_passing_values-2.7_2.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
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file28961/tkinter_test_passing_values_2.patch Added file: http://bugs.python.org/file28962/tkinter_test_passing_values-2.7_2.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
[issue17043] Invalid read in test_codecs
Serhiy Storchaka added the comment: Ping. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17043 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16723] io.TextIOWrapper on urllib.request.urlopen terminates prematurely
Serhiy Storchaka added the comment: Senthil, Antoine, anyone, what you think about this patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16137] Using time.asctime() with an array with negative tm_hour causes Python Crash.
Serhiy Storchaka added the comment: Thank you for comments, Victor. Here is an updated patch. -- Added file: http://bugs.python.org/file28963/asctime_s_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16137 ___diff -r 20f0c5398e97 Lib/test/test_time.py --- a/Lib/test/test_time.py Mon Feb 04 10:29:38 2013 -0500 +++ b/Lib/test/test_time.py Tue Feb 05 16:04:32 2013 +0200 @@ -128,10 +128,15 @@ # self.assertRaises(ValueError, time.asctime, # (12345, 1, 0, 0, 0, 0, 0, 0, 0)) # XXX: For now, just make sure we don't have a crash: -try: -time.asctime((12345, 1, 1, 0, 0, 0, 0, 1, 0)) -except ValueError: -pass +def check(tm): +try: +self.assertNotIn('\n', time.asctime(tm)) +except ValueError: +pass +check((12345, 1, 1, 0, 0, 0, 0, 1, 0)) +# Issue #16137 +check((2013, 2, 5, -1, 0, 0, 0, 0, 0)) +check((2013, 2, 5, 101, 0, 0, 0, 0, 0)) @unittest.skipIf(not hasattr(time, tzset), time module has no attribute tzset) diff -r 20f0c5398e97 Misc/NEWS --- a/Misc/NEWS Mon Feb 04 10:29:38 2013 -0500 +++ b/Misc/NEWS Tue Feb 05 16:04:32 2013 +0200 @@ -199,6 +199,10 @@ Library --- +- Issue #16137: Fix a segmentation fault when time.asctime() called with an + illegal time (i.e. with a negative hour) on Windows. On other platforms a + result of such call no more contains a trailing '\n'. + - Issue #6083: Fix multiple segmentation faults occured when PyArg_ParseTuple parses nested mutating sequence. diff -r 20f0c5398e97 Modules/timemodule.c --- a/Modules/timemodule.c Mon Feb 04 10:29:38 2013 -0500 +++ b/Modules/timemodule.c Tue Feb 05 16:04:32 2013 +0200 @@ -563,7 +563,10 @@ { PyObject *tup = NULL; struct tm buf; -char *p; +char *p, *q; +#ifdef MS_WINDOWS +char sbuf[100]; +#endif if (!PyArg_UnpackTuple(args, asctime, 0, 1, tup)) return NULL; if (tup == NULL) { @@ -571,14 +574,24 @@ buf = *localtime(tt); } else if (!gettmarg(tup, buf)) return NULL; +#ifdef MS_WINDOWS +if (asctime_s(sbuf, sizeof(sbuf) - 1, buf) != 0) +p = NULL; +else { +p = sbuf; +sbuf[sizeof(sbuf) - 1] = '\0'; +} +#else p = asctime(buf); +#endif if (p == NULL) { PyErr_SetString(PyExc_ValueError, invalid time); return NULL; } -if (p[24] == '\n') -p[24] = '\0'; -return PyString_FromString(p); +q = strchr(p, '\n'); +if (q == NULL) +q = strchr(p, '\0'); /* end of string */ +return PyString_FromStringAndSize(p, q - p); } PyDoc_STRVAR(asctime_doc, ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10557] Malformed error message from float()
Changes by Serhiy Storchaka storch...@gmail.com: -- status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10557 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17073] Integer overflow in sqlite module
Serhiy Storchaka added the comment: Here are tests for some bugs. -- assignee: - serhiy.storchaka Added file: http://bugs.python.org/file28965/sqlite_int_overflow_tests.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17073 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16203] Proposal: add re.fullmatch() method
Serhiy Storchaka added the comment: I did not analyze the patch deeply, only left on Rietveld comments on first sight. Need to update the documentation. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16203 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14263] switch_index_if_fails fails on py2
Serhiy Storchaka added the comment: Should it be closed? -- nosy: +serhiy.storchaka status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14263 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12177] re.match raises MemoryError
Serhiy Storchaka added the comment: This is a duplicate of issue9669. -- nosy: +serhiy.storchaka resolution: - duplicate stage: needs patch - committed/rejected status: open - closed superseder: - regexp: zero-width matches in MIN_UNTIL ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12177 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full
Serhiy Storchaka added the comment: In general it looks good to me. But we can get rid of Python file and use only os.open/os.write/os.close. Here is an updated patch which carefully close a file descriptor and remove a file even if write or close failed. Amir Szekely, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/ http://python.org/psf/contrib/ -- nosy: +georg.brandl, ncoghlan, serhiy.storchaka Added file: http://bugs.python.org/file28966/fix_tempfile_leaving_files_behind_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full
Serhiy Storchaka added the comment: In general it looks good to me. But we can get rid of Python file and use only os.open/os.write/os.close. Here is an updated patch which carefully close a file descriptor and remove a file even if write or close failed. Amir Szekely, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/ http://python.org/psf/contrib/ -- Added file: http://bugs.python.org/file28967/fix_tempfile_leaving_files_behind_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg181470 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28967/fix_tempfile_leaving_files_behind_2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16800 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16800] tempfile._get_default_tempdir() leaves files behind when HD is full
Serhiy Storchaka added the comment: And here are patches for 2.7 and 3.2 (there are some peculiarities, i.e. in exception handling). -- Added file: http://bugs.python.org/file28968/fix_tempfile_leaving_files_behind_2-2.7.patch Added file: http://bugs.python.org/file28969/fix_tempfile_leaving_files_behind_2-3.2.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16800 ___diff -r 20f0c5398e97 Lib/tempfile.py --- a/Lib/tempfile.py Mon Feb 04 10:29:38 2013 -0500 +++ b/Lib/tempfile.py Tue Feb 05 20:57:18 2013 +0200 @@ -193,14 +193,16 @@ name = namer.next() filename = _os.path.join(dir, name) try: -fd = _os.open(filename, flags, 0600) -fp = _os.fdopen(fd, 'w') -fp.write('blat') -fp.close() -_os.unlink(filename) -del fp, fd +fd = _os.open(filename, flags, 0o600) +try: +try: +_os.write(fd, b'blat') +finally: +_os.close(fd) +finally: +_os.unlink(filename) return dir -except (OSError, IOError), e: +except (OSError, IOError) as e: if e[0] != _errno.EEXIST: break # no point trying more names in this directory pass diff -r 20f0c5398e97 Lib/test/test_support.py --- a/Lib/test/test_support.py Mon Feb 04 10:29:38 2013 -0500 +++ b/Lib/test/test_support.py Tue Feb 05 20:57:18 2013 +0200 @@ -1298,6 +1298,33 @@ except: break +@contextlib.contextmanager +def swap_attr(obj, attr, new_val): +Temporary swap out an attribute with a new object. + +Usage: +with swap_attr(obj, attr, 5): +... + +This will set obj.attr to 5 for the duration of the with: block, +restoring the old value at the end of the block. If `attr` doesn't +exist on `obj`, it will be created and then deleted at the end of the +block. + +if hasattr(obj, attr): +real_val = getattr(obj, attr) +setattr(obj, attr, new_val) +try: +yield +finally: +setattr(obj, attr, real_val) +else: +setattr(obj, attr, new_val) +try: +yield +finally: +delattr(obj, attr) + def py3k_bytes(b): Emulate the py3k bytes() constructor. diff -r 20f0c5398e97 Lib/test/test_tempfile.py --- a/Lib/test/test_tempfile.py Mon Feb 04 10:29:38 2013 -0500 +++ b/Lib/test/test_tempfile.py Tue Feb 05 20:57:18 2013 +0200 @@ -1,7 +1,9 @@ # tempfile.py unit tests. import tempfile +import errno import os import signal +import shutil import sys import re import warnings @@ -202,8 +204,45 @@ test_classes.append(test__candidate_tempdir_list) +# We test _get_default_tempdir some more by testing gettempdir. -# We test _get_default_tempdir by testing gettempdir. +class TestGetDefaultTempdir(TC): +Test _get_default_tempdir(). + +def test_no_files_left_behind(self): +# use a private empty directory +our_temp_directory = tempfile.mkdtemp() +try: +# force _get_default_tempdir() to consider our empty directory +def our_candidate_list(): +return [our_temp_directory] + +with test_support.swap_attr(tempfile, _candidate_tempdir_list, +our_candidate_list): +# verify our directory is empty after _get_default_tempdir() +tempfile._get_default_tempdir() +self.assertEqual(os.listdir(our_temp_directory), []) + +def raise_OSError(*args, **kwargs): +raise OSError(-1) + +with test_support.swap_attr(os, open, raise_OSError): +# test again with failing os.open() +with self.assertRaises(IOError) as cm: +tempfile._get_default_tempdir() +self.assertEqual(cm.exception.errno, errno.ENOENT) +self.assertEqual(os.listdir(our_temp_directory), []) + +with test_support.swap_attr(os, write, raise_OSError): +# test again with failing os.write() +with self.assertRaises(IOError) as cm: +tempfile._get_default_tempdir() +self.assertEqual(cm.exception.errno, errno.ENOENT) +self.assertEqual(os.listdir(our_temp_directory), []) +finally: +shutil.rmtree(our_temp_directory) + +test_classes.append(TestGetDefaultTempdir) class test__get_candidate_names(TC): diff -r 801cb3918212 Lib/tempfile.py --- a/Lib/tempfile.py Tue Feb 05 10:49:49 2013 -0500 +++ b/Lib/tempfile.py Tue Feb
[issue2840] Expat parser locks XML source file if ContentHandler raises an exception
Serhiy Storchaka added the comment: This is a duplicate of issue15388. Parser doesn't close an input source's stream if an exception raised. -- nosy: +serhiy.storchaka resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - SAX parse (ExpatParser) leaks file handle when given filename input ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2840 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17122] Fix and cleanup test_functools
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17122 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16723] io.TextIOWrapper on urllib.request.urlopen terminates prematurely
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16723 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13541] HTTPResponse (urllib) has no attribute read1 needed for TextIOWrapper
Serhiy Storchaka added the comment: Issue12591 added support of raw streams without read1() in io.TextIOWrapper(). -- nosy: +serhiy.storchaka resolution: - out of date stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13541 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue8194] Incompatible API change in xmlrpclib.Transport.parse_response() of Python 2.7 and 3.2
Serhiy Storchaka added the comment: Should this issue be closed? -- nosy: +serhiy.storchaka status: open - pending ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8194 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11311] StringIO.readline(0) returns incorrect results
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +IO keywords: +easy nosy: +serhiy.storchaka stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6532] thread.get_ident() should return unsigned value
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka versions: +Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12596] cPickle - stored data differ for same dictionary
Changes by Serhiy Storchaka storch...@gmail.com: -- nosy: +serhiy.storchaka stage: - needs patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12596 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Changes by Serhiy Storchaka storch...@gmail.com: -- keywords: +easy nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17141] random.vonmisesvariate() hangs for large kappa
New submission from Serhiy Storchaka: random.vonmisesvariate(0, 1e16) hangs. -- components: Library (Lib) messages: 181511 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal stage: needs patch status: open title: random.vonmisesvariate() hangs for large kappa 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/issue17141 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Serhiy Storchaka added the comment: Here is a patch. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue14012] Misc tarfile fixes
Serhiy Storchaka added the comment: The patch is desynchronized from current sources. -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14012 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13234] os.listdir breaks with literal paths
Serhiy Storchaka added the comment: I added minor comments in Rietveld. Santoso Wijaya, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/ http://python.org/psf/contrib/ -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13234 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11311] StringIO.readline(0) returns incorrect results
Serhiy Storchaka added the comment: Here is a very simple patch. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file28974/StringIO_readline0.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11311 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Serhiy Storchaka added the comment: Now it is here. -- Added file: http://bugs.python.org/file28975/random_triangular.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue6532] thread.get_ident() should return unsigned value
Serhiy Storchaka added the comment: Here is a patch, which made all thread id to be unsigned. -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file28976/thread_id_unsigned.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6532 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Serhiy Storchaka added the comment: One minor comment: I'd prefer it if the second test were elif low == high:, since that more obviously guards against the division by zero. It is written deliberately. What if low == high != mode? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: Here is a patch for 3.x which adds checks for size overflow (only on 64-bit platform). -- keywords: +patch stage: needs patch - patch review Added file: http://bugs.python.org/file28977/marshal_overflow.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: And here is a patch for 2.7. -- Added file: http://bugs.python.org/file28978/marshal_overflow-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: (And as a matter of principle, INT_MAX isn't really right here: an int might be only 16 bits long on some strange platforms...). AFAIK Python doesn't support such platforms (and C standard requites at least 32-bit ints). However there are strange platforms with 64-bit ints. That's why I used the explicit constant 0x7FFF. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10355] SpooledTemporaryFile's name property is broken
Serhiy Storchaka added the comment: Here is a patch which implements properties for which it has a sense and remove if there is no sense. -- assignee: - serhiy.storchaka components: +Library (Lib) keywords: +patch nosy: +ncoghlan, serhiy.storchaka stage: needs patch - patch review versions: +Python 3.3, Python 3.4 -Python 3.1 Added file: http://bugs.python.org/file28980/SpooledTemporaryFile_properties.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10355] SpooledTemporaryFile's name property is broken
Changes by Serhiy Storchaka storch...@gmail.com: Added file: http://bugs.python.org/file28981/SpooledTemporaryFile_properties-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue13355] random.triangular error when low = high=mode
Serhiy Storchaka added the comment: An exception is better than a garbage result. But I agree, triangular() currently is not protectet against a situation when mode is not in low--high range. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13355 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11714] threading.Semaphore does not use try...finally
Serhiy Storchaka added the comment: LGTM. 3.x patch a little desynchronized but it is easy to update it. I'll commit it if Antoine have no objections. Thomas Rachel, can you please submit a contributor form? http://python.org/psf/contrib/contrib-form/ http://python.org/psf/contrib/ -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka stage: - commit review versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11714 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11763] assertEqual memory issues with large text inputs
Serhiy Storchaka added the comment: I left comments on Rietveld. Tests needed. -- nosy: +serhiy.storchaka versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11763 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue11640] Shelve references globals in its __del__ method
Changes by Serhiy Storchaka storch...@gmail.com: -- versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11640 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17147] BytesIO should be mentioned in SpooledTemporaryFile documentation
New submission from Serhiy Storchaka: Currently only StringIO is mentioned (which was inherited from Python 2). -- assignee: docs@python components: Documentation, Library (Lib) files: SpooledTemporaryFile_document_BytesIO.patch keywords: patch messages: 181563 nosy: docs@python, georg.brandl, ncoghlan, serhiy.storchaka priority: normal severity: normal stage: patch review status: open title: BytesIO should be mentioned in SpooledTemporaryFile documentation type: compile error versions: Python 3.2, Python 3.3, Python 3.4 Added file: http://bugs.python.org/file28983/SpooledTemporaryFile_document_BytesIO.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17147 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue1423] wave sunau aifc 16bit errors
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file18919/unnamed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1423 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: Perhaps you could add a bigmem test for this? (assuming you have enough memory somewhere to test it) I think this is possible. I now have some experience in the writing of bigmem tests. ;) -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16203] Proposal: add re.fullmatch() method
Serhiy Storchaka added the comment: I can't comment right now, but I am going inspect thoroughly re internals. This is a new feature and we have enough time before 3.4 freeze. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16203 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: No, that's not true: see Annex E of the standard, where the minimum for INT_MAX is declared to be 32767. My fault. Do I have to support such a case in the code? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue5308] cannot marshal objects with more than 2**31 elements
Serhiy Storchaka added the comment: Perhaps we should change signatures of w_string() and r_string() -- replace int by at least long. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5308 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17149] random.vonmisesvariate() returns a value only on the half-circle
Changes by Serhiy Storchaka storch...@gmail.com: -- type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17149 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17149] random.vonmisesvariate() returns a value only on the half-circle
New submission from Serhiy Storchaka: random.vonmisesvariate(mu, kappa) returns a value in the range (mu%2pi)-pi/2 to (mu%2pi)+pi/2 for kappa 1e-6. For kappa = 1e-6 it returns an uniform random value over the range 0 to 2*pi. -- components: Library (Lib) messages: 181588 nosy: rhettinger, serhiy.storchaka priority: normal severity: normal status: open title: random.vonmisesvariate() returns a value only on the half-circle versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17149 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17141] random.vonmisesvariate() hangs for large kappa
Serhiy Storchaka added the comment: Here is an implementation which is more precise for small and large kappa, doesn't hang for large kappa, and even a little faster. It is mathematically totally equivalent to existing, but use more accurate calculations. -- keywords: +patch Added file: http://bugs.python.org/file28985/random_vonmisesvariate.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17141 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17141] random.vonmisesvariate() hangs for large kappa
Changes by Serhiy Storchaka storch...@gmail.com: -- stage: needs patch - patch review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17141 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12596] cPickle - stored data differ for same dictionary
Serhiy Storchaka added the comment: It is surprising that the pickled representation of 1-element dict varies from run to run. -- components: +Extension Modules -None ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12596 ___ ___ 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
Serhiy Storchaka added the comment: There are 6 different ways to get a function (see comment around PyCFuncPtr_new() in Modules/_ctypes/_ctypes.c). The other tests just use other ways. I'm more carefully read ctype code and found my mistake. Need to import my_strchr, and not strchr. -- ___ 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
[issue16389] re._compiled_typed's lru_cache causes significant degradation of the mako_v2 bench
Serhiy Storchaka added the comment: Maybe lru_cache() should have a key argument so you can specify a specialized key function. It would be interesting to look at the microbenchmarking results. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16389 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue12596] cPickle - stored data differ for same dictionary
Serhiy Storchaka added the comment: It is most probable that the difference is caused by the string interning. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12596 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17047] Fix double double words words
Serhiy Storchaka added the comment: Terry, do you want to provide a patch? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17047 ___ ___ 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
Serhiy Storchaka added the comment: Just wait a few weeks to release of 3.2.4 and it's appearance in your distribution. -- ___ 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
[issue17114] Python IDLE GUI does not open in Ubuntu 12.04
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ 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
[issue17118] Add tests for testing Python-Tcl interaction
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ 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
[issue17073] Integer overflow in sqlite module
Changes by Serhiy Storchaka storch...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17073 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16564] email.generator.BytesGenerator fails with bytes payload
Serhiy Storchaka added the comment: import io, email bytesdata = b'\xfa\xfb\xfc\xfd\xfe\xff' msg = email.mime.application.MIMEApplication(bytesdata, _encoder=encoders.encode_7or8bit) s = io.BytesIO() g = email.generator.BytesGenerator(s) g.flatten(msg) Traceback (most recent call last): File stdin, line 1, in module File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 91, in flatten self._write(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 137, in _write self._dispatch(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 163, in _dispatch meth(msg) File /home/serhiy/py/cpython3.2/Lib/email/generator.py, line 393, in _handle_text if _has_surrogates(msg._payload): TypeError: can't use a string pattern on a bytes-like object -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16564 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Changes by Serhiy Storchaka storch...@gmail.com: Removed file: http://bugs.python.org/file28992/pygettext.py.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Changes by Serhiy Storchaka storch...@gmail.com: -- assignee: - serhiy.storchaka nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17149] random.vonmisesvariate() results range is inconsistent for small and not small kappa
Serhiy Storchaka added the comment: Sorry, I was wrong. I missed that z is in range -1..1. Original report is invalid, random.vonmisesvariate() always returns a value on the full circle. However there is some inconsistency. For small kappa (= 1e-6) result range is 0 to 2pi, for other kappa it is (mu%2pi)-pi to (mu%2pi)+pi. For consistency we should either shift a range for small kappa: if kappa = 1e-6: return (mu % TWOPI) - _pi + TWOPI * random() or normalize a result in another case: if u3 0.5: theta = (mu + _acos(f)) % TWOPI else: theta = (mu - _acos(f)) % TWOPI -- title: random.vonmisesvariate() returns a value only on the half-circle - random.vonmisesvariate() results range is inconsistent for small and not small kappa ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17149 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Serhiy Storchaka added the comment: Here is a patch for 3.x, which correctly detects input file encoding and correctly escapes non-ascii output files if -E specified (and only if it specified). For 2.7 we should just negate an argument for make_escapes. -- components: +Unicode nosy: +ezio.melotti, loewis stage: - patch review versions: +Python 3.3, Python 3.4 Added file: http://bugs.python.org/file29001/pygettext_unicode.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Serhiy Storchaka added the comment: Here is a patch for 2.7. pygettext doesn't try to detect input encoding and transparently works with bytes, but it no longer escapes non-ascii bytes if -E is not specified. -- versions: +Python 2.7 Added file: http://bugs.python.org/file29002/pygettext_unicode-2.7.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17047] Fix double double words words
Serhiy Storchaka added the comment: I cannot find python-gdb.py. This is a copy of Tools/gdb/libpython.py. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17047 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue16686] audioop overflow issues
Serhiy Storchaka added the comment: I fixed yet one bug in avgpp() and remove my XXX comment. *All* audioop functions are unsafe regarding unaligned access. I'll open a new issue for this. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ 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
[issue16686] audioop overflow issues
Serhiy Storchaka added the comment: *All* audioop functions are unsafe regarding unaligned access. Actually this is not true because currently audioop functions work only with bytes (and str, see issue16685) and not with arbitrary memoryview. -- ___ 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
[issue17147] BytesIO should be mentioned in SpooledTemporaryFile documentation
Serhiy Storchaka added the comment: Thank you for corrections Éric. -- assignee: docs@python - serhiy.storchaka resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17147 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue17156] Tools/i18n/pygettext.py doesn't parse unicode string.
Serhiy Storchaka added the comment: Default encoding on Python 3 is UTF-8. You should declare your encoding at the top of file if it differs from UTF-8 or ASCII (i.e. # -*- coding: euc-jp -*-). Otherwise Python will reject your file (for Shift_JIS and EUC-JP) or produce incorrect result (for ISO-2022-JP). $ python3 konnichiha.Shift_JIS.py File konnichiha.Shift_JIS.py, line 5 SyntaxError: Non-UTF-8 code starting with '\x82' in file konnichiha.Shift_JIS.py on line 5, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details $ python3 konnichiha.ISO-2022-JP.py konnichiha B$3$s$K$A$O -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17156 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com