[issue15546] Iteration breaks with bz2.open(filename,'rt')

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I encountered this when implemented bzip2 support in zipfile (issue14371). I 
solved this also by rewriting read and read1 to make as many reads from the 
underlying file as necessary to return a non-empty result.

--
nosy: +storchaka

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



[issue15522] impove 27 percent performance on stringpbject.c( by prefetch and loop optimization)

2012-08-04 Thread abael

abael added the comment:

added my implement( with some enhancement, got better performance, at less
for my apps. ).

test result:
with small chunk of str, got double performanc,
and 111% for big chunks;  it

## Util funcion for text definition:
def pf(f,n):
a=time()
for i in xrange(n):
f()
b=time()
print  n/(b-a)

#
 s=['abcd',u'\u548c\u6613\u541b'] * 1000
 pf(lambda:''.join(s), 1)
2289.28293164
 pf(lambda:text.join('',s), 1)
4457.27947763
 s=['abcd'*1000,u'\u548c\u6613\u541b'*1000] * 1000
 pf(lambda:''.join(s), 100)
15.2374868484
 pf(lambda:text.join('',s), 100)
16.939913023

##

2012/8/1 Antoine Pitrou rep...@bugs.python.org


 Antoine Pitrou added the comment:

 Hi, several points:

 - Python 2.7 is in bugfix mode; you need to work from the default
 Mercurial branch as explained in http://docs.python.org/devguide/ . In
 practice, this means your patch will target the future Python 3.4, and
 therefore either PyUnicode_Join or _PyBytes_Join.

 - please provide an actual patch (a Mercurial diff, probably)

 - please provide benchmarks (using e.g. timeit) which demonstrate the
 performance improvement you are proposing

 --
 nosy: +pitrou
 versions: +Python 3.4 -Python 2.7

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


--
Added file: http://bugs.python.org/file26681/stringjoin.c

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue15522
___# Author: Abael Heyijunhyj...@gmail.com
# Date: 2012-08-02

static PyObject *py_join(PyObject *self, PyObject *args){
  PyObject *seprator=NULL; PyObject *sequence=NULL;
  PyArg_ParseTuple(args, OO:join, seprator, sequence);
  register PyObject *seq =PySequence_Fast(sequence, join() only accept list/tuple arguments );
  const Py_ssize_t seqlen = PySequence_Fast_GET_SIZE(sequence);
  if (seq == NULL || !PyString_Check(seprator) || seqlen  0)return NULL;

  if (seqlen == 0){
	  Py_DECREF(seq);
	  return PyString_FromString();
  }

  register PyObject * item=NULL;
  item = PySequence_Fast_GET_ITEM(seq, 0);

	if (!PyString_Check(item)){
	  if (PyUnicode_Check(item)){
		  item=pyEncodeUTF8(self, item);
		  if (!PyString_Check(item))return PyErr_Format(PyExc_TypeError,sequence item %zd: expected string, %.80s found,0, Py_TYPE(item)-tp_name);
	  }else{
		  PyErr_Format(PyExc_TypeError,sequence item %zd: expected string, %.80s found,0, Py_TYPE(item)-tp_name);
		  Py_DECREF(seq);
		  return NULL;
	  }
	}

  if(seqlen == 1){
	  Py_INCREF(item);
	  return item;
  }

  const Py_ssize_t seplen = PyString_GET_SIZE(seprator);
  const char *sep = PyString_AS_STRING(seprator);
  register size_t isz=PyString_GET_SIZE(item);
  size_t usz=isz, alloc=isz8192?isz:8192;
  PyObject *res=PyString_FromStringAndSize(NULL, alloc);
  register char *p =(char *)PyString_AS_STRING(res);
  if(p==NULL)return NULL;
  if (isz){
	  Py_MEMCPY(p, (char *)PyString_AS_STRING(item),isz);
	  p+=isz;
  }
  register Py_ssize_t i;
  for (i=1; iseqlen; i++){
	item = PySequence_Fast_GET_ITEM(seq,i);
	if (!PyString_Check(item)){
	  if (PyUnicode_Check(item)){
		  item=pyEncodeUTF8(self, item);
		  if (!PyString_Check(item)){
			  PyErr_Format(PyExc_TypeError,sequence item %zd: transfer unicode to string, %.80s found,i, Py_TYPE(item)-tp_name);
			  return NULL;
		  }
	  }else{
		  PyErr_Format(PyExc_TypeError,sequence item %zd: expected string, %.80s found,i, Py_TYPE(item)-tp_name);
		  return NULL;
	  }
	}
	isz=PyString_GET_SIZE(item);
	if(isz){
		if (usz + seplen +iszalloc){
			do {
alloc+=8192;
if (alloc1){
	PyErr_SetString(PyExc_OverflowError,join() result is too long for a Python string);
	return NULL;
}
			}while (usz + seplen +iszalloc);
			if (_PyString_Resize(res, alloc)0){
PyErr_SetString(PyExc_OverflowError,join() result is too long for a Python string);
return NULL;
			}
			p=(char *)PyString_AS_STRING(res)+usz;
		}
		if(seplen){
			Py_MEMCPY(p, sep, seplen);
			p+=seplen;
	usz+=seplen;
		}
		Py_MEMCPY(p, (char *)PyString_AS_STRING(item),isz);
		p +=isz;
		usz +=isz;
	}
  }
  Py_DECREF(seq);
  if (_PyString_Resize(res, usz) 0){
	PyErr_SetString(PyExc_OverflowError,join() result is too long for a Python string);
	return NULL;
  }
  return res;
}
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15522] impove 27 percent performance on stringpbject.c( by prefetch and loop optimization)

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please port your code to Python 3.3 and compare with it. Python 3.3 
implementation of str.join() already more than twice faster then Python 2.7. 
Maybe your optimization will have no effect.

