[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 23.06.2013 22:43, Alexander Belopolsky wrote:
> 
> Alexander Belopolsky added the comment:
> 
> unicodedata.name() was discussed in #12353 (msg144739) where MvL argued that 
> misspelled names are better than corrected because they are more likely to 
> appear misspelled in other sources.  I am not sure I buy this argument.  
> Someone googling for 'BYZANTINE MUSICAL SYMBOL FHTORA SKLIRON CHROMA VASIS' 
> will probably just enter BYZANTINE VASIS and find what he or she needs.  A 
> more likely scenario is someone trying to get all FTHORA symbols using a 
> naive code like this: [hex(i) for i in range(1114112) if 'FTHORA' in 
> ud.name(chr(i), '')].
> 
> Even more likely scenario is someone seeing a fancy symbol on the web and 
> wanting to use it in a python program.  Such programmer would copy the symbol 
> to python prompt, call unicode.name() and copy the result in the program.  Do 
> we want to encourage people to perpetuate the mistake that Unicode has 
> corrected?
> 
> I don't think the issue of control codes names was discussed in #12353.  I 
> see no downside with returning the first alias in case no name is present.

We should stick to the rules. Please leave the function as it
is, i.e. a 1-1 mapping to the official, non-changing Unicode
name reference (including spelling errors, etc). Same with
code points that have no name.

If you want to expose the aliases, you can do so in a new
function, say .aliases() which then returns the list of
aliases of a character (including the original name,
if available).

If we change the return values of .name() to whatever we think
would be more usable, we'd be modifying how Python programmers
see the Unicode database. That's not the purpose of the module.

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Perhaps unicodedata.aliases() should return not a list, but an ordered dict.

What name should use the "namereplace" error handler? Original or corrected? 
Should it use first alias if there is no original name?

--

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 00:00, Jeffrey Armstrong wrote:
> 
> Jeffrey Armstrong added the comment:
> 
>> ...the fact that this issue has been open for almost 2 years is quite 
>> ridiculous.
> 
> I thought that I'd add a little statistic for everyone that might put this 
> bug into perspective.  Since this bug was opened, the MinGW installer has 
> been downloaded about 32,000,000 (32 million) times per sf.net:
> 
> http://sourceforge.net/projects/mingw/files/Installer/stats/timeline?dates=2011-07-26+to+2013-06-23
> 
> If we take a naive approach, that's 32 million compiler installations that 
> can't build Python extensions without manually modifying distutils first.  
> 
> That statistic doesn't include the multitude of people installing other 
> builds of GCC for Windows (including MinGW-W64, a whole other unsupported 
> version of GCC, but that's a different bug).

Could someone perhaps produce a single final patch file which can
be applied to Python 2.7 and 3.2+ ?

It is not clear at the moment which of all those patches on the ticket
should be applied.

--
nosy: +lemburg

___
Python tracker 

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



[issue18290] json encoder does not support JSONP/JavaScript safe escaping

2013-06-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +ezio.melotti, pitrou, rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue18236] str.isspace should use the Unicode White_Space property

2013-06-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue4610] Unicode case mappings are incorrect

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 00:52, Alexander Belopolsky wrote:
> 
> Alexander Belopolsky added the comment:
> 
> There has been a relatively recent discussion of case mappings under #12753 
> (msg144836).
> 
> I personally agree with Martin: str.upper/lower should remain the way it is - 
> a simplistic 1-to-1 mapping using UnicodeData.txt fields.  More sophisticated 
> case mapping algorithms belong to a specialized library module not python 
> core.
> 
> The behavior of .title() and .capitalize() is harder to defend, so if someone 
> can point out to a python library (PyICU?) that gets it right we can 
> reference it in the documentation.

.title() and .capitalize() are 1-1 mappings as well. Python only supports
"Simple Case Operations" and does not support "Full Case Operations"
which require parsing context (SpecialCasing.txt).

ICU does provide support for both:
http://userguide.icu-project.org/transforms/casemappings

PyICU wraps ICU, but it is not clear to me how you'd access those
mappings (the package doesn't provide dcoumentation on the API, instead
just gives a description of how to map the C++ API to a Python one):
https://pypi.python.org/pypi/PyICU

--

___
Python tracker 

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



[issue9369] const char* for PyObject_CallMethod and PyObject_CallFunction

2013-06-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
status: open -> closed

___
Python tracker 

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-06-24 Thread Jason R. Coombs

Changes by Jason R. Coombs :


--
nosy: +jason.coombs

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 10:05, Serhiy Storchaka wrote:
> 
> Serhiy Storchaka added the comment:
> 
> Perhaps unicodedata.aliases() should return not a list, but an ordered dict.
> 
> What name should use the "namereplace" error handler? Original or corrected? 
> Should it use first alias if there is no original name?

For compatibility with other tools, it should use .name(), not .aliases()
to determine the name. Please note that the aliases are not the official
Unicode names of the code points.

--

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Jeremy Kloth

Jeremy Kloth added the comment:

At least in a debug build, the MSVC 64-bit compiler seems to allocate space for 
each unique variable declared in the function body.  Therefore, by changing the 
temporary variables to be named identically, the amount of required space is 
minimized.

The refactoring of Py_DECREF is needed to prevent an error for local variable 
defined before use when Py_DECREF is nested within another macro already 
defining _py_tmp (it would expand to roughly PyObject *_py_tmp = _py_tmp).

--

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-06-24 Thread Oscar Benjamin

Oscar Benjamin added the comment:

On 24 June 2013 09:07, Marc-Andre Lemburg  wrote:
>
> Could someone perhaps produce a single final patch file which can
> be applied to Python 2.7 and 3.2+ ?

I've attached two patches "check_mno_cywin_py27.patch" for Python 2.7
and "check_mno_cywin_py3.patch" for Python 3.2 and 3.3. The changes
are identical but the 2.7 patch didn't apply cleanly against 3.x. I'll
upload the files used to test the patches in "test_mno_cygwin.tar.gz".

The patches are as I described previously and check the output of 'gcc
-dumpmachine' to see if the gcc on PATH is from cygwin. With the patch
'-mno-cygwin' will be passed if gcc version < 4 or the gcc is from
cygwin. Otherwise it will not be passed.

I've tested with versions:
Python 2.7.5, 3.2.5 and 3.3.2
MinGW gcc 4.7.2
Cygwin gcc 3.4.4 and 4.5.3

The results of the patch are the same for all versions of Python tested:
Cygwin gcc 3.x - still works
Cygwin gcc 4.x - still doesn't work (same error message)
MinGW gcc 4.7  - fixed after the patch

This patch does not attempt to add support for the newer (gcc 4.x)
Cygwin cross-compilers. I have experimented with what it would take to
have those work and it is something like:

if is_cygwingcc() and version >= 4:
platform = platform_map[get_platform()]
use platform + '-pc-cygwin-gcc' as gcc
use platform + '-pc-cygwin-g++' as g++
etc.

Then there would also need to modifications to the linker settings to
fix the problem that Martin mentioned (a long way above) that it would
link against the wrong MSVC runtime. I started writing the patch to do
these things as well as fix MinGW support and it became more and more
of a mess. I don't think that distutils should be trying to guess
whether or not people intended to use the Cygwin cross-compilers. If
these are to be supported then they should have a new
--compiler=cygwin-cross and a separate subclass of CygwinCCompiler to
avoid more issues like this one arising in the future.

Oscar

--
Added file: http://bugs.python.org/file30681/check_mno_cywin_py27.patch
Added file: http://bugs.python.org/file30682/check_mno_cywin_py3.patch

