[issue4356] Add "key" argument to "bisect" module functions

2010-08-29 Thread Sean Reifschneider

Sean Reifschneider  added the comment:

This issue came up on #python IRC, and that combined with the number of times 
this has been duplicated makes me think that maybe the mention of the 
SortedCollection recipe should be a little more prominent.

Perhaps either moved up by the method list, or something like: "Note: No key 
argument is available because of performance issues.  Please consider either 
the SortedCollection recipe or altering the objects comparison methods.

?  It just seems like it keeps coming up, and in this case came up after the 
recipe reference was added.

--
nosy: +jafo

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

>> A simple "IOError No such file or directory 'xxx'" exception would be
>> a lot more clear.
> Agreed, but the OpenSSL error reporting system looks too convoluted (or
> braindead) to easily allow such aliasing of errors. If you have an 
> idea, don't hesitate to share :)

The only idea which comes to mind is try to open() the file before calling 
load_cert_chain().
That would automatically also take care of permission errors, etc..
Not very clean, but... :-\

>> If possible, the error should be more clear about what happened.
>> Something like "malformed certfile was provided" or something.
> Same as above: the error message and numeric code come from OpenSSL, not
> from us.

No ideas here. I googled for some OpenSSL API to verify the certificate, which 
we can even possibly expose in ssl.py, but I couldn't find any. I guess we 
can't do nothing about this.

--

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
Removed message: http://bugs.python.org/msg115166

___
Python tracker 

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



[issue8266] tarfile library should support xz compression

2010-08-29 Thread Éric Araujo

Changes by Éric Araujo :


--
superseder:  -> please support lzma compression as an extension and in  the 
tarfile module

___
Python tracker 

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



[issue8075] Windows (Vista/7) install error when choosing to compile .py files

2010-08-29 Thread Andreas Schlapsi

Changes by Andreas Schlapsi :


--
nosy: +Andreas.Schlapsi

___
Python tracker 

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



[issue1225769] Proposal to implement comment rows in csv module

2010-08-29 Thread florian-rathgeber

Changes by florian-rathgeber :


--
nosy: +florian-rathgeber

___
Python tracker 

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



[issue1537721] csv module: add header row to DictWriter

2010-08-29 Thread florian-rathgeber

Changes by florian-rathgeber :


--
nosy: +florian-rathgeber

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> The only idea which comes to mind is try to open() the file before calling 
> load_cert_chain().
> That would automatically also take care of permission errors, etc..
> Not very clean, but... :-\

It's vulnerable to various issues such as race conditions (for example,
you open() the file while it still exists but it doesn't exist anymore
when OpenSSL opens it again).

A clean way to do this would be to use lower-level APIs such as
PEM_read_X509(), so that we can pass our own FILE* to OpenSSL. But it is
also much more code to write.

That said, have you checked the system errno at this point? Perhaps it
gives us enough information (if it hasn't been cleared by
OpenSSL... :/).

> No ideas here. I googled for some OpenSSL API to verify the
> certificate, which we can even possibly expose in ssl.py, but I
> couldn't find any.

I don't think that would change anything, since the verification APIs
would probably give you the exact same error message.

--

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-29 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file18671/Py_UNICODE_strcat.patch

___
Python tracker 

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



[issue9425] Rewrite import machinery to work with unicode paths

2010-08-29 Thread STINNER Victor

STINNER Victor  added the comment:

Py_UNICODE_strcat.patch: create Py_UNICODE_strcat() function.

Py_UNICODE_strdup.patch: create Py_UNICODE_strdup() function.

--
Added file: http://bugs.python.org/file18672/Py_UNICODE_strdup.patch

___
Python tracker 

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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2010-08-29 Thread Stefan Krah

New submission from Stefan Krah :

On Windows, the initfunc of a C extension is exported twice, as
seen here:

test_distutils
xxmodule.c
xxmodule.obj : warning LNK4197: export 'initxx' specified multiple times; using 
first specification


First export: pyport.h: #define PyMODINIT_FUNC __declspec(dllexport) void

Second export: Specified on the command line with /EXPORT

