[issue16588] gcc 4.7 unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Another patch proposal, not sure about which is cleaner.

--

___
Python tracker 

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



[issue16588] gcc 4.7 unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


Added file: http://bugs.python.org/file28177/z2.diff

___
Python tracker 

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



[issue16588] gcc 4.7 unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
title: gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h 
-> gcc 4.7 unused-but-set warnings on Python/thread_pthread.h

___
Python tracker 

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



[issue16588] gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
keywords: +patch
Added file: http://bugs.python.org/file28176/z.diff

___
Python tracker 

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



[issue16588] gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

The warning is legitimate. "error" is set to 0 at the beginning and it will be 
set to 1 if an error occurred (via CHECK_STATUS macro). But the variable 
"error" is never used in the function. So it is set, but never actually used in 
the function.

The obvious thing to do is to use the variable. For instance, with an "if 
(error) {}" do nothing construction.

Please, review the patch. I will commit it if another core developer thinks it 
is ok.

Python 2.7, 3.2, 3.3 and 3.4 affected.

It you think there is a better way of handling this, let me know.

PS: With the default compilation parameters (-O3), that empty "if" is optimized 
out, as it should.

--
assignee:  -> jcea
keywords: +easy
nosy: +jcea
stage:  -> patch review
versions: +Python 2.7, Python 3.2, Python 3.4

___
Python tracker 

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



[issue16588] gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h

2012-11-30 Thread Bruno Dupuis

New submission from Bruno Dupuis:

Looks like #10951, but for another version of gcc.

I get these warnings:

 In file included from Python/thread.c:86:0:
 Python/thread_pthread.h: In function ‘PyThread_free_lock’:
 Python/thread_pthread.h:304:17: attention : variable ‘error’ set but not used 
[-Wunused-but-set-variable]
 Python/thread_pthread.h: In function ‘PyThread_acquire_lock_timed’:
 Python/thread_pthread.h:335:17: attention : variable ‘error’ set but not used 
[-Wunused-but-set-variable]
 Python/thread_pthread.h: In function ‘PyThread_release_lock’:
 Python/thread_pthread.h:386:17: attention : variable ‘error’ set but not used 
[-Wunused-but-set-variable]

I tried to remove the variables, but the build crash as they are used in

 #define CHECK_STATUS(name)  if (status != 0) { perror(name); error = 1; }

looks like a gcc 4.7.2 bug.

--
components: Build
messages: 176737
nosy: bruno.dupuis
priority: normal
severity: normal
status: open
title: gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h
versions: Python 3.3

___
Python tracker 

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



[issue7976] warnings should provide a public API for accessing its option parsing code

2012-11-30 Thread Bruno Dupuis

Changes by Bruno Dupuis :


Added file: http://bugs.python.org/file28175/warnings_opt_parse_API-7.patch

___
Python tracker 

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



[issue16581] define "PEP editor" in PEP 1

2012-11-30 Thread Nick Coghlan

Nick Coghlan added the comment:

+1

I wrote the stuff in PEP 1 about committers acting as editors, but agree
the editor part itself also falls into the "currently unwritten, but should
be written" category.

--

___
Python tracker 

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



[issue7976] warnings should provide a public API for accessing its option parsing code

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

corrected, I changed the name of the function to parse_option, and I kept 
WarningsOptionParsingError as a name for the exception. These two sound good 
together.

--
Added file: http://bugs.python.org/file28174/warnings_opt_parse_API-6.patch

___
Python tracker 

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



[issue16587] Py_Initialize breaks wprintf on Windows

2012-11-30 Thread Markus Kettunen

Markus Kettunen added the comment:

If the standard streams are not used through Python, this hack can be used to 
work around the bug on C side:

#ifdef WIN32
#include 
#endif

...

Py_Initialize();

#ifdef WIN32
_setmode(stdin->_file, O_TEXT);
_setmode(stdout->_file, O_TEXT);
_setmode(stderr->_file, O_TEXT);
#endif

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Dustin Boswell

Dustin Boswell added the comment:

I thought simplejson was a standard module for 2.6, and got renamed to json 
(replacing the older json module) in later versions.

For instance, I get the same problem with 2.7 (no simplejson):

python2.7 -c "import json; json.loads('[' + '''\"...\", ''' * 2 + 
'0]') "
^AcTraceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/lib/python2.7/json/__init__.py", line 326, in loads
return _default_decoder.decode(s)
  File "/usr/local/lib/python2.7/json/decoder.py", line 369, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column -2094967293 - line 1 column 220003 
(char -2094967293 - 220003)


And if I use the "json" module in 2.6 (which is 10x slower, takes over 30 
minutes to run) it also fails, but with a difference trace:

python2.6 -c "import json; json.loads('[' + '''\"...\", ''' * 2 + 
'0]') "
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.6/json/__init__.py", line 307, in loads
return _default_decoder.decode(s)
  File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.6/json/decoder.py", line 336, in raw_decode
obj, end = self._scanner.iterscan(s, **kw).next()
  File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
  File "/usr/lib/python2.6/json/decoder.py", line 217, in JSONArray
