[issue16793] Get rid of deprecated assertEquals etc in tests

2012-12-28 Thread Georg Brandl

Georg Brandl added the comment:

And please don't commit cosmetic/cleanup changes to bugfix branches in the 
future.

--
nosy: +georg.brandl

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c0266ba8e4c6 by Serhiy Storchaka in branch '2.7':
Issue #16761: Raise TypeError when int() or long() called with base argument 
only.
http://hg.python.org/cpython/rev/c0266ba8e4c6

New changeset e4ea38a92c4d by Serhiy Storchaka in branch '3.2':
Issue #16761: Raise TypeError when int() called with base argument only.
http://hg.python.org/cpython/rev/e4ea38a92c4d

New changeset 157ff02bcc16 by Serhiy Storchaka in branch '3.3':
Issue #16761: Raise TypeError when int() called with base argument only.
http://hg.python.org/cpython/rev/157ff02bcc16

New changeset 1b2134a78c17 by Serhiy Storchaka in branch 'default':
Issue #16761: Raise TypeError when int() called with base argument only.
http://hg.python.org/cpython/rev/1b2134a78c17

--
nosy: +python-dev

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 When this patch is updated because of the commit for issue 16790, in 3.x can 
 the edited test cases be moved to the top of the test class per the following 
 comment (as appropriate)?

I will do this in issue16784. In any case I am going to move a large part of 
test_basic/test_long to IntLongCommonTests and then those test will be above 
test_keyword_args.

--

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Why did you backport this change after being advised not to do it?

--

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



[issue1180] Option to ignore or substitute ~/.pydistutils.cfg

2012-12-28 Thread Ned Deily

Ned Deily added the comment:

Andrew, comments to closed issues are usually ignored.  I suggest you open a 
new issue about this.  A quick glance suggests that the code for this feature 
is not in Python 3.  It may be that it was lost when, during the 2.7 
development cycle, it was decided to not allow new features to Distutils and a 
number of changes were reverted.  There have been some other cases of Distutils 
changes that were lost in Python 3.2+ because of this.

--
nosy: +ned.deily

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

I'd suggest leaving 3.2 and 3.3 as they are: the bug is fairly benign, but  
fixing it could break existing code unnecessarily.  That's something that we 
should try hard not to do in a bugfix release.

As to PyNumber_AsSsize_t() used instead PyLong_AsLongAndOverflow(), I *do* 
think that in general interfaces for built-in functions and methods that accept 
an integer should be prepared to accept anything that has an __index__.  If we 
can find a way to do that with sane exception types / messages, so much the 
better.  (One common application of __index__-able types occurs when using 
NumPy, where it's easy to end up with instances of numpy.int32 or numpy.int64 
instead of regular Python ints.)  I agree with Serhiy that ValueError is the 
appropriate exception for out-of-range values.

