[issue4015] [patch] make installed scripts executable on windows

2009-08-14 Thread Gabriel Genellina

Changes by Gabriel Genellina :


--
nosy: +gagenellina

___
Python tracker 

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



[issue2576] httplib read() very slow due to lack of socket buffer

2009-08-14 Thread Gabriel Genellina

Changes by Gabriel Genellina :


--
nosy: +gagenellina

___
Python tracker 

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



[issue6682] Default traceback does not handle PEP302 loaded modules

2009-08-14 Thread Gabriel Genellina

Changes by Gabriel Genellina :


--
nosy: +gagenellina

___
Python tracker 

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



[issue6689] subprocess doesn't pass arguments correctly on Linux when shell=True

2009-08-14 Thread David Fraser

David Fraser  added the comment:

Ah, upon closer inspection - the special parameters $0 $1 $2 etc
mentioned in the sh docs refer to parameters within the command string,
so that:
   sh -c 'echo $2 $0 $1' run for "the people"
produces:
   the people run for

So the correct patch would be to leave out the extra parameters and just
have the quoted string...

The question then becomes, is simple " ".join(args) sufficient or should
there be some quoting of them... attaching a patch in the meantime
although that needs to be resolved.

--
Added file: http://bugs.python.org/file14718/subprocess-shell-args-2.6.patch

___
Python tracker 

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



[issue6689] subprocess doesn't pass arguments correctly on Linux when shell=True

2009-08-14 Thread David Fraser

Changes by David Fraser :


Removed file: http://bugs.python.org/file14697/current-2.6.patch

___
Python tracker 

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



[issue6689] subprocess doesn't pass arguments correctly on Linux when shell=True

2009-08-14 Thread David Fraser

Changes by David Fraser :


Removed file: http://bugs.python.org/file14698/current-3.patch

___
Python tracker 

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



[issue6556] "HOME" is not a standard environment variable on Windows

2009-08-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

%HOME% isn't set by Windows.
%HOMEDRIVE%%HOMEPATH% points to the user's home directory.
%USERPROFILE% is where the user's profile is stored, and may or may not 
be the same as his home directory.

%HOMEDRIVE%%HOMEPATH% should be used then, defaulting to %USERPROFILE% 
only when those variables are not set (that's unlikely, but could 
happen e.g. with the runas command)

--
nosy: +gagenellina

___
Python tracker 

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



[issue6666] List of dirs to ignore in trace.py is applied only for the first file

2009-08-14 Thread Gabriel Genellina

Gabriel Genellina  added the comment:

That's exactly the change 2to3 would suggest for that line. The guy 
doing the conversion must have missed it.

--
nosy: +gagenellina

___
Python tracker 

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



[issue6693] New functions in site.py to get user/global site packages paths

2009-08-14 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

Done.

I've put Christian in the loop since he implemented the PEP 370
feature, to make sure these changes are fine with him.

--
nosy: +christian.heimes
Added file: http://bugs.python.org/file14719/site.patch

___
Python tracker 

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



[issue6693] New functions in site.py to get user/global site packages paths

2009-08-14 Thread Tarek Ziadé

Changes by Tarek Ziadé :


Removed file: http://bugs.python.org/file14707/site.patch

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

New submission from Bogdan Opanchuk :

I am sorry if the same issue was already considered and rejected for
some reason; quick search did not show any traces of it.

What I am going to write here is just a proof of concept, but if the
idea of the patch is acceptable, I am eager to prepare proper patches
for lib, documentation and so on.

So, my aim was to make xmlrpc module frendlier to those who want to
extend its functionality locally in their own projects. Currently there
are several problems with it:
1. Marshaller, unmarshaller and parser cannot be substituted by custom
versions easily.
2. Custom version of marshaller will look ugly (i.e., because it may
need to call Marshaller.__dump)
3. Transport, parser and unmarshaller are coupled now, though they are
completely independent.

My patch seem to eliminate these problems (see attach). Briefly, it
contains the following changes:
1. Transport, parser and unmarshaller are decoupled
2. Custom masrshaller, parser and unmarshaller classes can be passed to
client and server classes as parameters
3. Made Marshaller class easier to extend:
- __dump() renamed to _dump()
- added _add_memo() and _del_memo() (and hid .memo field)
- memo is now a set() (instead of dictionary with None values)
- dispatch table was made private

Results:
(good) This patch does not invalidate any part of documentation (but it
needs to be extended, according to new marshaller/unmarshaller/parser
parameters)
(good) test_xmlrpc still passes (with one little change to it, patch is
attached)
(good) Extension is easy now - see xmlrpc_overload.py as an example
(added bytes(), tuple() and dict() with non-string keys support)
(bad) Programs which use exported, but undocumented parts of xmlrpc can
break (though most of them can be easily fixed)