value, end = iterscan(s, idx=end, context=context).next()
  File "/usr/lib/python2.6/json/scanner.py", line 55, in iterscan
rval, next_pos = action(m, context)
  File "/usr/lib/python2.6/json/decoder.py", line 155, in JSONString
return scanstring(match.string, match.end(), encoding, strict)
ValueError: end is out of bounds

--

___
Python tracker 

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



[issue16587] Py_Initialize breaks wprintf on Windows

2012-11-30 Thread Markus Kettunen

New submission from Markus Kettunen:

In a C application on Windows, at least on MSVC 2010 and Windows 7, do this:

wprintf(L"Test\n");
Py_Initialize();
wprintf(L"Test\n");

Output is:
Test
 T e s t

I was able to track the issue to fileio.c to the following code block by 
searching where wprintf breaks:

if (dircheck(self, nameobj) < 0)
goto error;

#if defined(MS_WINDOWS) || defined(__CYGWIN__)
/* don't translate newlines (\r\n <=> \n) */
_setmode(self->fd, O_BINARY); <- breaks it
#endif

if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0)
goto error;

This can be easily confirmed by adding wprintfs on both sides of _setmode.

This issue was also raised at 
http://mail.python.org/pipermail/python-list/2012-February/620528.html but no 
solution was provided back then.

--
components: IO, Unicode, Windows
messages: 176732
nosy: ezio.melotti, makegho
priority: normal
severity: normal
status: open
title: Py_Initialize breaks wprintf on Windows
type: behavior
versions: Python 3.3

___
Python tracker 

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



[issue7976] warnings should provide a public API for accessing its option parsing code

2012-11-30 Thread Éric Araujo

Éric Araujo added the comment:

Thanks!  Latest version looks good to me.  David, Nick, do you want to have a 
look at the patch?

--

___
Python tracker 

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



[issue1075356] exceeding obscure weakproxy bug

2012-11-30 Thread Bruno Dupuis

Changes by Bruno Dupuis :


--
nosy: +bruno.dupuis

___
Python tracker 

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



[issue7976] warnings should provide a public API for accessing its option parsing code

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

Changes made. I added the exception doc and some cosmetics

--
Added file: http://bugs.python.org/file28173/warnings_opt_parse_API-5.patch

___
Python tracker 

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




[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ahem... I just noticed:

import simplejson as json

Dustin, this is not Python issue, this is simplejson issue. Can you reproduce 
the bug with standard json module? Try something like '[%*s]' % (2**32, ''), 
this should require less memory (especially on 3.3+).

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Issue16009 has an effect on error messages.

But this error message should not be. scan_once() returns a 32-bit overflowed 
index (994967285 == 330011 - 2**32). However all indices in Modules/_json.c 
are of type Py_ssize_t.

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Dustin Boswell

Dustin Boswell added the comment:

Here's a slightly smaller/cleaner test case that only requires 12GB of ram to 
run:

python -c "import simplejson as json; json.loads('[' + '''\"...\", ''' * 
2 + '0]') "

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/pymodules/python2.6/simplejson/__init__.py", line 307, in loads

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Ezio Melotti

Ezio Melotti added the comment:

Even if the json module can't handle these values, the error message can be 
improved.

Serhiy, does you patch have any effect on the error message?

--
nosy: +ezio.melotti
type: crash -> behavior

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 30.11.2012 22:27, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
>> try:
>> mapping = {}
>> mapping.max_collisions = 100
>> mapping.update(source)
>> except CollisionLimitError:
>> return 'no thank you'
> 
> May be use a more general solution?
> 
> try:
> with run_with_timeout(timeout=100, timer=collisions_count):
> mapping = insert_untrusted_data(source)
> except TimeoutError:
> return 'no thank you'
> 
> (You can can use different measurement for timeout: user time, real time, 
> ticks 
> count, collisions count, or even a user defined timer).

Sure, as long as there's a way to break into the execution,
any such method would do.

The problem is that you'd have to check for the timeout at some
point and the .update() call is running completely in C, so
the only way to break into execution is either by explicitly
adding a runtime check to the code, or use a signal (which is
a can of worms better avoided :-)).

Collision counting is one such method of detecting that
something is likely not working according to plan, but it's
really only another way of implementing the explicit runtime
check. Using other counters or timers would work just as well.

As long as you know that there are places in your code that can
produce CPU time overloads, you can address those issues.

The dictionary implementation is one such place, where you
can run into the problem, but there are usually many other
such areas in more complex applications as well, e.g. calculations
that enter endless loops for some parameters, deadlocks,
I/O operations that take unusually long (e.g. due to disk
errors), poorly written drivers of all sorts, etc. etc.

If there's a way to solve all these things in general
and without explicit runtime checks, I'd like to know :-)

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I saw nothing that could lead to a bug, except a few of the obsolete functions 
for work with size_t (for compatibility with versions <2.6). Here is a patch 
that gets rid of this outdated code. I don't have enough memory to check if 
this will help, but I think that at least for 3.4 it is worth to apply as a 
code cleanup.