___
Python tracker 

___diff -r a7db9f505e88 Lib/distutils/cygwinccompiler.py
--- a/Lib/distutils/cygwinccompiler.py  Sun Jun 23 16:12:32 2013 -0400
+++ b/Lib/distutils/cygwinccompiler.py  Mon Jun 24 12:03:15 2013 +0100
@@ -319,13 +319,18 @@
 else:
 entry_point = ''
 
-self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
- compiler_so='gcc -mno-cygwin -mdll -O -Wall',
- compiler_cxx='g++ -mno-cygwin -O -Wall',
- linker_exe='gcc -mno-cygwin',
- linker_so='%s -mno-cygwin %s %s'
-% (self.linker_dll, shared_option,
-   entry_point))
+if self.gcc_version < '4' or is_cygwingcc():
+no_cygwin = ' -mno-cygwin'
+else:
+no_cygwin = ''
+
+self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
+ compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
+ compiler_cxx='g++%s -O -Wall' % no_cygwin,
+ linker_exe='gcc%s' % no_cygwin,
+ linker_so='%s%s %s %s'
+% (self.linker_dll, no_cygwin,
+   shared_option, entry_point))
 # Maybe we should also append -mthreads, but then the finished
 # dlls need another dll (mingwm10.dll see Mingw32 docs)
 # (-mthreads: Support thread-safe exception handling on `Mingw32')
@@ -447,3 +452,16 @@
 else:
 dllwrap_version = None
 return (gcc_version, ld_version, dllwrap_version)
+
+
+def is_cygwingcc():
+'''Try to determine if the gcc that would be used is from cygwin.'''
+from subprocess import Popen, PIPE
+out = Popen(['gcc', '-dumpmachine'], shell=True, stdout=PIPE).stdout
+try:
+out_string = out.read()
+finally:
+out.close()
+# out_string is the target triplet cpu-vendor-os
+# Cygwin's gcc sets the os to 'cygwin'
+return out_string.strip().endswith('cygwin')
diff -r b9b521efeba3 Lib/distutils/cygwinccompiler.py
--- a/Lib/distutils/cygwinccompiler.py  Sat May 18 17:56:42 2013 +0200
+++ b/Lib/distutils/cygwinccompiler.py  Mon Jun 24 12:20:07 2013 +0100
@@ -291,13 +291,18 @@
 else:
 entry_point = ''
 
-self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
- compiler_so='gcc -mno-cygwin -mdll -O -Wall',
- compiler_cxx='g++ -mno-cygwin -O -Wall',
- linker_exe='gcc -mno-cygwin',
- linker_so='%s -mno-cygwin %s %s'
-

[issue12641] Remove -mno-cygwin from distutils

2013-06-24 Thread Oscar Benjamin

Changes by Oscar Benjamin :


Added file: http://bugs.python.org/file30683/test_mno_cygwin.tar.gz

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2013-06-24 Thread Nick Coghlan

Nick Coghlan added the comment:

Since this question just came up on python-ideas again, here's a summary of the 
current status:

1. The current patch is known to be outdated due to the inclusion of PEP 380 in 
Python 3.3 ("yield from itr" eliminates any need for "yield *itr")

2. Since this is a syntax change, a PEP is needed to elaborate on the exact 
details of what will be added (see PEP 3132 as an example of a PEP that covered 
a similar change for assignment *targets*)

--

___
Python tracker 

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

The fix is trivial: 

- define VARIANT_FALSE and VARIANT_BOOL according to specs
- enable 'v' on non-Windows systems
- enable tests for vbool

Done

--
keywords: +patch
nosy: +christian.heimes
Added file: http://bugs.python.org/file30684/16396_vbool.patch

___
Python tracker 

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



[issue12641] Remove -mno-cygwin from distutils

2013-06-24 Thread Oscar Benjamin

Oscar Benjamin added the comment:

On 24 June 2013 12:53, Oscar Benjamin  wrote:
> The changes
> are identical but the 2.7 patch didn't apply cleanly against 3.x. I'll
> upload the files used to test the patches in "test_mno_cygwin.tar.gz".

Correction: the patches are not quite identical as the py3 patch
decodes the output of the subprocess as ascii.

--

___
Python tracker 

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



[issue18240] hmac unnecessarily restricts input to "bytes"

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Your account hasn't been flagged yet. I'm going to ping the person in charge.

--

___
Python tracker 

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



[issue16595] Add resource.prlimit

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Updated patch, now raises PermissionError on EPERM.

--
Added file: http://bugs.python.org/file30685/prlimit2.patch

___
Python tracker 

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



[issue18291] codecs.open interprets space as line ends

2013-06-24 Thread Paul

New submission from Paul:

I hope I am writing in the right place.

When using codecs.open with UTF-8 encoding, it seems characters \x12, \x13, and 
\x14 are interpreted as end-of-line.

Example code:

>>> with open('unicodetest.txt', 'w') as f:
>>>   f.write('a'+chr(28)+'b'+chr(29)+'c'+chr(30)+'d'+chr(31)+'e')
>>> with open('unicodetest.txt', 'r') as f:
>>>   for i,l in enumerate(f):
>>> print i, l
0 a\x12b\x13c\x14d\x15e

The point here is that it reads it as one line, as I would expect. But using 
codecs.open with UTF-8 encoding it reads it as many lines:

>>> import codecs
>>> with codecs.open('unicodetest.txt', 'r', 'UTF-8') as f:
>>>   for i,l in enumerate(f):
>>> print i, l
0 a\x12
1 b\x13
2 c\x14
3 d\x15e

The characters \x12 through \x15 are described as "Information Separator Four" 
through "One" (in that order). As far as I can see they never mark line ends. 
Also interestingly, \x15 isn't interpreted as such.

As a sidenote, I tested and verified that io.open is correct (but when reading 
loads of data it appears to be 5 times slower than codecs):

>>> import io
>>> with io.open('unicodetest.txt', encoding='UTF-8') as f:
>>>   for i,l in enumerate(f):
>>> print i, l
0 a\x12b\x13c\x14d\x15e

--
components: IO, Unicode
messages: 191758
nosy: ezio.melotti, wpk
priority: normal
severity: normal
status: open
title: codecs.open interprets space as line ends
type: behavior
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



[issue16595] Add resource.prlimit

2013-06-24 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: http://bugs.python.org/file28184/prlimit.patch

___
Python tracker 

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



[issue1763] Winpath module - easy access to Windows directories like My Documents

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Oh my, this patch is rather ancient. Is this feature still of interest? I'm 
happy to port it from 2.6 to 3.4.

--
status: languishing -> open
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue1542] Ship 32 and 64bit libs with MSI installer

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Nobody has shown interest in this ticket in more than five years. I'm closing 
it.

--
status: open -> closed
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue1953] Compact int and float freelists

2013-06-24 Thread Christian Heimes

Changes by Christian Heimes :


--
status: open -> closed

___
Python tracker 

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



[issue18277] Queue is empty right after put from the same process/thread

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8dcc4e017d42 by Richard Oudkerk in branch '2.7':
Issue #18277: Document quirks of multiprocessing queue.
http://hg.python.org/cpython/rev/8dcc4e017d42

New changeset 0f921e73433a by Richard Oudkerk in branch '3.3':
Issue #18277: Document quirks of multiprocessing queue.
http://hg.python.org/cpython/rev/0f921e73433a

New changeset 06b1447becdc by Richard Oudkerk in branch 'default':
Issue #18277: Merge.
http://hg.python.org/cpython/rev/06b1447becdc

