[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-16 Thread Senthil Kumaran

Senthil Kumaran added the comment:

@Ezio, regarding msg172988. That's embarrassing. It should be fixed soon.

Review on the patch, how about having the strerror and filename from the 
exception?

-raise URLError(e.errno, e.strerror, e.filename)
+raise URLError(e.strerror, e.filename)

I believe, that could have been the original intention which got overlooked.

And yes to fixing the other URLError msg related issues too, with just changing 
to single msg first, instead of wrongly sending the filename.

--
assignee: orsenthil -> 

___
Python tracker 

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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-16 Thread Ned Deily

Ned Deily added the comment:

I'm still not keen on working around a Tk crash by modifying IDLE especially 
when we know exactly which Tk change set caused the regression.  On the other 
hand, I sympathize with Kevin regarding the complexity of trying to track down 
and fix things involving event loops spanning Cocoa, Tk, Python, and IDLE and I 
do appreciate the effort you've put into debugging this and other Tk problems.  
Thank you, Kevin.

So, if we're going to take the expedient approach, we need to come up with 
proper patches for 2.7, 3.2, 3.3, and default and then we need to test them for 
regressions with our other major supported platforms: Windows, some set of X11, 
OS X Carbon Tk 8.4, as well as the Cocoa Tk 8.5.  I can test the latter two.  
I'd appreciate it if others could test the other platforms.  Roger, do you feel 
up to turning your suggestions into patches?  Once we're comfortable that the 
workaround works and doesn't cause other regressions, I can bug the ActiveState 
folks to push out a new release of ActiveTcl with fixes for some other problems 
and these fixes can go out in the next set of Python maintenance releases that 
should be coming up in the near future.

--
stage:  -> needs patch
versions: +Python 3.4

___
Python tracker 

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



[issue16256] permissions wrong on Mac doc dir

2012-10-16 Thread Ned Deily

Changes by Ned Deily :


--
assignee: ronaldoussoren -> ned.deily
nosy: +ned.deily

___
Python tracker 

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



[issue16160] subclassing types.SimpleNamespace does not work

2012-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c5124145e79e by Eric Snow in branch '3.3':
Close #16160: Subclass support now works for types.SimpleNamespace.  Thanks to 
RDM for noticing.
http://hg.python.org/cpython/rev/c5124145e79e

New changeset 47b9732696eb by Eric Snow in branch 'default':
merge for issue #16160: Subclass support now works for types.SimpleNamespace.
http://hg.python.org/cpython/rev/47b9732696eb

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

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Trent Nelson

Trent Nelson added the comment:

Oh, and another "quirk" I noticed yesterday.  I usually religiously disable 
atime on all my filesystems.  For whatever reason, it's not disabled on this 
Solaris 10 box.

Turns out os.stat() was updating st_atime, which kind of throws a spanner in 
the works for all our st_atime tests in _test_utime() -- we call os.stat() 
after utime() to check that our atime update worked -- but the stat call 
results in another st_atime update.

--

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Trent Nelson

Trent Nelson added the comment:

Thanks for the feedback Larry; yeah that patch definitely wasn't intended to be 
"production quality" -- more of a proof of concept.  I agree with your points, 
they'll be factored into the next patch.

However, I'm absolutely baffled by the Solaris 10 failure.  The more I looked 
into it, the weirder it got.  The issue is always the same:

self.assertEqual(attr(st0, "st_mtime"), attr(st1, "st_mtime"))
AssertionError: 1347752941.275297 != 1347752941.275296

That is, test_utime() always results in a st1.st_mtime that is "off-by-1" from 
st0.st_mtime.  The precision is well within the nanasecond resolution offered 
by utimensat, so it doesn't appear to be the same issue experienced by other 
platforms.

I'll have to break into the debugger again and see what's going on.

Side note: I noticed this comment/code just above _test_utime():

def test_utime_dir(self):
delta = 100
st = os.stat(support.TESTFN)
# round to int, because some systems may support sub-second
# time stamps in stat, but not in utime.
os.utime(support.TESTFN, (st.st_atime, int(st.st_mtime-delta)))
st2 = os.stat(support.TESTFN)
self.assertEqual(st2.st_mtime, int(st.st_mtime-delta))

That... seems to (albeit vaguely) describe what's going on here with Solaris 
10.  I also noticed support.TESTFN is actually a directory in this test case.  
Again, I'm not sure how that fits in with test_utime_dir() versus a second 
invocation of _test_utime(support.TESTFN) from test_utime().

test_utime_dir() is ultra-lax, test_utime() is ultra-strict, I'm not sure which 
one should be updated to match the other.

--

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Larry Hastings

Larry Hastings added the comment:

You're a sneaky, naughty bunny.  "posix._have_functions" indeed!  I guess your 
back was to the wall.

1)
If I follow your code correctly, when one has utimensat, the assertLess calls 
using _t consider st0.st_mtime_ns < st1.st_mtime_ns even if the left operand is 
(2e18-1) greater than the right.  It divides both operands by 1e9, then checks 
whether their delta is < 2e9.  In nanoseconds, 2e18-1 is roughly 63.5 years.  
The case where one doesn't have utimensat but do have utimens is similarly 
generous.  Little wonder the test now passes!  Could you narrow down the range 
a little?

2)
I'd prefer if you amended the comment rather than remove it, perhaps adding

# (assuming your read and write functions both take the same units,
# which isn't true on all platforms--some Solaris and FreeBSD versions
# can read ns time but can only write ms time)

3)
Could you please find better names than "_t", "l", and "r"?