--
keywords: +patch
Added file: http://bugs.python.org/file28171/json_size_t_cleanup.patch
Added file: http://bugs.python.org/file28172/json_size_t_cleanup-2.7.patch

___
Python tracker 

___diff -r ce3f0399ea33 Modules/_json.c
--- a/Modules/_json.c   Thu Nov 29 10:58:43 2012 -0500
+++ b/Modules/_json.c   Sat Dec 01 00:32:05 2012 +0200
@@ -2,20 +2,6 @@
 #include "structmember.h"
 #include "accu.h"
 
-#if PY_VERSION_HEX < 0x0206 && !defined(Py_TYPE)
-#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
-#endif
-#if PY_VERSION_HEX < 0x0205 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#define PyInt_FromSsize_t PyInt_FromLong
-#define PyInt_AsSsize_t PyInt_AsLong
-#endif
-#ifndef Py_IS_FINITE
-#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
-#endif
-
 #ifdef __GNUC__
 #define UNUSED __attribute__((__unused__))
 #else
@@ -129,33 +115,12 @@
 raise_errmsg(char *msg, PyObject *s, Py_ssize_t end);
 static PyObject *
 encoder_encode_string(PyEncoderObject *s, PyObject *obj);
-static int
-_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr);
-static PyObject *
-_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr);
 static PyObject *
 encoder_encode_float(PyEncoderObject *s, PyObject *obj);
 
 #define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"')
 #define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || 
((c) == '\r'))
 
-static int
-_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr)
-{
-/* PyObject to Py_ssize_t converter */
-*size_ptr = PyLong_AsSsize_t(o);
-if (*size_ptr == -1 && PyErr_Occurred())
-return 0;
-return 1;
-}
-
-static PyObject *
-_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr)
-{
-/* Py_ssize_t to PyObject converter */
-return PyLong_FromSsize_t(*size_ptr);
-}
-
 static Py_ssize_t
 ascii_escape_unichar(Py_UCS4 c, unsigned char *output, Py_ssize_t chars)
 {
@@ -265,7 +230,7 @@
 if (errmsg_fn == NULL)
 return;
 }
-pymsg = PyObject_CallFunction(errmsg_fn, "(zOO&)", msg, s, 
_convertPyInt_FromSsize_t, &end);
+pymsg = PyObject_CallFunction(errmsg_fn, "(zOn)", msg, s, end);
 if (pymsg) {
 PyErr_SetObject(PyExc_ValueError, pymsg);
 Py_DECREF(pymsg);
@@ -524,7 +489,7 @@
 Py_ssize_t end;
 Py_ssize_t next_end = -1;
 int strict = 1;
-if (!PyArg_ParseTuple(args, "OO&|i:scanstring", &pystr, 
_convertPyInt_AsSsize_t, &end, &strict)) {
+if (!PyArg_ParseTuple(args, "On|i:scanstring", &pystr, &end, &strict)) {
 return NULL;
 }
 if (PyUnicode_Check(pystr)) {
@@ -1087,7 +1052,7 @@
 PyScannerObject *s;
 assert(PyScanner_Check(self));
 s = (PyScannerObject *)self;
-if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:scan_once", kwlist, 
&pystr, _convertPyInt_AsSsize_t, &idx))
+if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:scan_once", kwlist, 
&pystr, &idx))
 return NULL;
 
 if (PyUnicode_Check(pystr)) {
@@ -1288,8 +1253,8 @@
 
 assert(PyEncoder_Check(self));
 s = (PyEncoderObject *)self;
-if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:_iterencode", kwlist,
-&obj, _convertPyInt_AsSsize_t, &indent_level))
+if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:_iterencode", kwlist,
+&obj, &indent_level))
 return NULL;
 if (_PyAccu_Init(&acc))
 return NULL;
diff -r 1e614dae8448 Modules/_json.c
--- a/Modules/_json.c   Fri Nov 30 16:15:24 2012 -0500
+++ b/Modules/_json.c   Sat Dec 01 00:25:45 2012 +0200
@@ -1,18 +1,5 @@
 #include "Python.h"
 #include "structmember.h"
-#if PY_VERSION_HEX < 0x0206 && !defined(Py_TYPE)
-#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
-#endif
-#if PY_VERSION_HEX < 0x0205 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-#define PY_SSIZE_T_MAX INT_MAX
-#define PY_SSIZE_T_MIN INT_MIN
-#define PyInt_FromSsize_t PyInt_FromLong
-#define PyInt_AsSsize_t PyInt_AsLong
-#endif
-#ifndef Py_IS_FINITE
-#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X))
-#endif
 
 #ifdef __GNUC__
 #define UNUSED __attribute__((__unused__))
@@ -121,10 +108,6 @@
 raise_errmsg(char *msg, PyObject *s, Py_ssize_t end);
 static PyObject *
 encoder_encode_string(PyEncoderObject *s, PyObject *obj);