--
nosy: +python-dev

___
Python tracker 

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



[issue18143] ssl.get_default_verify_paths()

2013-06-24 Thread Christian Heimes

Changes by Christian Heimes :


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

___
Python tracker 

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



[issue16396] Importing ctypes.wintypes on Linux gives a traceback

2013-06-24 Thread Jason R. Coombs

Jason R. Coombs added the comment:

Looks good to me. Ben, any objections to applying this to 2.7?

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue18277] Queue is empty right after put from the same process/thread

2013-06-24 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> I did this to use the same abstraction that was used extensively for 
> other purposes, instead of recreating the same abstraction with a deque 
> as its basis. 

So you wanted a FIFO queue and preferred the API of Queue to that of deque?  
Well it will be *much* less efficient.  queue.Queue is also less efficient, but 
not by such a wide margin.

I have added a documentation note.

--

___
Python tracker 

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



[issue4558] ./configure --with-stdc89 to test ANSI C conformity

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Updated patch for Python 3.4.

The feature is still useful. For example I found a bug in pymacro.h and fixed 
it in r84306.

--
title: with_stdc89 -> ./configure --with-stdc89 to test ANSI C conformity
versions: +Python 3.3, Python 3.4 -Python 3.2
Added file: http://bugs.python.org/file30686/with_stdc89_3.patch

___
Python tracker 

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



[issue4558] ./configure --with-stdc89 to test ANSI C conformity

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Make that r6915dfddb3f6

--
Added file: http://bugs.python.org/file30687/with_stdc89_3.patch

___
Python tracker 

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



[issue1763] Winpath module - easy access to Windows directories like My Documents

2013-06-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also PyXDG (http://freedesktop.org/wiki/Software/pyxdg/) and winpaths 
(http://ginstrom.com/code/winpaths.html).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue7292] Multiprocessing Joinable race condition?

2013-06-24 Thread Richard Oudkerk

Richard Oudkerk added the comment:

unfinished_tasks is simply used as a counter.  It is only accessed while 
holding self._cond.  If you get this error then I think the error text is 
correct -- your progam calls task_done() to many times.

The proposed patch silences the sanity check by making it block for a while 
instead.  The fact the program seems to work without deadlocking does not mean 
the program or the patch is correct.

Without more information I will close this.

--
status: open -> pending

___
Python tracker 

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



[issue17791] PC/pyconfig.h defines PREFIX macro

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

It looks like we can drop PREFIX and EXEC_PREFIX from PC/pyconfig.h all along. 
Only Modules/getpath.c uses PREFIX and EXEC_PREFIX but MSVC build use 
PC/getpathp.c instead of Modules/getpath.c

--

___
Python tracker 

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



[issue18291] codecs.open interprets space as line ends

2013-06-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please provide an example which exposes slowness of io.open() by 
comparison with codecs.open().

--
nosy: +belopolsky, doerwalter, haypo, lemburg, serhiy.storchaka
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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

MAL> Please leave the function as it is, i.e. a 1-1 mapping to the
MAL> official, non-changing Unicode name reference (including
MAL> spelling errors, etc). Same with code points that have no name.

Since we have code points with no name - it is not 1-1 mapping but 1 to 0 or 1.

Unicode Standard recommends using "Code Point Labels" "To provide unique, 
meaningful labels for code points that do not have character names." (Section 
4.9.)

These labels are not very useful:

Control: control-
Reserved: reserved-
Noncharacter: noncharacter-
Private-Use: private-use-
Surrogate: surrogate-

According to the description in NameAliases.txt:

# The formal name aliases are part of the Unicode character namespace, which
# includes the character names and the names of named character sequences.

I believe this means that formal name aliases are as official as the character 
names.

If we don't change the default, what is the downside in adding an optional type 
argument to unicodedata.name()?  After all, according to the standard, aliases 
*are* names, just a different *type* of names.

--

___
Python tracker 

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



[issue15818] multiprocessing documentation of Process.exitcode

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f50bbae95bc8 by Richard Oudkerk in branch '2.7':
Issue #15818: Typo in docs.
http://hg.python.org/cpython/rev/f50bbae95bc8

New changeset 3a5e2f1dce5c by Richard Oudkerk in branch '3.3':
Issue #15818: Typo in docs.
http://hg.python.org/cpython/rev/3a5e2f1dce5c

New changeset 4f08d4647f75 by Richard Oudkerk in branch 'default':
Issue #15818: Merge.
http://hg.python.org/cpython/rev/4f08d4647f75

--
nosy: +python-dev

___
Python tracker 

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



[issue15818] multiprocessing documentation of Process.exitcode

2013-06-24 Thread Richard Oudkerk

Changes by Richard Oudkerk :


--
resolution:  -> fixed
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



[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Brett Cannon

Brett Cannon added the comment:

Import manages the lock, not loaders.

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 16:35, Alexander Belopolsky wrote:
> 
> Alexander Belopolsky added the comment:
> 
> MAL> Please leave the function as it is, i.e. a 1-1 mapping to the
> MAL> official, non-changing Unicode name reference (including
> MAL> spelling errors, etc). Same with code points that have no name.
> 
> Since we have code points with no name - it is not 1-1 mapping but 1 to 0 or 
> 1.

True, it's not 1-1 in the mathematical sense (bijective), only surjective.
However, it is 1-1 for all code points which have a name assigned.

> Unicode Standard recommends using "Code Point Labels" "To provide unique, 
> meaningful labels for code points that do not have character names." (Section 
> 4.9.)
> 
> These labels are not very useful:
> 
> Control: control-
> Reserved: reserved-
> Noncharacter: noncharacter-
> Private-Use: private-use-
> Surrogate: surrogate-

I don't any advantage of using these over plain \u codes.

> According to the description in NameAliases.txt:
> 
> # The formal name aliases are part of the Unicode character namespace, which
> # includes the character names and the names of named character sequences.
> 
> I believe this means that formal name aliases are as official as the 
> character names.

Yes, but they are official aliases, not official code point names :-)

> If we don't change the default, what is the downside in adding an optional 
> type argument to unicodedata.name()?  After all, according to the standard, 
> aliases *are* names, just a different *type* of names.

The .aliases() function would have to return a list, not a single
name, so a parameter would cause the return type to change, which
is not a good idea.

A new function also makes the origin of these names clear to the
user.

--

___
Python tracker 

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