4)
In the future, please upload a patch as an attached file rather than as an 
inline comment.  This will permit me to use the bug tracker's built-in  
Reitveld to examine the diff, which is more comfortable and permits inline 
comments.

--

___
Python tracker 

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



[issue12913] Add a debugging howto

2012-10-16 Thread Ramchandra Apte

Ramchandra Apte added the comment:

Right-click to open a menu in which you can set a breakpoint.
I don't think debugging in IDLE needs a tutorial. (except the setting 
breakpoint thing should be documented.

--
nosy: +ramchandra.apte

___
Python tracker 

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



[issue16259] Replace exec() in test.regrtest with __import__

2012-10-16 Thread Eric Snow

Eric Snow added the comment:

Rather, importlib.import_module().  :)

--
nosy: +eric.snow

___
Python tracker 

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



[issue12913] Add a debugging howto

2012-10-16 Thread Todd Rovito

Todd Rovito added the comment:

I think this is an excellent idea.  How about putting in some advanced 
debugging with IDLE?  For example I have read somewhere that IDLE lets you set 
break points but the documentation for IDLE OS not that clear on debugging.

--
nosy: +Todd.Rovito

___
Python tracker 

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



[issue16259] Replace exec() in test.regrtest with __import__

2012-10-16 Thread Ramchandra Apte

New submission from Ramchandra Apte:

In Lib/test/regrtest.py:1336 , exec is used to import an module. I think it 
could be replaced with an __import__ call.

--
components: Library (Lib)
messages: 173126
nosy: ramchandra.apte
priority: normal
severity: normal
status: open
title: Replace exec() in test.regrtest with __import__

___
Python tracker 

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



[issue16257] test_socket.test_create_connection tests for wrong errno on Solaris

2012-10-16 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue16258] test_local.TestEnUSCollection failures on Solaris 10

2012-10-16 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue16248] Security bug in tkinter allows for untrusted code execution.

2012-10-16 Thread Ramchandra Apte

Ramchandra Apte added the comment:

I made many mistakes in the original bug report. Here is a fixed one:

Because Lib/tkinter/__init__.py:1801 uses exec to execute code from a file, it 
has a security bug. It searches for the file in the home dir. Apparently, on my 
system, the $HOME variable is the same as the non-root one when running Python 
with root privileges using sudo.

Steps to reproduce:
create a file called .Tk.py in your home folder
Whatever code is in that file will be executed.

run these three lines of code in Python using sudo:

import tkinter
w = tkinter.Tk()

And the code in the .Tk.py will be executed (unless if you change the baseName 
for the Tk object)
There may be similar ways of running Python with root privileges preserving the 
environment variables in other OS'es
Using Kubuntu Linux (variant of Ubuntu Linux) 12.04

--

___
Python tracker 

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



[issue16258] test_local.TestEnUSCollection failures on Solaris 10

2012-10-16 Thread Trent Nelson

New submission from Trent Nelson:

==
ERROR: test_strxfrm (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File 
"/home/cpython/buildslave/3.x.snakebite-solaris10-u10ga2-sparc64-1/build/Lib/test/test_locale.py",
 line 346, in test_strxfrm
self.assertLess(locale.strxfrm('a'), locale.strxfrm('b'))
ValueError: character U+101010e is not in range [U+; U+10]

==
ERROR: test_strxfrm_with_diacritic (test.test_locale.TestEnUSCollation)
--
Traceback (most recent call last):
  File 
"/home/cpython/buildslave/3.x.snakebite-solaris10-u10ga2-sparc64-1/build/Lib/test/test_locale.py",
 line 367, in test_strxfrm_with_diacritic
self.assertLess(locale.strxfrm('à'), locale.strxfrm('b'))
ValueError: character U+101010e is not in range [U+; U+10]

--

Haven't investigated yet.

--
messages: 173124
nosy: trent
priority: normal
severity: normal
status: open
title: test_local.TestEnUSCollection failures on Solaris 10
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue16257] test_socket.test_create_connection tests for wrong errno on Solaris

2012-10-16 Thread Trent Nelson

New submission from Trent Nelson:

==
FAIL: test_create_connection (test.test_socket.NetworkConnectionNoServer)
--
Traceback (most recent call last):
  File 
"/home/cpython/buildslave/3.x.snakebite-solaris10-u10ga2-sparc64-1/build/Lib/test/test_socket.py",
 line 4112, in test_create_connection
self.assertEqual(cm.exception.errno, errno.ECONNREFUSED)
AssertionError: 128 != 146

>>> errno.errorcode[128]
'ENETUNREACH'

Needs a Solaris-specific exception.

--
messages: 173123
nosy: trent
priority: normal
severity: normal
status: open
title: test_socket.test_create_connection tests for wrong errno on Solaris
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett

Matthew Barnett added the comment:

OK, in order to avoid bikeshedding, "fullmatch" it is.

--

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Guido van Rossum

Guido van Rossum added the comment:

But my other argument stands.

--

___
Python tracker 

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



[issue16251] pickle special methods are looked up on the instance rather than the type

2012-10-16 Thread Eric Snow

Eric Snow added the comment:

> Before any change gets made, it should be discussed on python-dev
> (especially if you intend on backporting the change).

Agreed.

--

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread R. David Murray

R. David Murray added the comment:

Well, posix; but I was wrong about what posix required, as Roumen pointed out.

--

___
Python tracker 

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



[issue16251] pickle special methods are looked up on the instance rather than the type

2012-10-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> It may still break some existing code, though
> (especially for people using proxies).