--
nosy: +storchaka

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



[issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior

2012-08-04 Thread Hynek Schlawack

Hynek Schlawack added the comment:

do you want it by default or a new flag? default sounds like a source for 
obscure bugs to me.

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch removing cpu_set and using sets of integers instead.

--
Added file: http://bugs.python.org/file26682/cpuset.patch

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Removed file: http://bugs.python.org/file26682/cpuset.patch

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


Added file: http://bugs.python.org/file26683/cpuset.patch

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-08-04 Thread Oscar Campos

Oscar Campos added the comment:

Greetings,

I did a diff patch based on the previous work of Glenn Linderman and Pierre 
Quentel.

I did some test and is working well so now the implementation is doing what the 
docstring says. I already passed the full test suite without problems.

I add two patches:
CGIHTTPServer.patch is for Python 2.7
http-server.patch is for Python 3.2

This is my first contribution to the Python Core althrough I did follow the 
Developers Gruide and I already send my Contributor Agreement to the PSF maybe 
there is something I did wrong, if this is the case just tell me, I'm here to 
help and learn.

Regards.
Oscar Campos.

--
keywords: +patch
nosy: +oscar.campos
Added file: http://bugs.python.org/file26684/CGIHTTPServer.patch

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-08-04 Thread Oscar Campos

Changes by Oscar Campos oscar.cam...@member.fsf.org:


Added file: http://bugs.python.org/file26685/http-server.patch

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



[issue12655] Expose sched.h functions

2012-08-04 Thread STINNER Victor

STINNER Victor added the comment:

sched_getaffinity() does not fail if the set is smaller than the
number of CPU. Try with an initial value of ncpus=1. So we cannot
start the heuristic with ncpus=16, because it would only return 16
even if the computer has more cpus.

Instead of this heuristic, why not simply alway using ncpus = CPU_SETSIZE?

I don't know if CPU_SETSIZE is part of the standard (POSIX?).

You may also use a constant size (CPU_SETSIZE) of the set used by
sched_setaffinity() to simplify the code.

--

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-08-04 Thread Oscar Campos

Changes by Oscar Campos oscar.cam...@member.fsf.org:


Added file: http://bugs.python.org/file26686/http-server.patch

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Try with an initial value of ncpus=1.

Well, I've tried and it works:

 os.sched_getaffinity(0)
{0, 1, 2, 3}

 I don't know if CPU_SETSIZE is part of the standard (POSIX?).

These are Linux-specific functions.

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread STINNER Victor

STINNER Victor added the comment:

 Try with an initial value of ncpus=1.
 Well, I've tried and it works:

Oh, you're right :-) I only checked ncpus (1), not the final result.
It works because CPU_ALLOC_SIZE() rounds the size using
sizeof(unsigned long) (64 bits on my CPU). So CPU_ALLOC_SIZE(1)
returns 8, and sched_getaffinity() takes the size of the set in bytes,
and not the number of CPU.

sched_getaffinity(0) returns {0, 1, 2, 3, 4, 5, 6, 7} with ncpus=1 and
setsize=8.

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

+1 for Antoine's patch/approach: it's more usable and pythonic.
I think documentation should mention and link the existence of:
http://docs.python.org/library/multiprocessing.html#multiprocessing.cpu_count

--

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



[issue15546] Iteration breaks with bz2.open(filename,'rt')

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cdf27a213bd2 by Nadeem Vawda in branch 'default':
#15546: Fix BZ2File.read1()'s handling of pathological input data.
http://hg.python.org/cpython/rev/cdf27a213bd2

--
nosy: +python-dev

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



[issue15546] Iteration breaks with bz2.open(filename,'rt')

2012-08-04 Thread Nadeem Vawda

Nadeem Vawda added the comment:

OK, BZ2File should now be fixed. It looks like LZMAFile and GzipFile may
be susceptible to the same problem; I'll push fixes for them shortly.

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 You may also use a constant size (CPU_SETSIZE) of the set used by
sched_setaffinity() to simplify the code.

As Antoine pointed out to me (and I was convinced itself, experimented with an 
example from man:CPU_SET(3)) the cpu_set functions work with a sets of more 
than CPU_SETSIZE processors.

--
nosy: +storchaka

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



[issue1859] textwrap doesn't linebreak on \n

2012-08-04 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d6745ddbccbd by Antoine Pitrou in branch 'default':
Issue #12655: Instead of requiring a custom type, os.sched_getaffinity and
http://hg.python.org/cpython/rev/d6745ddbccbd

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, I've improved the default ncpus value and committed.

--
resolution:  - fixed
status: open - closed

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



[issue1859] textwrap doesn't linebreak on \n

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I believe that the method of work with newlines is too application specific.

Someone may prefer empty line separated paragraphs, here is another recipe:

def wrap_paragraphs(text, width=70, **kwargs):
return [line for para in re.split(r'\n\s*\n', text) for line in 
(textwrap.wrap(para, width, **kwargs) + [''])][:-1]

And here is another application-specific recipe:

def format_html_paragraphs(text, width=70, **kwargs):
return ''.join('p%s/p' % 'br'.join(textwrap.wrap(html.escape(para), 
width, **kwargs)) para in re.split(r'\n\s*\n', text))

I don't see a one obvious way to solve this problem, so I suggest a recipe, not 
a patch. In any case the specialized text-processing applications are not 
likely to use textwrap because most output now uses non-monowidth fonts. 
Textwrap is only for the simplest applications.

--

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



[issue15555] Default newlines of io.TextIOWrapper

2012-08-04 Thread Atsuo Ishimoto

New submission from Atsuo Ishimoto:

In http://docs.python.org/dev/library/io.html:

  if newline is None, any '\n' characters written are translated to the system 
default line separator, os.linesep. 

But os.linesep is not referred at all. On Windows default newline is always 
'\r\n' on Windows, '\n' otherwise.

--
assignee: docs@python
components: Documentation
messages: 167413
nosy: docs@python, ishimoto
priority: normal
severity: normal
status: open
title: Default newlines of io.TextIOWrapper

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Jeremy Kloth

New submission from Jeremy Kloth:

os.stat fails when called on a file that is pending delete but is still in the 
directory listing.

This in turn causes os.path.exists to return the wrong result.

Attached is a test case demonstrating this broken behavior.

--
components: Library (Lib), Windows
files: stat-bug.py
messages: 167414
nosy: jkloth
priority: normal
severity: normal
status: open
title: os.stat fails for file pending delete on Windows
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file26687/stat-bug.py

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:


--
nosy: +brian.curtin, loewis, pitrou, tim.golden -jkloth

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Jeremy Kloth

Changes by Jeremy Kloth jeremy.kloth+python-trac...@gmail.com:


--
nosy: +jkloth

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

How does it fail? Please paste the precise exception.

--

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

Traceback (most recent call last):
  File stat-bug.py, line 12, in module
print('stat', os.stat(pathname))
PermissionError: [Error 5] Access is denied: '\\Users\\Jeremy\\test.tmp'

--

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Martin v . Löwis

Martin v. Löwis added the comment:

Why do you think the behavior is broken? It looks right to me - it's not 
possible to get file information for a file that is scheduled for deletion.

ISTM that rather os.path.exists has non-intuitive behavior; it shouldn't infer 
from the PermissionError that the file does not exist, but that it is not able 
to tell.

However, this is not a bug, but documented behavior, see

http://docs.python.org/library/os.path.html#os.path.exists

--

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



[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't quite understand the purpose of your suggestions. What can you do with 
it help, what you can not do with contextlib.ExitStack, atexit, __del__ method, 
weakref.WeakKeyDictionary or weakref.ref? I read the documentation, but the 
meaning eludes me.

--
nosy: +storchaka

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

 Why do you think the behavior is broken? It looks right to me - it's not 
 possible to get file information for a file that is scheduled for deletion.

However you can when using MSVCRT's stat() function or even
FindFirstFile directly.

--
nosy: +jeremy.kloth

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



[issue14565] is_cgi doesn't function as documented for cgi_directories

2012-08-04 Thread Glenn Linderman

Glenn Linderman added the comment:

Thanks for the patch, Oscar, I've not had more time to follow up on this issue, 
and haven't yet learned how to generate the patches.

While you dropped the return False line, which surprised me, the implicit 
return None is sufficiently false, that there no real concern with the 
correctness of the code in the patch.

Hopefully, with your contribution, this issue can progress to completion.

--

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



[issue15556] os.stat fails for file pending delete on Windows

2012-08-04 Thread Chris Jerdonek

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


--
nosy: +cjerdonek

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



[issue15550] Trailing white spaces

2012-08-04 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 There already is a hook in place for the main python.org repository that 
 checks for and rejects changesets that include files with space issues:

If there is already a hook, then why do some files have spurious white space 
(i.e. at the end of a line)?  Is that because those issues were present prior 
to putting the hook in place?

--
nosy: +cjerdonek

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



[issue15544] math.isnan fails with some Decimal NaNs

2012-08-04 Thread Mark Dickinson

Mark Dickinson added the comment:

 Why not add a is_nan() method to float numbers instead?

That could work.  The duplication of float.is_nan and math.isnan (not to 
mention the different spellings) would be a bit ugly, but perhaps worth it.  It 
would make sense to add float.is_infinite and (possibly) float.is_finite 
methods at the same time.

Looks like we've got two separate issues here, that should probably be split 
into two separate bug reports.  The first issue is that Decimal.__float__ is 
brain-dead when it comes to NaNs with payloads;  I consider that a clear bug, 
and Steven's patch fixes it nicely for the Python version of decimal.  The 
second has to do with finding a nice type-agnostic way of determing whether 
something is a NaN---anyone mind if I open a separate issue for this?

W.r.t. the first issue:  Steven, thanks for the patch;  looks fine to me at 
first glance.

Two questions:  (1) What would you think about raising ValueError explicitly 
for the signaling NaN case rather than falling back to the ValueError coming 
from the string-to-float conversion.  I think the intentions of the code would 
be a little clearer that way;  and we get to choose a more informative error 
message that way, too.  (2) Should we apply the fix to 2.7 and/or 3.2 as well?

I'll look at extending Steven's fix to the cdecimal code, unless Stefan really 
wants to do it (which would be fine with me :-).

--
assignee:  - mark.dickinson
versions: +Python 2.7

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



[issue15557] Tests for webbrowser module

2012-08-04 Thread Anton Barkovsky

New submission from Anton Barkovsky:

Attaching a patch with some tests for webbrowser module.

The tests fail unless #15509 is fixed.
They also print lots of warnings unless #15447 is fixed.

--
components: Tests
files: test_webbrowser.patch
keywords: patch
messages: 167423
nosy: anton.barkovsky, r.david.murray
priority: normal
severity: normal
status: open
title: Tests for webbrowser module
versions: Python 3.3
Added file: http://bugs.python.org/file26688/test_webbrowser.patch

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



[issue15447] A file is not properly closed by webbrowser._invoke

2012-08-04 Thread Anton Barkovsky

Anton Barkovsky added the comment:

Added tests in #15557.

--

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



[issue15509] webbrowser.open sometimes passes zero-length argument to the browser.

2012-08-04 Thread Anton Barkovsky

Anton Barkovsky added the comment:

Added tests in #15557.

--

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



[issue13052] IDLE: replace ending with '\' causes crash

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0f38948cc6df by Andrew Svetlov in branch '3.2':
Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog 
ended with '\'.
http://hg.python.org/cpython/rev/0f38948cc6df

New changeset 9dcfba4d0357 by Andrew Svetlov in branch 'default':
Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog 
ended with '\'.
http://hg.python.org/cpython/rev/9dcfba4d0357

New changeset 44c00de723b3 by Andrew Svetlov in branch '2.7':
Issue #13052: Fix IDLE crashing when replace string in Search/Replace dialog 
ended with '\'.
http://hg.python.org/cpython/rev/44c00de723b3

--
nosy: +python-dev

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



[issue15544] math.isnan fails with some Decimal NaNs

2012-08-04 Thread Stefan Krah

Stefan Krah added the comment:

Mark Dickinson rep...@bugs.python.org wrote:
 Looks like we've got two separate issues here, that should probably be
 split into two separate bug reports.  The first issue is that
 Decimal.__float__ is brain-dead when it comes to NaNs with payloads;
 I consider that a clear bug, and Steven's patch fixes it nicely for
 the Python version of decimal.

If we are viewing the whole issue in terms of decimal - float conversion,
I'm not so sure anymore: Not all Decimal payloads have a meaning for floats
(and payloads get lost in the conversion).

On the other hand it doesn't matter since I doubt anyone is using payloads. :)

 The second has to do with finding a nice type-agnostic way of determing
 whether something is a NaN---anyone mind if I open a separate issue for this?

Yes, that should probably be another issue.

 Two questions:  (1) What would you think about raising ValueError explicitly
 for the signaling NaN case rather than falling back to the ValueError coming
 from the string-to-float conversion.

If we use your latest rationale for raising in case of 
Decimal('snan').__float__(),
I think that indeed __float__() should raise like Decimal.to_integral() does
for example.

If we are aiming for sNaN support in floats in the long term and at some point
allow carrying over sNaNs from decimal to float, then perhaps the error message
could say that sNaN conversion is currently not supported.

 (2) Should we apply the fix to 2.7 and/or 3.2 as well?

Yes, I think so.

 I'll look at extending Steven's fix to the cdecimal code, unless Stefan
 really wants to do it (which would be fine with me :-).

Please go ahead! For this year, I've seen more than enough of _decimal.c
already. :)

--

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



[issue12655] Expose sched.h functions

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fb975cb8fb45 by Victor Stinner in branch 'default':
Issue #12655: Mention multiprocessing.cpu_count() in os.sched_getaffinity() doc
http://hg.python.org/cpython/rev/fb975cb8fb45

--

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



[issue15550] Trailing white spaces

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

AFAIR the hook only applies to Python and reST files, not C files.
I think Georg wrote it, perhaps he knows the reasons.

--
nosy: +georg.brandl

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



[issue15492] textwrap.wrap expand_tabs does not behave as expected

2012-08-04 Thread R. David Murray

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


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

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



[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 I don't quite understand the purpose of your suggestions. What can you do 
 with it help, what you can not do with contextlib.ExitStack, atexit, 
 __del__ method, weakref.WeakKeyDictionary or weakref.ref? I read the 
 documentation, but the meaning eludes me.

finalize does not compete with contextlib.ExitStack, atexit and
weakref.WeakKeyDictionary.  It only competes with __del__ and weakref
callbacks.

Points 1 and 2 in my first message are the main points.  Also, read the
warning at

  http://docs.python.org/py3k/reference/datamodel.html#object.__del__

which also applies to weakref callbacks.

Other problems with __del__:

* Ref cycles which contain an object with a __del__ method are immortal

* __del__ methods can ressurect the object.

There was actually a proposal to remove or replace __del__ methods in
Python 3000.  See the Removing __del__ thread(s):

  http://mail.python.org/pipermail/python-3000/2006-September/thread.html#3797

As for weakref callbacks, I think they are just too difficult to use correctly
unless you are very familiar with them.

--

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



[issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

I *want* it to be the default, since I think that is the typical use case, but 
the existing default behavior means that such a backward incompatible change 
would not be acceptable for exactly the reason you state.  So yes, I want it as 
a new flag.  (exist_really_ok, he says with tongue in cheek.)  I haven't 
given much thought to the API, but perhaps there could be a value for the umask 
that means don't care?

--

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



[issue15550] Trailing white spaces

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 There already is a hook in place for the main python.org repository that
 checks for and rejects changesets that include files with space issues:

Now I understand why there is no problem with .py files. But there are a lot of 
other files (including .c and .h) with trailing whitespaces.

--

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



[issue15550] Trailing white spaces

2012-08-04 Thread Georg Brandl

Georg Brandl added the comment:

Well, I'm -0 on extending the hook to C files.

--

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



[issue15510] textwrap.wrap('') returns empty list

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

FTR I agree with Antoine that returning the empty list is the more logical 
behavior here.  Wrap is turning a string into a list of lines...if there is no 
content, the list of lines *should* be empty, IMO.  That is what I would 
expect, so for me the empty list follows the principle of least surprise here.  
Consider, for example, the fact that [] is False, while [''] is True.  I 
consider that definitive in favor of returning an empty list when there is no 
content to wrap, even ignoring the backward compatibility issue.

The issue of preserving whitespace-only is fuzzier, but given that it is fuzzy 
I also am inclined to leave the current behavior alone (and document it 
properly).  As Antoine said, there is no point in preserving whitespace unless 
it is preserving indentation, and if there is nothing but whitespace there is 
nothing to be indented.

--
nosy: +r.david.murray

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



[issue1859] textwrap doesn't linebreak on \n

2012-08-04 Thread R. David Murray

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


--
nosy: +r.david.murray

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



[issue15500] Python should support naming threads

2012-08-04 Thread R. David Murray

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


--
nosy: +r.david.murray

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



[issue14330] don't use host python, use host search paths for host compiler

2012-08-04 Thread Georg Brandl

Georg Brandl added the comment:

Matthias: ping.  I don't want to hold up beta2 indefinitely.  In order to 
resolve this blocker, we will revert the batch of cross-compiling patches in a 
few days if there is no progress here.

--

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



[issue15500] Python should support naming threads

2012-08-04 Thread Florent Xicluna

Changes by Florent Xicluna florent.xicl...@gmail.com:


--
nosy: +flox

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



[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 finalize does not compete with contextlib.ExitStack, atexit and
 weakref.WeakKeyDictionary.  It only competes with __del__ and weakref
 callbacks.

What kind of problems you solve with __del__  and weakref callbacks? For most 
of them contextlib.ExitStack and atexit are safer and better fit.

 Points 1 and 2 in my first message are the main points.  Also, read the
 warning at

For point 1: global weakref.WeakKeyDictionary is good store for weak refs with 
callbacks. 

global weakdict
weakdict[kenny] = weakref.ref(kenny, lambda _: print(you killed kenny!))

If you do not want to work at a low level, in most cases fit the above-
mentioned high-level tools.

For point 2 Antoine has noted that it is a known issue and there is a solution 
(issue812369).

   http://docs.python.org/py3k/reference/datamodel.html#object.__del__
 
 which also applies to weakref callbacks.

Is this your point 2?

 Other problems with __del__:
 
 * Ref cycles which contain an object with a __del__ method are immortal

It is use case for weakrefs which break reference loops.

 * __del__ methods can ressurect the object.

What you are meaning?

Relying on GC is dangerous thing for resource releasing. And it even more 
dangerous for alternative implementations without reference counting. That is 
why in recent times in Python there has been a tendency to RAII strategy 
(context managers).

Can you give examples, where the use of finalize necessary or more convenient 
the other ways?

--

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



[issue15550] Trailing white spaces

2012-08-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I found a few files where trailing spaces are significant (patches, RTF, test 
data). Excluding them and three generated file (Unicode data, generating 
scripts should be smarter), I divided the remaining into several parts:

1) the libffi library;
2) the libmpdec library;
3) other C sources;
4) the rest of the files (mainly readme-like files and build scripts).