[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I was thinking about the line

  self.__dict__.update(state)

overwriting new data with stale data.

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Here is an example of "prior art" that is relevant to this discussion:

"""
charnames::viacode(code)
..
As mentioned above under ALIASES, Unicode 6.1 defines extra names (synonyms or 
aliases) for some code points, most of which were already available as Perl 
extensions. All these are accepted by \N{...} and the other functions in this 
module, but viacode has to choose which one name to return for a given input 
code point, so it returns the "best" name. To understand how this works, it is 
helpful to know more about the Unicode name properties. All code points 
actually have only a single name, which (starting in Unicode 2.0) can never 
change once a character has been assigned to the code point. But mistakes have 
been made in assigning names, for example sometimes a clerical error was made 
during the publishing of the Standard which caused words to be misspelled, and 
there was no way to correct those. The Name_Alias property was eventually 
created to handle these situations. If a name was wrong, a corrected synonym 
would be published for it, using Name_Alias. viacode will return that corr
 ected synonym as the "best" name for a code point. (It is even possible, 
though it hasn't happened yet, that the correction itself will need to be 
corrected, and so another Name_Alias can be created for that code point; 
viacode will return the most recent correction.)

The Unicode name for each of the control characters (such as LINE FEED) is the 
empty string. However almost all had names assigned by other standards, such as 
the ASCII Standard, or were in common use. viacode returns these names as the 
"best" ones available. Unicode 6.1 has created Name_Aliases for each of them, 
including alternate names, like NEW LINE. viacode uses the original name, "LINE 
FEED" in preference to the alternate. Similarly the name returned for U+FEFF is 
"ZERO WIDTH NO-BREAK SPACE", not "BYTE ORDER MARK".
""" 

If .name() cannot be touched, what about implementing .bestname() with the 
above semantics?

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 16:58, Alexander Belopolsky wrote:
> 
> Alexander Belopolsky added the comment:
> 
> Here is an example of "prior art" that is relevant to this discussion:
> 
> """
> charnames::viacode(code)
> ..
> As mentioned above under ALIASES, Unicode 6.1 defines extra names (synonyms 
> or aliases) for some code points, most of which were already available as 
> Perl extensions. All these are accepted by \N{...} and the other functions in 
> this module, but viacode has to choose which one name to return for a given 
> input code point, so it returns the "best" name. To understand how this 
> works, it is helpful to know more about the Unicode name properties. All code 
> points actually have only a single name, which (starting in Unicode 2.0) can 
> never change once a character has been assigned to the code point. But 
> mistakes have been made in assigning names, for example sometimes a clerical 
> error was made during the publishing of the Standard which caused words to be 
> misspelled, and there was no way to correct those. The Name_Alias property 
> was eventually created to handle these situations. If a name was wrong, a 
> corrected synonym would be published for it, using Name_Alias. viacode will 
> return
  t
>  hat corr
>  ected synonym as the "best" name for a code point. (It is even possible, 
> though it hasn't happened yet, that the correction itself will need to be 
> corrected, and so another Name_Alias can be created for that code point; 
> viacode will return the most recent correction.)
> 
> The Unicode name for each of the control characters (such as LINE FEED) is 
> the empty string. However almost all had names assigned by other standards, 
> such as the ASCII Standard, or were in common use. viacode returns these 
> names as the "best" ones available. Unicode 6.1 has created Name_Aliases for 
> each of them, including alternate names, like NEW LINE. viacode uses the 
> original name, "LINE FEED" in preference to the alternate. Similarly the name 
> returned for U+FEFF is "ZERO WIDTH NO-BREAK SPACE", not "BYTE ORDER MARK".
> """ 
> 
> If .name() cannot be touched, what about implementing .bestname() with the 
> above semantics?

I think it's better to let the programmer decide what the "best"
name should be, e.g. some people will like ESC better than ESCAPE or
\u001b or \x1b.

unicodedata only provides neutral access to what's in the Unicode database.
It doesn't make any decisions on what's good or bad ;-)

--

___
Python tracker 

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



[issue18291] codecs.open interprets space as line ends

2013-06-24 Thread Paul

Paul added the comment:

Sorry for bringing that up as I suppose it is unrelated to the bug I am 
reporting, but you can an example file attached with timings.

--
Added file: http://bugs.python.org/file30688/codecs-io-example.py

___
Python tracker 

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



[issue17621] Create a lazy import loader mixin

2013-06-24 Thread Brett Cannon

Brett Cannon added the comment:

It still falls under the purview of import to manage that lock. It's just the 
design of the API from PEP 302. Otherwise it's just like any other reload.

--

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

We've "fixed" this debug-problem in other cases simply by skipping the test in 
question on debug builds.

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

> The .aliases() function would have to return a list, not a single
> name, so a parameter would cause the return type to change, which
> is not a good idea.

You misunderstood my proposal.  .name() will still return a single name, but 
the type parameter will control which name to return:

name(ch[, 
type=(None|'correction'|'control'|'alternate'|'figment'|'abbreviation')])

None - default, same as current behavior.

correction - indicates that the returned name is a corrected form for the 
original name (which remains valid) for the same code point.

control - return a new name added for a control character.

alternate - return an alternate name for a character

figment - return a name for a character that has been documented but was never 
in any actual standard.

abbreviation - return a common abbreviation for a character

--

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Martin v . Löwis

Martin v. Löwis added the comment:

But some of these types could still have lists as values, no?

--

___
Python tracker 

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



[issue18277] Queue is empty right after put from the same process/thread

2013-06-24 Thread shwouchk

shwouchk added the comment:

I agree it might be less efficient, but sometimes it is the price to pay for 
greater generality/simplicity. After all, If I *really* wanted efficiency 
perhaps I would have written everything in C++.

Anyway, thanks!

n.p.

1. "but should not cause any pratical difficulties" <-- you have a typo in 
'pratical' there.
2. What exactly do you mean by "managed" queues in the new addition?

Also, did part #2 of the note come up in other reports? It seemed somewhat 
trivial (can't hurt though)...

Finally, I don't know whether I'm supposed to close the issue, but its a good 
solution as far as I'm concerned.

Thanks again!

--

___
Python tracker 

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



[issue18291] codecs.open interprets space as line ends

2013-06-24 Thread R. David Murray

R. David Murray added the comment:

Is the "slower" test on 2.6?  io would definitely be slower there, since it is 
pure python.  2.7 has the C accelerated version.

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Jeremy Kloth

Jeremy Kloth added the comment:

Except, in this case, it actually crashes the interpreter.  I would hope to 
think that it isn't common practice to just hide crashers especially when there 
is a fix available.

--

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Could you please wrap your new macros in the do .. while boilerplate?

--

___
Python tracker 

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



[issue1763] Get path to shell/known folders on Windows

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Here is a patch that returns the paths of all known SHGetKnownFolderPath() and 
SHGetFolderPath(). SHGetKnownFolderPath() is currently not available for Python 
3.4 as Python 3.4 still uses Windows XP API but SHGetKnownFolderPath() requires 
Vista or newer.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb776911%28v=vs.85%29.aspx

--
title: Winpath module - easy access to Windows directories like My Documents -> 
Get path to shell/known folders on Windows
Added file: http://bugs.python.org/file30689/1763_knownfolders.patch

___
Python tracker 

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



[issue18234] Unicodedata module should provide access to codepoint aliases

2013-06-24 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 24.06.2013 18:10, Alexander Belopolsky wrote:
> 
> Alexander Belopolsky added the comment:
> 
>> The .aliases() function would have to return a list, not a single
>> name, so a parameter would cause the return type to change, which
>> is not a good idea.
> 
> You misunderstood my proposal.  .name() will still return a single name, but 
> the type parameter will control which name to return:
> 
> name(ch[, 
> type=(None|'correction'|'control'|'alternate'|'figment'|'abbreviation')])
> 
> None - default, same as current behavior.
> 
> correction - indicates that the returned name is a corrected form for the 
> original name (which remains valid) for the same code point.
> 
> control - return a new name added for a control character.
> 
> alternate - return an alternate name for a character
> 
> figment - return a name for a character that has been documented but was 
> never in any actual standard.
> 
> abbreviation - return a common abbreviation for a character

How can you be sure that each of those alias types occurs only
once ?

The NameAliases.txt doesn't say anything about this, AFAIK:

http://www.unicode.org/Public/UNIDATA/NameAliases.txt

Also, what would name() return in case to alias of a particular
type is defined ?

I think it would be easier and more future proof to have a function
aliases(code) -> [(type, alias),...] which simply returns all
defined aliases. Applications could then add helpers for
select the type they would like to use.

It may make sense to also add the name(code) value as
e.g. ('standard', name(code)) to that list.

-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Jun 24 2013)
>>> Python Projects, Consulting and Support ...   http://www.egenix.com/
>>> mxODBC.Zope/Plone.Database.Adapter ...   http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/