--
components: Library (Lib)
messages: 91546
nosy: bogdan.opanchuk
severity: normal
status: open
title: Make custom xmlrpc extension easier
type: feature request
versions: Python 3.2

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

Changes by Bogdan Opanchuk :


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

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

Changes by Bogdan Opanchuk :


Added file: http://bugs.python.org/file14721/client.py

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

Changes by Bogdan Opanchuk :


Added file: http://bugs.python.org/file14722/server.py

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

Changes by Bogdan Opanchuk :


Added file: http://bugs.python.org/file14723/test_xmlrpc.py

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Bogdan Opanchuk

Changes by Bogdan Opanchuk :


Added file: http://bugs.python.org/file14724/xmlrpc_overload.py

___
Python tracker 

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



[issue6702] Tkinter: modify xview of entry widget

2009-08-14 Thread paolo

New submission from paolo :

I wish to propose a useful and smart method modify in Tkinter Library:

Previously to scroll this widget we had to write an external function
(recalling xview_moveto and xview_scroll).

With my method this operation is cleared and the same as all other
widgets (just have to call xview).

--
Modify Proposal:
--
Change the method xview of entry so it works as all widget scrollable,
and it's compatible with 'old' xview.

So to scroll entry widget:

entry_widget['xscrollcommand']=scroll_widget.set
scroll_widget['command']=entry_widget.xview

The change in module Tkinter is:

def xview(self,*args):
"""Query and change horizontal position of the view."""
#modify
if not args:
return self._getdoubles(self.tk.call(self._w, 'xview'))
#old code
index=args[0]
self.tk.call(self._w, 'xview', index)
--
+
It's call the tk interpreter passing entry and xview without arguments;
returns a list containing two elements to pass to scrollbars via the
xscrollcommand option

If an argument (index) is passing, then display the character given by
index at the left edge of the window; it work as the original xview

With 'old' methon is impossible call xview without arguments, the change
has made possible this.

-
To scroll entry without modify:
---
import Tkinter as tk
root=tk.Tk()

def scollEntry(*args):
   if args[0]=='scroll':
e.xview_scroll(args[1],args[2])
   if args[0]=='moveto':
e.xview_moveto(args[1])

e=tk.Entry(width=10)
e.grid(row=0, sticky='e'+'w')

s=tk.Scrollbar(orient='horizontal')
s.grid(row=1, sticky='e'+'w')

e['xscrollcommand']=s.set
s['command']=scollEntry

root.mainloop()


With modify:

import Tkinter as tk
root=tk.Tk()

e=tk.Entry(width=10)
e.grid(row=0, sticky='e'+'w')

s=tk.Scrollbar(orient='horizontal')
s.grid(row=1, sticky='e'+'w')

e['xscrollcommand']=s.set
s['command']=e.xview

root.mainloop()

-
It's work also with tk-8.5 and ttk
--
import Tkinter as tk
import ttk
root=tk.Tk()

e=ttk.Entry(width=10)
e.grid(row=0, sticky='e'+'w')

s=ttk.Scrollbar(orient='horizontal')
s.grid(row=1, sticky='e'+'w')

e['xscrollcommand']=s.set
s['command']=e.xview

root.mainloop()
-

I tested with Python 2.5 and tk 8.4 and also tk 8.5 and module ttk

--
components: Tkinter
messages: 91547
nosy: paolo
severity: normal
status: open
title: Tkinter: modify xview of entry widget
versions: Python 2.5

___
Python tracker 

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



[issue6702] Tkinter: modify xview of entry widget

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

Please take a look on issue6180. Closing this as duplicate.

Also consider checking the issue 1135, your comments are welcome on both
issues and may help getting the fix committed.

--
nosy: +gpolo
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue6701] Make custom xmlrpc extension easier

2009-08-14 Thread Raghuram Devarakonda

Changes by Raghuram Devarakonda :


--
nosy: +draghuram

___
Python tracker 

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



[issue3344] IDLE - use enumerate instead of zip(count(), ...)

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

Committed on r74446, will merge into py3k.

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

___
Python tracker 

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



[issue3926] Idle doesn't obey the new improved warnings arguements

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

Committed on r74447, will merge into py3k.

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

___
Python tracker 

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



[issue1135] xview/yview of Tix.Grid is broken

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

This has been commited on r74448 now, will merge into py3k.