--
keywords: +patch
Added file: http://bugs.python.org/file26689/libffi_trailing_whitespaces.diff

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



[issue15550] Trailing white spaces

2012-08-04 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file26690/libmpdec_trailing_whitespaces.diff

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



[issue15550] Trailing white spaces

2012-08-04 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file26691/c_trailing_whitespaces.diff

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



[issue15550] Trailing white spaces

2012-08-04 Thread Serhiy Storchaka

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


Added file: http://bugs.python.org/file26692/other_trailing_whitespaces.diff

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



[issue15531] os.path symlink docs missing

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

The first of those acts as I would expect: os.path.realpath is operating only 
on the path, so if the last element is a symbolic link it doesn't have any 
reason to look for the target of that link.

The second one does seem less intuitive.

I'm not sure the first case is worth a patch...I'd have to see a suggested 
wording.  The second probably is, assuming it is not in fact a bug.

--
nosy: +larry, r.david.murray

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



[issue15550] Trailing white spaces

2012-08-04 Thread Ned Deily

Ned Deily added the comment:

-1 for making wholesale whitespace changes. It potentially makes merging harder 
for little benefit. Imported files from other projects should definitely not be 
touched. IMO, the only thing potentially worth considering is extending the 
existing hook to C files.  I'm +0 on that myself.