2013-06-18: Released mxODBC Django DE 1.2.0 ...   http://egenix.com/go47
2013-07-01: EuroPython 2013, Florence, Italy ...7 days to go
2013-07-16: Python Meeting Duesseldorf ... 22 days to go

   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611
   http://www.egenix.com/company/contact/

--

___
Python tracker 

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



[issue1257] atexit errors should result in nonzero exit code

2013-06-24 Thread Christian Heimes

Changes by Christian Heimes :


--
assignee: christian.heimes -> 
versions: +Python 3.4 -Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue1423] wave sunau aifc 16bit errors

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

Is somebody interested in this bug?

--
assignee: christian.heimes -> 
status: open -> languishing
versions: +Python 3.3, Python 3.4 -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



[issue18277] Queue is empty right after put from the same process/thread

2013-06-24 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> 1. "but should not cause any pratical difficulties" <-- you have a typo in 
> 'pratical' there.
> 2. What exactly do you mean by "managed" queues in the new addition?

Woops.  Fixed now see 860fc6a2bd21, 347647a1f798.  A managed queue is 
one created like

 manager = multiprocessing.Manager()
 queue = manager.Queue()

queue is a proxy for a conventional queue object in a "manager" process.

> Also, did part #2 of the note come up in other reports?
> It seemed somewhat trivial (can't hurt though)...

Yes it did (but I can't find the report now).

--

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Jeremy Kloth

Jeremy Kloth added the comment:

FYI, however, the new macro is designed as an internal implementation detail 
along the lines of the other _Py_* macros.  That is, just a tiny piece of a 
larger function to be used at your own risk.

Either way, I've uploaded another version with the do { } while (0) wrapping.

--
Added file: http://bugs.python.org/file30690/object-2.patch

___
Python tracker 

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



[issue18277] Queue is empty right after put from the same process/thread

2013-06-24 Thread Richard Oudkerk

Changes by Richard Oudkerk :


--
assignee:  -> docs@python
components: +Documentation -IO, Interpreter Core
nosy: +docs@python
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed
type: behavior -> 

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-06-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Yes, but in case someone else mindlessly starts using it elsewhere, let's spare 
them the macro bugz.

--

___
Python tracker 

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



[issue18189] IDLE Improvements: Unit test for Delegator.py

2013-06-24 Thread R. Jayakrishnan

R. Jayakrishnan added the comment:

I wrapped requires('gui') as submitted in patch2. But this time commands 
"python -m test test_idle" and with -ugui does not skip delegatortest (it runs 
successfully to both).

I took Lib/test/test_tk.py as an example.
It calls runtktests.get_tests using support.run_unittest from test module.
Exploring Lib/tkinter/test/runtktests.py the get_tests method begins like



def get_tests(text=True, gui=True, packages=None):
"""Yield all the tests in the modules found by get_tests_modules.
If nogui is True, only tests that do not require a GUI will be
returned."""
attrs = []
if text:
attrs.append('tests_nogui')
if gui:
attrs.append('tests_gui')

   
also notice the main method calles "test.support.use_resources = ['gui']"
Now the tktests have the line * require('gui') * before the class bigins, for 
example have a look on test_textensions.py 

So do we have to come up with the same procedure to skip and play with gui and 
non-gui tests for IDLE ? correct me if I am wrong anywhere.

--
Added file: http://bugs.python.org/file30691/test_delegator2.patch

___
Python tracker 

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



[issue17985] multiprocessing Queue.qsize() and Queue.empty() with different results

2013-06-24 Thread Richard Oudkerk

Richard Oudkerk added the comment:

This is really a documentation issue.  The doc fix for #18277 covers this.

--
components: +Library (Lib) -Extension Modules
resolution:  -> wont fix
stage:  -> committed/rejected
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue18292] IDLE Improvements: Unit test for AutoExpand.py

2013-06-24 Thread R. Jayakrishnan

New submission from R. Jayakrishnan:

Continuing the IDLE unittest framework initiated in #15392. Writing test for 
AutoExpand.py

--
components: IDLE, Tests
messages: 191795
nosy: JayKrish
priority: normal
severity: normal
status: open
title: IDLE Improvements: Unit test for AutoExpand.py
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread mpb

New submission from mpb:

At present (Python 2.7.[45] and 3.3.[12]), the cert_reqs parameter of 
ssl.wrap_socket can be one of:

ssl.CERT_NONE
ssl.CERT_OPTIONAL
ssl.CERT_REQUIRED

I would find the following additional modes to be useful:
ssl.CERT_OPTIONAL_NO_VERIFY
ssl.CERT_REQUIRED_NO_VERIFY

In these cases, the server's certificate would be available via the 
.getpeercert () method, even if the certificate does not pass verification.

The use case for these modes would be connecting to servers, some of which may 
use valid certificates, and others of which may be using self signed 
certificates.

Another use case might be an "ssh-like" mode of operation.  ssh will warn the 
user of possible man-in-the-middle attacks if a server's public key has changed.

Thanks!

--
components: Library (Lib)
messages: 191796
nosy: mpb
priority: normal
severity: normal
status: open
title: ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated 
certificates
type: enhancement
versions: Python 2.7, Python 3.3

___
Python tracker 

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



[issue18293] ssl sni

2013-06-24 Thread mpb

Changes by mpb :


--
title: ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated 
certificates -> ssl sni

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread mpb

mpb added the comment:

(Oops, I changed the title when I meant to do a search.  Changing it back now.)

--
title: ssl sni -> ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated 
certificates

___
Python tracker 

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



[issue8109] Server-side support for TLS Server Name Indication extension

2013-06-24 Thread mpb

Changes by mpb :


--
nosy: +mpb

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue18135] _ssl module: possible integer overflow for very long strings (+2^31 bytes)

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

Fixed patch: ssl_overflow-2.patch.

--
Added file: http://bugs.python.org/file30692/ssl_overflow-2.patch

___
Python tracker 

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



[issue18294] zlib module is not completly 64-bit safe

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

Related issue: #9566.

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

I created #18294 for the warnings in the zlib module.

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5c407b64920c by Victor Stinner in branch 'default':
Issue #9566: _io: Use Py_SAFE_DOWNCAST for fix a compiler warning on Windows x64
http://hg.python.org/cpython/rev/5c407b64920c

New changeset 931e1bc090f6 by Victor Stinner in branch 'default':
Issue #9566: zlib: Explicit cast to unsigned int to fix a compiler warning on 
Windows x64
http://hg.python.org/cpython/rev/931e1bc090f6

--

___
Python tracker 

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



[issue18294] zlib module is not completly 64-bit safe

2013-06-24 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch fixes different compiler warnings on Windows x64 in the zlib 
module. The module raises OverflowError if some values are longer than INT_MAX, 
but not all parameters are checked.

--
files: zlib_64bit.patch
keywords: patch
messages: 191799
nosy: haypo, loewis, serhiy.storchaka
priority: normal
severity: normal
status: open
title: zlib module is not completly 64-bit safe
versions: Python 3.4
Added file: http://bugs.python.org/file30693/zlib_64bit.patch

___
Python tracker 

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



[issue18294] zlib module is not completly 64-bit safe

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

The changeset 931e1bc090f6 fixes warnings in adler32 and crc32.

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c75ab7b802df by Victor Stinner in branch 'default':
Issue #9566: _winapi.WriteFile() now truncates length to DWORD_MAX (4294967295)
http://hg.python.org/cpython/rev/c75ab7b802df