I agree this is a significant risk.
Before any change gets made, it should
be discussed on python-dev (especially
if you intend on backporting the change).

--
nosy: +rhettinger

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I wouldn't blame android for this; I doubt Android claims to support whatever 
standard you are holding it to.

It seems simple enough for us to make the default configurable (a public module 
level constant that anyone can override in their code after importing the 
module to change the default) or to otherwise query the system for where the 
default shell is at import time.

--

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett

Matthew Barnett added the comment:

re2's FullMatch method contrasts with its PartialMatch method, which re doesn't 
have!

--

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread Chris Jerdonek

Changes by Chris Jerdonek :


--
nosy: +asvetlov, chris.jerdonek

___
Python tracker 

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



[issue16103] sys.stdin.readline 'unsupported' (IDLE 2.7.3, Win7, pythonw)

2012-10-16 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
resolution:  -> duplicate
status: open -> closed
superseder:  -> IDLE and Command line present different behavior for sys.stdin

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread R. David Murray

R. David Murray added the comment:

We should do that, then, if /bin/sh doesn't exist.

--
nosy: +gregory.p.smith
type: crash -> behavior
versions: +Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Guido van Rossum

Guido van Rossum added the comment:

re.matchall() would appear to be related to re.findall(), which it isn't.

The re2 package has a FullMatch method:
http://code.google.com/p/re2/wiki/CplusplusAPI

--

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Tim Peters

Tim Peters added the comment:

I like "matchall" fine, but I can't channel Guido on names - he sometimes gets 
those wrong ;-)

--

___
Python tracker 

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



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

For future reference, this affects 3.2 onwards.  It probably makes sense to 
address this in the same branches in which we plan to address issue 16247 
(currently set to 3.3 onwards).

--
stage:  -> needs patch
versions: +Python 3.3

___
Python tracker 

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



[issue16103] sys.stdin.readline 'unsupported' (IDLE 2.7.3, Win7, pythonw)

2012-10-16 Thread Roger Serwy

Roger Serwy added the comment:

Terry, your idlelib directory is in an inconsistent state. IDLE 2.7.3 works 
well on Arch Linux. I rebuilt it from revision 70274d53c1dd. With and without a 
subprocess, IDLE's sys.stdin.readline works.

Let's close this issue and focus on #9290. It's your decision to close.

--

___
Python tracker 

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



[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett

Matthew Barnett added the comment:

I'm about to add this to my regex implementation and, naturally, I want it to 
have the same name for compatibility.

However, I'm not that keen on "fullmatch" and would prefer "matchall" instead.

What do you think?

--

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread Ben Rousch

Ben Rousch added the comment:

@rpetrov thanks for finding that - I was having trouble hunting down what the 
standard is. I think you're quoting from 
http://pubs.opengroup.org/onlinepubs/009695399/utilities/sh.html

--

___
Python tracker 

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



[issue16256] permissions wrong on Mac doc dir

2012-10-16 Thread Christopher Barker

New submission from Christopher Barker:

I just tried to "pip install ipython" and got:

error: could not create
'/Library/Frameworks/Python.framework/Versions/2.7/share/doc/ipython':
Permission denied

indeed:

$ ls -l /Library/Frameworks/Python.framework/Versions/2.7/share/
total 0
drwxr-xr-x  3 root  admin  102 Oct 11 09:14 doc
drwxrwxr-x  3 root  admin  102 Jun 11  2011 man

which looks like the doc dir should have the same perms as the man dir.

we might want to clen up that tiny nugget in future builds.

--
assignee: ronaldoussoren
components: Installation, Macintosh
messages: 173108
nosy: Chris.Barker, ronaldoussoren
priority: normal
severity: normal
status: open
title: permissions wrong on Mac doc dir
versions: Python 2.7

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread Roumen Petrov

Roumen Petrov added the comment:

...Applications should note that the standard PATH to the shell cannot be 
assumed to be either /bin/sh or /usr/bin/sh, and should be determined by 
interrogation of the PATH returned by getconf PATH , ensuring that the returned 
pathname is an absolute pathname and not a shell built-in

--
nosy: +rpetrov

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley

David Beazley added the comment:

Another note: the PyUnicode_AsUTF8String() doesn't leave the UTF-8 encoded byte 
string behind on the original string object.  I got into this thinking that 
PyUnicode_AsWideCharString() might have similar behavior.

--

___
Python tracker 

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



[issue16194] imp.load_dynamic imports wrong module when called several times on a multi-module .so

2012-10-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

"""To prevent initializing an extension module more than
   once, we keep a static dictionary 'extensions' keyed by module name
   (for built-in modules) or by filename (for dynamically loaded
   modules), containing these modules.
"""
So there can be only one module per filename.
But what if this dictionary was keyed by tuple(name, filename) instead?

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley

David Beazley added the comment:

Maybe it's not a bug, but I still think it's undesirable.   Basically, you have 
a function that allocates a buffer, fills it with data, and allows the buffer 
to be destroyed.   Yet, as a side effect, it allocates a second buffer, fills 
it, and permanently attaches it to the original string object.  Thus it makes 
the size of the string object blow up to a size substantially larger than it 
was before with no way to reclaim memory other than to delete the whole string.

Maybe this is some sort of rare event that doesn't matter, but maybe there's 
some bit of C extension code that is trying to pass a wchar_t array off to some 
external library.  The extension writer is using the 
PyUnicode_AsWideCharString() function with the understanding that it creates a 
new array and that you have to destroy it.   They understand that it's not 
super fast to have to make a copy, but it's better than nothing.  What's 
unfortunate is that all of this attention to memory management doesn't reward 
the programmer as a copy gets left behind on the string object anyways.

For instance, I start with a 10 Megabyte string, I pass it through a C 
extension function, and now the string is mysteriously using 50 Megabytes of 
memory.

I think the idea of filling wstr, returning it and clearing it (if originally 
NULL) would definitely work here.   Actually, that's exactly what I want--don't 
fill in the wstr member if it's not set already.  That way, it's possible for C 
extensions to temporarily get the wstr buffer, do something, and then toss it 
away without affecting the original string.

Another suggestion: An API function to simply clear wstr and the UTF-8 
representation could also work.   Again, this is for extension writers who want 
to pull data out of strings, but don't want to leave these memory side effects 
behind.

--

___
Python tracker 

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



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2012-10-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

>From the macro posted earlier:
  Py##child##ArrType_Type.tp_base = &Py##parent2##ArrType_Type;

tp_base is *not* PyInt_Type, so I was wrong when I said that the dominant base 
was int.
This is wrong IMO: tp_base should be int, for the type to be correctly 
initialized.

Compare:
>>> from numpy import *
>>> print int_.__bases__, int_.__base__
(, ) 
>>> class C(signedinteger, int):
... pass
... 
>>> print C.__bases__, C.__base__
(, ) 

--

___
Python tracker 

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



[issue16238] Automatically remove build directory when build options changed

2012-10-16 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Trent Nelson

Trent Nelson added the comment:

This patch (surprisingly) seems to do the job quite nicely:

diff -r 1280b38fe583 Lib/test/test_os.py
--- a/Lib/test/test_os.py   Tue Oct 16 23:14:03 2012 +1000
+++ b/Lib/test/test_os.py   Tue Oct 16 21:25:36 2012 +
@@ -40,6 +40,20 @@
 or (st.st_mtime != st[8])
 or (st.st_ctime != st[9]))
 