--

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



[issue15536] re.split doesn't respect MULTILINE

2012-08-04 Thread R. David Murray

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


--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - MULTILINE confuses re.split

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



[issue15496] harden directory removal for tests on Windows

2012-08-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

I've updated the comment in the patch to reflect Martin's concern.

Martin is partially correct in that the handle opened in the stat() call will 
not prolong the pending status.  It is due to the fact that it does not open 
the handle with any sharing mode set, thus effectively blocking any other 
process from grabbing another handle to the file while the stat function has 
its handle open.

--
Added file: http://bugs.python.org/file26693/support.diff

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



[issue15539] Fixing Tools/scripts/pindent.py

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

There is now a test_tools, so it would be great to have tests to go along with 
this patch.

I haven't looked at the patch in detail, but as long as you are modernizing it 
please kill those # end ... lines.

--
nosy: +r.david.murray

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



[issue15558] webbrowser output to console

2012-08-04 Thread Juancarlo Añez

New submission from Juancarlo Añez:

Under Ubuntu Linux 11.10 and 12.04, webbroser.open() will output the following 
message to the console:

Created new window in existing browser session.

The behavior is both unexpected and troublesome.

--
components: Library (Lib)
messages: 167443
nosy: apalala
priority: normal
severity: normal
status: open
title: webbrowser output to console
type: behavior
versions: Python 2.7, Python 3.2

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