The code responsible for adding the initfunc name to ext.export_symbols
is in build_ext.py:get_export_symbols. I'm not sure if it could be
removed, since older extensions might not use PyMODINIT_FUNC.

If it can't be removed, perhaps PyMODINIT_FUNC could be specified
simply as void.

--
assignee: eric.araujo
components: Distutils, Distutils2
messages: 115181
nosy: brian.curtin, eric.araujo, skrah
priority: normal
severity: normal
stage: needs patch
status: open
title: test_distutils warning: initfunc exported twice on Windows
type: behavior
versions: 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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Fortunately errno was set.
Patch in attachment introduces the following changes:

=== 1 ===

Before:
>>> ssl.wrap_socket(socket.socket(), server_side=1)
>>>

Now:
>>> ssl.wrap_socket(socket.socket(), server_side=1)
ValueError: certfile must be specified for server-side operations


=== 2 ===

Before:
>>> s = ssl.wrap_socket(socket.socket(), server_side=1, 
>>> certfile='Lib/test/keycert.pem')
>>> s.connect(('blogger.com', 443))
>>>

Now:
>>> s = ssl.wrap_socket(socket.socket(), server_side=1, 
>>> certfile='Lib/test/keycert.pem')
>>> s.connect(('blogger.com', 443))
ValueError: can't connect in server-side mode


=== 3 ===

Before:
>>> os.path.exists('xxx')
False
>>> ssl.wrap_socket(socket.socket(), certfile='xxx')
ssl.SSLError: [Errno 336445442] _ssl.c:1604: error:140DC002:SSL 
routines:SSL_CTX_use_certificate_chain_file:system lib

Now:
>>> os.path.exists('xxx')
False
>>> ssl.wrap_socket(socket.socket(), certfile='xxx')
IOError: [Errno 2] No such file or directory


=== 4 ===

Before:
>>> os.path.exists('xxx')
False
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
>>> ctx.load_verify_locations('xxx')
ssl.SSLError: [Errno 185090050] _ssl.c:1676: error:0B084002:x509 certificate 
routines:X509_load_cert_crl_file:system lib

Now:
>>> os.path.exists('xxx')
False
>>> ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
>>> ctx.load_verify_locations('xxx')
IOError: [Errno 2] No such file or directory

--
keywords: +patch
Added file: http://bugs.python.org/file18673/ssl-errors.patch

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

>>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
>>> ctx.wrap_socket(socket.socket(), server_side=1)

>>> 

I'm not sure how to raise ValueError("certfile must be specified") here as 
SSLContext class doesn't store certfile information, at least at Python level. 
Any hint?

--

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> >>> ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
> >>> ctx.wrap_socket(socket.socket(), server_side=1)
> 
> >>> 
> 
> I'm not sure how to raise ValueError("certfile must be specified")
> here as SSLContext class doesn't store certfile information, at least
> at Python level. Any hint?

Actually, you shouldn't raise the error, since the certfile can be
specified after wrapping the socket.

--

___
Python tracker 

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2010-08-29 Thread David Watson

David Watson  added the comment:

OK, I still think this issue should be addressed, but here is a patch for the 
part we agree on: that decoding should not return any Unicode characters except 
ASCII.

--
Added file: http://bugs.python.org/file18674/decode-strict-ascii.diff

___
Python tracker 

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2010-08-29 Thread David Watson

David Watson  added the comment:

The rest of the issue could also be straightforwardly addressed by adding bytes 
versions of the name lookup APIs.  Attaching a patch which does that (applies 
on top of decode-strict-ascii.diff).

--
Added file: http://bugs.python.org/file18675/hostname-bytes-apis.diff

___
Python tracker 

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2010-08-29 Thread David Watson

Changes by David Watson :


Removed file: http://bugs.python.org/file18675/hostname-bytes-apis.diff

___
Python tracker 

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



[issue9377] socket, PEP 383: Mishandling of non-ASCII bytes in host/domain names

2010-08-29 Thread David Watson

David Watson  added the comment:

Oops, forgot to refresh the last change into that patch.  This should fix it.