+try:
+import posix
+except ImportError:
+# Windows has nanosecond utime resolution.
+UTIME_EPSILON = 2e-9
+else:
+import sysconfig
+if 'HAVE_UTIMENSAT' in posix._have_functions:
+UTIME_EPSILON = 2e-9
+elif 'HAVE_UTIMES' in sysconfig.get_config_vars():
+UTIME_EPSILON = 2e-6
+else:
+UTIME_EPSILON = 1.0
+
 # Detect whether we're on a Linux system that uses the (now outdated
 # and unmaintained) linuxthreads threading library.  There's an issue
 # when combining linuxthreads with a failed execv call: see
@@ -312,18 +326,32 @@
 st0 = os.stat(filename)
 # Doesn't set anything new, but sets the time tuple way
 utime(filename, (attr(st0, "st_atime"), attr(st0, "st_mtime")))
-# Setting the time to the time you just read, then reading again,
-# should always return exactly the same times.
 st1 = os.stat(filename)
-self.assertEqual(attr(st0, "st_mtime"), attr(st1, "st_mtime"))
-self.assertEqual(attr(st0, "st_atime"), attr(st1, "st_atime"))
+
+def _t(left, right, attr, name):
+l = attr(left, name)
+r = attr(right, name)
+if isinstance(l, int):
+assert isinstance(r, int)
+l = l / 1e9
+r = r / 1e9
+return abs(l - r)
+
+epsilon = UTIME_EPSILON
+self.assertLess(_t(st0, st1, attr, "st_mtime"), epsilon)
+self.assertLess(_t(st0, st1, attr, "st_atime"), epsilon)
+
 # Set to the current time in the old explicit way.
 os.utime(filename, None)
 st2 = os.stat(support.TESTFN)
 # Set to the current time in the new way
 os.utime(filename)
 st3 = os.stat(filename)
-self.assertAlmostEqual(attr(st2, "st_mtime"), attr(st3, "st_mtime"), 
delta=delta)
+self.assertAlmostEqual(
+attr(st2, "st_mtime"),
+attr(st3, "st_mtime"),
+delta=delta
+)
 
 def test_utime(self):
 def utime(file, times):


test_os passes on FreeBSD, Linux and Mac OS X with that applied.  However, the 
Solaris 10/SPARC box still fails:

AssertionError: 9.5367431640625e-07 not less than 2e-09

But it appears that build is actually picking up utimensat(), which makes the 
Solaris failures unrelated to the FreeBSD/NetBSD ones.  I'll do some more 
investigating.  Might warrant a separate issue.

Larry: thoughts on the test_os.patch as is?

--
keywords: +patch
Added file: http://bugs.python.org/file27599/test_os.patch

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +haypo

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread Martin v . Löwis

Martin v. Löwis added the comment:

As stated, this is not a bug: there is no memory leak, nor any deviation from 
documented behavior.

You are right that it fills the wstr pointer, by calling 
PyUnicode_AsUnicodeAndSize in unicode_aswidechar, and then copying the data to 
a fresh buffer.

This is merely the simplest implementation; it's certainly possible to improve 
it. Contributions are welcome.

A number of things need to be considered:
- Computing the wstr size is somewhat expensive if on a 16-bit wchar_t system, 
since the result may need surrogate pairs.
- I would suggest that if possible, the wstr representation should be returned 
out of the unicode object (resetting wstr to NULL). This should produce the 
greatest reuse in code, yet avoid unnecessary copying.
- It's not possible to do so for strings where wstr is shared with the 
canonical representation (i.e. a UCS-2 string on 16-bit wchar_t, and a UCS-4 
string on 32-bit wchar_t).
- I don't think wstr should be cleared if it was already filled when the 
function got called. Instead, wstr should only be returned if it was originally 
NULL.