[issue15550] Trailing white spaces

2012-08-04 Thread Stefan Krah

Stefan Krah added the comment:

I'm not against whitespace cleanup every now and then, but also -0
on a hook for C files. I think that (for C) the annoyance of having
a patch rejected because of trailing whitespace outweighs the
overall benefit.

--
nosy: +skrah

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



[issue15541] logging.exception doesn't accept 'extra'

2012-08-04 Thread R. David Murray

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


--
nosy: +vinay.sajip

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



[issue15496] harden directory removal for tests on Windows

2012-08-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

With the latest changes, is there anything left preventing the
inclusion of this patch?

Without some change, the Win64 buildbot is relatively irrelevant as it
is nearly always in a state of failure due to these errors.

--

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



[issue15496] harden directory removal for tests on Windows

2012-08-04 Thread Brian Curtin

Brian Curtin added the comment:

 Without some change, the Win64 buildbot is relatively irrelevant as it
is nearly always in a state of failure due to these errors.

Not that some change isn't necessary, but what else are you running on your 
build slave? I ran a Windows 2008 R2 x64 slave for some time and it never had 
issues around file/directory removal. I only had to decommission it because the 
physical machine became unreliable.

--

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



[issue15551] Unit tests that return generators silently fail

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

This is not something that is specific to unittest.  In Python, if you call a 
generator function *it returns a generator-iterator*.  Unless you *do* 
something with the the iterator, nothing else happens.  This is true in *any* 
python code.  