--
Added file: http://bugs.python.org/file18676/hostname-bytes-apis.diff

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

@Antoine: ok, thanks.

This is now committed in r84352. See also r84351 which raises ValueError if 
non-zero flag argument is provided for sendall().
http://bugs.python.org/msg115166 was the original message at the top of this 
discussion which I accidentally removed.

--
assignee:  -> giampaolo.rodola
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue4356] Add "key" argument to "bisect" module functions

2010-08-29 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

> maybe the mention of the SortedCollection recipe should 
> be a little more prominent.

Thanks for the suggestion.  Will look at moving the note higher on the page.

--
components: +Documentation -Library (Lib)
status: closed -> open

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> @Antoine: ok, thanks.
> 
> This is now committed in r84352.

I don't think it's ok to test for the IOError message ("No such file"),
because it comes from the OS and can therefore change from platform to
platform. Instead, you should check the value of the "errno" attribute
on the IOError objects.

Also:

+except IOError as x:
+if support.verbose:
+sys.stdout.write("\nsocket.error is %s\n" % str(x))

The message should be changed (IOError instead of socket.error).

--

___
Python tracker 

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



[issue9710] 2to3 could remove "-*- coding: utf-8 -*-"

2010-08-29 Thread Florent Xicluna

New submission from Florent Xicluna :

According to PEP8, "Files using ASCII (or UTF-8, for Python 3.0) should not 
have a coding cookie."

--
components: 2to3 (2.x to 3.0 conversion tool)
messages: 115191
nosy: flox
priority: normal
severity: normal
status: open
title: 2to3 could remove "-*- coding: utf-8 -*-"
type: feature request

___
Python tracker 

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



[issue9710] 2to3 could remove "-*- coding: utf-8 -*-"

2010-08-29 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

They're also harmless.

--
nosy: +benjamin.peterson
priority: normal -> low

___
Python tracker 

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



[issue9710] 2to3 could remove "-*- coding: utf-8 -*-"

2010-08-29 Thread Georg Brandl

Georg Brandl  added the comment:

Hmm, actually I don't see a rationale for this, even if it doesn't give Python 
any useful information, it serves that purpose for editors.

--
nosy: +georg.brandl
resolution:  -> 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



[issue9709] test_distutils warning: initfunc exported twice on Windows

2010-08-29 Thread Stefan Krah

Stefan Krah  added the comment:

Tarek, I forgot to add you, sorry. I was thinking mainly about distutils,
not distutils2.

--
nosy: +tarek

___
Python tracker 

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



[issue9711] ssl.SSLSocket's keyfile argument seems to be ignored if specified without certfile

2010-08-29 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola' :

By taking a look at ssl.py it seems that keyfile argument is ignored if 
certfile argument is not specified as well.
Here's an extract of ssl.py code:

class SSLSocket:

def __init__(self, sock=None, keyfile=None, certfile=None,
 server_side=False, cert_reqs=CERT_NONE,
 ssl_version=PROTOCOL_SSLv23, ca_certs=None,
 do_handshake_on_connect=True,
 family=AF_INET, type=SOCK_STREAM, proto=0, fileno=None,
 suppress_ragged_eofs=True, ciphers=None,
 _context=None):
[...]
if certfile and not keyfile:
keyfile = certfile
[...]
if certfile:
self.context.load_cert_chain(certfile, keyfile)

So at the current stage this:

>>> ssl.wrap_socket(socket.socket(), keyfile="XXX")


...would be equal to:

>>> ssl.wrap_socket(socket.socket())



To me this leads to one question: are there circumstances in which it makes 
sense to specify "keyfile" and *not* "certfile"?
As far as I know, on server-side it is always required to specify *at least* 
certfile argument, in which case this would represent a bug.
Not sure about client-side sockets.

--
messages: 115195
nosy: exarkun, giampaolo.rodola, janssen, pitrou
priority: normal
severity: normal
status: open
title: ssl.SSLSocket's keyfile argument seems to be ignored if specified 
without certfile

___
Python tracker 

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



[issue9706] ssl errors checking