--
nosy: +loewis

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread R. David Murray

R. David Murray added the comment:

Android really should not be breaking the standards that way.  We do want to 
support Android, but have you submitted a bug report to them?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue15744] missing tests for {RawIO,BufferedIO,TextIO}.writelines

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I've committed a modified version of your patch. Thank you !

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

___
Python tracker 

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



[issue13572] import _curses fails because of UnicodeDecodeError('utf8' codec can't decode byte 0xb5 ...') on ARM Ubuntu 3.x

2012-10-16 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

I cannot reproduce it with Python 3.3 hg head on my ARM buildbot.  _curses 
builds and imports just fine now.

--

___
Python tracker 

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



[issue15744] missing tests for {RawIO,BufferedIO,TextIO}.writelines

2012-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5b062bb56037 by Antoine Pitrou in branch '2.7':
Also add tests for TextIOWrapper.writelines() (issue #15744).
http://hg.python.org/cpython/rev/5b062bb56037

--

___
Python tracker 

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



[issue15853] IDLE crashes selecting Preferences menu with OS X ActiveState Tcl/Tk 8.5.12.1

2012-10-16 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis :


--
nosy: +Arfrever

___
Python tracker 

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



[issue15744] missing tests for {RawIO,BufferedIO,TextIO}.writelines

2012-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4c204a61bd79 by Antoine Pitrou in branch '3.2':
Also add tests for TextIOWrapper.writelines() (issue #15744).
http://hg.python.org/cpython/rev/4c204a61bd79

New changeset 2efcaec45697 by Antoine Pitrou in branch '3.3':
Merge for issue #15744: add tests for the writelines() method of file objects.
http://hg.python.org/cpython/rev/2efcaec45697

New changeset e526d67016f0 by Antoine Pitrou in branch 'default':
Merge for issue #15744: add tests for the writelines() method of file objects.
http://hg.python.org/cpython/rev/e526d67016f0

--
nosy: +python-dev

___
Python tracker 

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



[issue13220] print function unable while multiprocessing.Process is being run

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

*nix has the same difference of behavior between interpreter and IDLE shell.

With issue9290 patch the "function f" line also printed. And then the script 
hangs.

--
nosy: +serhiy.storchaka
versions: +Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Trent Nelson

Trent Nelson added the comment:

There doesn't appear to be on FreeBSD.  Although, on Solaris, -D__EXTENSIONS__ 
opens up access to utimensat() (at least on 11), so I'll factor that into 
configure.ac.

--

___
Python tracker 

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



[issue16255] subrocess.Popen needs /bin/sh but Android only has /system/bin/sh

2012-10-16 Thread Ben Rousch

New submission from Ben Rousch:

The subprocess.Popen function uses /bin/sh in Unix environments. Android is 
detected as a Unix environemnt, but has moved that executable to 
/system/bin/sh. This can be worked around by adding a parameter 
"executable='/system/bin/sh'" to the call, but it is impractical to do this for 
every call to Popen in every library and codebase. For subprocess.Popen to work 
on Android, Popen needs to be able to detect if /bin/sh is not there and try 
/system/bin/sh instead.

--
components: Library (Lib)
messages: 173093
nosy: brousch
priority: normal
severity: normal
status: open
title: subrocess.Popen needs /bin/sh but Android only has /system/bin/sh
type: crash
versions: Python 2.7

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Larry Hastings

Larry Hastings added the comment:

Is there a different utime family function on these platforms that *can* write 
atime/mtime with ns resolution?

--

___
Python tracker 

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



[issue15744] missing tests for {RawIO,BufferedIO,TextIO}.writelines

2012-10-16 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
stage: needs patch -> patch review
versions: +Python 3.4

___
Python tracker 

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



[issue1529353] Squeezer - squeeze large output in the interpreter

2012-10-16 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue16105] Pass read only FD to signal.set_wakeup_fd

2012-10-16 Thread Felipe Cruz

Felipe Cruz added the comment:

I've followed latest suggestions.

Test and code updated.

--
Added file: http://bugs.python.org/file27598/issue16105_v4.patch

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley

David Beazley added the comment:

I should quickly add, is there any way to simply have this function not keep 
the wchar_t buffer around afterwards?   That would be great.

--

___
Python tracker 

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



[issue10909] thread hang, possibly related to print

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is this issue reproduced now, with Python 2.7.3+?

Is this issue reproduced with issue9290 patch?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue16254] PyUnicode_AsWideCharString() increases string size

2012-10-16 Thread David Beazley

New submission from David Beazley:

The PyUnicode_AsWideCharString() function is described as creating a new buffer 
of type wchar_t allocated by PyMem_Alloc() (which must be freed by the user).   
However, if you use this function, it causes the size of the original string 
object to permanently increase.  For example, suppose you had some extension 
code like this:

static PyObject *py_receive_wchar(PyObject *self, PyObject *args) {
  PyObject *obj;
  wchar_t *s;
  Py_ssize_t len;

  if (!PyArg_ParseTuple(args, "U", &obj)) {
return NULL;
  }
  if ((s = PyUnicode_AsWideCharString(obj, &len)) == NULL) {
return NULL;
  }
  /* Do nothing */
  PyMem_Free(s);
  Py_RETURN_NONE;
}

Now, try an experiment (assume that the above extension function is available 
as 'receive_wchar'). 