-static int
-_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr);
-static PyObject *
-_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr);
 static PyObject *
 encoder_encode_float(PyEncoderObject *s, PyObject

[issue7976] warnings should provide a public API for accessing its option parsing code

2012-11-30 Thread Éric Araujo

Éric Araujo added the comment:

More comments in the review.

--

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo, serhiy.storchaka

___
Python tracker 

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



[issue4805] Make python code compilable with a C++ compiler

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue16586] json library can't parse large (> 2^31) strings

2012-11-30 Thread Dustin Boswell

New submission from Dustin Boswell:

Here's a command-line that parses a json string containing a large array of 
short strings:

python -c "import simplejson as json; json.loads('[' + '''\"asdfadf\", ''' * 
1 + '\"asdfasf\"]') "

That works, but if you increase the size a little bit (so the string is > 2^31)

python -c "import simplejson as json; json.loads('[' + '''\"asdfadf\", ''' * 
3 + '\"asdfasf\"]') "

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/pymodules/python2.6/simplejson/__init__.py", line 307, in loads
return _default_decoder.decode(s)
  File "/usr/lib/pymodules/python2.6/simplejson/decoder.py", line 338, in decode
raise ValueError(errmsg("Extra data", s, end, len(s)))
ValueError: Extra data: line 1 column -994967285 - line 1 column 330011 
(char -994967285 - 330011)


Here's my version:

$ python
Python 2.6.5 (r265:79063, Oct  1 2012, 22:04:36) 
[GCC 4.4.3] on linux2
>>> import sys;print("%x" % sys.maxsize, sys.maxsize > 2**32)
('7fff', True)


Also note that the test above requires at least 20GB of memory (that's not a 
bug, just a heads-up).

--
components: Library (Lib)
messages: 176722
nosy: Dustin.Boswell
priority: normal
severity: normal
status: open
title: json library can't parse large (> 2^31) strings
type: crash
versions: Python 2.6, Python 2.7

___
Python tracker 

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



[issue2897] include structmember.h in Python.h

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue16568] allow constructors to be documented separately from class

2012-11-30 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue16566] Structure._anonymous_ should not allow strings

2012-11-30 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy
versions:  -Python 3.1

___
Python tracker 

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



[issue2921] enable embedding: declare/#define only py* symbols in #includes

2012-11-30 Thread Bruno Dupuis

Changes by Bruno Dupuis :


--
nosy: +bruno.dupuis

___
Python tracker 

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



[issue16585] surrogateescape broken w/ multibytecodecs' encode

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
stage:  -> needs patch

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> try:
> mapping = {}
> mapping.max_collisions = 100
> mapping.update(source)
> except CollisionLimitError:
> return 'no thank you'

May be use a more general solution?

try:
with run_with_timeout(timeout=100, timer=collisions_count):
mapping = insert_untrusted_data(source)
except TimeoutError:
return 'no thank you'

(You can can use different measurement for timeout: user time, real time, ticks 
count, collisions count, or even a user defined timer).

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Serhiy Storchaka: Yes, but it is still O(log n) worst case. Even in the
> worst case rebalancing, you only need to walk up/down rotating/spliting
> every node in your path. As the tree height is guaranteed to be x * log n
> (x from 1 to 2, depending on the algorithm), the rebalancing operation is
> aways limited by O(log n).

Agree. However I think that for large enough data a balanced tree is slower 
than a hashtable with any slow hash.

--

___
Python tracker 

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



[issue6036] Clean up test_posixpath.py

2012-11-30 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 980b13df6ccd by Benjamin Peterson in branch '2.7':
Remove redundant check for symlink. (closes #6036)
http://hg.python.org/cpython/rev/980b13df6ccd

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

___
Python tracker 

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



[issue11797] 2to3 does not correct "reload"

2012-11-30 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Thanks for the patch. Could you try to share could with fix_intern? Maybe by 
moving some things to fixer_utils.

--

___
Python tracker 

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



[issue16585] surrogateescape broken w/ multibytecodecs' encode

2012-11-30 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Codecs should be fixed to accept bytes from the error handler and the 
definition in the docs loosened. Returning bytes seems to be useful.

--

___
Python tracker 

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



[issue6036] Clean up test_posixpath.py

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

Mark, correct, this test doesn't exist in 3.X branches. I updated the patch for 
2.7. It is trivial, so if someone may merge it, we could close this bug 
(please, before next SCM switch :-) )

--
nosy: +loewis
Added file: 
http://bugs.python.org/file28170/6036_test_posixpath_cleanup_2.7.patch

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread René

René added the comment:

Serhiy Storchaka: Yes, but it is still O(log n) worst case. Even in the worst 
case rebalancing, you only need to walk up/down rotating/spliting every node in 
your path. As the tree height is guaranteed to be x * log n (x from 1 to 2, 
depending on the algorithm), the rebalancing operation is aways limited by 
O(log n).

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 30.11.2012 21:06, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
> René, a balanced tree requires rebalancing on every (or almost every) item 
> for some special (sorted) data sequences.

Sure, but that's still O(N*log N) for an attack scenario, not O(N^2).