--

___
Python tracker 

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



[issue18295] Possible integer overflow in PyCode_New()

2013-06-24 Thread STINNER Victor

New submission from STINNER Victor:

On Windows x64, we get the following warning:

..\Objects\codeobject.c(106): warning C4244: '=' : conversion from 'Py_ssize_t' 
to 'unsigned char', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]

Code:

unsigned char *cell2arg = NULL;
Py_ssize_t total_args = argcount + kwonlyargcount +
((flags & CO_VARARGS) != 0) + ((flags & CO_VARKEYWORDS) != 0);
PyObject *cell = PyTuple_GET_ITEM(cellvars, i);
for (j = 0; j < total_args; j++) {
PyObject *arg = PyTuple_GET_ITEM(varnames, j);
if (!PyUnicode_Compare(cell, arg)) {
  > cell2arg[i] = j; <= HERE
used_cell2arg = 1;
break;
}
}

total_args is not checked for being smaller than 256.

Related issue: #9566.

--
components: Interpreter Core
messages: 191805
nosy: haypo
priority: normal
severity: normal
status: open
title: Possible integer overflow in PyCode_New()
versions: Python 3.4

___
Python tracker 

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



[issue18295] Possible integer overflow in PyCode_New()

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

Similar issue:

..\Objects\funcobject.c(636): warning C4244: 'function' : conversion from 
'Py_ssize_t' to 'int', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]
..\Objects\funcobject.c(637): warning C4244: 'function' : conversion from 
'Py_ssize_t' to 'int', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]
..\Objects\funcobject.c(637): warning C4244: 'function' : conversion from 
'Py_ssize_t' to 'int', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]

Extract of function_call() function:

result = PyEval_EvalCodeEx(
PyFunction_GET_CODE(func),
PyFunction_GET_GLOBALS(func), (PyObject *)NULL,
&PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg),
k, nk, d, nd,
PyFunction_GET_KW_DEFAULTS(func),
PyFunction_GET_CLOSURE(func));

argcount, kwcount and defcount are int, whereas function_call() pass Py_ssize_t 
values.

function_call() should check PyTuple_GET_SIZE(arg) <= INT_MAX, nk <= INT_MAX 
and nd <= INT_MAX.

--

___
Python tracker 

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



[issue18164] Embedding Python doc incorrectly refers to LINKFORSHARED

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e18b92bae4d6 by Ned Deily in branch '2.7':
Issue #18164: Backport the more detailed embedding compile-and-link section
http://hg.python.org/cpython/rev/e18b92bae4d6

New changeset 4a114b0db866 by Ned Deily in branch '3.3':
Issue #18164: Clarify the embedding docs regarding link options.
http://hg.python.org/cpython/rev/4a114b0db866

New changeset 262689e0fa2a by Ned Deily in branch 'default':
Issue #18164: merge from 3.3
http://hg.python.org/cpython/rev/262689e0fa2a

--
nosy: +python-dev

___
Python tracker 

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



[issue18164] Embedding Python doc incorrectly refers to LINKFORSHARED

2013-06-24 Thread Ned Deily

Ned Deily added the comment:

Patches committed (with consistent use of get_config_var as suggested by 
Antoine) for 2.7.5, 3.3.3, and 3.4.0 docs.

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

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2013-06-24 Thread SpaghettiToastBook

Changes by SpaghettiToastBook :


--
nosy: +SpaghettiToastBook

___
Python tracker 

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



[issue18295] Possible integer overflow in PyCode_New()

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

And another one:

..\Python\ceval.c(4271): warning C4244: '=' : conversion from 'Py_ssize_t' to 
'int', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]
..\Python\ceval.c(4459): warning C4244: '=' : conversion from 'Py_ssize_t' to 
'int', possible loss of data 
[C:\buildbot.python.org\3.x.kloth-win64\build\PCbuild\pythoncore.vcxproj]

First in fast_function(), nd type is int:

if (argdefs != NULL) {
d = &PyTuple_GET_ITEM(argdefs, 0);
 ==>nd = Py_SIZE(argdefs);  <=== HERE
}
return PyEval_EvalCodeEx((PyObject*)co, globals,
 (PyObject *)NULL, (*pp_stack)-n, na,
 (*pp_stack)-2*nk, nk, d, nd, kwdefs,
 PyFunction_GET_CLOSURE(func));

Second in ext_do_call(), nstar type is int:

nstar = PyTuple_GET_SIZE(stararg);

Must check: Py_SIZE(argdefs) <= INT_MAX and PyTuple_GET_SIZE(stararg) <= 
INT_MAX.

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 72087ebf83f0 by Victor Stinner in branch 'default':
Issue #9566: Fix a compiler warning on Windows x64
http://hg.python.org/cpython/rev/72087ebf83f0

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6b4d279508a3 by Victor Stinner in branch 'default':
Issue #9566: Fix a compiler warning in tupleiter_setstate() on Windows x64
http://hg.python.org/cpython/rev/6b4d279508a3

--

___
Python tracker 

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



[issue1040439] Missing documentation on how to link with libpython

2013-06-24 Thread Ned Deily

Ned Deily added the comment:

I've now backported the 3.x update to the 2.7 docs in Issue18164 (I hadn't 
noticed that this issue was still open).  As Eli noted, if any updates are 
needed to cover Windows, a separate issue should be opened. I'm closing this 
one.

--
nosy: +ned.deily
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5a72adc7c8f7 by Victor Stinner in branch 'default':
Issue #9566: pystrtod.c: Fix a compiler warnings on Windows x64
http://hg.python.org/cpython/rev/5a72adc7c8f7

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c1a400501db6 by Victor Stinner in branch 'default':
Issue #9566: recv(), recvfrom(), send(), sendall() and sendto() methods
http://hg.python.org/cpython/rev/c1a400501db6

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3a393fc86b29 by Victor Stinner in branch 'default':
Issue #9566: More long/Py_ssize_t fixes in tuple and list iterators (it_index)
http://hg.python.org/cpython/rev/3a393fc86b29

--

___
Python tracker 

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



[issue18081] test_logging failure in WarningsTest on buildbots

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2a9e1eb3719c by Victor Stinner in branch 'default':
Issue #18081: Workaround "./python -m test_idle test_logging" failure
http://hg.python.org/cpython/rev/2a9e1eb3719c

--
nosy: +python-dev

___
Python tracker 

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



[issue18081] test_logging failure in WarningsTest on buildbots

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

This issue is *really* annoying: it makes buildbots almost useless (it is no 
more possible to check if a commit introduces a regression). So until the best 
fix is decided, I applied a temporary fix (based on  changes.diff written by  
Vinay Sajip):

New changeset 2a9e1eb3719c by Victor Stinner in branch 'default':
Issue #18081: Workaround "./python -m test_idle test_logging" failure
http://hg.python.org/cpython/rev/2a9e1eb3719c

I checked that "import warnings; warnings.warn('test')" does still use the 
custom warning hook in IDLE. I don't know how to test all hooks.

--
nosy: +haypo

___
Python tracker 

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



[issue18135] _ssl module: possible integer overflow for very long strings (+2^31 bytes)

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bfede07268a1 by Victor Stinner in branch '3.3':
Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input
http://hg.python.org/cpython/rev/bfede07268a1

New changeset 12a388024d5b by Victor Stinner in branch 'default':
(Merge 3.3) Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if
http://hg.python.org/cpython/rev/12a388024d5b

--

___
Python tracker 

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



[issue18135] _ssl module: possible integer overflow for very long strings (+2^31 bytes)