Unittest calls whatever test method you define, and handles (reports) the 
exceptions that result from that call.  That's the fundamental design of 
unittest.  Your generator test method does not raise any exceptions when 
called, therefore the test passed.

--
nosy: +r.david.murray

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



[issue15496] harden directory removal for tests on Windows

2012-08-04 Thread Jeremy Kloth

Jeremy Kloth added the comment:

 Not that some change isn't necessary, but what else are you running on your 
 build slave? I ran a Windows 2008 R2 x64 slave for some time and it never had 
 issues around file/directory removal. I only had to decommission it because 
 the physical machine became unreliable.

The errors only started happening after upgrading the HD from a PATA
Ultra133 to an SATA3 SSD.  The super-fast HD is allowing for these
timing errors to show through.

--

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Windows buildbots now show failures in the test suite.

--
status: closed - open
versions: +Python 3.3

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



[issue15554] correct and clarify str.splitlines() documentation

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

Sigh. ;)

At this point in my Python programming I intuitively understand what splitlines 
does, but every time we try to explain it in detail it gets messier and 
messier.  I wasn't really happy with the addition of that sentence about split 
in the first place.

I don't understand what your splitlines examples are trying to say, they all 
look clear to me based on the fact that we are splitting *lines*.  

I don't find your proposed language in the patch to be clearer.  The existing 
sentence describes the concrete behavior, while your version is sort-of 
describing (ascribing?) some syntax to the line separators (does not 
delimit).  The problem is that there *is* a syntax here, that of 
universal-newline-delimited-text, but that is too big a topic to explain in the 
splitlines doc.  There's another issue for creating a central description of 
universal-newline parsing, perhaps this entry could link to that discussion 
(and that discussion could perhaps mention splitlines).

