[issue7826] support caching for 2to3

2010-02-01 Thread Brian Harring

Brian Harring  added the comment:

*Cough*.

Ya, going to blame the bugzie on that one.  right, it's at fault rather than me 
being a complete freaking moron.

Patch attached, hopefully with far less idiocy than I've demonstrated thus 
far

Pardon.

--
Added file: http://bugs.python.org/file16080/2to3-caching.patch

___
Python tracker 

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



[issue7826] support caching for 2to3

2010-02-01 Thread Brian Harring

Brian Harring  added the comment:

Related note, don't be drunk when posting the missing patch- sorry for the 
noise, here is the caching version,, daftly presumed the early patch contained 
lib2to3.caching

Now I'm going to go crawl in a corner, if you need me, I'll be there.
Doubly pardon.

As for the algo, sha1 might be wiser- as said, integrating fix/nofix is 
definitely needed, let alone writing tests.  This is more a proof of concept I 
was using for speed reasons- assuming folk are game, I'm game to write the 
tests for it.

--
Added file: http://bugs.python.org/file16081/2to3-caching.patch

___
Python tracker 

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



[issue7826] support caching for 2to3

2010-02-01 Thread Brian Harring

Changes by Brian Harring :


Removed file: http://bugs.python.org/file16078/2to3-caching.patch

___
Python tracker 

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



[issue7826] support caching for 2to3

2010-02-01 Thread Brian Harring

Changes by Brian Harring :


Removed file: http://bugs.python.org/file16080/2to3-caching.patch

___
Python tracker 

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



[issue7826] support caching for 2to3

2010-02-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

Please submit a contributor agreement, see http://www.python.org/psf/contrib/

I'm still not clear on what the specific use case is: how *exactly* are you 
going to run 2to3 when you have that patch integrated? In particular, where do 
you put the output (3.x) files? I'd rather recommend to create a --outdir 
option (assuming that would also fit your needs).

I'm -0 on using hashing. The whole point of this caching is speed, so wasting 
time in recomputing hash codes is, well, wasted.

If you do think you need hashing, please read the source file in binary, rather 
than first decoding and then encoding it.

Don't use print(). If you must output progress, use the same approach as the 
rest of 2to3 (i.e. logging).

--

___
Python tracker 

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



[issue7030] Update version{added, changed} entries in py3k unittest docs

2010-02-01 Thread Ezio Melotti

Ezio Melotti  added the comment:

The versionadded/changed have been fixed in r77788.
The doc for assertSameElements should also clarify that repeated elements are 
ignored.

--

___
Python tracker 

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



[issue7030] Update version{added, changed} entries in py3k unittest docs

2010-02-01 Thread Ezio Melotti

Ezio Melotti  added the comment:

s/r77788/r77888/

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Antoine Pitrou wrote:
> 
> Antoine Pitrou  added the comment:
> 
>> I find that the null termination for 8-bit strings makes low-level
>> parsing operations (e.g., parsing a numeric string) safer and easier:
> 
> Not to mention faster. The new IO library makes use of it (for newline
> detection), on both bytestrings and unicode strings.

I'd consider that a bug. Esp. the IO lib should be 8-bit clean
in the sense that it doesn't add any special meaning to NUL
characters or code points.

Besides, using a for-loop with a counter is both safer and faster
than checking each an every character for NUL.

Just think of what can happen if you have buggy code that overwrites
the NUL byte in some corner case situation and then use the assumption
of having the NUL byte as terminator - a classical buffer overrun.

If you're lucky, you get a segfault. If not, you end up with
data corruption or manipulation of data which could lead to
unwanted code execution.

The Python Unicode API deliberately tries to always use the combination
of a Py_UNICODE* pointer and a length integer to avoid such issues.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I'd consider that a bug. Esp. the IO lib should be 8-bit clean
> in the sense that it doesn't add any special meaning to NUL
> characters or code points.

It doesn't add any special meaning to them. It just relies on a NUL
being present after the end of the string. It doesn't care about other
NULs.

> Besides, using a for-loop with a counter is both safer and faster
> than checking each an every character for NUL.

It's slower, since it has one more condition to check.
Newline detection as it is written has a fast path in the form of:
 while (*c++ >= 0x20);

> Just think of what can happen if you have buggy code that overwrites
> the NUL byte in some corner case situation and then use the assumption
> of having the NUL byte as terminator - a classical buffer overrun.

Well, buggy code leads to bugs :)

--

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This is a particularly verbose patch for the information it is trying to convey.

--
nosy: +pitrou

___
Python tracker 

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



[issue7823] multiplying a list of dictionaries

2010-02-01 Thread R. David Murray

R. David Murray  added the comment:

I'm not quite sure from what you wrote if you understood.  Just to make sure no 
one reading this ticket later gets confused: it works the same way for all 
objects, and the behavior that sometimes surprises people shows up with mutable 
objects.  So lists and dicts behave the same way in this scenario:

>>> x = [[]]*3
>>> x
[[], [], []]
>>> x[0].append(1)
>>> x
[[1], [1], [1]]

--
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



[issue7823] multiplying a list of dictionaries

2010-02-01 Thread R. David Murray

Changes by R. David Murray :


--
priority:  -> normal
stage:  -> committed/rejected

___
Python tracker 

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



[issue7827] recv_into() argument 1 must be pinned buffer, not bytearray

2010-02-01 Thread Andrew Dalke

Andrew Dalke  added the comment:

Since I see the change to "test needed", I've attached a diff against Python 
2.6's test_socket.py. I would have generated one against the 2.7 version in 
subversion but that test doesn't exit.

--
keywords: +patch
Added file: http://bugs.python.org/file16082/test_socket.py.diff

___
Python tracker 

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



[issue7829] dis module documentation gives no indication of the dangers of bytecode inspection