I think the main point here is that using hash tables or dictionaries
for these things without any size limit is simply a wrong development
approach.

Developers need to be made aware of the problem and given data
structures that they can use more safely to store the data and
instead of trying to hide away the problem using some crypto
approach, it's better to offer methods that allow developers to
gain control over the problem (e.g. via an exception) rather than
hoping for few hash collisions.

If a developer has to build a lookup table from untrusted data,
she should be able to say:

try:
mapping = insert_untrusted_data(source)
except UnderAttackError:
return 'no thank you'

instead of:

# Hmm, let's hope this doesn't bomb...
mapping = insert_untrusted_data(source)

At the moment, the best thing you can do is insert the data
in chunks and measure the time it takes for each chunk. If it
takes too long, you raise the UnderAttackError.

If we make the collision counting limit a per-dictionary adjustable
limit with some global default limit, the above could be written
as:

try:
mapping = {}
mapping.max_collisions = 100
mapping.update(source)
except CollisionLimitError:
return 'no thank you'

Aside: It's better to know you worst case and program for it, rather
than to ignore the problem and hope an attacker won't find your secret
key. In the above case, if you know what the worst-case timing is for
a 100-item dictionary, you can safely deal with it, possibly adjusting
the limit to more suitable value for your application.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Nov 30 2012)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2012-11-28: Released eGenix mx Base 3.2.5 ... http://egenix.com/go36
2013-01-22: Python Meeting Duesseldorf ... 53 days to go

::: Try our new mxODBC.Connect Python Database Interface for free ! 

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Michal Petrucha

Michal Petrucha added the comment:

On Fri, Nov 30, 2012 at 08:06:32PM +, Serhiy Storchaka wrote:
> René, a balanced tree requires rebalancing on every (or almost
> every) item for some special (sorted) data sequences.

That's perfectly true and it holds for most unsorted sequences as
well -- that's why they are balanced. The fact that the tree is always
balanced guarantees that each rebalance takes at most O(log n)
operations.

--

___
Python tracker 

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



[issue16585] surrogateescape broken w/ multibytecodecs' encode

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Unicode
nosy: +benjamin.peterson, ezio.melotti, haypo, lemburg, pitrou, serhiy.storchaka
type:  -> behavior
versions: +Python 3.4

___
Python tracker 

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



[issue16585] surrogateescape broken w/ multibytecodecs' encode

2012-11-30 Thread Philip Jenvey

New submission from Philip Jenvey:

surrogateescape claims to be "implemented by all standard Python codecs"

http://docs.python.org/3/library/codecs.html#codec-base-classes

However it fails w/ multibytecodecs on encode:

Python 3.2.3+ (3.2:eb999002916c, Oct 26 2012, 16:11:03) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> "\u30fb".encode('gb18030')
b'\x819\xa79'
>>> "\u30fb\udc80".encode('gb18030', 'surrogateescape')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: encoding error handler must return (unicode, int) tuple

The problem being that multibytecodec.c forces error handler return results to 
always be unicode and surrogateescape returns bytes here.

(surrogatepass also similarly returns bytes but it claims to be utf-8 only)

The error handler spec seems to imply that error handlers should always return 
unicode, because "The encoder will encode the replacement"

http://docs.python.org/3/library/codecs.html#codecs.register_error

but obviously that's not really the case: some codecs special case bytes 
results and copy them directly to the output, e.g.:

http://hg.python.org/cpython/file/ce3f0399ea33/Objects/unicodeobject.c#l6305

--
components: Interpreter Core
messages: 176711
nosy: pjenvey
priority: normal
severity: normal
status: open
title: surrogateescape broken w/ multibytecodecs' encode
versions: Python 3.2, Python 3.3

___
Python tracker 

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



[issue16581] define "PEP editor" in PEP 1

2012-11-30 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Nov 30, 2012, at 07:55 PM, Chris Jerdonek wrote:

>Thanks for providing the info.  To clarify, is membership in peps@ restricted
>to editors?

Yes.  It may not be a perfect overlap, but that's the best we have, and should
be the intent, IMHO.

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

René, a balanced tree requires rebalancing on every (or almost every) item for 
some special (sorted) data sequences.

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread René

René added the comment:

Serhiy Storchaka: I said a O(log n) data structure, so I was referring to 
balanced trees, like AVL, RBT or B+-tree. They are not vulnerable to sorted 
data. The downside is that they need the keys to provide robust comparison 
methods (like, if z < y < x, then z < x). 

Christian Heimes: Right, the seed indeed doesn't provides protection...

But the collision counting is compatible with your two suggestions, and solves 
the problem. The only difference is that you don't get the performance hit if 
not under attack.

--

___
Python tracker 

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



[issue16582] Tkinter calls SystemExit with string

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +gpolo
versions:  -Python 2.6, Python 3.1

___
Python tracker 

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



[issue16583] Tkinter nested SystemExit

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +2to3 (2.x to 3.x conversion tool)
nosy: +benjamin.peterson, gpolo
versions:  -Python 3.1

___
Python tracker 

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



[issue16581] define "PEP editor" in PEP 1