>>> s = "Hell"*1000
>>> len(s)
4000
>>> import sys
>>> sys.getsizeof(s)
4049
>>> receive_wchar(s)
>>> sys.getsizeof(s)
20053
>>>

It seems that PyUnicode_AsWideCharString() may be filling in the wstr field of 
the associated PyASCIIObject structure from PEP393 (I haven't verified).  Once 
filled, it never seems to be discarded.

Background:  I am trying to figure out how to convert from Unicode to (wchar_t, 
int *) that doesn't cause a permanent increase in the memory footprint of the 
original Unicode object.  Also, I'm trying to stay away from deprecated Unicode 
APIs.

--
components: Extension Modules, Interpreter Core, Unicode
messages: 173089
nosy: dabeaz, ezio.melotti
priority: normal
severity: normal
status: open
title: PyUnicode_AsWideCharString() increases string size
versions: Python 3.3

___
Python tracker 

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-10-16 Thread Trent Nelson

Trent Nelson added the comment:

I've figured out what the primary problem is on these platforms: os.stat() 
returns st_mtime and st_atime values with nanosecond resolution, but without a 
corresponding utimensat(), we can only affect time with microsecond precision 
via utimes().

Therefore, the following logic is faulty:

def _test_utime(self, filename, attr, utime, delta):
# Issue #13327 removed the requirement to pass None as the
# second argument. Check that the previous methods of passing
# a time tuple or None work in addition to no argument.
st0 = os.stat(filename)
# Doesn't set anything new, but sets the time tuple way
utime(filename, (attr(st0, "st_atime"), attr(st0, "st_mtime")))
# Setting the time to the time you just read, then reading again,
# should always return exactly the same times.
st1 = os.stat(filename)
self.assertEqual(attr(st0, "st_mtime"), attr(st1, "st_mtime"))
self.assertEqual(attr(st0, "st_atime"), attr(st1, "st_atime"))

--

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> I couldn't find any doc for bytes.join, etc.

One of the contributing factors to this is that bytes doesn't have its own 
class entry in the same way that, for example, list, dict, and memoryview have.

This creates a stumbling block for readers because they have to know to click 
on the "Bytes and Bytearray Operations" section as opposed to simply clicking 
on the type name as it is done for several other types.

With a class entry, locating where the methods are documented would be quicker 
and more intuitive.

--
nosy: +chris.jerdonek

___
Python tracker 

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



[issue7512] shutil.copystat may fail EOPNOTSUPP

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, thanks.

--
resolution: accepted -> fixed
status: open -> closed

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Unfortunately we have not a unittest framework for IDLE yet. After implementing 
issue15392 I will make tests for these proxies.

--

___
Python tracker 

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



[issue16251] pickle special methods are looked up on the instance rather than the type

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I'm marking this as a bug rather than a feature since it is a deviation 
> from the specification for special methods.

It may still break some existing code, though (especially for people using 
proxies).

--
nosy: +pitrou

___
Python tracker 

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



[issue5223] infinite recursion in PyErr_WriteUnraisable

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, so I would say this whole issue is out of date now, since maintained 
branches don't show the issue.

--
resolution:  -> out of date
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue16253] Docs for PyArg_ParseTupleAndKeywords say it doesn't accept nested tuples

2012-10-16 Thread Roger Upole

New submission from Roger Upole:

The docs for this function state
"Nested tuples cannot be parsed when using keyword arguments!"
but this restriction was removed some time ago.

--
assignee: docs@python
components: Documentation
messages: 173081
nosy: docs@python, rupole
priority: normal
severity: normal
status: open
title: Docs for PyArg_ParseTupleAndKeywords say it doesn't accept nested tuples

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> However check at top of Objects/stringlib/join.h does not protect from using 
> the file with asciilib or ucs1lib.

I'm not sure that's a problem. Someone would have to go out of their way
to use join.h with only UCS1 unicode strings. Also tests would probably
start failing, since str.join doesn't have the right signature :-)

--

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Well done.

However check at top of Objects/stringlib/join.h does not protect from using 
the file with asciilib or ucs1lib.

--

___
Python tracker 

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



[issue16251] pickle special methods are looked up on the instance rather than the type

2012-10-16 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
title: some special methods are looked up on the instance rather than the type 
-> pickle special methods are looked up on the instance rather than the type

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

For the record, in the SSL socket docs, I listed the supported methods 
explicitly (http://docs.python.org/dev/library/ssl.html#ssl-sockets). I think 
it makes things clearer for the reader.

--

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ah, right. I guess a hyperlink to those methods wouldn't hurt, though :)

--

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Ezio Melotti

Ezio Melotti added the comment:

http://docs.python.org/dev/library/stdtypes.html#bytes-and-bytearray-operations

"""
Due to the common use of ASCII text as the basis for binary protocols, bytes 
and bytearray objects provide almost all methods found on text strings, with 
the exceptions of:
"""

The additional methods are documented after that.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Antoine Pitrou

Changes by Antoine Pitrou :


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

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Done now.

--

___
Python tracker 

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



[issue16252] bytes and bytearray methods are undocumented

2012-10-16 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Everything is in the title. I couldn't find any doc for bytes.join, etc. (while 
str methods are documented in library/stdtypes.html#string-methods).

--
assignee: docs@python
components: Documentation
messages: 173074
nosy: docs@python, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: bytes and bytearray methods are undocumented
type: behavior
versions: Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue9290] IDLE and Command line present different behavior for sys.stdin