2010-02-01 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone :

>From python-dev:

On Fri, Jan 29, 2010 at 15:04,   wrote:
> On 10:47 pm, tjre...@udel.edu wrote:
>>
>> On 1/29/2010 4:19 PM, Collin Winter wrote:
>>>
>>> On Fri, Jan 29, 2010 at 7:22 AM, Nick Coghlan wrote:
>>
>>> Agreed. We originally switched Unladen Swallow to wordcode in our
>>> 2009Q1 release, and saw a performance improvement from this across the
>>> board. We switched back to bytecode for the JIT compiler to make
>>> upstream merger easier. The Unladen Swallow benchmark suite should
>>> provided a thorough assessment of the impact of the wordcode ->
>>> bytecode switch. This would be complementary to a JIT compiler, rather
>>> than a replacement for it.
>>>
>>> I would note that the switch will introduce incompatibilities with
>>> libraries like Twisted. IIRC, Twisted has a traceback prettifier that
>>> removes its trampoline functions from the traceback, parsing CPython's
>>> bytecode in the process. If running under CPython, it assumes that the
>>> bytecode is as it expects. We broke this in Unladen's wordcode switch.
>>> I think parsing bytecode is a bad idea, but any switch to wordcode
>>> should be advertised widely.
>>
>> Several years, there was serious consideration of switching to a
>> registerbased vm, which would have been even more of a change. Since I
>> learned 1.4, Guido has consistently insisted that the CPython vm is not part
>> of the language definition and, as far as I know, he has rejected any byte-
>> code hackery in the stdlib. While he is not one to, say, randomly permute
>> the codes just to frustrate such hacks, I believe he has always considered
>> vm details private and subject to change and any usage thereof 'at one's own
>> risk'.
>
> Language to such effect might be a useful addition to this page (amongst
> others, perhaps):
>
>  http://docs.python.org/library/dis.html
>
> which very clearly and helpfully lays out quite a number of APIs which can
> be used to get pretty deep into the bytecode.  If all of this is subject to
> be discarded at the first sign that doing so might be beneficial for some
> reason, don't keep it a secret that people need to join python-dev to learn.
>

Can you file a bug and assign it to me?

-Brett

--
assignee: georg.brandl
components: Documentation
messages: 98661
nosy: exarkun, georg.brandl
severity: normal
status: open
title: dis module documentation gives no indication of the dangers of bytecode 
inspection

___
Python tracker 

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



[issue7829] dis module documentation gives no indication of the dangers of bytecode inspection

2010-02-01 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
assignee: georg.brandl -> brett.cannon
nosy: +brett.cannon

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Again, on Windows there are many many usages of PyUnicode_AS_UNICODE() that 
pass the result to various Windows API functions, expecting a nul-terminated 
array of WCHARs. Please don't change this!

--

___
Python tracker 

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



[issue5677] Serious interpreter crash and/or arbitrary memory leak using .read() on writable file

2010-02-01 Thread Stefan Krah

Stefan Krah  added the comment:

I see that a complete errno based solution would get messy. To avoid
interfering with EAGAIN special cases, this would be needed:

#if defined(EBADF)
#define ERRNO_EBADF(x) ((x) == EBADF)
#else
#define ERRNO_EBADF(x) 0
#endif

Then, additional checks would need to be added to get_line,
getline_via_fgets and a couple of other places.


I think the right thing is to add a field f_modeflags to the file
object, to be initialized on creation. Or use f->readable, f->writable
like py3k. Thoughts?

--

___
Python tracker 

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



[issue5677] Serious interpreter crash and/or arbitrary memory leak using .read() on writable file

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

I think checking errno would be fine (provided it eliminates all variations ot 
this bug).

--

___
Python tracker 

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



[issue3426] os.path.abspath with unicode argument should call os.getcwdu

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

The patch intentionally doesn't use assertIsInstance because that method 
doesn't exist in 2.6.

--

___
Python tracker 

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



[issue6906] Tkinter sets an unicode environment variable on win32

2010-02-01 Thread Jon Foster

Jon Foster  added the comment:

This bug also breaks code that uses the subprocess module, e.g.:

env = os.environ.copy()
env['MY_VARIABLE'] = 'MY_VAL'
subprocess.Popen(... , env=env)

Fails on Windows 7 with an error that the environment can only contain strings. 
 The offending variables are TK_LIBRARY and TCL_LIBRARY, which have Unicode 
strings as their values.  I'm using Python 2.6.2.

(The subprocess module should probably be fixed to use CreateProcessW and 
handle Unicode, but that's a separate issue).

--
nosy: +JonFoster

___
Python tracker 

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



[issue7805] test_multiprocessing failure

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Also witnessed on one of the buildbots:

test test_multiprocessing failed -- Traceback (most recent call last):
  File 
"/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/test/test_multiprocessing.py",
 line 1076, in test_pool_worker_lifetime
self.assertNotEqual(sorted(origworkerpids), sorted(finalworkerpids))
TypeError: unorderable types: NoneType() < int()

http://www.python.org/dev/buildbot/3.x.stable/builders/ia64%20Ubuntu%203.x/builds/434/steps/test/logs/stdio

--
assignee:  -> jnoller
components: +Tests
versions: +Python 3.1 -Python 2.7

___
Python tracker 

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



[issue7805] test_multiprocessing failure

2010-02-01 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
versions: +Python 2.6, Python 2.7

___
Python tracker 

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



[issue6906] Tkinter sets an unicode environment variable on win32

2010-02-01 Thread Brian Curtin

Changes by Brian Curtin :


--
components: +Windows
keywords: +needs review
nosy: +brian.curtin
priority:  -> normal
stage:  -> test needed
type:  -> behavior

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

Amaury Forgeot d'Arc wrote:
> 
> Amaury Forgeot d'Arc  added the comment:
> 
>> Base type Unicode buffers end with a null-Py_UNICODE termination,
>> but this is not used anywhere, AFAIK
> On Windows, code like 
>CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL)
> is very common, at least in posixmodule.c.