[A side-issue here is that the various PyLong_As* utility functions are a mess: 
some use __int__, some use __index__, etc.  I have some thoughts about how to 
fix this, but that's another issue.]

--

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

 The only difference with previous code is that now OverflowError raised  for 
 large bases instead of ValueError.

Serhiy: can you clarify this remark?  Where do you see the OverflowError? The 
current exception and message look fine to me, so maybe I'm misunderstanding 
what you're talking about:

Python 3.4.0a0 (default:1b2134a78c17, Dec 28 2012, 10:06:47) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type help, copyright, credits or license for more information.
 int('34', base=2**100)
Traceback (most recent call last):
  File stdin, line 1, in module
ValueError: int() base must be = 2 and = 36
[66206 refs, 23451 blocks]

I actually think this issue can be closed as fixed:  the current code looks 
fine to me, and I don't think the fix should be backported.

--

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

 I actually think this issue can be closed as fixed:

Ah, whoops;  I failed to understand Serhiy's comment about the still existing 
if (!PyLong_Check(obase)), which does indeed mean that the code *still* 
doesn't work for __index__-able types.

Here's a fix for that, with tests.

--
keywords: +patch
Added file: http://bugs.python.org/file28465/issue16772.patch

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
assignee: serhiy.storchaka - mark.dickinson

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



[issue16772] int() accepts float number base

2012-12-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 I actually think this issue can be closed as fixed:  the current code looks 
 fine to me, and I don't think the fix should be backported.

How about backporting the tests?  In addition to adding tests for the fix, Greg 
added more comprehensive tests for the existing behavior (i.e. 
test_int_base_limits()).  Backporting the latter would help prevent regressions 
from future fixes in earlier versions.

Also, if we don't backport shouldn't there be a version changed in the docs?

--

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

Sure, I don't see any issue with backporting test_int_base_limits;  that has 
little to do with this issue, though, so shouldn't prevent closing this one.

I'll add a Misc/NEWS entry when I commit;  not sure it's meaningful to add doc 
changes, since I the 3.2 and 3.3 acceptance of floats is undocumented anyway.  
I can and will add a versionchanged entry for the acceptance of __index__-able 
types, though.

--

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



[issue16772] int() accepts float number base

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

Patch including doc update.

--
Added file: http://bugs.python.org/file28466/issue16772_v2.patch

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Larry Hastings

New submission from Larry Hastings:

The line declaring the function dbm.open looks like this:
def open(file, flag='r', mode=0o666):

The docstring for dbm.open looks like this:
open(file, flag='r', mode=438)

Obviously 438==0o666.  But the author used the octal representation because 
it's more readable.  Unfortunately Python throws that enhanced readability away 
when it round-trips the rvalue from a string into an integer and back into a 
string again for the docstring.

It might be an improvement if Python preserved the original source code's 
representation for integer (and perhaps float) default arguments for 
parameters.  I haven't looked at the code that does the parsing / builds the 
docstring, but I suspect we could hang the original representation on the AST 
node and retrieve it when building the docstring.

The only problem I can forsee: what about code that uses local variables, or 
computation including perhaps function calls, to calculate default values?  On 
the one hand, the local variable or the function call may be inscrutable--on 
the other, perhaps the magic integer value it replaced was no better.  Or we 
could have a heuristic, like if the original representation contains internal 
spaces or parentheses we use str(rvalue), otherwise we use the original 
representation.

--
components: Interpreter Core
messages: 178383
nosy: larry
priority: normal
severity: normal
status: open
title: Preserve original representation for integers / floats in docstrings
type: enhancement
versions: Python 3.4

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Larry Hastings

Larry Hastings added the comment:

(I was also considering proposing using annotations to tell the parser we want 
the original representation in the docstring, but I suspect that's a bad idea.  
That would instantly restrict the untamed frontier that is annotations.)

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

It's an interesting idea.  This sounds like the wrong solution to me, though:  
it's significant extra machinery to produce a solution that only fixes a small 
handful of cases;  IOW, the benefit / cost ratio seems to small to make this 
worth it.  E.g., apart from the function calls that you mention, what about 
expressions?  -0x8000 isn't a numeric literal, so the 'original 
representation' information attached to 0x8000 will have been lost.

I'm also sceptical that this can be done as simply as you describe:  isn't the 
AST no longer available at the time that the docstring is built?

Perhaps what we need instead is a general mechanism to override the generated 
signature line?

--
nosy: +mark.dickinson

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



[issue16640] Less code under lock in sched.scheduler

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What is the point of having heapq.heappush under a lock if heapq.heappop in 
another method is not protected? The logic doesn't seem to make sense.

--

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



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Changes by Daniel Shahaf pyt...@danielsh.fastmail.net:


--
nosy: +danielsh

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-28 Thread Richard Oudkerk

New submission from Richard Oudkerk:

The actual signature is

socket.socket(family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None)

but the documented signature is

socket.socket([family[, type[, proto]]])

Should the fileno argument be documented or is it considered an implementation 
detail?

--
messages: 178387
nosy: sbt
priority: normal
severity: normal
status: open
title: fileno argument to socket.socket() undocumented
versions: Python 3.2, Python 3.3, Python 3.4

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



[issue16485] FD leaks in aifc module

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Of course. Thanks for point. It's my editor made wrong whitespace changes after 
block indent/unindent. hg diff shows this changes and I shouldn't miss this. 
I will review every patch before commit one more time.

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Charles-François Natali

Charles-François Natali added the comment:

 A couple of years ago I conducted similar tests and it turned out that 64k 
 was the best compromise:
 http://code.google.com/p/pyftpdlib/issues/detail?id=94
 Twisted uses 128k.
 I'd be for using 64k and also change asynchat.async_chat.ac_*_buffer_size in 
 accordance.

That sounds reasonable.

However, the mere fact that such constants are duplicated tends to
make me think that async_chat should actually be a subclass of
asyncore.asyncore_with_send (or move c_*_buffer_size to
asyncore.asyncore). Sane default buffering constants belong more to
asyncore than asynchat, no?

--

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



[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread R. David Murray

R. David Murray added the comment:

If it is a feature, then is it documented in the language reference and is this 
actually a bug in PyPy (it sounds like it is)?

--

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



[issue16486] Add context manager support to aifc module

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

fout.close() here is intentional no-op. This is a check that fout was closed 
properly (in contrary case close() should raise exception). Unfortunately there 
is no other way to test that fout was closed.

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread R. David Murray

R. David Murray added the comment:

I don't think you mean 'docstring'.  A docstring is something a human writes in 
the source code.  I presume you are actually talking about introspection of the 
signature here.  Beyond that, I agree with Mark's comments.

--
nosy: +r.david.murray

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



[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

It looks to me as though this has nothing to do with itertools  In CPython 2.7:


Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type credits, demo or enthought for more information.
 b = [1]
 b += (x for x in b)   # runs until Ctrl-C
^CTraceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 1, in genexpr
KeyboardInterrupt


In PyPy:

Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Jun 09 2012, 14:24:15)
[PyPy 1.9.0] on darwin
Type help, copyright, credits or license for more information.
And now for something completely different: ``the world doesn't want us to
know''
 b = [1]
 b += (x for x in b)  # Returns immediately.
 b
[1, 1]

So it seems that PyPy is building the RHS before appending it to b.  That looks 
like a bug in PyPy to me.

--
nosy: +mark.dickinson

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



[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

And here's a non-infinite example where CPython and PyPy differ.

Python 2.7.3 |EPD 7.3-1 (32-bit)| (default, Apr 12 2012, 11:28:34) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type credits, demo or enthought for more information.
 b = [1]
 b += (x+1 for x in b if x  5)
 b
[1, 2, 3, 4, 5]
 
iwasawa:cpython mdickinson$ pypy-c
-bash: pypy-c: command not found
iwasawa:cpython mdickinson$ /opt/local/bin/pypy-c
Python 2.7.2 (341e1e3821fff77db3bb5cdb7a4851626298c44e, Jun 09 2012, 14:24:15)
[PyPy 1.9.0] on darwin
Type help, copyright, credits or license for more information.
And now for something completely different: ``'that's definitely a case of
uh'''
 b = [1]
 b += (x+1 for x in b if x  5)
 b
[1, 2]

--

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



[issue16791] itertools.chain.from_iterable doesn't stop

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

Opened https://bugs.pypy.org/issue1355 for this.

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

IMO no. asyncore.dispatcher_with_send should not exist in the first place as it 
basically is a castrated version of asynchat.async_chat with less capabilities. 
I'd say it's there only for an historical reason.

Moving ac_*_buffer_size to asyncore.dispatcher makes no sense as it offers no 
buffer capabilities whatsoever in the first place.

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

BTW, in case it saves anyone else some time, the current machinery is in 
Lib/pydoc.py, in the `TextDoc.docroutine` method.  It uses 
inspect.getfullargspec to retrieve the information to format, though I guess 
using inspect.Signature would be the modern way to do this.

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Mark Dickinson

Mark Dickinson added the comment:

Bah.  s/inspect.Signature/inspect.signature/

--

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



[issue16802] fileno argument to socket.socket() undocumented

2012-12-28 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' g.rod...@gmail.com:


--
nosy: +giampaolo.rodola

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



[issue13454] crash when deleting one pair from tee()

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Good point. Here is updated patch.

--
Added file: 
http://bugs.python.org/file28467/itertools_tee_nonrecursive_clear_2.patch

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I agree that 64K seems better here (on Linux).
There is another problem with dispatcher_with_send: the buffering algorithm 
(both when appending and popping) is quadratic. You can easily observe it with 
your test script, when growing the DATA. async_chat looks much saner in that 
respect, I wonder why the same algorithm couldn't it be re-used.

(regardless, reading the asyncore code really hurts the eyes :-/)

--
nosy: +pitrou

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



[issue16793] Get rid of deprecated assertEquals etc in tests

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry. I were understand that patches were approved by several core devs. This 
issue was created for fixing regression from issue16045, but then I saw yet 
some forgotten deprecated asserts. If you want, I will revert this additional 
changes in 2.7 and 3.3.

--

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, I have not noticed your advice before I did commit (it took me a lot of 
time). Should I now revert my changes to 2.7, 3.2 and 3.3?

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Charles-François Natali

Charles-François Natali added the comment:

Alright, here's a simple patch bumping the buffers to 64K for asyncore
and asynchat.

 There is another problem with dispatcher_with_send: the buffering algorithm 
 (both when appending and popping) is quadratic. You can easily observe it 
 with your test script, when growing the DATA. async_chat looks much saner in 
 that respect, I wonder why the same algorithm couldn't it be re-used.

Yeah, I noticed that.
But even in asynchat, there's a lot of copying going on, length
computations performed twice in a row, etc.

 (regardless, reading the asyncore code really hurts the eyes :-/)

Indeed.

--
Added file: http://bugs.python.org/file28468/asyncore_buffsize.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16787
___diff --git a/Lib/asynchat.py b/Lib/asynchat.py
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -56,8 +56,8 @@
 
 # these are overridable defaults
 
-ac_in_buffer_size   = 4096
-ac_out_buffer_size  = 4096
+ac_in_buffer_size   = 65536
+ac_out_buffer_size  = 65536
 
 # we don't want to enable the use of encoding by default, because that is a
 # sign of an application bug that we don't want to pass silently
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -532,7 +532,7 @@
 
 def initiate_send(self):
 num_sent = 0
-num_sent = dispatcher.send(self, self.out_buffer[:512])
+num_sent = dispatcher.send(self, self.out_buffer[:65536])
 self.out_buffer = self.out_buffer[num_sent:]
 
 def handle_write(self):
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16763] test_ssl with connect_ex don't handle unreachable server correctly

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 support.transient doesn't help here since no exception is raised

An exception can still be raised in do_handshake(), which is called when the 
connection succeeds. But, yes, it's otherwise useless.

 Note that I'm not sure that connect_ex returning None is normal in the 
 first place

It is not. The 2.7 implementation currently calls socket.connect() and catches 
socket errors, while the 3.2 implementation directly calls socket.connect_ex(). 
This means the 2.7 implementation will unwillingly catch name resolution 
errors, and other issues:

 socket.socket().connect_ex((svnn.python.org, 443))
Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/antoine/cpython/27/Lib/socket.py, line 224, in meth
return getattr(self._sock,name)(*args)
socket.gaierror: [Errno -5] No address associated with hostname
 ssl.wrap_socket(socket.socket()).connect_ex((svnn.python.org, 443))
-5

I will backport the 3.2 implementation of connect_ex() in order to fix this 
inconsistency. Unfortunately there is no easy way to test for it.

--

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



[issue16640] Less code under lock in sched.scheduler

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This heapq.heappop does applied to a copy of self._queue. Copying done under a 
lock.

--

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



[issue16772] int() accepts float number base

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 Serhiy: can you clarify this remark?  Where do you see the OverflowError?
 The current exception and message look fine to me, so maybe I'm
 misunderstanding what you're talking about:

Sorry, I have been confused (and confuse you) by the variety of PyLong_As* and 
PyNumber_* functions. Now I see PyNumber_AsSsize_t(x, NULL) doesn't raise 
OverflowError but truncates its argument.

The patch LGTM.

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 But even in asynchat, there's a lot of copying going on, length
 computations performed twice in a row, etc.

What/where do you mean exactly?
I see little value in focusing efforts towards things such as 
initiate_with_send which are not supposed to be used but asynchat.async_chat is 
different.

--

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



[issue12065] test_ssl failure when svn.python.org fails to resolve

2012-12-28 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3436769a7964 by Antoine Pitrou in branch '2.7':
Backport Python 3.2 fix for issue #12065, and add another test for 
SSLSocket.connect_ex().
http://hg.python.org/cpython/rev/3436769a7964

--

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



[issue16799] switch regrtest from getopt options to argparse Namespace

2012-12-28 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe tshep...@gmail.com:


--
nosy: +tshepang

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



[issue16640] Less code under lock in sched.scheduler

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, ok. By the way, the queue property says it returns An ordered list, but 
it seems to actually return an iterator.

--

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



[issue16803] Make time_importlib run tests under both _frozen_importlib and importlib._bootstrap

2012-12-28 Thread Brett Cannon

New submission from Brett Cannon:

Need to do some work on the importlib tests such that they get run using both 
_frozen_importlib and importlib._bootstrap to prevent any drift between 
importlib/_bootstrap.py and import.c (and to make it easier to develop).

--
components: Tests
messages: 178409
nosy: brett.cannon
priority: normal
severity: normal
stage: needs patch
status: open
title: Make time_importlib run tests under both _frozen_importlib and 
importlib._bootstrap
type: behavior
versions: Python 3.4

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



[issue16640] Less code under lock in sched.scheduler

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps it was inherited from Python 2.

--

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



[issue15302] Use argparse instead of getopt in test.regrtest

2012-12-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Good step!

--

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



[issue16799] switch regrtest from getopt options to argparse Namespace

2012-12-28 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
nosy: +asvetlov

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Charles-François Natali

Charles-François Natali added the comment:

 What/where do you mean exactly?


187 def push (self, data):
188 sabs = self.ac_out_buffer_size
189 if len(data)  sabs:
190 for i in range(0, len(data), sabs):
191 self.producer_fifo.append(data[i:i+sabs])


len(data) is called twice


228 # handle classic producer behavior
229 obs = self.ac_out_buffer_size
230 try:
231 data = first[:obs]
232 except TypeError:
233 data = first.more()


Here, I think that len(first) = self.ac_out_buffer_size, by
definition. So the slicing is actually just a copy (I realize that it
has the side effect of checking whether it's a buffer or a producer).

memoryview is also great to avoid copies when sending/receiving to a socket.

--

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

If PyPy gets away with a different behaviour, there's probably nobody relying 
on it, so I'd say the backports are safe.

--
nosy: +pitrou

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

 memoryview is also great to avoid copies when sending/receiving to a socket.

That's interesting. How exactly? Would producer_fifo have to change from a 
deque() to a memoryview() object? In that case we might have to take backward 
compatibility into account (producer_fifo already changed in 2.6 and if I'm not 
mistaken that might have caused some problems).
Maybe it makes sense to file a separate issue to address asynchat enhancements.

--

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



[issue16165] sched.scheduler.run() blocks scheduler

2012-12-28 Thread Serhiy Storchaka

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


--
nosy: +chris.jerdonek

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



[issue16645] Wrong test_extract_hardlink() in test_tarfile.py

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, Chris.

--

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



[issue16165] sched.scheduler.run() blocks scheduler

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, Chris. I have opened too many browser tabs. ;)

--
nosy:  -chris.jerdonek

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



[issue16642] Mention new kwargs named tuple parameter in sched module

2012-12-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What anyone can say about this doc changes?

--

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



[issue16795] Patch: some changes to AST to make it more useful for static language analysis

2012-12-28 Thread Brett Cannon

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


--
nosy: +brett.cannon

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



[issue16642] Mention new kwargs named tuple parameter in sched module

2012-12-28 Thread Ezio Melotti

Ezio Melotti added the comment:

LGTM.

--
nosy: +ezio.melotti, rhettinger

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



[issue7325] tempfile.mkdtemp() does not return absolute pathname when relative dir is specified

2012-12-28 Thread Brett Cannon

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


--
nosy:  -brett.cannon

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



[issue16748] Ensure test discovery doesn't break for modules testing C and Python implementations

2012-12-28 Thread Brett Cannon

Brett Cannon added the comment:

Making tests discoverable allows for the future possibility of dropping our 
custom test runner code and using more of unittest code by having regrtest use 
unittest's discovery code to find all tests.

--

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



[issue10848] Move test.regrtest from getopt to argparse

2012-12-28 Thread Brett Cannon

Brett Cannon added the comment:

Since http://bugs.python.org/issue10967 is the meta issue for updating regrtest 
this can be closed.

--
resolution:  - fixed
status: open - closed

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-28 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

New patch in attachment.
It always uses poll() and maintains and internal fd/Connection map.
I get one failure due to the returned list being sorted differently than when 
using select() though.


==
FAIL: test_wait_integer (__main__.TestWait)
--
Traceback (most recent call last):
  File Lib/test/test_multiprocessing.py, line 3277, in test_wait_integer
self.assertEqual(res, [p.sentinel, b])
AssertionError: Lists differ: [multiprocessing.connection.C... != [7, 
multiprocessing.connectio...

First differing element 0:
multiprocessing.connection.Connection object at 0x7f8924fccd30
7

- [multiprocessing.connection.Connection object at 0x7f8924fccd30, 7]
?  ---

+ [7, multiprocessing.connection.Connection object at 0x7f8924fccd30]
?  +++




I don't how important this is.
If it's not tests can be adapted accordingly.

--
Added file: http://bugs.python.org/file28469/issue10527-2.patch

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



[issue16794] Can't get a list of modules in Python's help system

2012-12-28 Thread vertograd phrokhladny

vertograd phrokhladny added the comment:

Re:
2012/12/27 R. David Murray rep...@bugs.python.org


 R. David Murray added the comment:

 This is a duplicate of issue 10060, and as indicated there there really
 isn't much Python can do about this.  You should report the bug to Ubuntu,
 but I'm pretty sure there is already a bug in their system for it (which I
 believe has been fixed).


   Thanks for your comment. I've looked through that very
continuous thread (issue 10060) and than went to Ubuntu.You're  right  ,
there's   bug  #896836 (and several duplicates)   reported  on 2011-11-27
(for Oneiric) with confirmed status. As I understood from recommended
reading  the segmentation fault occurs
because of the conflict between loading dynamic and static bindings in C
based modules.Unfortunately there's no fix for it yet.

--

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



[issue16804] python3 -S -m site fails

2012-12-28 Thread Antoine Pitrou

New submission from Antoine Pitrou:

$ python3.4 -S -m site
sys.path = [
'',
'/home/antoine/opt/lib/python34.zip',
'/home/antoine/opt/lib/python3.4/',
'/home/antoine/opt/lib/python3.4/plat-linux',
'/home/antoine/opt/lib/python3.4/lib-dynload',
]
Traceback (most recent call last):
  File /home/antoine/opt/lib/python3.4/runpy.py, line 160, in 
_run_module_as_main
__main__, fname, loader, pkg_name)
  File /home/antoine/opt/lib/python3.4/runpy.py, line 73, in _run_code
exec(code, run_globals)
  File /home/antoine/opt/lib/python3.4/site.py, line 640, in module
_script()
  File /home/antoine/opt/lib/python3.4/site.py, line 612, in _script
exists if os.path.isdir(USER_BASE) else doesn't exist))
  File /home/antoine/opt/lib/python3.4/genericpath.py, line 42, in isdir
st = os.stat(s)
TypeError: stat: can't specify None for path argument

--
components: Library (Lib)
messages: 178424
nosy: ncoghlan, pitrou
priority: normal
severity: normal
status: open
title: python3 -S -m site fails
type: behavior
versions: Python 3.3, Python 3.4

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



[issue16748] Ensure test discovery doesn't break for modules testing C and Python implementations

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I should think that the first fix should be to the PEP. If I understand 
msg177908, that would mean removing unittest.TestCase as a base for ExampleTest 
and adding it as bases for AcceleratedExampleTest and PyExampleTest. Or have I 
missed something?

--
nosy: +terry.reedy

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



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Daniel Shahaf added the comment:

Attached patch that:

- Adds sqlite3.SQLITE_OK constants
- Adds sqlite3.errorcode dictionary
- Adds sqlite_errcode attribute to sqlite.Error instances

The patch does not add support for extended result codes
(http://www.sqlite.org/c3ref/c_abort_rollback.html).

--
keywords: +patch
Added file: http://bugs.python.org/file28470/i16379-v1.diff

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



[issue16761] Fix int(base=X)

2012-12-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

 Should I now revert my changes to 2.7, 3.2 and 3.3?

Once committed, I would say leave it in as long as you're confident that no 
currently working code will break as a result.  In general, be very 
conservative about backporting any behavioral change.

--

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



[issue16748] Ensure test discovery doesn't break for modules testing C and Python implementations

2012-12-28 Thread R. David Murray

R. David Murray added the comment:

That sounds right to me.

Note that PEP 399 is following older conventions that were laid down in a time 
when unittest did not *have* test discovery, so this is a new paradigm we'd 
like to move to (for the reasons Brett mentioned), and it may take a while to 
get there.  It applies to more than just the python/C accelerator distinction; 
it applies any time a base class plus specialized classes are used to construct 
test cases.  (I do this a bunch in the email tests, for example, and that has 
no accelerator.)

--
nosy: +r.david.murray

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



[issue16379] SQLite error code not exposed to python

2012-12-28 Thread Daniel Shahaf

Daniel Shahaf added the comment:

I didn't compile-test the Doc/ part of the patch.

--

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



[issue16793] Get rid of deprecated assertEquals etc in tests

2012-12-28 Thread Georg Brandl

Georg Brandl added the comment:

Like Raymond said in the other issue: it's not going to be a problem once 
committed, but please be mindful of what you commit to bugfix branches in the 
future.

--

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



[issue16793] Get rid of deprecated assertEquals etc in tests

2012-12-28 Thread Ezio Melotti

Ezio Melotti added the comment:

 And please don't commit cosmetic/cleanup changes to bugfix branches in the 
 future.

Note that those methods are deprecated and thus raise deprecation warnings when 
the tests are run.  It's not just a simple cosmetic/cleanup change IMHO.

--

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



[issue10527] multiprocessing.Pipe problem: handle out of range in select()

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The order of the results is probably unimportant.

--

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



[issue3871] cross and native build of python for mingw* hosts

2012-12-28 Thread Jason Huntley

Jason Huntley added the comment:

Finally! I was able to get all building on mingw64, gcc 4.7.2, and python 3.3. 
I had to take everybody's work here a little further, and I have produced a new 
patch which will build python33 using the latest minw64 compiler in an msys 
environment.

I cloned the 3.3 branch and applied the latest patch available here, 
py3k-20121004-MINGW.patch. I had to make quite a few more updates to get all 
the modules compiling with 4.7.2 and python find all the modules in the correct 
paths in an msys/mingw64 environment. I've compiled another patch, which 
addresses all the latest issues.

For all interested, run my setup script from the following location:

https://github.com/onepremise/MinGW-AD64S/

Just open dos in admin mode and run setup.bat.

This will build all the required dependencies and finally python 3.3.

--
Added file: http://bugs.python.org/file28471/py3k-20121227-MINGW.patch

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Charles-François Natali

Charles-François Natali added the comment:

 memoryview is also great to avoid copies when sending/receiving to a socket.

 That's interesting. How exactly? Would producer_fifo have to change from a 
 deque() to a memoryview() object? In that case we might have to take backward 
 compatibility into account (producer_fifo already changed in 2.6 and if I'm 
 not mistaken that might have caused some problems).
 Maybe it makes sense to file a separate issue to address asynchat 
 enhancements.

Probably.
For an example of how it might be used, you can have a look here:
http://stackoverflow.com/questions/6736771/buffers-and-memoryview-objects-explained-for-the-non-c-programmer
and here:
http://eli.thegreenplace.net/2011/11/28/less-copies-in-python-with-the-buffer-protocol-and-memoryviews/

Also, IIRC, Antoine used memoryviews when rewriting parts of
multiprocessing in pure Python.

--

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



[issue16784] Int tests enhancement and refactoring

2012-12-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Another task: backport the tests for current behavior added under issue 16772 
(e.g. test_int_base_limits() tests).

--

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



[issue16787] asyncore.dispatcher_with_send - increase the send buffer size

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Would producer_fifo have to change from a deque() to a memoryview()
 object?

A memoryview is not a container, it's a view over an existing container.

 In that case we might have to take backward compatibility into account 
 (producer_fifo already changed in 2.6 and if I'm not mistaken that
 might have caused some problems).

Does asyncore expose its implementation details?

--

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



[issue16793] Get rid of deprecated assertEquals etc in tests

2012-12-28 Thread Georg Brandl

Georg Brandl added the comment:

That makes it more of a fix, true.

--

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



[issue16749] Fatal Python error: PyEval_RestoreThread: NULL tstate

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Antoine: do you know anything about this message?
Fatal Python error: PyEval_RestoreThread: NULL tstate
Is there a serious possibility that it could indicate a CPython error, as 
opposed to an extension author error? Could running Windows on Mac hardware 
make a difference?

Leonardo: You should have quoted the full error message instead of making each 
person search the image.

Also, Please don't quote entire messages in your replies (which means deleting 
them if replying with a mail program). They are already visible above your 
reply and constitute noise that makes scrolling in the web interface more 
tedious.

We will likely close this, at least for now, because there is currently no 
basis for action on our part.

1. From years of experience with such reports, we can be fairly certain that 
the problem is with the third party extension code. It is known that such code 
can crash CPython if it misuses the C API. We cannot prevent that without 
adding unacceptible overhead.

2. If there is a bug in CPython, then to do anything, we would need either 
Python code or proper C code that causes the crash. The latter would likely 
require cooperation of the Solidoodle extension authors.
 
For us to do anything, we need evidence in the form of (minimal) code we can 
run that there is a CPython bug.

Retrying under OS X is a good idea.

You could try testing the windows python installation with the test suite 
(python -m test.regrtest in a command window) but there are two problems when 
doing this with a user installation, as opposed to the test buildbots: there 
will be (expected) error boxes that you have to dismiss by hitting enter; and 
there will be a few reported errors that are not really errors in python itself.

--
nosy: +pitrou, terry.reedy
title: Fatal Python Error - Fatal Python error: PyEval_RestoreThread: NULL 
tstate
versions: +Python 2.7

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



[issue16749] Fatal Python error: PyEval_RestoreThread: NULL tstate

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, the error message comes from a misuse of the PyEval_RestoreThread() (by 
passing it a NULL argument), either directly or by using another API such as 
Py_END_ALLOW_THREADS which calls that function. The problem is likely to be in 
the Solidoodle extension. Whatever the source of the problem, though, only a 
low-level C traceback would allow to tell.

I agree with closing, stock Python is very unlikely to produce such tracebacks.

--
status: open - pending

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



[issue16778] Logger.findCaller needs to be smarter

2012-12-28 Thread Vinay Sajip

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


--
hgrepos: +166

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



[issue16778] Logger.findCaller needs to be smarter

2012-12-28 Thread Vinay Sajip

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


--
keywords: +patch
Added file: http://bugs.python.org/file28472/8756372f0f5f.diff

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



[issue16784] Int tests enhancement and refactoring

2012-12-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Improvement of int/long tests should also be reflected in the Tests section of 
Misc/NEWS.  An entry wasn't added in issue 16045.  For linking purposes, this 
issue number would probably be the best to use for such an entry.

--

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



[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This is at most a further doc clarification issue as the code is working as 
documented. In a previous issue, I added the following sentence to all current 
versions to try to clarify this type of behavior:  If exec gets two separate 
objects as globals and locals, the code will be executed as if it were embedded 
in a class definition. (This follows  Remember that at module level, globals 
and locals are the same dictionary) Let's try it:

class Dummy:
from ctypes import wintypes
print(wintypes.LONG)

class LOGFONT(object):
 field = wintypes.LONG

class 'ctypes.c_long'
Traceback (most recent call last):
...
  File F:\Python\mypy\tem.py, line 6, in LOGFONT
field = wintypes.LONG
NameError: name 'wintypes' is not defined

Bingo! Anatoly's result is just as documented.

The doc later says modifications to the default locals dictionary should not 
be attempted. Anatoly's result is an example of why not.

Lets distill the situation:

1. The globals dict and locals mapping passed to exec are either the same 
object or different objects. This relation determines the execution behavior.

2. If they are the same object, the code is executed as if at module scope. 
They are the same if exec is called with both defaults at module scope, where 
globals() is locals(), or if they are explicitly made the same (globals = 
locals(), locals = globals(), or globals=dic, locals=dic).

3. If they are different objects, the code is executed as if embedded in a 
(dummy) class definition. They are different if exec is called with both 
defaults within a class or function scope*, where globals() is not locals(), or 
if explicit settings leave them different (globals = dic where dic is not 
locals(), locals=map, where map is not globals, or globals=dic, locals=map, 
where dic is not map).

I believe this nails the situation#.

* In 2.x, comprehensions do not create a function scope, but in 3.x, they do. 
Lambda expressions always do. This is why I did not write 'within a class or 
function definition', as some might not see that as including comprehensions.

# The new last sentence of the second paragraph, quoted above, contradicts the 
older first sentence: In all cases, if the optional parts are omitted, the 
code is executed in the current scope. Before 2.2, when the 'current scope' of 
a function was limited to global and local namespaces, that sentence was true. 
Indeed, it summarized points 1,2,3 above. I believe that it is not true now, 
and should be revised, as nonlocal namespaces cannot be seen by exec'ed code. I 
believe I checked that before adding the new sentence, but I would recheck 
before revising. I am thinking about how to perhaps rewrite the paragraph.

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, terry.reedy
stage:  - needs patch

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



[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive

2012-12-28 Thread Tshepang Lekhonkhobe

New submission from Tshepang Lekhonkhobe:

I am running Debian 7, which has sphinx is1.1.3+dfsg-4.

When I run

$ python tools/sphinx-build.py -bhtml . build/

I get a whole bunch of errors:

Making output directory...
Running Sphinx v1.1.3
loading pickled environment... not yet created
building [html]: targets for 435 source files that are out of date
updating environment: 435 added, 0 changed, 0 removed
reading sources... [100%] whatsnew/index


/home/wena/src/python/cpython/Doc/c-api/arg.rst:47: ERROR: Error in note 
directive:
invalid option block.

.. note::
   For all ``#`` variants of formats (``s#``, ``y#``, etc.), the type of
   the length argument (int or :c:type:`Py_ssize_t`) is controlled by
   defining the macro :c:macro:`PY_SSIZE_T_CLEAN` before including
   :file:`Python.h`.  If the macro was defined, length is a
   :c:type:`Py_ssize_t` rather than an :c:type:`int`. This behavior will change
   in a future Python version to only support :c:type:`Py_ssize_t` and
   drop :c:type:`int` support. It is best to always define 
:c:macro:`PY_SSIZE_T_CLEAN`.
/home/wena/src/python/cpython/Doc/c-api/init.rst:547: ERROR: Error in note 
directive:
invalid option block.

.. note::
   When only the main thread exists, no GIL operations are needed. This is a
   common situation (most Python programs do not use threads), and the lock
   operations slow the interpreter down a bit. Therefore, the lock is not
   created initially.  This situation is equivalent to having acquired the lock:
   when there is only a single thread, all object accesses are safe.  Therefore,
   when this function initializes the global interpreter lock, it also acquires
   it.  Before the Python :mod:`_thread` module creates a new thread, knowing
   that either it has the lock or the lock hasn't been created yet, it calls
   :c:func:`PyEval_InitThreads`.  When this call returns, it is guaranteed that
   the lock has been created and that the calling thread has acquired it.

   It is **not** safe to call this function when it is unknown which thread (if
   any) currently has the global interpreter lock.

   This function is not available when thread support is disabled at compile 
time.
/home/wena/src/python/cpython/Doc/faq/library.rst:513: ERROR: Error in note 
directive:
invalid option block.

.. note::
   To read and write binary data, it is mandatory to open the file in
   binary mode (here, passing ``rb`` to :func:`open`).  If you use
   ``r`` instead (the default), the file will be open in text mode
   and ``f.read()`` will return :class:`str` objects rather than
   :class:`bytes` objects.
/home/wena/src/python/cpython/Doc/library/fractions.rst:93: ERROR: Error in 
note directive:
invalid option block.

.. note:: From Python 3.2 onwards, you can also construct a
   :class:`Fraction` instance directly from a :class:`float`.
/home/wena/src/python/cpython/Doc/library/fractions.rst:102: ERROR: Error in 
note directive:
invalid option block.

.. note:: From Python 3.2 onwards, you can also construct a
   :class:`Fraction` instance directly from a :class:`decimal.Decimal`
   instance.
/home/wena/src/python/cpython/Doc/library/getopt.rst:12: ERROR: Error in note 
directive:
invalid option block.

.. note::
   The :mod:`getopt` module is a parser for command line options whose API is
   designed to be familiar to users of the C :c:func:`getopt` function. Users 
who
   are unfamiliar with the C :c:func:`getopt` function or who would like to 
write
   less code and get better help and error messages should consider using the
   :mod:`argparse` module instead.
/home/wena/src/python/cpython/Doc/library/io.rst:678: ERROR: Error in warning 
directive:
invalid option block.

.. warning::
   :class:`BufferedRWPair` does not attempt to synchronize accesses to
   its underlying raw streams.  You should not pass it the same object
   as reader and writer; use :class:`BufferedRandom` instead.
/home/wena/src/python/cpython/Doc/library/logging.config.rst:144: ERROR: Error 
in note directive:
invalid option block.

.. note:: Because portions of the configuration are passed through
   :func:`eval`, use of this function may open its users to a security risk.
   While the function only binds to a socket on ``localhost``, and so does
   not accept connections from remote machines, there are scenarios where
   untrusted code could be run under the account of the process which calls
   :func:`listen`. Specifically, if the process calling :func:`listen` runs
   on a multi-user machine where users cannot trust each other, then a
   malicious user could arrange to run essentially arbitrary code in a
   victim user's process, simply by connecting to the victim's
   :func:`listen` socket and sending a configuration which runs whatever
   code the attacker wants to have executed in the victim's process. This is
   especially easy to do 

[issue16806] col_offset is -1 for multiline string expressions resembling docstrings

2012-12-28 Thread Carsten Klein

New submission from Carsten Klein:

Given an input module such as

class klass(object):
multi line comment
continued on this line


single line comment


Another multi
line
comment


and implementing a custom ast.NodeVisitor such as


import as

class CustomVisitor(ast.NodeVisitor):

def visit_ClassDef(self, node):

for childNode in node.body:

self.visit(childNode)

def visit_Expr(self, node):

print(node.col_offset)
print(node.value.col_offset)


and feeding it the compiled ast from the module above


f = open('./module.py')
source = f.read()
node = ast.parse(source, mode = 'exec')
visitor = CustomVisitor()
visitor.visit(node)


should yield -1/-1 for the docstring that is the first
child node expression of the classdef body.

it will, however, yield the correct col_offset of 4/4 for
the single line docstring following the first one.

the multi line docstring following that will again
yield a -1/-1 col_offset.



It believe that this behaviour is not correct and instead
the col_offset should be 4 for both the expression node
and its str value.

--
components: Interpreter Core
messages: 178444
nosy: carsten.kl...@axn-software.de
priority: normal
severity: normal
status: open
title: col_offset is -1 for multiline string expressions resembling docstrings
type: enhancement
versions: Python 3.4

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



[issue16806] col_offset is -1 for multiline string expressions resembling docstrings

2012-12-28 Thread Carsten Klein

Carsten Klein added the comment:

Please note that, regardless of the indent level, the col_offset for multi line 
str expressions will always be -1.

--

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



[issue16749] Fatal Python error: PyEval_RestoreThread: NULL tstate

2012-12-28 Thread Leonardo DaVinci

Leonardo DaVinci added the comment:

Terry,

I've tried installing on Mac at least 6 times and I still get error
messages. I'm dealing with Solidoodle with no success.

I have an appointment with a 3d Print Lab on Jan 3rd (50 miles away) to
help me resolve my issues.

Regards
Ciro

On Fri, Dec 28, 2012 at 5:07 PM, Terry J. Reedy rep...@bugs.python.orgwrote:


 Terry J. Reedy added the comment:

 Antoine: do you know anything about this message?
 Fatal Python error: PyEval_RestoreThread: NULL tstate
 Is there a serious possibility that it could indicate a CPython error, as
 opposed to an extension author error? Could running Windows on Mac hardware
 make a difference?

 Leonardo: You should have quoted the full error message instead of making
 each person search the image.

 Also, Please don't quote entire messages in your replies (which means
 deleting them if replying with a mail program). They are already visible
 above your reply and constitute noise that makes scrolling in the web
 interface more tedious.

 We will likely close this, at least for now, because there is currently no
 basis for action on our part.

 1. From years of experience with such reports, we can be fairly certain
 that the problem is with the third party extension code. It is known that
 such code can crash CPython if it misuses the C API. We cannot prevent that
 without adding unacceptible overhead.

 2. If there is a bug in CPython, then to do anything, we would need either
 Python code or proper C code that causes the crash. The latter would likely
 require cooperation of the Solidoodle extension authors.

 For us to do anything, we need evidence in the form of (minimal) code we
 can run that there is a CPython bug.

 Retrying under OS X is a good idea.

 You could try testing the windows python installation with the test suite
 (python -m test.regrtest in a command window) but there are two problems
 when doing this with a user installation, as opposed to the test buildbots:
 there will be (expected) error boxes that you have to dismiss by hitting
 enter; and there will be a few reported errors that are not really errors
 in python itself.

 --
 nosy: +pitrou, terry.reedy
 title: Fatal Python Error - Fatal Python error: PyEval_RestoreThread:
 NULL tstate
 versions: +Python 2.7

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


--
status: pending - open

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



[issue16749] Fatal Python error: PyEval_RestoreThread: NULL tstate

2012-12-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 I've tried installing on Mac at least 6 times and I still get error
 messages. I'm dealing with Solidoodle with no success.
 
 I have an appointment with a 3d Print Lab on Jan 3rd (50 miles away) to
 help me resolve my issues.

Ciro, it seems you should wait a bit for Solidoodle's answer if you
asked them a question. I don't know about them, but if they're a
volunteer-run project you can't expect them to answer all requests very
quickly.

--

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



[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive

2012-12-28 Thread Sandro Tosi

Sandro Tosi added the comment:

Hello Tshepang,
the documentation is not compatible with Sphinx versions different than the one 
the Makefile will download (in this case it's 1.0.7 for all active branches). 
I'd suggest to build the doc with just

$ make -C Doc html

and it will fetch the needed modules (at the correct version) and build the 
html version of the documentation in Doc/build/html/.

I'm inclined to close this issue as invalid, but I'd like to hear from your 
first.

Regards,
Sandro

--
nosy: +sandro.tosi

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



[issue1062277] Pickle breakage with reduction of recursive structures

2012-12-28 Thread Eugene Toder

Eugene Toder added the comment:

To recap, the issue is that pickle doesn't handle recursion via reduce 
arguments (i.e. arguments to the constructor function as returned in 2nd 
element of the tuple from __reduce__). This leads to 2 kind of effects:

class C:
def __init__(self, x=None):
self.x = x if x is not None else self
def __reduce__(self):
return C, (self.x,)

A. Recursion error:
 pickle.dumps(C())
Traceback (most recent call last):
  File pyshell#5, line 1, in module
pickle.dumps(C())
RuntimeError: maximum recursion depth exceeded while calling a Python object

This cannot be helped with the current reduce protocol. The error may be 
improved, but that's about it.

B. Duplication of object when unpickling:
 c = C([])
 c.x.append(c)
 c.x[0] is c
True
 c2 = pickle.loads(pickle.dumps(c))
 c2.x[0] is c2
False

This happens because list (or another recursion-friendly type) inside the 
problematic object handles recursion, but we still get the outer object, 
identical to the inner one.
This can be solved the same way as for tuple:
 t=([],1,2)
 t[0].append(t)
 t2 = pickle.loads(pickle.dumps(t))
 t2[0][0] is t2
True
 pickletools.dis(pickle.dumps(t))
0: \x80 PROTO  3
2: ]EMPTY_LIST
3: qBINPUT 0
5: hBINGET 0
7: KBININT11
9: KBININT12
   11: \x87 TUPLE3
   12: qBINPUT 1
   14: aAPPEND
   15: KBININT11
   17: KBININT12
   19: 0POP
   20: 0POP
   21: 0POP
   22: hBINGET 1
   24: .STOP

After pickling its elements tuple checks if it got into memo. If it did, this 
means it was pickled by one of the elements, so it POPs all elements from the 
stack and fetches itself via GET. This is somewhat inefficient, but probably 
the best it can do.

I suggest we do 3 things:

1. Improve the documentation for __reduce__ function. It should mention that 
all state that a) can potentially point back to the object and b) not strictly 
necessary in the constructor function should be passed via the 3rd element of 
__reduce__ tuple (aka state) instead of the 2nd element, and applied by 
__setstate__. This handles recursion in robust and optimal way.

2. Check that all built-in/standard types follow this advice. I see that Stefan 
Mihaila already fixed sets.

3. To fix case B above add the memo check from save_tuple to save_reduce. While 
at it, we can consider checking after pickling every element instead of after 
pickling all elements, so we reduce the number of POPs and the wastage they 
cause.

--
nosy: +eltoder, pitrou

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



[issue1062277] Pickle breakage with reduction of recursive structures

2012-12-28 Thread Eugene Toder

Changes by Eugene Toder elto...@gmail.com:


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

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



[issue16758] SubprocessStartupError

2012-12-28 Thread Andrew Svetlov

Andrew Svetlov added the comment:

I guess it is actually firewall.

--
nosy: +asvetlov
type: performance - behavior

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



[issue16783] sqlite3 accepts strings it cannot (by default) return

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Opening a duplicate issue to rant against the developers is not responsible 
behavior. Since you do not seem to understand Martin's 2.x solution, ask for 
help on python-list or elsewhere (and read below). The proper fix for multiple 
Unicode and text coding problems was and is to use Unicode for text, as we did 
and do in 3.x.

Note that while we link to sqlite3 with a Python interface, and choose that as 
the database to link to in the stdlib, we do not control sqlite3 itself. As 
documented and as Martin wrote, sqlite *assumes*, by default, that byte-encoded 
text handed to it is error-free utf-8 encoded. However, docs and Martin both 
say that you can override that assumption by replacing its text_factory. Sqlite 
should not reject *any* bytes because anything *could* be just what the use 
intended.

The problem of multiple byte encodings for text and of encoding info getting 
separated from encoded bytes is a general one. We constantly get questions on 
python-list like how do I determine the real encoding of a web page if the 
encoding information is missing or wrong. We are doing our part to solve it by 
using unicode for text and pushing utf-8 as the one, true encoding that 
everyone should use whenever possible.

If you need more explanation, try python-list, as I said before.

--
nosy: +terry.reedy
resolution:  - duplicate
status: open - closed
title: sqlite3 accepts strings it cannot return - sqlite3 accepts strings it 
cannot (by default) return

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



[issue16806] col_offset is -1 for multiline string expressions resembling docstrings

2012-12-28 Thread Carsten Klein

Carsten Klein added the comment:

In addition, the reported lineno will be set to the last line of the multi line 
string instead of the first line where parsing the parse began parsing the 
string.

--

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



[issue16798] DTD not checked

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

You should ask for usage tips on python-list or other forums.
2.6 and 3.1 only get security fixes.
2.7 and 3.2,3.3 only get bug fixes.
This looks like a request for a new feature (assuming that it is not available 
now).
I am not familiar with the modules, but I expect that the request is out of 
scope for minidom. xml.dom.minidom is a light-weight implementation of the 
Document Object Model interface. It is intended to be simpler than the full DOM 
and also significantly smaller.

Eli, is etree open to new features and might the request be a sensible 
addition, or should this issue be closed?

--
nosy: +eli.bendersky, terry.reedy
type: behavior - enhancement
versions: +Python 3.4 -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 
3.3

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



[issue16783] sqlite3 accepts strings it cannot (by default) return

2012-12-28 Thread William D. Colburn

William D. Colburn added the comment:

I'm ranting against an improper bug closure and bad behavior from the
python sqlite3.  Treating invalid data as sometimes valid and sometime
as invalid is a problem.  Problems with a Python module are not
anuser-error, they are an implementation error.  Users should never
have to work around bugs in Python.

I'm saddened by your poor response to this issue.

On Fri, Dec 28, 2012 at 6:04 PM, Terry J. Reedy rep...@bugs.python.org wrote:

 Terry J. Reedy added the comment:

 Opening a duplicate issue to rant against the developers is not responsible 
 behavior. Since you do not seem to understand Martin's 2.x solution, ask for 
 help on python-list or elsewhere (and read below). The proper fix for 
 multiple Unicode and text coding problems was and is to use Unicode for text, 
 as we did and do in 3.x.

 Note that while we link to sqlite3 with a Python interface, and choose that 
 as the database to link to in the stdlib, we do not control sqlite3 itself. 
 As documented and as Martin wrote, sqlite *assumes*, by default, that 
 byte-encoded text handed to it is error-free utf-8 encoded. However, docs and 
 Martin both say that you can override that assumption by replacing its 
 text_factory. Sqlite should not reject *any* bytes because anything *could* 
 be just what the use intended.

 The problem of multiple byte encodings for text and of encoding info getting 
 separated from encoded bytes is a general one. We constantly get questions on 
 python-list like how do I determine the real encoding of a web page if the 
 encoding information is missing or wrong. We are doing our part to solve it 
 by using unicode for text and pushing utf-8 as the one, true encoding that 
 everyone should use whenever possible.

 If you need more explanation, try python-list, as I said before.

 --
 nosy: +terry.reedy
 resolution:  - duplicate
 status: open - closed
 title: sqlite3 accepts strings it cannot return - sqlite3 accepts strings it 
 cannot (by default) return

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

--

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



[issue16798] DTD not checked

2012-12-28 Thread Javier Domingo

Javier Domingo added the comment:

I am currently using a subprocess with a call to xmllint to make it create a 
temporal file that gets created on execution for xmllint use.

I have seen about lxml, but I wondered if there is any place in the standard 
python to put xml validation

--

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



[issue16781] execfile/exec execution in other than global scope uses locals(), leading to undefined behavior

2012-12-28 Thread R. David Murray

R. David Murray added the comment:

It looks like you are correct Terry.  The problem, I think, is that the 
behavior of name spaces inside a class definition is probably the least 
intuitive aspect of python scoping, so that sentence, while technically 
complete, doesn't provide enough guidance.

--

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



[issue16801] Preserve original representation for integers / floats in docstrings

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

David is correct

 dbm.open.__doc__
Open or create database at path given by *file*.\n\nOptional argument 
*flag* can be 'r' (default) for read-only access, 'w'\nfor read-write 
access of an existing database, 'c' for read-write access\nto a new or 
existing database, and 'n' for read-write access to a new\ndatabase.\n\n
Note: 'r' and 'w' fail if the database doesn't exist; 'c' creates it\nonly 
if it doesn't exist; and 'n' always creates a new database.\n
 help(dbm.open)
Help on function open in module dbm:

open(file, flag='r', mode=438)
Open or create database at path given by *file*.
...

IDLE tooltip (still using inspect.getfullargspec) also shows
open(file, flag='r', mode=438)
The int comes from dbm.open.__defaults__[1]
438

--
nosy: +terry.reedy

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



[issue16805] when building docs on Debian 7 -- ERROR: Error in note directive

2012-12-28 Thread Tshepang Lekhonkhobe

Tshepang Lekhonkhobe added the comment:

It is my preference to be able to build all of CPython with the
already-installed distro packages, instead of pulling in foreign ones.
Any reason why not use later versions? Can't the docs be written such
that they can run on various versions of these tools anyway?

--

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



[issue16807] argparse group nesting lost on inheritance

2012-12-28 Thread Dougal Sutherland

New submission from Dougal Sutherland:

If you wrap a mutually exclusive group inside an argument group in an 
argparse.ArgumentParser, and then use parents= to inherit from that parser, the 
non-exclusive argument group is forgotten in the help output, and the arguments 
move to the default optional arguments section. For example:

# construct the parser with a mutually exclusive group
 import argparse
 parent = argparse.ArgumentParser(add_help=False)
 group = parent.add_argument_group('the group')
 group.add_argument('--foo') and None
 mutex = group.add_mutually_exclusive_group()
 mutex.add_argument('-a', action='store_true') and None
 mutex.add_argument('-b', action='store_true') and None
 parent.print_help()
usage: [--foo FOO] [-a | -b]

the group:
  --foo FOO
  -a
  -b

# now try to inherit from it; the group is forgotten for
# mutex arguments, but remains for others
 argparse.ArgumentParser(add_help=False, parents=[parent]).print_help()
usage: [--foo FOO] [-a | -b]

optional arguments:
  -a
  -b

the group:
  --foo FOO

I see the same behavior on 2.7.3 and 3.3.0.

The problem is that 
[`argparse._ActionsContainer._add_container_actions`](http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Lib/argparse.py#l1331)
 always adds mutex groups to the top level, rather than to the equivalent of 
their `_container` attribute. The attached patch fixes this, and adds a test 
based on the formatted output (almost identical to the `test_groups_parents` 
test).

One thing about the patch: it assumes that the `_container` attribute of all 
the mutex groups will be either the `container` argument to 
`_add_container_actions` or an argument group that has been processed in 
`group_map`. If this is not the case, it'll fail with either an 
`AttributeError` or a `KeyError`. I don't know when this would happen, or if 
it's common enough that it's worth checking for more explicitly.

--
components: Library (Lib)
files: argparse_mutex_parent.patch
keywords: patch
messages: 178459
nosy: Dougal.Sutherland, bethard
priority: normal
severity: normal
status: open
title: argparse group nesting lost on inheritance
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file28473/argparse_mutex_parent.patch

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



[issue16772] int() accepts float number base

2012-12-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

To me the doc strongly implies, but does not boldly and baldly say, that base 
should be an int.

A base-n literal consists of the digits 0 to n-1, with a to z (or A to Z) 
having values 10 to 35. The default base is 10. The allowed values are 0 and 
2-36. Base-2, -8, and -16 literals can be optionally prefixed with 0b/0B, 
0o/0O, or 0x/0X, as with integer literals in code. Base 0 means to interpret 
exactly as a code literal, so that the actual base is 2, 8, 10, or 16, and so 
that int('010', 0) is not legal, while int('010') is, as well as int('010', 8).

I think it should be revised to say The allowed values are ints 0 and 2-36. 
(or 'integers' or 'index values'). If it had been that already, the current 
behavior would clearly be a bug and eligible to be fixed in 3.2/3. As it is, I 
will not argue with whatever others do.

(I strongly suspect there are other places in the docs where int args are 
similarly implied but not explicit, but int-ness *is* checked. If someone were 
to complain about 0.0 being rejected, I expect we would correct the doc, not 
the code.;-)

--
nosy: +terry.reedy

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



[issue16799] switch regrtest from getopt options to argparse Namespace

2012-12-28 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Here is a patch to start using a Namespace object.

I also noticed that the usage() function I removed in 6e2e5adc0400 is still 
used elsewhere in regrtest.main(), so this patch also fixes that.

--
keywords: +patch
Added file: http://bugs.python.org/file28474/issue-16799-1.diff

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



  1   2   >