2012-11-30 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Thanks for providing the info.  To clarify, is membership in peps@ restricted 
to editors?

--

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

Thank you for the review, Guilherme.

--

___
Python tracker 

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



[issue12891] Clean up traces of manifest template in packaging

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

Ok, thanks, Èric.

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

However a tree data structure is vulnerable to sorted data.

May be worth it to have the two hash functions (switchable by interpreter 
option or environment variable), strong for applications which can be attacked, 
and fast for applications which run in safe environment?

--

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread Christian Heimes

Christian Heimes added the comment:

No, Murmur3 *is* busted. Some clever people have found a way to perform a 
universal multicollision attack, that's a key independent attack. An attacker 
doesn't need to know the seed for an attack.

Collision counting as not a solution for the issue, just a workaround. It has 
been proofed for decades that a tree data structure is not vulnerable to this 
kind of collision attacks. A hash function with crypto properties is the second 
best solution.

--

___
Python tracker 

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



[issue16581] define "PEP editor" in PEP 1

2012-11-30 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Nov 30, 2012, at 02:00 AM, Chris Jerdonek wrote:

>In particular, PEP 1 should say whether editorship is an invitation-only
>status and/or how one becomes a PEP editor.  It would also be good if it said
>(for transparency) how to go about seeing the current list of editors.

IMO, becoming a PEP editor is by invitation-only, as decided by consensus of
the current set of PEP editors.  The current list of editors is exactly
equivalent to the members of the peps@ mailing list, currently:

Anthony Baxter
Barry Warsaw
Brett Cannon
Georg Brandl
David Goodger
Guido van Rossum
Jesse Noller

If there are editors who are not members of this mailing list, they should be!
If there are editors who want to retire and be removed from the list, please
let me know.

>There is also inconsistent singular/plural usage that I think would be good
>to clear up.  Currently, in many places PEP 1 says "the PEP editor"
>(singular), so it's not clear if each PEP has its own editor, if there is a
>single PEP editor for all PEPs at any one time, or if it simply means "the
>PEP editor that happens to reply to an e-mail to p...@python.org".

The latter, and it should be plural everywhere.

>PEP 0 also has this issue because its introduction says, "[This] PEP contains
>the index of all Python Enhancement Proposals, known as PEPs.  PEP numbers
>are assigned by the PEP Editor, and once assigned are never changed."

Plural.

--

___
Python tracker 

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



[issue16581] define "PEP editor" in PEP 1

2012-11-30 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +anthony_baxter

___
Python tracker 

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



[issue16349] Document whether it's safe to use bytes for struct format string

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

No, this is not r59687. I can't found from which revision in 59680-59695 it 
came.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue16349] Document whether it's safe to use bytes for struct format string

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python 2 supports only str. Support for unicode objects has been added in 
r59687 (merged with other unrelated changes in changeset 13aabc23cf2e). Maybe 
Raymond can explain why the type for the Struct.format was chosen bytes, not 
unicode.

--
components: +Extension Modules -Library (Lib)
nosy: +rhettinger, serhiy.storchaka
versions: +Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable

2012-11-30 Thread Till Maas

Changes by Till Maas :


--
keywords: +patch
Added file: http://bugs.python.org/file28169/filecmp_exception.patch

___
Python tracker 

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



[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable

2012-11-30 Thread Till Maas

New submission from Till Maas:

If filecmp is used with files that the user is not allowed to read, it creates 
an IOError exception instead of returning the file's name as an file that could 
not compared. The documentation says:

http://docs.python.org/2/library/filecmp.html
Returns three lists of file names: match, mismatch, errors. [...] errors lists 
the names of files which could not be compared. Files are listed in errors if 
they don’t exist in one of the directories, the user lacks permission to read 
them or if the comparison could not be done for some other reason.

The attached file fails with an IOError:
$ python filecmp-minimal.py 
Traceback (most recent call last):
  File "filecmp-minimal.py", line 21, in 
print filecmp.cmpfiles(join(t, "a"), join(t, "b"), ["testfile"], 
shallow=False)
  File "/usr/lib64/python2.7/filecmp.py", line 258, in cmpfiles
res[_cmp(ax, bx, shallow)].append(x)
  File "/usr/lib64/python2.7/filecmp.py", line 270, in _cmp
return not abs(cmp(a, b, sh))
  File "/usr/lib64/python2.7/filecmp.py", line 53, in cmp
outcome = _do_cmp(f1, f2)
  File "/usr/lib64/python2.7/filecmp.py", line 66, in _do_cmp
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
IOError: [Errno 13] Permission denied: '/tmp/tmpp93pmt/a/testfile'

A quick glance at the current code in hg shows, that this bug is probably also 
present in all later Python versions than 2.7. I will attach a small patch that 
fixes this bug.

--
components: Library (Lib)
files: filecmp-minimal.py
messages: 176700
nosy: till
priority: normal
severity: normal
status: open
title: unhandled IOError filecmp.cmpfiles() if file not readable
type: crash
versions: Python 2.7
Added file: http://bugs.python.org/file28168/filecmp-minimal.py

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> So specifying "text" and "textvariable" is the same for tk.

Thanks for clarifying.

--

___
Python tracker 

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



[issue16583] Tkinter nested SystemExit

2012-11-30 Thread Abraham Karplus

New submission from Abraham Karplus:

When a callback function gets called from Tkinter and raises SystemExit (either 
directly or through sys.exit), a new SystemExit exception is raised with the 
original exception as its code field, such as
SystemExit(SystemExit(),)
This is due to a bug in Tkinter's CallWrapper, where it has
except SystemExit as msg:
raise SystemExit(msg)
which since msg is a SystemExit instance, creates the nesting. This bug did not 
exist in Python 2 because there the code was
except SystemExit, msg:
raise SystemExit, msg
and this raises msg, as it already is a SystemExit instance. I suspect the bug 
was introduced by using the 2to3 tool, as it will do the conversion. If so, 
this is a bug in 2to3, as the two snippets are not functionally identical.

--
components: Tkinter
messages: 176698
nosy: Abraham Karplus
priority: normal
severity: normal
status: open
title: Tkinter nested SystemExit
type: behavior
versions: Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue14621] Hash function is not randomized properly