The above usage is clearly wrong. PyUnicode_AS_UNICODE() should
only be used to access Py_UNICODE data directly when
working on Python Unicode objects. The macro is not meant
to be used directly in external APIs.

For such uses, the Unicode conversion APIs need to be used,
e.g. the PyUnicode_AsWideChar() API. These will then also
apply any 0-termination as necessary.

Note that Python is free to change the meaning of Py_UNICODE
(e.g. to use UCS4 on all platforms) or Unicode implementation
details (such as e.g. the 0-termination) and this would then break
any use such as the one you quoted.

--

___
Python tracker 

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



[issue3872] Python 2.6rc2: Tix ComboBox error

2010-02-01 Thread Matthieu Labbé

Changes by Matthieu Labbé :


--
nosy: +matthieu.labbe

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Then there are many places to change, in core python as well as in third-party 
code. And PyArg_ParseTuple("u") would not work any more.

--

___
Python tracker 

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



[issue7749] pydoc error - "No module named tempfile"

2010-02-01 Thread R. David Murray

R. David Murray  added the comment:

Just FYI, it was backported to 2.6 in r76313.

--

___
Python tracker 

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



[issue7798] document pydoc methods

2010-02-01 Thread anatoly techtonik

anatoly techtonik  added the comment:

I won't mind against the pager module in the main library.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

> Note that Python is free to change the meaning of Py_UNICODE
> (e.g. to use UCS4 on all platforms)

Python-UCS4 has never worked on Windows. Most developers on Windows, taking 
example on core python source code, implicitly assumed that HAVE_USABLE_WCHAR_T 
is true, and use the Py_Unicode* api the same way they use the PyString* 
functions.

PyString_AsString is documented to return a nul-terminated array. If 
PyUnicode_AsUnicode starts to behave differently, people will have more trouble 
to port their modules to py3k.
This is not an implementation detail.

--

___
Python tracker 

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



[issue6939] shadows around the io truncate() semantics

2010-02-01 Thread Pascal Chambon

Pascal Chambon  added the comment:

Argh, I had indeed missed some IO-related tests, hadn't noticed the new test_io 
docstring:
# Tests of io are scattered over the test suite:
# * test_bufio - tests file buffering
# * test_memoryio - tests BytesIO and StringIO
# * test_fileio - tests FileIO
# * test_file - tests the file interface
# * test_io - tests everything else in the io module
# * test_univnewlines - tests universal newline support
# * test_largefile - tests operations on a file greater than 2**32 bytes
# (only enabled with -ulargefile)

Thanks for the commits B-)

--

___
Python tracker 

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



[issue7830] Flatten nested functools.partial

2010-02-01 Thread Alexander Belopolsky

New submission from Alexander Belopolsky :

Currently applying functools.partial to a callable that is already 
functools.partial object results in a nested object:

>>> from functools import partial
>>> def f(a,b,c): pass
... 
>>> p = partial(partial(f, 1), 2)
>>> p.func, p.args
(, (2,))


Proposed patch makes partial(partial(f, 1), 2) return partial(f, 1, 2) instead:
>>> p.func, p.args
(, (1, 2))

This patch is partially (no pun intended) motivated by a patch submitted by 
Christophe Simonis for issue4331. Christophe's patch flattens nested partials 
for a specific case of using partials as bound methods.

As proposed, the patch will enable flattening for subclasses of 
functools.partial, but will return a baseclass instance.  Flattening will also 
discard any state attached to the nested partial such as __name__, __doc__, etc 
or any subclass data.  I believe this is the right behavior, but this caveat is 
the reason I classify this patch as a "feature request" rather than 
"performance" or "resource usage".

--
components: Library (Lib)
files: no-nested-partial.diff
keywords: patch
messages: 98674
nosy: Alexander.Belopolsky
severity: normal
status: open
title: Flatten nested functools.partial
type: feature request
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file16083/no-nested-partial.diff

___
Python tracker 

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



[issue4331] Can't use _functools.partial() created function as method

2010-02-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Please see issue7830 for a related patch.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

modules to py3k.
> This is not an implementation detail.

It is, otherwise I would have documented it. The fact that some
developers are not using those APIs correctly doesn't change that.

Note that PyUnicode_AsUnicode() only returns a pointer to the
Py_UNICODE buffer. It makes no guarantees on the 0-termination.
Developers need to use PyUnicode_GetSize() to access the size
of the Unicode string.

But no worries: We're not going to change it. It's too late
after 10 years in the wild.

Still, developers will have to be aware of the fact that 0-termination
is not a guaranteed Unicode feature and should stop making that
assumption and it will not necessarily hold or be guaranteed
for Unicode subclasses.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le lundi 01 février 2010 à 19:21 +, Marc-Andre Lemburg a écrit :
> > This is not an implementation detail.
> 
> It is, otherwise I would have documented it.

Ok, so the current allocation scheme of unicode objects is an
implementation detail as well, right?

--

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-01 Thread Sijin Joseph

Sijin Joseph  added the comment:

Looking at the code in httplib it seems that response.will_close is set under 
the following circumstances,

1. HTTP version is 0.9
2. HTTP response header connection is set to close
3. Non-chunked content with a length of zero

This suggests that the underlying socket closure is valid under the conditions 
and that a subsequent response.read() should not be returning  any content.

If you think this is still an issue, I'd suggest that you create a small 
example client/server script that

Client:
1. Opens a HTTP connection
2. Continues to read data from it and dumps it to the console.