The split behavior without a specified separator might actually be a bug (if 
so, it is not a fixable one), but in any case you are right that that 
clarification should be added if the existing sentence is kept.

--
nosy: +ncoghlan, r.david.murray

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



[issue15555] Default newlines of io.TextIOWrapper

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

And that is the value of os.linesep at Python startup.  I'm don't think that we 
really support the mutability of os.linesep, we just don't bother to make it 
immutable.  I'm not sure how this would be documented, since code that does use 
os.linesep is indeed affected by changing it.

--
nosy: +r.david.murray

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4efad7fba42a by Antoine Pitrou in branch '3.2':
Fix test_sys under Windows (issue #13119)
http://hg.python.org/cpython/rev/4efad7fba42a

New changeset e4a87f0253e9 by Antoine Pitrou in branch 'default':
Merge universal newlines-related fixes (issue #13119)
http://hg.python.org/cpython/rev/e4a87f0253e9

--

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



[issue15558] webbrowser output to console

2012-08-04 Thread R. David Murray

R. David Murray added the comment:

This message does not come from the Python webbrowser module.  You should 
report this upstream to the bug tracker for your browser.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f8e435d6a801 by Antoine Pitrou in branch 'default':
Fix test_venv to work with universal newlines (issue #13119)
http://hg.python.org/cpython/rev/f8e435d6a801

--

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



[issue13837] test_shutil fails with symlinks enabled under Windows

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ping?

--

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



[issue15541] logging.exception doesn't accept 'extra'

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 322da186cced by Vinay Sajip in branch '2.7':
Issue #15541: Correct anomaly in logging.exception. Thanks to Ned Batchelder 
for the report.
http://hg.python.org/cpython/rev/322da186cced

--
nosy: +python-dev

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



[issue15541] logging.exception doesn't accept 'extra'

2012-08-04 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
assignee:  - vinay.sajip
resolution:  - fixed
status: open - closed
versions:  -Python 3.2

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

test_httpservers still fails, it's the CGI tests...

--

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



[issue15528] Better support for finalization with weakrefs

2012-08-04 Thread Richard Oudkerk

Richard Oudkerk added the comment:

 For point 1: global weakref.WeakKeyDictionary is good store for weak refs 
 with 
 callbacks. 

 global weakdict
 weakdict[kenny] = weakref.ref(kenny, lambda _: print(you killed kenny!))

That depends on kenny being hashable.

It also surprises me a bit that it works.  It seems to depend on unguaranteed
implementation details: PyObject_ClearWeakRefs() copies all weakrefs with 
callbacks to a tuple before invoking callbacks.  If this were not the case
then I think the weakref you created (which is scheduled to fire second) would
be garbage collected before its callback could be invoked.

I think users should have a documented way to schedule callbacks without having 
to
explicitly save the weakref.

 For point 2 Antoine has noted that it is a known issue and there is a 
 solution 
 (issue812369).

That has been languishing for 9 years.  I would not hold your breath.

http://docs.python.org/py3k/reference/datamodel.html#object.__del__
  
  which also applies to weakref callbacks.
 
 Is this your point 2?

Yes.

 Relying on GC is dangerous thing for resource releasing. And it even more 
 dangerous for alternative implementations without reference counting. That is 
 why in recent times in Python there has been a tendency to RAII strategy 
 (context managers).

I agree that explicit clean up using context managers to be strongly encouraged.
But resources should still be released if the object is garbage collected.  Or
do you think that file objects should stop bothering to close their fds when 
they
are deallocated?

 Can you give examples, where the use of finalize necessary or more convenient 
 the other ways?

multiprocessing (which I orginally wrote) makes extensive use of finalizers, 
(although with a different implementation and api).  In some cases that is 
because
at the time I wanted to support versions of Python which did not have the with
statement.

But there are various things there that depend on finalizers, and on being able
to guarantee that they get called on exit (in a predictable order).

--

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



[issue15500] Python should support naming threads

2012-08-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I don't think this should be done by default as it will break people's 
expectations and, perhaps worse, compatibility.

--
nosy: +pitrou

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Atsuo Ishimoto

Atsuo Ishimoto added the comment:

Fix for test_httpservers

--
Added file: http://bugs.python.org/file26694/issue13119_httpserver.patch

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



[issue15546] Iteration breaks with bz2.open(filename,'rt')

2012-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5284e65e865b by Nadeem Vawda in branch 'default':
#15546: Fix {GzipFile,LZMAFile}.read1()'s handling of pathological input data.
http://hg.python.org/cpython/rev/5284e65e865b

--

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



[issue15546] Iteration breaks with bz2.open(filename,'rt')

2012-08-04 Thread Nadeem Vawda

Nadeem Vawda added the comment:

Done.

Thanks for the bug report, David.

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

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



[issue15531] os.path symlink docs missing

2012-08-04 Thread Larry Hastings

Larry Hastings added the comment:

I just tried it, and os.readlink('/tmp/broken-symlink') worked fine.  What OS 
are you using?

--

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



[issue15548] Mention all new os functions in What's New in Python 3.3

2012-08-04 Thread Larry Hastings

Larry Hastings added the comment:

ftruncate isn't new.

--

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Atsuo Ishimoto

Atsuo Ishimoto added the comment:

Sorry, please ignore the patch 'issue13119_httpserver.patch' I posted above. 

Behavior of -u commandline option in Python3.3 is differ than in Python 2. 

We should not convert newline characters if -u specified? I'll investigate 
more.

--

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



[issue15531] os.path symlink docs missing

2012-08-04 Thread Dave Abrahams

Dave Abrahams added the comment:

MacOS 10.7

--

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



[issue15531] os.path symlink docs missing

2012-08-04 Thread Larry Hastings

Larry Hastings added the comment:

What does the following script print out?

import os

os.chdir('/tmp')
os.symlink('--success--', 'foo')
print(this should print --success-- :)
print(os.readlink('foo'))
os.unlink('foo')

--

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



[issue13119] Newline for print() is \n on Windows, and not \r\n as expected

2012-08-04 Thread Atsuo Ishimoto

Atsuo Ishimoto added the comment:

We should not convert \n with -u command line option or PYTHONUNBUFFERED was 
set.

Added a patch to fix error in test_httpservers.

--
Added file: http://bugs.python.org/file26695/issue13119_unbuffered.patch

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



[issue15544] math.isnan fails with some Decimal NaNs

2012-08-04 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On 05/08/12 03:45, Mark Dickinson wrote:

 It would make sense to add float.is_infinite and (possibly) float.is_finite
 methods at the same time.

If you don't add is_finite, you know someone is going to express surprise that 
it wasn't already done. Just as happened with math.isfinite :)

http://bugs.python.org/issue9165#msg109326

 The second has to do with finding a nice
 type-agnostic way of determing whether something is a NaN---anyone mind if
 I open a separate issue for this?

Please do.

 Two questions:  (1) What would you think about raising ValueError
 explicitly for the signaling NaN case [...]   (2) Should we apply
 the fix to 2.7 and/or 3.2 as well?

Agree to both. I think this counts as a bug report and not a new feature.

 I'll look at extending Steven's fix to the cdecimal code

Thank you :)

--

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