2012-11-30 Thread René

René added the comment:

Christian Heimes: It has always been trivial to artificially generate 
collisions for fast hashes designed for hash tables, like MurmurHash. I 
wouldn't call Murmurhash3 "busted" because of that, as this was never a design 
goal. It is a known propriety of this type of hash: you do that basically 
running them backwards. You can't even call that cryptanalysis. 

Of course, you need the seed to search those collisions, but from this thread 
it seems very difficult, if not impossible, not to leak the random seed to the 
attacker. 

I see the various collision counting alternatives proposed as the less 
intrusive and definitive solution for this problem. It also has the benefit 
that it can work for any type of key. Some pseudo code:

hash as always, with a fast hash.
if reprobes > initial_threshold:
if the table has only one key type AND it has a robust comparison method:
store the collisions in a O(log n) worst case structure (tree).
elif the object has a secondary slow secure hash:
try searching/inserting the key again with the new secure hash.
It works like a double hashing reprobing hash table.
elif collisions > max_threshold:
raise Exception("Under attack or the object is using a crappy hash, 
with no fallback.")

The first option, the O(log n) structure, can be ignored as unnecessary 
complication (even though there is already a path implementing that), but I 
suspect it may be faster than a secure hash. If not, then there is really no 
point in this option, except if the secure hash proves to be not so secure.

--
nosy: +ReneSac

___
Python tracker 

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



[issue16582] Tkinter calls SystemExit with string

2012-11-30 Thread Abraham Karplus

New submission from Abraham Karplus:

Exiting a Tkinter application normally results in printing '0' and exiting with 
error code 1. This is a result of Tkinter's _exit function, whose default 
argument for code is the string '0'. It then calls SystemExit with the code 
argument. However, according to the SystemExit documentation "if [the argument] 
has another type (such as a string), the object’s value is printed and the exit 
status is one". A simple fix for this would be to change the Tkinter _exit 
function to convert code to an int before passing it to SystemExit.

--
components: Tkinter
messages: 176696
nosy: Abraham Karplus
priority: normal
severity: normal
status: open
title: Tkinter calls SystemExit with string
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue15727] PyType_FromSpecWithBases tp_new bugfix

2012-11-30 Thread Robin Schreiber

Robin Schreiber added the comment:

Here is revised version of the patch. 

Martin von Löwis and I had discovered a way to reproduce problems with 
refactored modules, that
occur without this patch. This is was several months ago, however I will try to 
give you a code sample! :-)

--
keywords: +patch
Added file: 
http://bugs.python.org/file28167/PyType_FromSpecWithBases_tp_new_fix_v1.patch

___
Python tracker 

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



[issue12891] Clean up traces of manifest template in packaging

2012-11-30 Thread Éric Araujo

Éric Araujo added the comment:

Packaging is removed from the stdlib, and distutils2 (the backport for Python 
2.5-3.3) shares its uncertain future.  It would take too long to explain why 
that is here; I’m working on a blog post to do that and will give a link if you 
are interested.

--
assignee: tarek -> eric.araujo
stage: needs patch -> 
versions: +3rd party

___
Python tracker 

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



[issue16535] json encoder unable to handle decimal

2012-11-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue16490] "inspect.getargspec()" and "inspect.getcallargs()" don't work for builtins

2012-11-30 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Larry, Ping... :-)

--

___
Python tracker 

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



[issue10589] I/O ABC docs should specify which methods have implementations

2012-11-30 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Updated the patch. Is it ok now?

--
nosy: +asvetlov
Added file: http://bugs.python.org/file28166/issue10589.diff

___
Python tracker 

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



[issue14174] argparse.REMAINDER fails to parse remainder correctly

2012-11-30 Thread Michael Edwards

Michael Edwards added the comment:

I'm attaching my own bug repro script for Eric. Is this sufficient? I can 
demonstrate the entire resulting Namespace, but the problem is that argparse 
doesn't even produce a Namespace. The cases I show simply fail.