--
resolution:  -> accepted
status: open -> closed
versions: +Python 2.7, Python 3.2 -Python 2.5, Python 2.6

___
Python tracker 

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



[issue6180] Tkinter.Entry: fix for xview and some doc clarifications

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

This is now obsolete since r74448 and r74449, closing.

--
status: open -> closed

___
Python tracker 

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



[issue1135] xview/yview of Tix.Grid is broken

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

> This has been commited on r74448 now, will merge into py3k.

py3k: r74450

--

___
Python tracker 

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



[issue3926] Idle doesn't obey the new improved warnings arguements

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

> Committed on r74447, will merge into py3k.

py3k: r74450

--

___
Python tracker 

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



[issue3344] IDLE - use enumerate instead of zip(count(), ...)

2009-08-14 Thread Guilherme Polo

Guilherme Polo  added the comment:

> Committed on r74446, will merge into py3k.

py3k: r74450

--

___
Python tracker 

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



[issue6687] Move the special-case for integer objects out of PyBytes_FromObject.

2009-08-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

+1 from me too;  I agree the current API of PyBytes_FromObject is ugly.  

Is there still a need for a separate C function for creating a zero-
initialized bytes object from a Py_ssize_t or a Python integer?  It's a 
fairly simple operation (PyBytes_FromStringAndSize + memset), so perhaps 
it doesn't need its own public function.

I'm not sure about the extra PyUnicode_Check:  this seems to go against 
Python's philosophy of duck-typing.  After all, the empty string *is* an 
iterable all of whose elements are integers.  And this check doesn't cover 
other, similar, cases:  for example, list('') will still be converted by 
PyBytes_FromObject, while list('123') won't.  What's the benefit?

If this check is going to stay, there should probably also be a unit test 
for this behaviour.

Apart from the reservation about the PyUnicode_Check, the patch looks good 
to me.  All tests pass on my machine (OS X 10.5) with this patch applied.

--
nosy: +marketdickinson

___
Python tracker 

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



[issue6703] cross platform failure and silly test in doctest

2009-08-14 Thread Chris Withers

New submission from Chris Withers :

Hi All,

Line 355 of this code on the 2.6 branch and trunk:

http://svn.python.org/view/python/branches/release26-
maint/Lib/doctest.py?view=annotate
http://svn.python.org/view/python/trunk/Lib/doctest.py?annotate=69012

...contain a check that doesn't work cross platform.

I'd argue that the check is worthless and should be removed.
I'm happy to do this, but is this code tested?
If not, do I need to add a test when I remove those two lines?

cheers,

Chris

--
assignee: cjw296
messages: 91557
nosy: cjw296
severity: normal
status: open
title: cross platform failure and silly test in doctest
versions: Python 2.6, 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



[issue6695] PyXXX_ClearFreeList for dict, set, and list

2009-08-14 Thread Matthias Troffaes

Matthias Troffaes  added the comment:

Thanks for the feedback!

Attaching a new patch which implements tp_free_list slot as suggested -
I hope I did it correctly. I've only implemented the new slot for dict
so far, but I'm happy to tp_free_list-ify the other freelist types as
well, in a future patch, if this gets the green light.

Description of the patch:

* added tp_free_list slot to PyTypeObject (definitely for review: is the
location of tp_free_list right after tp_free sensible?)
* added PyType_ClearFreeList(PyTypeObject *) to C API, which calls the
tp_free_list function if not NULL
* inserted the new slot where necessary (e.g. in PyGen_Type) to sync
type definitions with the updated PyTypeObject
* created dict_free_list function and added it to PyDict_Type
* call PyType_ClearFreeList(&PyDict_Type) from gc.collect()

--
Added file: http://bugs.python.org/file14725/py3k-tp_free_list-dict.patch

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2009-08-14 Thread jan matejek

jan matejek  added the comment:

for completenes, here's a patch that's in use in SUSE. it's advantage
over Fedora's is that it works on both 32bit and 64bit installs

--
Added file: http://bugs.python.org/file14726/Python-2.6.2-multilib.patch

___
Python tracker 

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



[issue1424148] urllib.FancyURLopener.redirect_internal looses data on POST!

2009-08-14 Thread Giorgio

Giorgio  added the comment:

I am not sure where we stand with this issue. It seems to be an old one.
urllib2 still claim (as of python 2.6) the following;

# Strictly (according to RFC 2616), 301 or 302 in response
# to a POST MUST NOT cause a redirection without confirmation
# from the user (of urllib2, in this case).  In practice,
# essentially all clients do redirect in this case, so we
# do the same.
# be conciliant with URIs containing a space