2013-06-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a29eaffa7d72 by Victor Stinner in branch '2.7':
Issue #18135: ssl.SSLSocket.write() now raises an OverflowError if the input
http://hg.python.org/cpython/rev/a29eaffa7d72

--

___
Python tracker 

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



[issue7732] imp.find_module crashes Python if there exists a directory named "__init__.py"

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

The test just failed on x86 Windows Server 2003 [SB] 3.x:

http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%203.x/builds/1077/steps/test/logs/stdio

==
FAIL: test_bug7732 (test.test_imp.ImportTests)
--
Traceback (most recent call last):
  File 
"E:\Data\buildslave\cpython\3.x.snakebite-win2k3r2sp2-x86\build\lib\test\test_imp.py",
 line 285, in test_bug7732
imp.find_module, support.TESTFN, ["."])
AssertionError: ImportError not raised by find_module

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

___
Python tracker 

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



[issue18279] IDLE Unit test for RstripExtension.py

2013-06-24 Thread Phil Webster

Phil Webster added the comment:

Modified the first patch to get rid of mock EditorWindow in favor of the real 
thing. Also renamed the test to 'test_rstrip'.

--
Added file: http://bugs.python.org/file30694/test_rstrip.patch

___
Python tracker 

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



[issue18189] IDLE Improvements: Unit test for Delegator.py

2013-06-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

"test.support.requires" returns True if
"called from a context with __name__ = '__main__'" or
"'gui' in test.support.use_resources".

The first clause is never true for buildbots, so the presumption is that the 
test was invoked by a user with a gui screen. (Windoes has an extra test that 
is only relevant to buildbots.) See #18103 for more discussion.

Here is a minimal test_gui.py file. In what follows, I only note the print 
output and skip notices.

Running test_gui by itself:

F5 when file is in Idle editor; and
python -m idlelib.idle_test.test_gui
have identical output, as they should,
and print 'in gui', 'nogui', because test_gui is main.

python -m unittest idlelib.idle_test.test_gui
python -m unittest idlelib.idle_test.test_gui.FakeGuiTest
have identical output for this simple file
and print 'nogui', 'skipped=1', because test_gui is not main.

The first of these two lines is not needed; just omit 'unittest'.
The second means that we cannot pick out and run just a gui testcase from a 
file.

Running as part of suite:

F5 with test_idle loaded in editor window
python -m test -v test_idle
python -m test.test_idle
python -m unittest -v idlelib.idle_test
all print 'skipped', 'nogui', 'skipped=1'
(and otherwise similar output).
because verbosity is set either in the file or command line
and because main is not test_gui and 'gui' not in use_resources.

python -m test test_idle
prints only 'nogui', no skip notice
(because skips are ignored by non-verbose regrtest).

python -m test -ugui test_idle
prints 'in gui', 'nogui'
because regrtest sets use_resources to ['gui'].

python -m idlelib.idle_test does not run but would if there were a .__main__ 
similar to test.test_idle.

Attribute use_resources can be set by anyone, not just by regrtest.
In test_idle, after "if __name__ == '__main__':", add
from test import support; support.use_resources = ['gui']
and
F5 with test_idle loaded in editor window
python -m test.test_idle
both print 'in gui', 'nogui'.

--
I added test_delegator.py and it skips when it should, but one must get verbose 
output to tell. (I do not see anything on the screen even when it does run.) 
Perhaps you mistook the absence of a failure report and the absence of a skip 
report to mean the absence of skips. It does not. Here is what I see.

C:\Users\Terry>python -m test test_idle
[1/1] test_idle
nogui
Warning -- os.environ was modified by test_idle
1 test altered the execution environment:
test_idle

If I add '-ugui', the *only* visible difference is the added 'in gui' from my 
file. Prints are really useful for leaving a record.

With -v, the difference is
  skipped "Use of the 'gui' resource not enabled"
versus
  test_setdelegate (idlelib.idle_test.test_delegator.Test_delegator) ... ok
It appears that methods within a skipped testcase are not listed, whereas a 
skipped method within a not-skipped testcase is listed.

I believe your patch is working correctly as far is it goes, and that we should 
move forward.

The Delegator.py patch needs something like the use_resource line I added to 
test_idle in order for the gui test to run when Delegator.py is run. The line I 
gave will work; I am also thinking of a context manager.

As I said on idle-dev, I decided you were right to call your first TestCase 
'PathBrowserTest' instead of 'Test_xxx', as I did at first. Having testcases 
end with 'Test' while methods begin with 'test' is less confusing. So let us 
make it 'DelegatorTest'.

--
stage:  -> patch review
Added file: http://bugs.python.org/file30695/test_gui.py

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread Christian Heimes

Christian Heimes added the comment:

I'm setting the version to 3.4 as this is a feature request. 2.7 and 3.3 are in 
feature freeze mode.

OpenSSL doesn't support our idea out of the box. OpenSSL either verifies the 
peer's certificate and chain or doesn't verify the peer's certificate and 
chain. Optional and required verification makes only a different for client 
side certs. Server side certs are always verified in both modes. See 
http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html#NOTES

When you are talking to a server the peer's certificate is always available, 
even in SSL_VERIFY_NONE mode. The server cert's public key is required to 
asymmetrically encrypt part of the session key. It's Python's ssl module that 
doesn't return the cert information in getpeercert() when 
SSL_CTX_get_verify_mode() doesn't have SSL_VERIFY_PEER. You can still get the 
DER encoded peer cert with getpeercert(True).

Now for something completely different: Without verification and the correct 
root cert it's not possible to get the root cert of a peer's chain (see issue 
#18233). AFAIK SSL doesn't provide the full root cert as part of the peer chain 
because the other side is suppose the have a copy of the chain root anyway. 
Different story, though.

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

___
Python tracker 

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



[issue11390] doctest: add cmdline parameters

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

The new tests added in changeset ae802dc4dcd4 are failing on some buildbots. I 
can reproduce the issue on my Linux box (Fedora 18). First failure of "./python 
-m test test_doctest":

[1/1] test_doctest
**
File "/home/haypo/prog/python/default/Lib/test/test_doctest.py", line 2627, in 
test.test_doctest.test_CLI
Failed example:
rc1, out1, err1
Expected:
(0, b'', b'')
Got:
(0, b'\x1b[?1034h', b'')

The b'\x1b[?1034h' sequence it written by the readline module when it is 
imported. The readline module is imported by pdb, which is used by doctest.

The following article proposes set to TERM environment variable to "linux" to 
workaround the issue:
http://reinout.vanrees.org/weblog/2009/08/14/readline-invisible-character-hack.html

It works:

$ echo $TERM  # yeah, Fedora supports 256 colors!
xterm-256color
$ ./python -c 'import readline'|hexdump -C
  1b 5b 3f 31 30 33 34 68   |.[?1034h|
0008
$ TERM=linux ./python -c 'import readline'|hexdump -C

This issue was reported to OpenSuse in 2009:
http://lists.opensuse.org/opensuse-bugs/2009-05/msg01633.html

The issue is not specific to Python. Just one another example with Octave 
(issue closed as "not a bug"):
https://bugzilla.redhat.com/show_bug.cgi?id=304181

The issue was also reported upstream (bug-readline mailing list) a few days ago:
http://lists.gnu.org/archive/html/bug-readline/2013-06/msg0.html

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue11390] doctest: add cmdline parameters

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

Attached doctest_term_dummy.patch: workaround the issue by setting TERM env var 
to "dummy".

Why is test_CLI() implemented using a doctest? Why not reusing the unittest 
module to benefit from test.support and test.regrtest? (Hint: I don't like 
doctests :-))