--
nosy: +Michael.Edwards
Added file: http://bugs.python.org/file28165/test.py

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Guilherme Polo

Guilherme Polo added the comment:

Calm down for a moment. This is just incorrect usage of Entry. There is no 
"text" parameter documented for this class (see its docstring, for a quick 
reference on that). Also, there is a lot of Tkinter documentation, the official 
one at can be found at  http://docs.python.org/2/library/tkinter.html, which 
includes links for further documentation.

This is actually unrelated to string hash randomization, it is only barely 
related to the unordered nature of the hash implementation. What actually 
happens is that the tk lib usually accepts abbreviations of parameter names. So 
specifying "text" and "textvariable" is the same for tk.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue6036] Clean up test_posixpath.py

2012-11-30 Thread Bruno Dupuis

Changes by Bruno Dupuis :


--
nosy: +bruno.dupuis

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Tkinter

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I confirm this. The bug appears sporadically on 3.x.

When the entry displays text, self.entry1['textvariable'] is 'PY_VAR0'. When it 
does not, self.entry1['textvariable'] is '0' (actually the value of "text" 
parameter).

The bug is due to the fact that option "text" is applied after the option 
"textvariable". Due to string hash randomization it occurs in 50% on 3.3+ (and 
always or never on default 2.7, depending on other options used in this call). 
For work around this bug you should not use both "text" and "textvariable" 
keyword or dict parameters in one call. Probably it is worth to mention in the 
documentation (unfortunately the Tkinter documentation is almost non-existent).

--
assignee:  -> docs@python
components: +Documentation -Tkinter
nosy: +docs@python, serhiy.storchaka
stage:  -> needs patch
type: behavior -> enhancement

___
Python tracker 

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



[issue16235] Add python-config.sh for use during cross compilation.

2012-11-30 Thread Ray Donnelly

Ray Donnelly added the comment:

New patch attached:

LIBPL changed to a more direct AC_SUBST and PLATINCDIR used for --includes and 
--cflags.

--
Added file: http://bugs.python.org/file28164/-add-python-config-sh.patch

___
Python tracker 

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



[issue14892] 'import readline' hangs when launching with '&' on BSD and OS X

2012-11-30 Thread Ronald Oussoren

Changes by Ronald Oussoren :


--
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue777588] asyncore is broken for windows if connection is refused

2012-11-30 Thread Marc Schlaich

Marc Schlaich added the comment:

This issue is not fixed. Another workaround would be the `win32select` function 
from twisted: 
http://twistedmatrix.com/trac/browser/trunk/twisted/internet/selectreactor.py#L23

--
nosy: +schlamar

___
Python tracker 

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



[issue16472] Distutils+mingw links agains msvcr90, while python27.dll is linked agains msvcrt

2012-11-30 Thread Václav Šmilauer

Václav Šmilauer added the comment:

I was having a compiled module consistently crash at import time when linking 
against msvcr90, and being imported fine when linked against msvcrt. I will try 
to investigate further with mingw folks.

--

___
Python tracker 

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



[issue10259] Entry text not set if all of 'Font', 'Foreground' and 'Justify' are set

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

I updated the script to 3k. Now the behaviour is very odd :

Python 2.7: works only if `justify="right"` is commented out.

Python 3.3: Shroedinger-like behaviour (sometimes dead, sometimes alive, nobody 
knows before we check) whith `justify="right"`

Looks like some kind of race-condition or something, so this results may only 
be relevant on my hardware (2 yo low-end PC).

I'm not a tkinter expert, so even if the app code looks good I need someone 
that knows tk to double-check if there is some oddities in the script before we 
go further.

--
nosy: +bruno.dupuis, gpolo
versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4 -Python 2.6
Added file: http://bugs.python.org/file28163/Project5_3k.py

___
Python tracker 

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



[issue12891] Clean up traces of manifest template in packaging

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

Sounds easy even though there's quite a bit of lines to impact. I may do it, I 
just need a go.

Tarek? Éric? anyone?

--
nosy: +bruno.dupuis
versions:  -3rd party

___
Python tracker 

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



[issue6835] doctest problem with decorated function when decorator is defined in separate file

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

it's a duplicate of #1108

--

___
Python tracker 

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



[issue6835] doctest problem with decorated function when decorator is defined in separate file

2012-11-30 Thread Bruno Dupuis

Bruno Dupuis added the comment:

updated the test to 3k (requires sh and Python2.{6,7} as python2). It works. 
Anyone to close?

--
nosy: +ezio.melotti, michael.foord
Added file: http://bugs.python.org/file28162/mytest3k.sh

___
Python tracker 

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



[issue16349] Document whether it's safe to use bytes for struct format string

2012-11-30 Thread Thomas Kluyver

Thomas Kluyver added the comment:

I'm happy to put together a docs patch, but I don't have any indication of the 
right answer (is it a safe feature to use, or an implementation detail?) Is 
there another venue where I should raise the question?

--

___
Python tracker 

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