This is just not true, we don't do the same at all. redirect_request
does not pass data along and it even changes the headers to reflect
content-size, thus behaving perfectly in accordance with RFC.

For those who stumbled upon this page looking for a workaround, this is
how to do: create a new class inheriting from HTTPRedirectHandler and
use this one instead:


class AutomaticHTTPRedirectHandler(urllib2.HTTPRedirectHandler):

def redirect_request(self, req, fp, code, msg, headers, newurl):
"""Return a Request or None in response to a redirect.

The default response in redirect_request claims not to 
follow directives in RFC 2616 but in fact it does
This class does not and makes handling 302 with POST
possible
"""
m = req.get_method()
if (code in (301, 302, 303, 307) and m in ("GET", "HEAD")
or code in (301, 302, 303) and m == "POST"):
newurl = newurl.replace(' ', '%20')
return urllib2.Request(newurl,
   data=req.get_data(),
   headers=req.headers,
   origin_req_host=req.get_origin_req_host(),
   unverifiable=True)
else:
raise urllib2.HTTPError(req.get_full_url(), code, msg,
headers, fp)

--
nosy: +crocowhile
versions: +Python 2.5 -Python 3.0

___
Python tracker 

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



[issue6695] PyXXX_ClearFreeList for dict, set, and list

2009-08-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Guido, do you want a slot assigned for this?

--
assignee:  -> gvanrossum
nosy: +gvanrossum, rhettinger

___
Python tracker 

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



[issue6646] test_pickle fails on AIX -- 6.9999999999999994e-308 != 6.9999999999999984e-308

2009-08-14 Thread Mark Dickinson

Mark Dickinson  added the comment:

Closing this as a won't fix:  as far as I can tell, the test failure is 
due to a platform deficiency (string <-> float conversions provided by the 
C standard library aren't correctly rounded; moreover, they're not 
accurate enough that converting a C double to 17 significant digits and 
back recovers the original double).  It's not clear what Python can 
reasonably do to fix this.  I'd prefer not to disable or weaken these 
tests, since they're useful on other platforms.

srid, if you do have any alternative suggestions about how this might be 
fixed then please do submit them.

For what it's worth, this particular failure should no longer be a problem 
in Python 3.1 and higher, since 3.1 uses its own string <-> float 
conversion code (based on David Gay's dtoa.c).

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



[issue6695] PyXXX_ClearFreeList for dict, set, and list

2009-08-14 Thread Guido van Rossum

Guido van Rossum  added the comment:

A slot in every type object for this purpose seems wasteful; the large
majority of types won't have a free list.  (Remember, each user-defined
class allocates a full type structure on the heap.)

--
assignee: gvanrossum -> 

___
Python tracker 

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



[issue4970] test_os causes delayed failure on x86 gentoo buildbot: Unknown signal 32

2009-08-14 Thread Sridhar Ratnakumar

Sridhar Ratnakumar  added the comment:

[...]
test_poll
test_popen
test_poplib
stub-asunix.sh: line 238: 25474 Unknown signal 32   $PYTHON 
$installdir/lib/python?.?/test/regrtest.py -w -u all,-curses,-audio,-
network -x $SKIPS
stub: core Python test suite FAILED (retval: 160)

--
nosy: +srid

___
Python tracker 

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



[issue6695] PyXXX_ClearFreeList for dict, set, and list

2009-08-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Marking the PyXXX_ClearFreeList version as approved.

--
resolution:  -> accepted

___
Python tracker 

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



[issue6704] better col_offset for AST in statements like "for a, b in ..."

2009-08-14 Thread Frank Wierzbicki

New submission from Frank Wierzbicki :

For statements like:

for a,b in c:
   pass

The Tuple node "a,b" ends up with a col_offset of 0 (the position of the
"for"), but the col_offset should probably be 4 (the position of "a").
This is more consistent with other Tuple node col_offset results.

--
components: Interpreter Core
files: ast.diff
keywords: patch
messages: 91566
nosy: fwierzbicki
severity: normal
status: open
title: better col_offset for AST in statements like "for a,b in ..."
versions: Python 2.7
Added file: http://bugs.python.org/file14727/ast.diff

___
Python tracker 

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



[issue6703] cross platform failure and silly test in doctest

2009-08-14 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

How about removing it and seeing if tests fail?

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue6704] better col_offset for AST in statements like "for a, b in ..."

2009-08-14 Thread Frank Wierzbicki

Frank Wierzbicki  added the comment:

Adding tests to test_ast.py for the three cases that exercise the "for
a,b" scenario.  Also fixed a small bug in the test code generator in
test_ast.py