Server:
1. Setup a script that does not close incoming HTTP connection requests and 
continues to keep sending data back to the client.

--
nosy: +sijinjoseph

___
Python tracker 

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



[issue7813] Bug in command-line module launcher

2010-02-01 Thread Pascal Chambon

Pascal Chambon  added the comment:

Here is the patch you mentionned, it fixes my problem and seems unharmful 
indeed.

The little problem is, I've not found related tests (test_pkgutil doesn't deal 
with the importer part) to ad little checks around compile().

Is that patch worth commiting anyway ?

--
keywords: +patch
Added file: http://bugs.python.org/file16084/py26_pkgutil_compile.patch

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Florent Xicluna

New submission from Florent Xicluna :

The cmp(a, b) function is missing in 3.0.

This change is slightly documented in Doc/whatsnew/3.0.rst:
"The cmp() function should be treated as gone."

There's no "-3" warning and no 2to3 fixer for it.

--
messages: 98680
nosy: flox
priority: normal
severity: normal
status: open
title: cmp() is missing in 3.x
type: behavior
versions: Python 3.1, Python 3.2

___
Python tracker 

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



[issue7640] buffered io seek() buggy

2010-02-01 Thread Pascal Chambon

Changes by Pascal Chambon :


Removed file: http://bugs.python.org/file15759/seek_cur_buffers_py26.patch

___
Python tracker 

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



[issue7640] buffered io seek() buggy

2010-02-01 Thread Pascal Chambon

Pascal Chambon  added the comment:

BufferedRandom's seek() is still borken in the latest svn revision of python2.6 
(I haven't checked python2.7 yet), so here is a new, smaller patch, tested with 
the 6 IO-related test suites this time, on win32 and linux.

--

___
Python tracker 

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



[issue7640] buffered io seek() buggy

2010-02-01 Thread Pascal Chambon

Pascal Chambon  added the comment:

The patch itself...

--
Added file: http://bugs.python.org/file16085/Py26_relative_seek.patch

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The note starts out "Do not (do x) unless you're not (doing y)". This is 
confusing. I believe this means "If you are (doing y), you may (do x)". If so, 
please write it so. If not, please write what you do mean.

After thinking about it, "Only (do x) if you are (doing y)" might be a better 
rewrite. Or "You may (do x) only if you are (doing y)"

Change "be mindful of escaping" to the more direct "escape". Perhaps give a 
list of possible special characters.

I agree that this seems a bit verbose for reference documentation. Perhaps 
there should be a separate PyWiki entry or HowTo doc. That could, for instance, 
list the special characters for various shells if they are not all the same.

--
nosy: +tjreedy

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

PS. I only looked at the style of the patch. Once that is clearer, someone who 
knows more than me needs to review it for content correctness.

--

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Florent Xicluna

Florent Xicluna  added the comment:

As a replacement, it could be useful to propose a "universal key" for sort() 
method and sorted() builtin.

>>> lst = sorted([{2: '3'}, 1, '05'], key=list.ukey)
>>> 


There's a reference implementation in the pprint._safe_key private class.

--

___
Python tracker 

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



[issue1943] improved allocation of PyUnicode objects

2010-02-01 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

>It is, otherwise I would have documented it. The fact that some
developers are not using those APIs correctly doesn't change that.

If, as Antoine claimed, 'it' is a documented feature of str strings, and Py3 
says str = Unicode, it is a plausible inference.

--

___
Python tracker 

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



[issue3058] Let SimpleXMLRPCServer pass client_address to called functions.

2010-02-01 Thread STINNER Victor

STINNER Victor  added the comment:

client_address is not interresting, but I prefer the handler object 
(SimpleXMLRPCRequestHandler instance). The handler contains more information:
 * handler.address_string() gives the FQDN
 * handler.connection.getpeername() gives the client address
 * handler.connection.getsockanem() gives the server address, useful is the 
server is listening to multiple addresses
 * etc.

If the server uses SSL, it would be possible to get more information about SSL 
from handler(.connection).

Your patch breaks the API for all (service) callbacks. Add an option to 
register_function() would allow a smoother transition (don't break API): you 
don't have to inherit from a new class. Eg. server.register_function(whoami, 
with_handler=True).

--
nosy: +haypo

___
Python tracker 

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



[issue3058] Let SimpleXMLRPCServer pass client_address to called functions.

2010-02-01 Thread STINNER Victor

STINNER Victor  added the comment:

Oops, I mean "client_address is interresting, but ..."

--

___
Python tracker 

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



[issue3058] Let SimpleXMLRPCServer pass client_address to called functions.

2010-02-01 Thread STINNER Victor

STINNER Victor  added the comment:

Oops oops oops, samwyse wrote exactly the same idea than me in the first 
comment!

--

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

No, cmp is not missing. It's intentionally removed, and won't come back. So 
closing this as "won't fix".

I'm not sure what you are aiming at with the universal key function; if you 
want a key function that guarantees a total order, use key=id.

--
nosy: +loewis
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Florent Xicluna

Florent Xicluna  added the comment:

Ok.
Maybe we need a "-3" warning and/or a 2to3 fixer?

--
components: +2to3 (2.x to 3.0 conversion tool)
versions: +Python 2.6, Python 2.7

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Florent Xicluna

Changes by Florent Xicluna :


--
versions:  -Python 2.6

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Florent Xicluna

New submission from Florent Xicluna :

The current behavior of "assertSameElements" is not correctly documented.

The unit test confirm that it is a tested behaviour.

However it seems more useful to provide a method which compares the actual 
count of each element in both sequences.
There's already some use cases in the stdlib test suite.

Proposed behavior:

Success: assertSameElements([1, None, None], [None, 1, None])
Failure: assertSameElements([1, None, None], [1, 1, 1, None])

--
messages: 98692
nosy: ezio.melotti, flox, gregory.p.smith
priority: normal
severity: normal
status: open
title: assertSameElements([0, 1, 1], [0, 0, 1]) does not fail
type: feature request
versions: Python 2.7, Python 3.2

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +Merwok

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +Merwok

___
Python tracker 

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



[issue7831] cmp() is missing in 3.x

2010-02-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I think this should be discussed on python-dev (I believe it *has* been 
discussed on python-dev, I just don't remember the outcome). Creating fixers is 
not feasible, I think. In any case, it's an issue different from the one you 
reported.

--

___
Python tracker 

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



[issue7833] Bdist_wininst installers fail to load extensions built with Issue4120 patch

2010-02-01 Thread Christoph Gohlke

New submission from Christoph Gohlke :

Wininst-9.0.exe and wininst-9.0-amd64.exe are missing MSVCRT90 dependencies in 
the embedded manifest.

While testing installers of pywin32  
version 214 built with Python 2.6.4 and the 
msvc9compiler_stripruntimes_regexp2.diff patch from Issue4120 
, I noticed that the post_install script 
fails with an ImportError while trying to load extensions without embedded 
MSVCRT90 manifest:

Traceback (most recent call last):
  File "", line 601, in 
  File "", line 311, in install
  File "", line 149, in LoadSystemModule
ImportError: DLL load failed: The specified module could not be found.

The code that fails is:

mod = imp.load_module(modname, None, filename, ('.dll', 'rb', 
imp.C_EXTENSION))

where modname='pywintypes' and filename points to an existing 
'pywintypes26.dll' file. 

The post_install script runs fine when executed from the main python.exe 
interpreter.

A possible fix is to embed a MSVCRT90 dependency into wininst-9.0.exe and 
wininst-9.0-amd64.exe using the following linker switches:

/MANIFESTDEPENDENCY:"type='Win32' name='Microsoft.VC90.CRT' 
version='9.0.21022.8' processorArchitecture='X86' 
publicKeyToken='1fc8b3b9a1e18e3b'"

/MANIFESTDEPENDENCY:"type='Win32' name='Microsoft.VC90.CRT' 
version='9.0.21022.8' processorArchitecture='amd64' 
publicKeyToken='1fc8b3b9a1e18e3b'" 

See also 

A patch against the Python 2.6 PCbuild\bdist_wininst.vcproj is attached. I 
tested it with Python 2.6.4, 32 and 64 bit, and pywin32 214 installers built 
with the following command:

  python.exe setup.py bdist_wininst --user-access-control=auto 
--install-script=wxpython_win_post_install.py

--
assignee: tarek
components: Distutils, Windows
files: bdist_wininst.vcproj.patch
keywords: patch
messages: 98694
nosy: cgohlke, tarek
severity: normal
status: open
title: Bdist_wininst installers fail to load extensions built with Issue4120 
patch
versions: Python 2.6
Added file: http://bugs.python.org/file16086/bdist_wininst.vcproj.patch

___
Python tracker 

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



[issue7806] httplib.HTTPConnection.getresponse closes socket which destroys the response

2010-02-01 Thread Robert Buchholz

Robert Buchholz  added the comment:

An example cannot be constructed using the standard python socket class. As you 
point out, the response.will_close attribute is set correctly: The client is 
supposed to close to connect after completion of the request (as does the 
server). However, when the HTTPConnection object calls close() on the socket, 
reading the request is not completed -- the request object merely created a 
file-like object representing the socket.

The reason why this is not an issue is that the Python socket library does 
reference counting to determine when to close a socket object. When the 
HTTPConnection calls close(), its own socket object is destroyed and 
unreferenced. However, the file-like object in the HTTPResponse still has a 
copy of the socket.

In alternative socket implementations (like Paramiko SOCKS-proxied sockets), 
this poses a problem: When the socket user calls close(), they actually close 
the socket -- as the original socket API documentation describes:

close()
Close the socket.  It cannot be used after this call.

makefile([mode[, bufsize]]) -> file object
Return a regular file object corresponding to the socket.  The mode
and bufsize arguments are as for the built-in open() function.

Consequently, I do not consider this to be a bug in Paramiko and reported it 
for the httplib. I can present example code using a paramiko tunneled socket 
(client and server) if you like.

--

___
Python tracker 

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



[issue7833] Bdist_wininst installers fail to load extensions built with Issue4120 patch

2010-02-01 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This doesn't look right. IIUC, wininst.exe loads python26.dll, which in turn 
loads pywintypes.dll. So it should be python26.dll which loads the CRT.

IIUC, wininst.exe is linked statically, precisely to avoid a dependency on the 
CRT assembly.

--
nosy: +loewis

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Florent Xicluna

Florent Xicluna  added the comment:

Patch which adds method "assertItemsEqual".

However we could reuse the "assertSameElements" name, and replace the current 
implementation: it is still the alpha stage.

--
keywords: +patch
Added file: http://bugs.python.org/file16087/issue7832_assertItemsEqual.diff

___
Python tracker 

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



[issue7830] Flatten nested functools.partial

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Flattening should only happen for instances of the exact type. When people 
create subclasses, there's usually a reason for it.

--
nosy: +pitrou

___
Python tracker 

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



[issue7833] Bdist_wininst installers fail to load extensions built with Issue4120 patch

2010-02-01 Thread Christoph Gohlke

Christoph Gohlke  added the comment:

The last line of my previous post should actually read 
  python.exe setup.py bdist_wininst

Anyway, here are three files (also attached) that can reproduce the problem:

1) setup.py

from distutils.core import setup, Extension
setup(name='testpyd', scripts = ["testpyd_postinstall.py"],
ext_modules=[Extension('testpyd', ['testpyd.c'],)],
options = {"bdist_wininst": {"install_script": 
"testpyd_postinstall.py", "user_access_control": "auto"},})

2) testpyd.c