--
Added file: http://bugs.python.org/file30696/doctest_term_dummy.patch

___
Python tracker 

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



[issue11390] doctest: add cmdline parameters

2013-06-24 Thread STINNER Victor

STINNER Victor added the comment:

test_doctest.test_CLI() is also failing on Windows:

http://buildbot.python.org/all/builders/x86%20Windows%20Server%202003%20%5BSB%5D%203.x/builds/1078/steps/test/logs/stdio

It looks like an issue with Windows newline (\r\n) versus UNIX newline (\n). 
test_CLI() decodes the bytes output from UTF-8, but do not normalize newlines.

The universal_newlines=True option can be passed to subprocess, which is not 
possible currently using script_helper. Is there function somewhere else to 
normalize newlines?

--

___
Python tracker 

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



[issue18296] test_os.test_trailers() is failing on AMD64 FreeBSD 9.0 dtrace 3.x

2013-06-24 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/1560/steps/test/logs/stdio

==
FAIL: test_trailers (test.test_os.TestSendfile)
--
Traceback (most recent call last):
  File "/usr/home/buildbot/python/3.x.koobs-freebsd/build/Lib/test/test_os.py", 
line 1962, in test_trailers
self.assertEqual(data, b"abcde12345")
AssertionError: b'abcde\x00\x00\x00...\x00\x0012345' != b'abcde12345'
Warning -- threading._dangling was modified by test_os
test test_os failed

(I replaced a long list of \x00 with "...")

I don't understand why test_trailers() of test_os tries to copy 4096 bytes 
using os.sendto(), whereas the input file only contains 5 bytes.

--
messages: 191827
nosy: haypo
priority: normal
severity: normal
status: open
title: test_os.test_trailers() is failing on AMD64 FreeBSD 9.0 dtrace 3.x
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2013-06-24 Thread Brandon Craig Rhodes

Brandon Craig Rhodes added the comment:

Kristján, you are certainly correct that a single-argument that can be either a 
filename or a cert is inappropriate; we should not be peeking inside of strings 
to guess what they contain.

And I think you also have a good point about Pythonic-ness when it comes to 
polymorphism; routines that are sensitive to object type have been going more 
and more out of style for the past twenty years, and for good reason.

But, having ceded those points, I still think string-or-file-like-object is the 
correct approach here, simply because it is the overwhelming approach of the 
Standard Library; everyone is used to it, and will already "know the ropes" of 
that approach; and it prevents noisying up the interface with redundant 
arguments. Were we doing this over again, we would simply not allow a filename 
at all, and let the user open the file if they needed to. But since a filename 
is allowed, it feels like the Official Standard Library Approach to also allow 
a file-like object.

Some examples:

zipfile.ZipFile: "Open a ZIP file, where file can be either a path to a file (a 
string) or a file-like object."

http://docs.python.org/2/library/zipfile#zipfile.ZipFile

binhex.hexbin: "Decode a binhex file input. input may be a filename or a 
file-like object supporting read() and close() methods."

http://docs.python.org/release/2.7.5/library/binhex.html#binhex.hexbin

xml.dom.minidom.parse: "filename_or_file may be either a file name, or a 
file-like object."

http://docs.python.org/2/library/xml.dom.minidom.html#xml.dom.minidom.parse

mailbox.Mailbox.add: "Parameter message may be a Message instance, an 
email.message.Message instance, a string, or a file-like object (which should 
be open in text mode)."

http://docs.python.org/2/library/mailbox.html#mailbox.Mailbox.add

pickletools.dis: "pickle can be a string or a file-like object."

http://docs.python.org/2/library/pickletools.html#pickletools.dis

I suggest that these precedents, along with others that I believe we could find 
with a more exhaustive search of the Standard Library, are sufficient to 
suggest that in this case the least-surprise approach is a single argument 
that's either a filename or file-like object. I would suggest reviewing quickly 
the code for the above examples and following their example for how to 
distinguish most cleanly between a filename and file-like object; I wonder if 
they call any common code to get the contents out, or each do it completely by 
themselves? :)

Thanks again for wanting to add this to the SSL module, it will be a *great* 
addition that solves an important use case!

--

___
Python tracker 

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



[issue18113] Memory leak in curses.panel

2013-06-24 Thread A.M. Kuchling

A.M. Kuchling added the comment:

I believe the most recent 2 commits fix the segfault problem, so I'll now close 
this again.  Please re-open if there are further issues with the bugfix.

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

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread mpb

mpb added the comment:

Hi Christian, thanks for the prompt response.

Sorry about choosing the wrong versions - I wasn't thinking that enhancements 
should target future versions, but of course that makes sense.

After submitting the enhancement request, I did dig into the OpenSSL docs, and, 
as Christian points out, I discovered that OpenSSL is not designed in a way 
that makes it easy to implement the enhancement.

Aside: Interestingly, it looks easier to implement the enhancement in PolarSSL, 
and probably also in MatrixSSL and CyaSSL.  Of course, that's not really an 
option.  I did not look at GnuTLS.

Thanks for the pointer about being able to get the server's DER certificate.  
That will be useful.  Is there some reason to return DER but not PEM?  Or is 
this perhaps a bug that could be fixed in a future version of Python's ssl 
module?

Christian wrote: "Optional and required verification makes only a differen[ce] 
for client side certs."

I believe there is one small exception:  With SSL_VERIFY_NONE, a client will 
continue talking with a server with an invalid certificate.  With 
SSL_VERIFY_PEER, when a client fails to verify the server's certificate, the 
client will terminate the connection.

Ideally, I would like a client to be able to get both of  the following from 
the API: (a) the server's certificate (and chain?), and (b) whether or not the 
certificate (and chain?) is valid (against a given sets of root certs).

Similarly, I would like a Python server to be able to get both of: (a) the 
client's certificate, and (b) whether the certificate is valid (against a given 
set of root certs).

In the latter case, it seems that OpenSSL is even more restrictive!  With 
SSL_VERIFY_NONE, the server will not request (and presumably therefore not even 
receive) a certificate.  With SSL_VERIFY_PEER, the server will terminate the 
connection if the client's certificate does not validate!  Very inconvenient!

Interestingly, I believe I have worked around this limitation in OpenSSL using 
M2Crypto (which is built on top of OpenSSL), by installing my own verifier that 
overrides the built-in verifier.  This is done as follows:

import M2Crypto.SSL
ctx  = M2Crypto.SSL.Context ()
ctx.load_cert ('var/cert.pem')
def verify (*args):  return True
ctx.set_verify (M2Crypto.SSL.verify_peer, 10, verify)

After doing this, both the client and the server can see each other's 
certificates, even if those certificates are invalid.  (Of course I'll have to 
write my own verifier.  "return True" is only useful for testing purposes.)

I'm not sure how much of this functionality the Python developers might be 
interested in putting into Python 3.4?  Given that M2Crypto does not work with 
Python 3.x at all (at least not yet?), I am interested in finding something 
that will work with Python 3.x and give me the functionality I want.

I can probably help with the C OpenSSL code, if needed.  However, I have no 
experience writing Python bindings.

Your thoughts?  Thanks!

--

___
Python tracker 

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



[issue18293] ssl.wrap_socket (cert_reqs=...), getpeercert, and unvalidated certificates

2013-06-24 Thread mpb

mpb added the comment:

Oh, I see.  getpeercert (binary_form) is not DER vs. PEM, it is DER vs. dict.

--

___
Python tracker 

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



  1   2   >