--
Added file: http://bugs.python.org/file14728/ast.diff

___
Python tracker 

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



[issue6556] "HOME" is not a standard environment variable on Windows

2009-08-14 Thread Tarek Ziadé

Tarek Ziadé  added the comment:

The code works as expected because it uses os.path.expanduser('~'),
which will look to the right values depending on the platform.

So it's just the documentation that is wrong about how distutils behaves
under Windows.

I'll fix this doc asap, thanks for the feedback.

--
components: +Documentation -Distutils
resolution:  -> accepted
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



[issue1424148] urllib.FancyURLopener.redirect_internal looses data on POST!

2009-08-14 Thread John J Lee

John J Lee  added the comment:

This issue is not a bug, and should be closed.  It was discussed at 
length many years ago (different bug tracker ticket), and resolved.  
Since then the same issue seems to come up every year or so, 
apparently raised by people who haven't checked the issue tracker for 
previous discussion.  Please, somebody close this issue!


> It seems to be an old one.
> urllib2 still claim (as of python 2.6) the following;
> 
> # Strictly (according to RFC 2616), 301 or 302 in response
> # to a POST MUST NOT cause a redirection without confirmation
> # from the user (of urllib2, in this case).  In practice,
> # essentially all clients do redirect in this case, so we
> # do the same.

Note that this is NOT a statement about whether the request sent as a 
result of the redirect response contains the original POST data.


> This is just not true, we don't do the same at all. redirect_request
> does not pass data along and it even changes the headers to reflect
> content-size, thus behaving perfectly in accordance with RFC.

This appears to be a statement about (amongst other things) whether 
the request sent as a result of the redirect response contains the 
original POST data.

So where's the connection between the comment you quote and your 
response to it, Giorgio?  Actually, I hope you don't mind if I ask you 
not to answer that question, but instead to go and read, very 
carefully, the tracker discussion for the original fix that introduced 
the comment you posted (you should be able to find it by svn 
annotating the source, finding the appropriate commit, then looking 
for a reference in the commit message to a bug tracker issue ID).  
Once you've done that, please stop posting on this issue <0.2 wink>

Sorry, I'm not normally this grumpy, but this issue just seems to keep 
coming back forever, because people haven't spent the time to test 
browser behaviour, carefully read the RFC, tracker discussion, commit 
messages, etc.  If you have done all that and thought carefully and 
still think there's a bug, by all means come back, but please make 
sure you're extremely clear about *exactly* what you think is wrong, 
and why.  Write a test case, and cite specific RFC wording.  If what 
you think is wrong is not the same as the original issue described in 
the opening comment of this bug tracker ticket, please raise a new 
ticket rather than commenting on this one.


> For those who stumbled upon this page looking for a workaround, this 
is
> how to do: create a new class inheriting from HTTPRedirectHandler 
and
> use this one instead:

I don't know what this is a workaround *for*.

--

___
Python tracker 

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



[issue1424148] urllib.FancyURLopener.redirect_internal looses data on POST!

2009-08-14 Thread Giorgio

Giorgio  added the comment:

>I don't know what this is a workaround *for*.

As you can see yourself, that code does a complete redirection, taking
along the post_data too which is simply not possible by default (and
that is obviously a pain in the neck).

I never said it was "bug" nor that the code had to be changed. I am just
saying this is "a lack of a feature" that obviously many would like to
see implemented - and this is probably why it "seems to come back forever".

--

___
Python tracker 

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



[issue6705] '''3, 5'''.strip(r''', ''') does not strip comma, returns '3, 5'

2009-08-14 Thread Michael Gruen

New submission from Michael Gruen :

I am new, I apologize if this is a trivial or non-problem.  I have
researched for hours, tried every variant but cannot understand why this
doesn't work.

--
components: None
messages: 91572
nosy: mgruen
severity: normal
status: open
title: '''3,5'''.strip(r''',''') does not strip comma, returns '3,5'
type: behavior
versions: Python 3.1

___
Python tracker 

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



[issue6705] '''3, 5'''.strip(r''', ''') does not strip comma, returns '3, 5'

2009-08-14 Thread R. David Murray

R. David Murray  added the comment:

strip removes any of a set of characters from the beginning and end of a
string, not the middle.

Please refer questions such as this to python-list or python-tutor. 
There are many helpful people on those lists who will help you learn
your way around python.

--
nosy: +r.david.murray
priority:  -> low
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



[issue6705] '''3, 5'''.strip(r''', ''') does not strip comma, returns '3, 5'

2009-08-14 Thread Eric Smith

Eric Smith  added the comment:

Good advice from R. David. In addition, you'll find the help command useful:

>>> help(''.strip)
Help on built-in function strip:

strip(...)
S.strip([chars]) -> string or unicode

Return a copy of the string S with leading and trailing
whitespace removed.
If chars is given and not None, remove characters in chars instead.
If chars is unicode, S will be converted to unicode before stripping

--
nosy: +eric.smith

___
Python tracker 

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



[issue6681] email.parser clips trailing \n of multipart/mixed part if part ends in \r\n

2009-08-14 Thread R. David Murray

R. David Murray  added the comment:

The only way I can think of to fix this that won't fail in the case
where the body ends with just '\r' (rather than '\r\n' the way the test
body does) is to have feedparser keep track of what the overall line
endings for the stream being parsed are.  ie: to basicly outlaw
mixed-line-ending input (except insofar as such alternate line endings
are encoded in a non-text multipart).  That seems like something that
should only be considered in the context of email 6.0 rather than in a
bug fix.

cgi doesn't use a RE, by the way, it just looks at the last two
chars...and is subject to the same bug if a part ends with '\r' in input
with '\n' line terminators.

I've attached a patch that turns Guido's test into a test case, and
fixes his edge case.  I did not touch the other places where the eol RE
is used, since in those cases there should not be binary data preceeding
the line ending characters.

--
keywords: +patch
priority:  -> normal
stage:  -> patch review
Added file: http://bugs.python.org/file14729/issue6681.diff

___
Python tracker 

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



[issue6697] Python 3.1 segfaults when invalid UTF-8 characters are passed from command line

2009-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

The error occurs in Py_Main(), on _PyUnicode_AsString(commandObj). The
problem is that _PyUnicode_AsString() is not checked for error. Here is
a patch fixing two errors:
 - display on error message instead of a crash on
_PyUnicode_AsString(commandObj) failure
 - don't call Py_DECREF(commandObj) if commandObj is NULL
(PyUnicode_FromWideChar error, a different error)

My patch also includes a test. The test should be moved somewhere else,
but I don't know where.

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file14730/pymain.patch

___
Python tracker 

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



[issue6669] TarFile.getmembers fails at struct.unpack: unpack requires a string argument of length 4

2009-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

First, gzip should use its own errors: this issue depends on #6584.

--
nosy: +haypo

___
Python tracker 

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



[issue6669] TarFile.getmembers fails at struct.unpack: unpack requires a string argument of length 4

2009-08-14 Thread R. David Murray

R. David Murray  added the comment:

Since 6584 is deemed (correctly, IMO) a feature request, this one must
be as well.

--
dependencies: +gzip module has no custom exception
keywords: +easy
nosy: +r.david.murray
priority:  -> normal
stage:  -> test needed
type: behavior -> feature request
versions: +Python 2.7, Python 3.2 -Python 2.6

___
Python tracker 

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



[issue6706] asyncore's accept() is broken

2009-08-14 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

An old bad design choice in asyncore is how it forces the user to 
override handle_accept() and then call self.accept() to obtain a socket 
pair.

def handle_accept(self):
conn, addr = self.accept()

The documentation itself shows the code above as an example of how an 
asyncore-based server should handle an incoming connection.
What the doc doesn't say is that the user calling self.accept() is 
exposed to different risks:

- self.accept() can return None instead of a socket pair in which case 
TypeError is raised (see pyftpdlib bug: 
http://code.google.com/p/pyftpdlib/issues/detail?id=91)

- ECONNABORTED can be raised. This is reproducible on Linux by hammering 
the server with nmap (see pyftpdlib bug: 
http://code.google.com/p/pyftpdlib/issues/detail?id=105)

- EAGAIN can be raised too. I never experienced this error condition 
myself in pyftpdlib but by looking at twisted/internet/tcp.py it seems 
reasonable to catch EAGAIN too.

- The resulting address can be None, which means that the connection 
didn't take place.
This is reproducible by hammering the server with nmap (see pyftpdlib 
bug http://code.google.com/p/pyftpdlib/issues/detail?id=104).


The right thing to do when one of such events occur is to "return" as no 
connection has really been established between client and server.

Now, altough handling these kind of conditions is quite easy, the API 
design remains fundamentally wrong, as it forces the user to call 
accept().
As asyncore.py is structured right now the only chance the user has to 
properly accepting a connection is manually handling all these cases in 
his subclass.


My patch in attachment tries to solve this problem by defining a new 
"handle_accept_event()" method which takes care of all the error 
conditions described above resulting in handle_accept() be called *only 
when a connection really took place*.
When the connection is established handle_accept_event() stores the 
socket pair as an attribute and the next call to accept() returns that 
pair.
This preserves the current implementation without breaking any code as 
the user will have to override handle_accept() and then call accept() in 
the same manner [1], with the difference that self.accept() will always 
return a valid socket pair.

[1] 
def handle_accept(self):
conn, addr = self.accept()

--
components: Library (Lib)
messages: 91579
nosy: giampaolo.rodola, josiahcarlson
severity: normal
status: open
title: asyncore's accept() is broken
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



[issue6707] dir() on __new__'d module w/o dict crashes 2.6.2

2009-08-14 Thread Dino Viehland

New submission from Dino Viehland :

from types import ModuleType as M
m = M.__new__(M)
dir(m)

In 2.5 this raises an exception about not having __dict__, 2.6.2 
crashes out right.

--
components: Interpreter Core
messages: 91580
nosy: DinoV
severity: normal
status: open
title: dir() on __new__'d module w/o dict crashes 2.6.2
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



[issue6239] c_char_p return value returns string, not bytes

2009-08-14 Thread STINNER Victor

STINNER Victor  added the comment:

I agree that the C type 'char' is a byte, not a character. So Python3
should creates a Python bytes object for the ctypes "c_char_p" type.
Since Python 3.1 is out, is it too late to change it in the 3.x branch?
:-) Maybe for Python 3.2?

--
nosy: +haypo

___
Python tracker 

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



[issue6673] Py3.1 hangs in coroutine and eats up all memory

2009-08-14 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reopening - this should be rejected by the compiler as a SyntaxError,
since it is the comprehension equivalent of writing "return Value"
inside a generator function.

Specifically, in 3.x, the equivalent written out code is:

while True:
def _listcomp():
result = []
for i in range(chunk_size):
result.append((yield))
return result # Would trigger SyntaxError!
target.send(_listcomp())

As noted in the comment, the compiler would disallow that expansion with
a SyntaxError on the marked line, so the comprehension equivalent should
be rejected as well. This also applies to dict and set comprehensions.

Generator expressions are slightly less clear, since their expanded
equivalent would produce legal code:

>>> g = ((yield)*(yield) for i in range(1))
>>> next(g)
>>> g.send(2)
>>> g.send(3)
6
>>> next(g)
Traceback (most recent call last):
  File "", line 1, in 
StopIteration

That first line is roughly equivalent to:
def _genexp():
for i in range(1):
yield (yield)*(yield)
g = _genexp()

So the compiler should probably be keeping track of whether it is inside
a comprehension or not to decide whether or not to allow yield expressions.

--
keywords: +64bit
nosy: +ncoghlan
resolution: invalid -> 

___
Python tracker 

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



[issue6626] show Python mimetypes module some love

2009-08-14 Thread Jacob Rus

Jacob Rus  added the comment:

Okay, here's a version of this patch which (a) adds deprecation warnings, 
and (b) doesn't bother with lazy init. It should still be nearly 
completely backwards compatible with the previous mimetypes module.

--
Added file: http://bugs.python.org/file14731/mimetypes5.diff

___
Python tracker 

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



[issue6708] raw_input() calls generate compile errors.

2009-08-14 Thread starz

New submission from starz :

# -- SOURCE ---
# cheerleading program
word = raw_input("Who do you go for? ")

for letter in word:
call = "Gimme a " + letter + "!"
print (call)
print (letter) + "!"

print( "What does that spell?")
print( word + "!")

# --- end source ---

## within python.help()
## 
help> raw_input()
no Python documentation found for 'raw_input()'

help>

### --- run from O/S ---

C:\Program Files\OpenOffice.org 2.0\program\python3.1>python 
PYsource\test3.py
Traceback (most recent call last):
  File "PYsource\test3.py", line 22, in 
word = raw_input("Who do you go for? ")
NameError: name 'raw_input' is not defined

C:\Program Files\OpenOffice.org 2.0\program\python3.1>

--
components: Library (Lib)
files: test3.py
messages: 91584
nosy: starz
severity: normal
status: open
title: raw_input() calls generate compile errors.
type: behavior
versions: Python 3.1
Added file: http://bugs.python.org/file14732/test3.py

___
Python tracker 

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



[issue6626] show Python mimetypes module some love

2009-08-14 Thread Jacob Rus

Jacob Rus  added the comment:

And at Rietveld, patch version 5:
http://codereview.appspot.com/107042

--

___
Python tracker 

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



[issue6708] raw_input() calls generate compile errors.

2009-08-14 Thread Skip Montanaro

Skip Montanaro  added the comment:

Try it at the help> prompt without the parens (you're not calling
it here, just asking for the documentation on the name "raw_input".

help> raw_input

Help on built-in function raw_input in module __builtin__:

raw_input(...)
raw_input([prompt]) -> string

Read a string from standard input.  The trailing newline is stripped.
If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise
EOFError.
On Unix, GNU readline is used if enabled.  The prompt string, if given,
is printed without a trailing newline before reading.

--
nosy: +skip.montanaro
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue6708] raw_input() calls generate compile errors.

2009-08-14 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

raw_input() has been renamed to input() in Python 3.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue6709] It's possible to create TryExcept with no handlers

2009-08-14 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
type:  -> behavior

___
Python tracker 

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



[issue6677] Place the term "delete" within the documentation for os.remove() and os.rmdir()

2009-08-14 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

If a change is make, 'remove (delete)' would be sufficient.

--
nosy: +tjreedy

___
Python tracker 

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



[issue6709] It's possible to create TryExcept with no handlers

2009-08-14 Thread Benjamin Peterson

New submission from Benjamin Peterson :

I think we might need to devise some way to add custom validation when
AST is being compiled. For example, you can also pass a level to
ImportFrom which is < -1.

>>> x = ast.parse("try: x\nexcept y: pass")
>>> del x.body[0].handlers[:]
>>> compile(x, "", "exec")
 at 0x7f0a92aed918, file "", line 1>
>>> from dis import dis
>>> dis(x)
>>> dis(compile(x, "", "exec"))
  1   0 SETUP_EXCEPT 8 (to 11)
  3 LOAD_NAME0 (x)
  6 POP_TOP
  7 POP_BLOCK
  8 JUMP_FORWARD 1 (to 12)
>>   11 END_FINALLY
>>   12 LOAD_CONST   0 (None)
 15 RETURN_VALUE

--
components: Extension Modules, Interpreter Core
messages: 91587
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: It's possible to create TryExcept with no handlers
versions: Python 2.5, 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



[issue1660179] functools.compose to chain functions together

2009-08-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I concur with Martin's reasons for closing the patch.

--

___
Python tracker 

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



[issue1660179] functools.compose to chain functions together

2009-08-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I concur with Martin's reasons for closing the patch.

--

___
Python tracker 

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



[issue6695] PyXXX_ClearFreeList for dict, set, and list

2009-08-14 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Does anyone here know why GC calls the free_xxx functions?  ISTM, they
cannot be involved in cycles.  Free lists are kept by container objects
to speed-up allocation.  Having GC call the free_xxx just slows down the
GC process and all the subsequent set/list/tuple allocations until the
free lists are built-up again.  IMO, the free_xxx functions should only
be called during atexit or by an explicit call from the user perhaps,
sys.clear_freelists() or somesuch.

--

___
Python tracker 

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



[issue2576] httplib read() very slow due to lack of socket buffer

2009-08-14 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Note that http://bugs.python.org/issue4879 may have already fixed this
problem in trunk r68532.

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



[issue2576] httplib read() very slow due to lack of socket buffer

2009-08-14 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

Okay, I do not think this has been fixed yet.  Anyone calling
getresponse() can indeed use buffering=True, it can mess things up if
the do not close the connection afterwards.

The addition of the sockbuf parameter to HTTPConnection as proposed in
buffered_socket.diff will work, but I'd follow the earlier work's lead.
 Don't expose it as the "sockbuf" integer.  Just use a boolean
"buffering" parameter that defaults to False.  When true, do the same
thing you do with sockbuf != 0.

I see little value in actually being able to specify the exact buffer
size used on the internal makefile on the HTTPConnection.  The default
will be sufficient.

If you still want the user to be able to control it, perhaps add a
HTTPConnection class attribute that defaults to -1
(socket.socket.makefile()'s bufsize default value) that you pass to
makefile.  Users can subclass HTTPConnection and give it a new value in
that case.  Personally I'd call that overkill.

--

___
Python tracker 

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



[issue6117] Fix O(n**2) performance problem in socket._fileobject

2009-08-14 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

backported to release26-maint in r74456.

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



[issue4879] Allow buffering for HTTPResponse

2009-08-14 Thread Gregory P. Smith

Gregory P. Smith  added the comment:

I believe there will be a problem with the patch committed in r68532. 
If getresponse(buffering=True) is called, extra data on the socket may
be consumed by the socket.makefile() buffer which will cause problems if
the connection is not closed immediately after this response.

I mentioned this in comments on http://bugs.python.org/issue2576 which
happens to have a way of fixing this already proposed as they are trying
to solve an almost identical issue to this without yet having seen this
issue.

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