2012-10-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I agree with the goal. We need an automated test for these proxies.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 16285c1b4dda by Antoine Pitrou in branch 'default':
Issue #15958: bytes.join and bytearray.join now accept arbitrary buffer objects.
http://hg.python.org/cpython/rev/16285c1b4dda

--
nosy: +python-dev

___
Python tracker 

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



[issue16103] sys.stdin.readline 'unsupported' (IDLE 2.7.3, Win7, pythonw)

2012-10-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Roger, you are partially right -- there are changes, but they were intentional. 
I updated the idlelib part of my installation to match the repository on July 9 
to incorporate the _RPCFile wrapping of of the three stdio files, including 
this:

-sys.stdin = self.console = self.get_remote_proxy("stdin")

+sys.stdin = self.console = _RPCFile(self.get_remote_proxy("stdin"))

>>> import sys
>>> sys.stdin


Sorry about forgetting this. Anyway, I presume you remember that issue. It 
seems that there is still a bug either in that update or its interaction with 
other code. What happens in linux with a fresh 2.7 build?

Serhiy's patch for #9290 replaces _RPCXyxFile with PseudoXyzFile subclasses of 
revised PseudoFile. If it works, it should fix this issue also.

--

___
Python tracker 

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



[issue13572] import _curses fails because of UnicodeDecodeError('utf8' codec can't decode byte 0xb5 ...') on ARM Ubuntu 3.x

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are three patches. I think one of them (or any) should fix the issue. The 
question is what solution returns more suitable result for non-ascii key 
names.

--
keywords: +patch
Added file: 
http://bugs.python.org/file27595/curses_getkey_utf8_surrogateescape.patch
Added file: http://bugs.python.org/file27596/curses_getkey_latin1.patch
Added file: http://bugs.python.org/file27597/curses_getkey_locale.patch

___
Python tracker 

___diff -r bd3647e9ac62 Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c   Tue Oct 16 13:52:53 2012 +0300
+++ b/Modules/_cursesmodule.c   Tue Oct 16 21:53:38 2012 +0300
@@ -1144,12 +1144,20 @@
 return Py_BuildValue("C", rtn);
 } else {
 const char *knp;
+size_t size;
 #if defined(__NetBSD__)
 knp = unctrl(rtn);
 #else
 knp = keyname(rtn);
 #endif
-return PyUnicode_FromString((knp == NULL) ? "" : knp);
+if (knp == NULL)
+return PyUnicode_FromStringAndSize(NULL, 0);
+size = strlen(knp);
+if (size > PY_SSIZE_T_MAX) {
+PyErr_SetString(PyExc_OverflowError, "input too long");
+return NULL;
+}
+return PyUnicode_DecodeUTF8Stateful(knp, (Py_ssize_t)size, 
"surrogateescape", NULL);
 }
 }
 
diff -r bd3647e9ac62 Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c   Tue Oct 16 13:52:53 2012 +0300
+++ b/Modules/_cursesmodule.c   Tue Oct 16 21:54:08 2012 +0300
@@ -1144,12 +1144,20 @@
 return Py_BuildValue("C", rtn);
 } else {
 const char *knp;
+size_t size;
 #if defined(__NetBSD__)
 knp = unctrl(rtn);
 #else
 knp = keyname(rtn);
 #endif
-return PyUnicode_FromString((knp == NULL) ? "" : knp);
+if (knp == NULL)
+return PyUnicode_FromStringAndSize(NULL, 0);
+size = strlen(knp);
+if (size > PY_SSIZE_T_MAX) {
+PyErr_SetString(PyExc_OverflowError, "input too long");
+return NULL;
+}
+return PyUnicode_DecodeLatin1(knp, (Py_ssize_t)size, NULL);
 }
 }
 
diff -r bd3647e9ac62 Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c   Tue Oct 16 13:52:53 2012 +0300
+++ b/Modules/_cursesmodule.c   Tue Oct 16 21:54:40 2012 +0300
@@ -1144,12 +1144,20 @@
 return Py_BuildValue("C", rtn);
 } else {
 const char *knp;
+size_t size;
 #if defined(__NetBSD__)
 knp = unctrl(rtn);
 #else
 knp = keyname(rtn);
 #endif
-return PyUnicode_FromString((knp == NULL) ? "" : knp);
+if (knp == NULL)
+return PyUnicode_FromStringAndSize(NULL, 0);
+size = strlen(knp);
+if (size > PY_SSIZE_T_MAX) {
+PyErr_SetString(PyExc_OverflowError, "input too long");
+return NULL;
+}
+return PyUnicode_DecodeLocaleAndSize(knp, (Py_ssize_t)size, NULL);
 }
 }
 
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> I added new comments. :-(

Thanks. I think I will commit after adding the missing #undef :-)

--

___
Python tracker 

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



[issue16251] some special methods are looked up on the instance rather than the type

2012-10-16 Thread Eric Snow

Changes by Eric Snow :


--
title: object.__reduce__() -> some special methods are looked up on the 
instance rather than the type

___
Python tracker 

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



[issue16251] object.__reduce__()

2012-10-16 Thread Benjamin Peterson

Benjamin Peterson added the comment:

pickle and _pickle also look on the instance for __reduce__ and __reduce_ex__.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I added new comments. :-(

--

___
Python tracker 

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



[issue16251] object.__reduce__()

2012-10-16 Thread Eric Snow

New submission from Eric Snow:

In Objects/typeobject.c, reduce_2() makes _PyObject_GetAttrId() calls to pull 
some methods for the object in question.  This is a problem when the object's 
type defines __getattr__() or __getattribute__() and returns something like 
None when the attribute is not found:


from copy import deepcopy

class Spam(dict):
def __getattr__(self, name):
# defaults to None
return self.get(name)

deepcopy(Spam(ham=5))


While we could do a check on the result of _PyObject_GetAttrId() to make sure 
it is callable, the better solution would be to look up the methods on the 
object's type rather than on the object.  Doing so falls in line with the 
specified pattern for special method lookup [1].  I'm guessing there are a few 
other related places in typeobject.c that have the same problem which could be 
fixed in the same way.

I'm marking this as a bug rather than a feature since it is a deviation from 
the specification for special methods.

[1] http://docs.python.org/dev/reference/datamodel.html#special-method-lookup

--
components: Interpreter Core
messages: 173066
nosy: eric.snow
priority: normal
severity: normal
stage: needs patch
status: open
title: object.__reduce__()
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue13572] import _curses fails because of UnicodeDecodeError('utf8' codec can't decode byte 0xb5 ...') on ARM Ubuntu 3.x

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Barry, you can reproduce it? The issue obviously in PyUnicode_FromString() call 
from PyCursesWindow_GetKey(). We can try latin1 encoding, locale encoding or 
utf-8 with surrogateescape error handler.

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue15958] bytes.join() should allow arbitrary buffer objects