#include "Python.h"
PyMethodDef methods[] = {{NULL, NULL},};
void inittestpyd() {(void)Py_InitModule("testpyd", methods);}

3) testpyd_postinstall.py

#!python
import testpyd


Build the installer with python 2.6 and Issue4120 patch applied:
python setup.py bdist_wininst

Run the installer:
dist\testpyd-0.0.0.win32-py2.6.exe

The postinstall script fails with:

Traceback (most recent call last):
  File "", line 1, in 
ImportError: DLL load failed: The specified module could not be found.

According to Sysinternals process monitor python26.dll is loaded from the 
system32 directory, the testpyd.pyd extension is found at the right place, and 
then the Windows path is searched in vain for MSVCR90.DLL.

Tested on Windows 7 Pro 64 bit.

--
Added file: http://bugs.python.org/file16088/test-bdist_wininst.zip

___
Python tracker 

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



[issue7834] socket.connect() no longer works with AF_BLUETOOTH L2CAP sockets

2010-02-01 Thread Mathew Martineau

New submission from Mathew Martineau :

The sockaddr_l2 struct used with connect() has changed in recent versions of 
the Linux kernel.  There is a new l2_cid member.

connect() only works with L2CAP sockets if l2_cid is set to 0.

Suggest initializing the whole sockaddr_l2 struct to 0 in getsockaddrarg() 
(socketmodule.c).

--
components: Extension Modules
messages: 98700
nosy: Mathew.Martineau
severity: normal
status: open
title: socket.connect() no longer works with AF_BLUETOOTH L2CAP sockets
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

___
Python tracker 

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



[issue7834] socket.connect() no longer works with AF_BLUETOOTH L2CAP sockets

2010-02-01 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Could you produce a patch?

--
keywords: +easy
nosy: +pitrou
priority:  -> normal
stage:  -> needs patch

___
Python tracker 

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



[issue4772] undesired switch fall-through in socketmodule.c

2010-02-01 Thread Brian Curtin

Changes by Brian Curtin :


Removed file: http://bugs.python.org/file15665/issue4772.diff

___
Python tracker 

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



[issue4772] undesired switch fall-through in socketmodule.c

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

Minor change to the patch to correct for Antoine's suggestion.

--
Added file: http://bugs.python.org/file16089/issue4772.diff

___
Python tracker 

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



[issue4772] undesired switch fall-through in socketmodule.c

2010-02-01 Thread Brian Curtin

Changes by Brian Curtin :


Removed file: http://bugs.python.org/file16089/issue4772.diff

___
Python tracker 

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



[issue4772] undesired switch fall-through in socketmodule.c

2010-02-01 Thread Brian Curtin

Changes by Brian Curtin :


Added file: http://bugs.python.org/file16090/issue4772.diff

___
Python tracker 

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



[issue7835] Minor bug in 2.6.4 related to cleanup at end of program

2010-02-01 Thread Jesse Aldridge

Jesse Aldridge  added the comment:

I ran into an error while trying to use the shelve module.  Alex Martelli 
seemed to think I was running into a python bug.  He suggested I file a bug 
report.  For more info see:  
http://stackoverflow.com/questions/2180946/really-weird-issue-with-shelve-python

--

___
Python tracker 

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



[issue7266] test_lib2to3 failure under Windows

2010-02-01 Thread Meador Inge

Meador Inge  added the comment:

This looks to be fixed now [1].  The log shows 'test_lib2to3' passing.

BTW, why do we run through Cygwin?  I think to test on Windows as most Windows 
developers do things we need to use the native cmd.exe shell.

[1] 
http://www.python.org/dev/buildbot/builders/x86%20XP-4%20trunk/builds/2931/steps/test/logs/stdio

--
nosy: +minge

___
Python tracker 

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



[issue7830] Flatten nested functools.partial

2010-02-01 Thread Alexander Belopolsky

Alexander Belopolsky  added the comment:

Antoine> Flattening should only happen for instances of the exact type.

I am attaching a variant of the patch that will only flatten if both nested and 
wrapping partial is of the exact type. Other possibilities would include 
flattening partial_subtype(f, ...) if type(f) == partial and if type(f) == 
partial_subtype, but I'll present only the least and most conservative variants.

Antoine> When people create subclasses [of partial type], there's usually a 
reason for it.

It is hard not to agree with this thesis, but I don't see how it follows that 
subclass writers will not benefit from flattening their instances.  Can you 
suggest a use case where flattening in functools.partial subtype would be 
undesirable?

--
Added file: http://bugs.python.org/file16091/no-nested-partial-exact.diff

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Chris Rebert

Chris Rebert  added the comment:

Working on a more concise new draft...

--

___
Python tracker 

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



[issue7835] Minor bug in 2.6.4 related to cleanup at end of program

2010-02-01 Thread R. David Murray

R. David Murray  added the comment:

Here's a patch that fixes the problem for shelve.  For the more general problem 
with Python shutdown and module cleanup, see issue 812369.