2010-08-29 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

You're right. Committed in r84355.

--

___
Python tracker 

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



[issue9683] Dead code in py3k inspect module

2010-08-29 Thread Georg Brandl

Changes by Georg Brandl :


--
assignee:  -> georg.brandl
nosy: +georg.brandl
resolution:  -> accepted

___
Python tracker 

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



[issue2830] Copy cgi.escape() to html

2010-08-29 Thread Pablo Mouzo

Pablo Mouzo  added the comment:

I'm attaching a new patch with the documentation updated.

I agree with Georg that it'd be better to escape everything by default. Are 
there any good reasons not to?

--
Added file: http://bugs.python.org/file18677/issue2830.diff

___
Python tracker 

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



[issue2830] Copy cgi.escape() to html

2010-08-29 Thread Pablo Mouzo

Changes by Pablo Mouzo :


Removed file: http://bugs.python.org/file18667/issue2830.diff

___
Python tracker 

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



[issue7877] Iterators over _winreg EnumKey and EnumValue results

2010-08-29 Thread Brian Curtin

Changes by Brian Curtin :


--
assignee:  -> brian.curtin
components: +Extension Modules -Library (Lib)
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



[issue1625] bz2.BZ2File doesn't support multiple streams

2010-08-29 Thread Oliver Deppert

Oliver Deppert  added the comment:

Dear all,

first of all, thank you for the patch making multiple file-streams in bz2 
available in python. Yesterday, I've tried to adapt the recent patch for python 
3k to the actual python 2.7. Most of the hunks could be easy adapted by editing 
just one ore two things concerning the different file-layout between p3k and 
python 2.7.

Unfortunatelly it wasn't possible for me to completly downgrade this patch to 
python 2.7. Especially the last hunk in the patch and also the hunks which are 
related to self->rawfp couldn't be adapted succesfully by me.

Could anybody assist me to make this patch available for python 2.7 or does a 
patch for this python version already exist?

If you like, I can upload my recent changes in this patch for further 
investigation.

Thank you!

best regards,
Oliver Deppert

--
nosy: +Kontr-Olli

___
Python tracker 

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



[issue9703] default param values

2010-08-29 Thread vladimir

vladimir  added the comment:

On Sat, Aug 28, 2010 at 10:24 PM, Benjamin Peterson
wrote:

>
> Benjamin Peterson  added the comment:
>
> Rest assured: it's expected behavior.
>
> Thank you for your cooperation.

--
Added file: http://bugs.python.org/file18678/unnamed

___
Python tracker 

___On Sat, Aug 28, 2010 at 10:24 PM, Benjamin 
Peterson rep...@bugs.python.org> 
wrote:

Benjamin Peterson benja...@python.org> added the 
comment:

Rest assured: it's expected behavior.

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



[issue9703] default param values

2010-08-29 Thread Éric Araujo

Changes by Éric Araujo :


Removed file: http://bugs.python.org/file18668/unnamed

___
Python tracker 

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



[issue9703] default param values

2010-08-29 Thread Éric Araujo

Changes by Éric Araujo :


Removed file: http://bugs.python.org/file18678/unnamed

___
Python tracker 

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



[issue8668] add a 'develop' command

2010-08-29 Thread Éric Araujo

Éric Araujo  added the comment:

One part of develop that we could add is the creation of a .pth file in a 
directory on sys.path (with Python >= 2.6, --user gives that for free). IMNSHO, 
this should be implemented as an option to the install_lib* command, named 
--link-only or something better.

*(Not install, since .pth does not handle scripts, headers or data. The purpose 
of this command/option is to make modules and packages importable, more would 
be trickier.)

(“pythonx.y setup.py install_lib --user --link-only” is long, I agree. This 
problem is solved with copy/paste, shell history, shell function, or we could 
steal the aliases system from setuptools.)

I have a suspicion the install command (or a subcommand) already has most of 
what it takes to do this. I’m still trying to understand the extra_path 
argument (#901727), which may or may not give us 90% of what’s needed to 
implement this feature.

--
nosy: +alexis

___
Python tracker 

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