2012-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a new patch checking that the sequence size didn't change. I also 
refactored the join() implementation into a shared function in stringlib.

--
Added file: http://bugs.python.org/file27594/bytes_join_buffers3.patch

___
Python tracker 

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



[issue5223] infinite recursion in PyErr_WriteUnraisable

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On 2.7 prints two 42, on 3.x fails (RuntimeError: maximum recursion depth 
exceeded in comparison) on first call. 2.6 out of date for non-security fix.

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2012-10-16 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue2263] struct.pack() + numpy int raises SystemError

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

FYI Py_TPFLAGS_INT_SUBCLASS already not used in Python 3.x.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue5476] datetime: timedelta(minutes = i) silently fails with numpy.int32 input

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It is more than 6 months old with no activity.

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

> raise URLError('local file error: not on local host')

I should also point out that URLError invocations with formats like the above 
already do occur in Lib/urllib/request.py.  For example:

raise URLError('ftp error: no host given')
exc = URLError('ftp error: %s' % msg)
raise URLError("http protocol error: bad status line")

--

___
Python tracker 

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



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ncoghlan

___
Python tracker 

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



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Senthil Kumaran

Changes by Senthil Kumaran :


--
nosy: +orsenthil

___
Python tracker 

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



[issue10836] urllib.request.urlretrieve calls URLError with 3 args

2012-10-16 Thread Chris Jerdonek

Chris Jerdonek added the comment:

For tracking purposes, I created issue 16250 for what you observed above, which 
as you said is related to but not the same as Nick's issue 16247.

--

___
Python tracker 

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



[issue16250] URLError invoked with reason as filename

2012-10-16 Thread Chris Jerdonek

New submission from Chris Jerdonek:

This issue is to fix invocations of URLError so that "reasons" are not passed 
in for the "filename" argument of the URLError constructor.

Ezio found and described this issue when commenting on issue 10836:

  http://bugs.python.org/issue10836#msg172988

In more detail: URLError accepts "reason" and "filename" arguments:

http://hg.python.org/cpython/file/74b95194ba86/Lib/urllib/error.py#l23

However, in several places in Lib/urllib, URLError is invoked with a "reason" 
passed in for the filename.  For example:

raise URLError('local file error', 'not on local host')

This issue could be addressed for this example by changing the above to:

raise URLError('local file error: not on local host')

This dovetails with issue #16247, which is to start passing the actual filename 
in for some calls to URLError (and perhaps to adjust URLError's __str__, etc).

--
components: Library (Lib)
keywords: easy
messages: 173058
nosy: chris.jerdonek, ezio.melotti
priority: normal
severity: normal
status: open
title: URLError invoked with reason as filename
type: enhancement
versions: Python 3.4

___
Python tracker 

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



[issue7512] shutil.copystat may fail EOPNOTSUPP

2012-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Tests added in issue14662. This issue can be closed.

--
nosy: +serhiy.storchaka
status: pending -> open

___
Python tracker 

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



[issue16249] unicode name accepts a punctuation glyph

2012-10-16 Thread Ezio Melotti

Ezio Melotti added the comment:

The characters with the Other_ID_Continue property are also included, i.e.:

00B7  ; Other_ID_Continue # Po   MIDDLE DOT
0387  ; Other_ID_Continue # Po   GREEK ANO TELEIA
1369..1371; Other_ID_Continue # No   [9] ETHIOPIC DIGIT ONE..ETHIOPIC DIGIT 
NINE
19DA  ; Other_ID_Continue # No   NEW TAI LUE THAM DIGIT ONE

See http://unicode.org/Public/UNIDATA/PropList.txt

--
assignee:  -> ezio.melotti
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue16249] unicode name accepts a punctuation glyph

2012-10-16 Thread julien tayon

julien tayon added the comment:

http://www.fileformat.info/info/unicode/char/b7/index.htm

the unicode category is Po (Ponctuation). 

Empirically, it cannot start a variable name so according to the rules given in 
the lexical analyser it should be one of : Mn, Mc, Nd, Pc

Which is not the case Po not in [ Mn, Mc, Nd, Pc ].

Modulo my weak brain, it does not seem right.

--

___
Python tracker 

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



  1   2   >