I can come up with a sort-of unit test for this (setting _ClosedDict to None, 
calling close to prove it doesn't generate an error, and restoring _CloseDict), 
but it is rather artificial, since the real bug involves __del__ getting called 
during shutdown after module finalization.  So I'm not sure the unit test is 
worthwhile.

--
keywords: +easy, patch
nosy: +r.david.murray
priority:  -> normal
stage:  -> patch review
versions: +Python 2.7, Python 3.1, Python 3.2
Added file: http://bugs.python.org/file16092/shelve-clean-shutdown.patch

___
Python tracker 

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



[issue1578269] Add os.link() and os.symlink() and os.path.islink() support for Windows

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

I haven't yet had a chance to look into what caused the failures, but 
test_tarfile did not pass. This is on Windows 7 x64.


==
ERROR: test_extract_hardlink (__main__.MiscReadTest)
--
Traceback (most recent call last):
  File "lib\test\test_tarfile.py", line 295, in test_extract_hardlink
data = open(os.path.join(TEMPDIR, "ustar/symtype"), "rb").read()
IOError: [Errno 2] No such file or directory: 'd:\\python-dev\\py3...@test_2972_
tmp\\ustar/symtype'

==
ERROR: test_extract_hardlink (__main__.GzipMiscReadTest)
--
Traceback (most recent call last):
  File "lib\test\test_tarfile.py", line 295, in test_extract_hardlink
data = open(os.path.join(TEMPDIR, "ustar/symtype"), "rb").read()
IOError: [Errno 2] No such file or directory: 'd:\\python-dev\\py3...@test_2972_
tmp\\ustar/symtype'

--

___
Python tracker 

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



[issue5673] Add timeout option to subprocess.Popen

2010-02-01 Thread Reid Kleckner

Reid Kleckner  added the comment:

> - why do you say Thread.join() uses a busy loop? is it because it uses
>   Condition.wait()? If so, this will be solved in py3k by issue7316 (which you
>   are welcome to review). Otherwise, I think there should be an upper bound on
>   the sleeping granularity (say 2 seconds).

Yes, that's what I was referring to.  I'm glad to hear the situation will
improve in the future!

> - the "if 'timeout' in kwargs" dance is a bit complicated. Why not simply
>   "kwargs.pop('timeout', None)"?

Good call, done.

> - if it times out, communicate() should raise a specific exception. Bonus 
> points
>   if the exception holds the partial output as attributes (that's what we do 
> for
>   non-blocking IO in py3k), but if it's too difficult we can leave that out. I
>   don't think returning None would be very good.

I agree.  Does subprocess.TimeoutExpired sound good?

It won't be possible with the current implementation to put the partial output
in the exception, because read blocks.  For example, in the Windows threaded
implementation, there's a background thread that just calls self.stdout.read(),
which blocks until its finished.

> - for consistency, other methods should probably raise the same exception. I
>   think we can leave out the more complex scenarios such as "timing out but
>   still processing the beginning of the output".

What do you mean still processing?  I agree, they should all throw the same
exception.  I think call and check_call should clean up after themselves by
killing the child processes they create, while communicate and wait should leave
that to the user.

I'm imagining something like this for communicate:

try:
(stdout, stderr) = p.communicate(timeout=123)
except subprocess.TimeoutExpired:
p.kill()
(stdout, stderr) = p.communicate()  # Should not block long

And nothing special for check_call(cmd=[...], timeout=123).

--
Added file: http://bugs.python.org/file16093/subprocess-timeout.patch

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Chris Rebert

Chris Rebert  added the comment:

Okay; new, hopefully better, draft. Feedback?

--
versions:  -Python 3.1
Added file: http://bugs.python.org/file16094/subprocess.rst.patch

___
Python tracker 

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



[issue1578269] Add os.link() and os.symlink() and os.path.islink() support for Windows

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

Most of the guts have already been reviewed, but here are some mainly minor 
comments on the last patch.

Lib/test/symlink_support.py
- No need to import print_function
- I'd just put the docstrings on one line
- A bunch of if tests are one-lined

Lib/test/test_win_symlink.py
- getwindowsversion now returns named members, so you can just use 
getwindowsversion().major for example, rather than the tuple.
- Rather than check the Windows version in the setUp, I think it would be 
cleaner to use the unittest.skipIf decorator on the entire WindowsSymlinkTest 
class.
- You might want to stack skip decorators to first skip outright if it's not 
Windows, and then skip if it's not Win 6 or greater -- it gets you out of 
checking if getwindowsversion actually exists.
- test_remove_directory_link_to_missing_target has some commented out code.

Lib/test/test_posixpath.py
- Lines 365-366 - why check has_symlink() and immediately check it again?

Modules/posixmodule.c
- Line 2740 - "//*** todo: fix this"
- C++ style comments in a few other places (nit picky, I know)
- Line 5117 - win_symlink__doc__ is double spaced and contains an extra slash 
at line 5121. For consistency it should probably just be single spaced.

--

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Brian Curtin

Brian Curtin  added the comment:

The raw_input() doesn't provide anything. I'd just drop that and pass the 
string directly to shlex.split.

"Do not put an argument-taking option together with its argument as a single 
item in the *args* list"
-- Something like "Argument-taking options should not be grouped with their 
arguments in the *args* list." may be a cleaner read, and avoids the big scary 
"do not".

"Because that is incorrect"
-- Maybe something like "shlex.split would suggest the following" instead?

--
keywords: +needs review
nosy: +brian.curtin
stage:  -> patch review

___
Python tracker 

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



[issue7316] Add a timeout functionality to common locking operations

2010-02-01 Thread Brian Curtin

Changes by Brian Curtin :


--
nosy: +brian.curtin

___
Python tracker 

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



[issue5211] Fix complex type to avoid coercion in 2.7.

2010-02-01 Thread Meador Inge

Meador Inge  added the comment:

Mark,

Is this still of interest?

I found the relevant changes in py3k, but I am not sure it is the behavior that 
gumtree is expecting.  Since py3k removes coercion completely, the test case 
from issue 3734 would just issue:

   Traceback (most recent call last):
 File "test-5211.py", line 34, in 
   print type(z + xz)
 File "test-5211.py", line 5, in __coerce__
   t = complex.__coerce__(self,other)
   AttributeError: type object 'complex' has no attribute '__coerce__'

Where as I think gumtree wants the xcomplex case to behave as the xfloat case, 
e.g.
   
   
Since coercion is getting axed in py3k, I don't think it makes sense to provide 
this behavior.

On the other hand, as you mentioned, the removal of coercion from complex could 
be backported.  However, if we are going to do that then we might as well just 
backport the whole removal of coercion instead of just the bits from 
'complexobject.c'.  Bascially checkins r51431 and r58226.

--
nosy: +minge

___
Python tracker 

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



[issue6978] compiler.transformer dict key bug d[1,] = 1

2010-02-01 Thread Chuck Rhode

Chuck Rhode  added the comment:

Here are four ways to generate things called in the documentation Abstract 
Syntax Trees (ASTs).  Obviously they are not all the same kind of object:

#!/usr/local/bin/python2.6

import sys
import compiler
import parser
import ast

STATEMENT = 'd[1,] = 2'

print 'level %s' % sys.version
print compiler.parse(STATEMENT)
print parser.suite(STATEMENT).tolist()
print ast.dump(
compile(STATEMENT, '', 'exec', ast.PyCF_ONLY_AST),
annotate_fields=False,
include_attributes=False,
)
print ast.dump(
ast.parse(STATEMENT),
annotate_fields=False,
include_attributes=False,
)

# Fin

Here are the results:

>>> level 2.6.2 (r262:71600, Jun 29 2009, 08:08:18) 
[GCC 4.3.2]
>>> Module(None, Stmt([Assign([Subscript(Name('d'), 'OP_ASSIGN', [Const(1)])], 
>>> Const(2))]))
>>> [257, [267, [268, [269, [270, [327, [304, [305, [306, [307, [308, [310, 
>>> [311, [312, [313, [314, [315, [316, [317, [318, [1, 'd']], [322, [9, '['], 
>>> [323, [324, [304, [305, [306, [307, [308, [310, [311, [312, [313, [314, 
>>> [315, [316, [317, [318, [2, '1', [12, ',']], [10, 
>>> ']', [22, '='], [327, [304, [305, [306, [307, [308, [310, 
>>> [311, [312, [313, [314, [315, [316, [317, [318, [2, '2']], 
>>> [4, '']]], [0, '']]
>>> Module([Assign([Subscript(Name('d', Load()), Index(Tuple([Num(1)], 
>>> Load())), Store())], Num(2))])
>>> Module([Assign([Subscript(Name('d', Load()), Index(Tuple([Num(1)], 
>>> Load())), Store())], Num(2))])

To me the *compiler* module has vestigial utility.  It would be nice if it 
returned correct results.

--

___
Python tracker 

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



[issue6978] compiler.transformer dict key bug d[1,] = 1

2010-02-01 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I don't see why the compiler module is any better than any of the other ways 
that produce reasonable AST.

--

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

I like that this patch adds a new method with the different behavior.  They are 
both distinct and desirable behaviors.  The existing behavior has already been 
shipped in Python 3.1 so it should not change.  Also it is already in use via 
the http://code.google.com/p/python-unittest-backport/ project.

Also, I would put the assertItemEquals unit tests in their own method instead 
of at the end of the existing one.

--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Gregory P. Smith

Changes by Gregory P. Smith :


--
nosy: +michael.foord

___
Python tracker 

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



[issue6978] compiler.transformer dict key bug d[1,] = 1

2010-02-01 Thread Chuck Rhode

Chuck Rhode  added the comment:

> I don't see why the compiler module is any better than any of the other 
> ways that produce reasonable AST.

It is available on Python releases older than 2.6?

--

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Chris Rebert

Chris Rebert  added the comment:

Gonna have to disagree about the raw_input(), because the escaping involved 
would complicate the example and could be distracting/confusing.
Rest of Brian's suggestions taken into account.

--
Added file: http://bugs.python.org/file16095/subprocess.rst.patch

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Chris Rebert

Changes by Chris Rebert :


Removed file: http://bugs.python.org/file14770/subprocess.rst.patch

___
Python tracker 

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



[issue6760] patch to subprocess docs to better explain Popen's 'args' argument

2010-02-01 Thread Chris Rebert

Changes by Chris Rebert :


Removed file: http://bugs.python.org/file16094/subprocess.rst.patch

___
Python tracker 

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



[issue1683368] object.__init__ shouldn't allow args/kwds

2010-02-01 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

FYI - A discussion on why this change may have been a bad idea and breaks 
peoples existing code:

 http://freshfoo.com/blog/object__init__takes_no_parameters

--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue6978] compiler.transformer dict key bug d[1,] = 1

2010-02-01 Thread Kees Bos

Kees Bos  added the comment:

It's available at least since 2.4.

We're using it in Pyjamas (pyjs.org) to generate javascript code from python 
code.

If there are better ways to produce python asts, I'd be happy to know that.

--

___
Python tracker 

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



[issue7832] assertSameElements([0, 1, 1], [0, 0, 1]) does not fail

2010-02-01 Thread Ezio Melotti

Ezio Melotti  added the comment:

Just out of curiosity, what are the use cases for assertSameElements? If one 
has two objects, doesn't care about the order and the duplicates then these two 
objects are most likely sets and assertSetEqual can be used instead.
OTOH checking if two sequences have the same elements regardless of their order 
seems more common, and I don't see any method that does it (I was expecting 
assertSameElements to do that).

I would be -0 to add another method -- the API is already too confusing IMHO 
(is not so easy to remember if it's assertSameList, assertSameLists, 
assertListEqual, assertListsEqual; also note the 'assertItemsEqual' in 
msg98697, 'assertItemEquals' in msg98717).
Maybe a check_order arg in assertSequenceEqual (or was it assertSameSequence? 
;) would be better, or at least more explicit.

--
stage:  -> needs patch

___
Python tracker 

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