[issue18297] In range.sample() correct the ValueError message for negative k

2013-06-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +mark.dickinson, rhettinger

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



[issue18297] In random.sample() correct the ValueError message for negative k

2013-06-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
title: In range.sample() correct the ValueError message for negative k - In 
random.sample() correct the ValueError message for negative k

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18297
___
___
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-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Extension Modules
nosy: +nadeem.vawda
stage:  - patch review
type:  - behavior
versions: +Python 2.7, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18294
___
___
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-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +loewis

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



[issue18297] In random.sample() correct the ValueError message for negative k

2013-06-25 Thread Mark Dickinson

Mark Dickinson added the comment:

This has been proposed and rejected before:  see issue #17388.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18297
___
___
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-25 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

ok, I concede that a file-like object makes sense from a polymorphism point of 
view.  It makes no sense from a streaming point of view.  A caller can then 
wrap their data into a StringIO instance.

I'll rework the patch in the manner you suggest.

--

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



[issue18298] pythonw.exe fails with redirected stdett

2013-06-25 Thread anatoly techtonik

New submission from anatoly techtonik:

---cut test.py---
print(-1-)

open(-2-, w).write(-3-)
---cut test.py---


 C:\Python27\pythonw.exe test.py  -4-
 type -4-
-1-

 C:\Python27\pythonw.exe test.py 2 -4-
 type -4-
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

 C:\Python27\python.exe test.py 2 -4-
-1-
type -4-



This may also affect subprocess calls under pythonw.exe  I am running Python 
2.7.3

--
messages: 191839
nosy: techtonik
priority: normal
severity: normal
status: open
title: pythonw.exe fails with redirected stdett
versions: Python 2.7

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread anatoly techtonik

Changes by anatoly techtonik techto...@gmail.com:


--
components: +Windows

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread anatoly techtonik

Changes by anatoly techtonik techto...@gmail.com:


--
title: pythonw.exe fails with redirected stdett - pythonw.exe fails with 
redirected stderr

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread anatoly techtonik

anatoly techtonik added the comment:

This subprocess.communicate() call fails with pythonw.exe

--cut testhg.py--
import subprocess

hg = hg
output, _err = subprocess.Popen([hg, 'id', '-nib'],
   stdout=subprocess.PIPE).communicate()
open(-hg-, w).write(output)
--cut testhg.py--


When testhg.py is run with python.exe from cmd.exe session, the -hg- file is 
created ok. When pythonw.exe is used, nothing happens. When redirecting stderr 
from pythonw.exe with:

C:\Python27\pythonw.exe testhg.py 21

1 contains the following stacktrace:
Traceback (most recent call last):
  File testhg.py, line 5, in module
stdout=subprocess.PIPE).communicate()
  File C:\Python27\lib\subprocess.py, line 672, in __init__
errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File C:\Python27\lib\subprocess.py, line 787, in _get_handles
p2cread = self._make_inheritable(p2cread)
  File C:\Python27\lib\subprocess.py, line 826, in _make_inheritable
_subprocess.DUPLICATE_SAME_ACCESS)
WindowsError: [Error 6] The handle is invalid

--

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread anatoly techtonik

anatoly techtonik added the comment:

This was meant to be a separate issue. :/

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
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-25 Thread koobs

Changes by koobs koobs.free...@gmail.com:


--
nosy: +koobs

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Yes, in pythonw.exe the C stderr is not really usable, and this leads to 
unpredictable results.
It's difficult to fix in python2 though; python3 has fixed this issue, but in a 
way that cannot be backported.

Some workarounds:
- don't use pythonw.exe in a console, it's meant to be a *windows* application, 
without standard streams. I'm actually surprised of the behavior of your first 
example.

- use python3, where pythonw will set sys.stderr to None, and prints will be 
silently discarded.

--
nosy: +amaury.forgeotdarc
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
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-25 Thread R. David Murray

R. David Murray added the comment:

It is implemented as a doctest because everything else in that test module is 
implemented as a doctest.  And clearly this reveals a bug of some sort.  
Perhaps the dummy trick needs to be done by doctest itself?  (I will need to 
read your post over more carefully and understand the issue better.)

As for the windows failures, my apologies.  I knew I would need to check 
windows after the commit when I wrote the code, but I forgot to actually do it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11390
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

 As for the windows failures, my apologies.  I knew I would need to check 
 windows after the commit when I wrote the code, but I forgot to actually do 
 it.

No problem, it's so easy to forget Windows :-) And we have buildbots
for this task (detect regressions).

2013/6/25 R. David Murray rep...@bugs.python.org:

 R. David Murray added the comment:

 It is implemented as a doctest because everything else in that test module is 
 implemented as a doctest.  And clearly this reveals a bug of some sort.  
 Perhaps the dummy trick needs to be done by doctest itself?  (I will need to 
 read your post over more carefully and understand the issue better.)

 As for the windows failures, my apologies.  I knew I would need to check 
 windows after the commit when I wrote the code, but I forgot to actually do 
 it.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue11390
 ___

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11390
___
___
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-25 Thread Oscar Benjamin

Oscar Benjamin added the comment:

I'm attaching one more patch check_mno_cywin_py34.patch. This is my
preferred patch for Python 3.4 (default). It fixes building with MinGW
and removes all support for using Cygwin gcc with --compiler=mingw32.
The user would see the following error message:

'''
Q:\current\testing\hellotestbuild q:\tools\cygwin\bin -3.3
running build_ext
error: Cygwin gcc cannot be used with --compiler=mingw32
'''

I think that this is reasonable as '-mno-cygwin' is a previously
experimental and now long deprecated, discouraged and discontinued
feature of Cygwin's gcc. Removing support for it in future Pythons
would make problems involving MinGW build (like this one) much easier
to solve in future: there would be no need to consider anything other
than the behaviour of MinGW's gcc.

--
Added file: http://bugs.python.org/file30698/check_mno_cywin_py34.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12641
___diff -r 7aab60b70f90 Lib/distutils/cygwinccompiler.py
--- a/Lib/distutils/cygwinccompiler.py  Sun Jun 23 15:47:03 2013 -0700
+++ b/Lib/distutils/cygwinccompiler.py  Tue Jun 25 11:38:05 2013 +0100
@@ -54,7 +54,8 @@
 from distutils.ccompiler import gen_preprocess_options, gen_lib_options
 from distutils.unixccompiler import UnixCCompiler
 from distutils.file_util import write_file
-from distutils.errors import DistutilsExecError, CompileError, UnknownFileError
+from distutils.errors import (DistutilsExecError, CCompilerError,
+CompileError, UnknownFileError)
 from distutils import log
 from distutils.version import LooseVersion
 from distutils.spawn import find_executable
@@ -294,11 +295,15 @@
 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'
+if is_cygwingcc():
+raise CCompilerError(
+'Cygwin gcc cannot be used with --compiler=mingw32')
+
+self.set_executables(compiler='gcc -O -Wall',
+ compiler_so='gcc -mdll -O -Wall',
+ compiler_cxx='g++ -O -Wall',
+ linker_exe='gcc',
+ linker_so='%s %s %s'
 % (self.linker_dll, shared_option,
entry_point))
 # Maybe we should also append -mthreads, but then the finished
@@ -393,3 +398,15 @@
 
 commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version']
 return tuple([_find_exe_version(cmd) for cmd in commands])
+
+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.decode('ascii').strip().endswith('cygwin')
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

 Perhaps the dummy trick needs to be done by doctest itself?

The issue really comes from the readline module. The workaround is to set an 
environment variable, which affects the whole process (all threads).

Only setting TERM for test_CLI() is fine, because it's the only test running 
doctest in a subprocess.

Hum, we may set TERM=dummy in script_helper directly, because this module tries 
to run Python in a fresh environment. It uses python -E for example.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11390
___
___
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-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Agreed, a file-like object is the way to go.
I don't think you need to write the logic in C, by the way. You can write a 
high-level function and defer to a low-level C func for the basic API wrapping.

--
stage: patch review - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16487
___
___
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-25 Thread Paul

Paul added the comment:

You're absolutely right. I tested it on another machine now, with Python 2.7.3 
installed and it is actually twice as fast as codecs. Thanks.

So I guess there is little interest in fixing codecs because io is the 
preferred package for reading unicode files.

--

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



[issue18297] In random.sample() correct the ValueError message for negative k

2013-06-25 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
resolution:  - duplicate
status: open - closed
superseder:  - Providing invalid value to random.sample can result in 
incorrect error message

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18297
___
___
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-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I guess Victor have an interest. ;)

--
versions: +Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18291
___
___
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-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8f22e03f5f07 by R David Murray in branch 'default':
#11390: fix test failures due to readline and windows lineneds.
http://hg.python.org/cpython/rev/8f22e03f5f07

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11390
___
___
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-25 Thread R. David Murray

R. David Murray added the comment:

Fixed for this test.  It would probably be worthwhile to improve 
script_helpers, I'll open a new issue for that.

--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11390
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

@Serhiy: Oh, thanks for your review. My patch was far from being perfect, a 
review was necessary! (I hesitated to commit it directly.)

Here is a new patch using unsigned int is most places, parsing arguments with 
I format, and explicit cast to (size_t) to not compare unsigned with signed.

--
Added file: http://bugs.python.org/file30699/zlib_64bit-2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18294
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

 So I guess there is little interest in fixing codecs because io is the
 preferred package for reading unicode files.

 I guess Victor have an interest. ;)

Ah ah, good joke. I wrote the PEP 400:
http://www.python.org/dev/peps/pep-0400/

And yes, for best performances, you have to choose between codecs and
io module depending on the Python version. It suggest to always use
the io module because it has more features, like universal newline,
and less bugs.

--

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



[issue18299] Change script_helper to use universal_newlines=True in _assert_python

2013-06-25 Thread R. David Murray

New submission from R. David Murray:

A look at a random selection of tests that use script_helper indicates that 
using universal_newlines=True would either simplify or make no difference to 
the usage of the script_helper assert_python functions in the majority of the 
tests that use it.  Even if there turn out to be a few uses where having bytes 
is required, it would probably be worth catering to the common case and making 
those exceptional cases use Popen directly.  (Or alternatively provide 
assert_python_xxx_binary helpers.)

--
keywords: easy
messages: 191854
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Change script_helper to use universal_newlines=True in _assert_python
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18299
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

Here is a new patch using unsigned int is most places, parsing
arguments with I format, and explicit cast to (size_t) to not
compare unsigned with signed.

Oh oh, it's still wrong. The I parser format does not check for
integer overflow. _PyBytes_Resize() also uses Py_DECREF(retVal);
retVal = NULL; on failure, instead of Py_CLEAR(retVal), whereas
_PyBytes_Resize(retVal, ...) sets retVal to NULL...

--

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



[issue18300] script_helper._asert_python should set TERM='' by default.

2013-06-25 Thread R. David Murray

New submission from R. David Murray:

See issue 11390 for a discussion, but briefly: there is a bug in the readline 
library that causes it, on some systems, to emit a control sequence on stdout 
when readline is first initialized and TERM is set to xterm.  The bug can be 
avoided by setting TERM='', and since assert_python is often used to test 
output, the bogus characters can cause tests to fail on just some systems.  
_assert_python should therefore set TERM='' unless the TERM environment 
variable is passed explicitly by the caller.

While this issue probably has minimal impact on the earlier python versions 
(where only doctest is likely to trigger this bug, because it calls pdb which 
calls readline), on 3.4 readline is always initialized, and therefore the bug 
is more likely to cause unexpected test failures.

--
messages: 191856
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: script_helper._asert_python should set TERM='' by default.
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

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



[issue18299] Change script_helper to use universal_newlines=True in _assert_python

2013-06-25 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18299
___
___
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-25 Thread R. David Murray

Changes by R. David Murray rdmur...@bitdance.com:


--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18293
___
___
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-25 Thread Christian Heimes

Christian Heimes added the comment:

 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?

It doesn't matter how getpeercert() returns the raw cert. PEM and DER
encode the X.509 same in ASN.1 notation. PEM is just the base64
representation with some line breaks surrounded BEGIN/END CERTIFICATE lines.

 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.

You are referring to server side certs, that is the server provides a
cert and the client verifies it. I was talking about client side cert
(aka server mode), a rarely used mode in which the client side provides
a cert to the server. In CERT_OPTIONAL mode the client is allowed to
send no cert. CERT_REQUIRED is mapped to SSL_VERIFY_PEER |
SSL_VERIFY_FAIL_IF_NO_PEER_CERT.

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

In client mode you already have the server's cert and as much of the
chain as the peer (server) provides. SSL_VERIFY_NONE makes no difference
because the server cert is used in the ClientHello / ServerHello
handshake and session key negotiation.

Perhaps you are a bit confused by Python's ssl API. Somebody once made
the choice to return an empty dict from getpeercert(False) when
SSL_VERIFY_NONE is used. That's all. :)
http://hg.python.org/cpython/file/76196691b5d0/Modules/_ssl.c#l1098

 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'd rather not implement a full wrapper for X509_STORE_CTX and X509
certs. It's way too much code, super complex and easily confuses even
experienced developers. Python's ssl module is limited to core
functionality by design and choice.

However I might be intrigue to implement support for
SSL_CTX_set_cert_verify_callback() or SSL_CTX_set_verify().
SSL_CTX_set_cert_verify_callback() has more potential, e.g.

def cert_verify_callback(sslsocket, storectx, verify_ok):
context = sslsocket.context

storectx is a minimal X509_STORE_CTX object and verify_ok the boolean
return value of X509_verify_cert(). Without a cert verify callback
OpenSSL just uses the return value of X509_verify_cert()
(ssl/ssl_cert.c:ssl_verify_cert_chain()). sslsocket gives you access to
the peer's cert and chain (with #18233).

The callback could be used for multiple uses cases like cert
blacklisting, too.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18293
___
___
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-25 Thread koobs

koobs added the comment:

I recently updated the buildbot host to the latest 9-STABLE sources (changeset 
delta is approximately 4-6 weeks)

On a hunch I asked our src committers if there had been any sendfile related 
changes and was pointed to 3 changesets that were merged from current (MFC) to 
stable/9 4 weeks ago:

http://svnweb.freebsd.org/base?view=revisionrevision=250907

I reverted the kernel to r250906 (hunch commit -1) that resulted in a clean run:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/1563

Manual Rebuild: Trying to isolate test_trailing with older kernel

I have it on preliminary evidence that our regression tests are passing on this 
functionality, but analysis at the Python end for a root cause and details on 
how the test implementation plays a role would be helpful.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18296
___
___
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-25 Thread Christian Heimes

Changes by Christian Heimes li...@cheimes.de:


--
nosy: +christian.heimes

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16487
___
___
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-25 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

Antoine, are you suggesting that we remove the current c-level capability to 
use file system files (using open()) and just go with raw bytes data at the C 
api level, and then do the 'filename or filelike object' in Python land?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16487
___
___
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-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 Antoine, are you suggesting that we remove the current c-level
 capability to use file system files (using open()) and just go with
 raw bytes data at the C api level, and then do the 'filename or
 filelike object' in Python land?

Yes, I think that's reasonable. Hopefully it won't break any existing uses.

--

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



[issue14264] Comparison bug in distutils2.version

2013-06-25 Thread Éric Araujo

Éric Araujo added the comment:

Yes.

--
resolution:  - fixed
stage: test needed - committed/rejected
status: open - closed
versions:  -Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue14264
___
___
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-25 Thread Christian Heimes

Christian Heimes added the comment:

I didn't know about this issue and have worked on a similar feature in #18138.

--

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread anatoly techtonik

anatoly techtonik added the comment:

It is not about modifying Python in general, it is about patching pythonw.exe 
or subprocess or documenting how to make subprocess calls compatible with 
pythonw.exe


don't use pythonw.exe in a console

And how to debug the issue? Maybe the only solution in not using pythonw.exe at 
all if you want *windows* app solution, and do custom management of hidden 
windows.

http://code.google.com/p/spyderlib/source/browse/CHANGELOG
http://code.google.com/p/spyderlib/source/browse/spyderlib/utils/windows.py

--
resolution: wont fix - 
status: closed - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
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-25 Thread Brett Cannon

Brett Cannon added the comment:

I replied on python-checkins, I'll state here as well: the fix is still off
as warnings.formatwarning is still being replaced.
On Jun 24, 2013 6:20 PM, STINNER Victor rep...@bugs.python.org wrote:


 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 rep...@bugs.python.org
 http://bugs.python.org/issue18081
 ___


--

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



[issue18298] pythonw.exe fails with redirected stderr

2013-06-25 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

The proper solution if you use pythonw.exe is to define sys.stdout/sys.stderr 
yourself in pythonw.exe::
sys.stdout = open('c:/temp/output.txt', 'w')

IOW, do the redirect from inside the program, don't rely on the shell which (by 
design?) does not work correctly with /subsytem:windows binaries.
Again, this is a workaround for 2.7, because no backward-compatible fix could 
be found.

--
resolution:  - wont fix
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18298
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

 I replied on python-checkins, I'll state here as well: the fix is still off
 as warnings.formatwarning is still being replaced.

My changeset only fixes the unit test (test_idle), it's just to fix
buildbots. As I wrote, it's just a workaround.

--

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



[issue11698] Improve repr for structseq objects to show named, but unindexed fields

2013-06-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue15729] PyStructSequence_NewType enhancement

2013-06-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue7434] general pprint rewrite

2013-06-25 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
nosy: +eric.snow

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



[issue17883] Fix buildbot testing of Tkinter

2013-06-25 Thread Zachary Ware

Zachary Ware added the comment:

Ok, I've managed to cobble together a buildbot setup to test the hang myself 
and have come up with a couple possible solutions.

The first is to change the buildbot service on the slaves to allow desktop 
interaction.  This way, the tests can actually run.  If that's not possible, 
it's probably simplest to just pass -u-gui to the buildslaves in question, 
since there is in fact no gui available.  That should at least fix the 
test_ttk_guionly problem.

As for the test_tcl problem, how about this patch?  It simply wraps the Popen 
call in a try/except, and converts to a skip in case of an 'Access is denied' 
error.

--
nosy: +pitrou
resolution: fixed - 
Added file: http://bugs.python.org/file30700/issue17883-skip-on-error.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17883
___
___
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-25 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ha, funny. Now it's time to reconciliate your respective patches :)

--

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



[issue18297] In random.sample() correct the ValueError message for negative k

2013-06-25 Thread py.user

py.user added the comment:

it was rejected by Raymond Hettinger because the proposed message wasn't 
informative

--

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



[issue7796] No way to find out if an object is an instance of a namedtuple

2013-06-25 Thread Eric Snow

Eric Snow added the comment:

A NamedTuple ABC doesn't have to define any API (so that part could wait?)[1].  
I see it as most useful for isinstance checks.  Here's a solution along those 
lines:


class NamedTuple(Sequence):
@classmethod
def __subclasshook__(cls, C):
if cls is NamedTuple:
if any(_fields in B.__dict__ for B in C.__mro__):
return True
return NotImplemented

def namedtuple(...):
...
NamedTuple.register(result)
return result

(or include NamedTuple in the bases in the template)

For structseq support:

class NamedTuple(Sequence):
@classmethod
def __subclasshook__(cls, C):
if cls is NamedTuple:
if any(_fields in B.__dict__ or  # for namedtuple
   n_fields in B.__dict__  # for structseq
   for B in C.__mro__):
return True
return NotImplemented


[1] I agree there is still a problem if we define an ABC here with no API and 
then add some later.  Then classes that inherit from NamedTuple would break 
later when we add an API (just `_fields`?).  Not sure how much that is a 
concern though.  Then again we could just close out issue1820 and actually 
establish the API.

--

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



[issue1745722] please add wsgi to SimpleXMLRPCServer

2013-06-25 Thread R. David Murray

R. David Murray added the comment:

I've had a pep8-ification of this patch sitting on my disk for a while.  
Uploading it here so it doesn't get lost.  It feels like there is a lot of 
redundancy now in the docs.  But, it also seems to make sense to provide a wsgi 
version of this.  So I'm inclined to commit it, but would appreciate second 
opinions.

--
nosy: +r.david.murray
Added file: http://bugs.python.org/file30701/wsgi_xml_rpc_pep8.patch

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



[issue1820] Enhance Object/structseq.c to match namedtuple and tuple api

2013-06-25 Thread Eric Snow

Eric Snow added the comment:

Would we also want to implement _make().

--

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



[issue17883] Fix buildbot testing of Tkinter

2013-06-25 Thread Jeremy Kloth

Jeremy Kloth added the comment:

Although the solution for test_ttk_guionly of disabling the gui resource is a 
good quick fix, I'm curious as to why there isn't the same issue (test hangs) 
when run using 3.3 on the same machine.

Note that by running as a service without desktop interaction several 
assumptions wrt permissions have been uncovered, so I'm quite hesitant to flip 
that switch.

--

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



[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread py.user

New submission from py.user:

http://docs.python.org/2/library/itertools.html#itertools.chain.from_iterable

 class A:
...   @classmethod
...   def from_iterable(iterables):
... for it in iterables:
...   for element in it:
... yield element
... 
 A.from_iterable(['ABC', 'DEF'])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: from_iterable() takes 1 positional argument but 2 were given


--
assignee: docs@python
components: Documentation
files: issue.diff
keywords: patch
messages: 191874
nosy: docs@python, py.user
priority: normal
severity: normal
status: open
title: In itertools.chain.from_iterable() there is no cls argument
type: enhancement
versions: Python 3.3, Python 3.4
Added file: http://bugs.python.org/file30702/issue.diff

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



[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread py.user

py.user added the comment:

http://docs.python.org/3/library/itertools.html#itertools.chain.from_iterable

--

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



[issue18302] test_multiprocessing: test.support.import_module() does not ignore the ImportError on SemLock

2013-06-25 Thread STINNER Victor

New submission from STINNER Victor:

test.support.import_module() catchs ModuleNotFoundError instead of ImportError 
since the following changeset:

changeset:   84106:c4d7228421df
user:Brett Cannon br...@python.org
date:Wed Jun 12 20:12:30 2013 -0400
files:   Lib/test/regrtest.py Lib/test/support.py Lib/test/test___all__.py 
Lib/xmlrpc/server.py Lib/zipfile.py
description:
Move test___all__ over to unittest.main() and use ModuleNotFoundError

The problem is that multiprocessing.synchronize raises an ImportError if 
_multiprocess.SemLock does not exist:

# Try to import the mp.synchronize module cleanly, if it fails
# raise ImportError for platforms lacking a working sem_open implementation.
# See issue 3770
try:
from X_multiprocessing import SemLock
except (ImportError):
raise ImportError(This platform lacks a functioning sem_open +
   implementation, therefore, the required +
   synchronization primitives needed will not +
   function, see issue 3770.)

As a result, test_multiprocessing is no more skipped on FreeBSD 6.4, but the 
following traceback is written:

http://buildbot.python.org/all/builders/x86%20FreeBSD%206.4%203.x/builds/3771/steps/test/logs/stdio

Re-running test 'test_multiprocessing' in verbose mode
test test_multiprocessing crashed -- Traceback (most recent call last):
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py,
 line 27, in module
from _multiprocessing import SemLock
ModuleNotFoundError: cannot import name SemLock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File /usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/regrtest.py, 
line 1300, in runtest_inner
the_module = importlib.import_module(abstest)
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py, 
line 93, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File frozen importlib._bootstrap, line 1614, in _gcd_import
  File frozen importlib._bootstrap, line 1595, in _find_and_load
  File frozen importlib._bootstrap, line 1562, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 609, in _check_name_wrapper
  File frozen importlib._bootstrap, line 1058, in load_module
  File frozen importlib._bootstrap, line 928, in load_module
  File frozen importlib._bootstrap, line 274, in _call_with_frames_removed
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/test_multiprocessing.py,
 line 30, in module
test.support.import_module('multiprocessing.synchronize')
  File /usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/test/support.py, 
line 123, in import_module
return importlib.import_module(name)
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/importlib/__init__.py, 
line 93, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
  File frozen importlib._bootstrap, line 1614, in _gcd_import
  File frozen importlib._bootstrap, line 1595, in _find_and_load
  File frozen importlib._bootstrap, line 1562, in _find_and_load_unlocked
  File frozen importlib._bootstrap, line 609, in _check_name_wrapper
  File frozen importlib._bootstrap, line 1058, in load_module
  File frozen importlib._bootstrap, line 928, in load_module
  File frozen importlib._bootstrap, line 274, in _call_with_frames_removed
  File 
/usr/home/db3l/buildarea/3.x.bolen-freebsd/build/Lib/multiprocessing/synchronize.py,
 line 32, in module
 function, see issue 3770.)
ImportError: This platform lacks a functioning sem_open implementation, 
therefore, the required synchronization primitives needed will not function, 
see issue 3770.

--
messages: 191876
nosy: brett.cannon, haypo, sbt
priority: normal
severity: normal
status: open
title: test_multiprocessing: test.support.import_module() does not ignore the 
ImportError on SemLock
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18302
___
___
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-25 Thread Mark Shannon

Mark Shannon added the comment:

I think blaming the crash in test_marshall
http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/2009/steps/test/logs/stdio
on the new macros (change aff41a6421c2) is correct.

It may be the proximate cause, but that doesn't make it the underlying one. The 
interpreter should be more resilient against minor changes to the amount of C 
stack used per call.

Can we get a full stack trace (for the C stack not the Python one) for the 
failure?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17206
___
___
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-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c31bec42e411 by Victor Stinner in branch 'default':
Issue #17206: test.regrtest and test.script_helper enable faulthandler module
http://hg.python.org/cpython/rev/c31bec42e411

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17206
___
___
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-25 Thread Jeremy Kloth

Jeremy Kloth added the comment:

I'm unsure as to how to get a stack trace from Visual Studio, but I can assure 
you that the changes introduced by the change aff41a6421c2 *is* the cause of 
the failure in test_marshal.

In a nutshell, the overflow happens in a recursion on the marhsal.c:r_object() 
function for the test_marshal test of BugsTestCase.test_loads_recursion().

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17206
___
___
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-25 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1a9367d5aabc by Victor Stinner in branch 'default':
Issue #17206: Fix test_cmd_line and test_faulthandler for my previous change
http://hg.python.org/cpython/rev/1a9367d5aabc

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17206
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

 Can we get a full stack trace (for the C stack not the Python one) for the 
 failure?

Yes, using a debugger on Windows x64. I'm waiting for a renewal of my MSDN 
account to get Visual Studio (full version, not the Express version limited to 
32-bit).

Until this, I enabled faulthandler in subprocesses created by test.regrtest and 
test.script_helper because it may help this issue, but also others future 
crashes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17206
___
___
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-25 Thread mpb

mpb added the comment:

Christian wrote:
 sslsocket gives you access to the peer's cert and chain (with 
 #18233).

Very interesting (and useful).  I've mostly been working with Python
2.7, and I had not fully noticed that Python 3.2+ has a ssl.SSLContext
class.

 I'd rather not implement a full wrapper for X509_STORE_CTX and X509 
 certs. It's way too much code, super complex and easily confuses even 
 experienced developers. Python's ssl module is limited to core 
 functionality by design and choice.

 However I might be intrigue to implement support for
 SSL_CTX_set_cert_verify_callback() or SSL_CTX_set_verify().

SSL_CTX_set_verify() seems (mostly) redundant SSLContext.verify_mode.  
Or am I missing something?

 SSL_CTX_set_cert_verify_callback() has more potential, e.g.
 
 def cert_verify_callback(sslsocket, storectx, verify_ok):
 context = sslsocket.context

 storectx is a minimal X509_STORE_CTX object and verify_ok the boolean
 return value of X509_verify_cert(). Without a cert verify callback
 OpenSSL just uses the return value of X509_verify_cert()
 (ssl/ssl_cert.c:ssl_verify_cert_chain()).

I believe support for SSL_CTX_set_cert_verify_callback() would allow
customized certificate verification, which is what I am looking for.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18293
___
___
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-25 Thread STINNER Victor

STINNER Victor added the comment:

I enabled faulthandler in subprocesses created by test.regrtest and 
test.script_helper...

Oh, it doesn't help for this issue. On Windows, faulthandler is unable to dump 
the Python traceback on a stack overflow. On UNIX, it allocates a diffrent 
stack for its signal handler, and so the signal handler can run even on a stack 
overflow.

The Windows exit code 0xC0FD (3221225725) means Stack overflow / 
exhaustion.

[ 81/375] test_marshal
Traceback (most recent call last):
  File ../lib/test/regrtest.py, line 1618, in module
main_in_temp_cwd()
  File ../lib/test/regrtest.py, line 1593, in main_in_temp_cwd
main()
  File ../lib/test/regrtest.py, line 775, in main
raise Exception(Child error on {}: {}.format(test, result[1]))
Exception: Child error on test_marshal: Exit code 3221225725

--

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



[issue18301] In itertools.chain.from_iterable() there is no cls argument

2013-06-25 Thread R. David Murray

R. David Murray added the comment:

It is implemented as a classmethod, but the equivalent code doesn't need to 
be part of the class all.  I'm not sure what should be done here (say 
@staticmethod?  Leave the decorator off?).  We should probably see what Raymond 
thinks.  I lean toward the latter, that's the way it is in the python2 docs, 
and it doesn't seem to have caused any confusion.

--
nosy: +r.david.murray, rhettinger

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



[issue17883] Fix buildbot testing of Tkinter

2013-06-25 Thread Zachary Ware

Zachary Ware added the comment:

 Jeremy Kloth added the comment:

 Although the solution for test_ttk_guionly of disabling the gui resource is a 
 good quick fix, I'm curious as to why there isn't the same issue (test hangs) 
 when run using 3.3 on the same machine.

As it turns out, 3.3(+)'s test.support has an _is_gui_available
function that prevents the hang, added in issue9931.  Ironically, it
was not added to 2.7 because the 2.7 buildbots weren't showing
symptoms...because the tests weren't actually being run.

I'll work on trying to backport the patch that added
_is_gui_available, but my experience with ctypes is practically nil,
so if anyone can get to it before I can post a patch, don't hold off
on my account.

--

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



[issue17883] Fix buildbot testing of Tkinter

2013-06-25 Thread Zachary Ware

Zachary Ware added the comment:

It seems all it took to backport was a copy and paste.  Here's the patch.

--
Added file: 
http://bugs.python.org/file30703/issue17883-add_is_gui_available.diff

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



[issue18303] json.dumps() claims numpy.bool_ is not serializable

2013-06-25 Thread miscjunk

New submission from miscjunk:

When json.dumps() is called on a numpy.bool_ object, it crashes.

To recreate:
import numpy as np
import json
a = np.array([1,2,3,4,5,6])
a = a  5
json.dumps(a) #crash
json.dumps(a[0]) #crash
json.dumps(a.tolist()) #this works!

Example of error output
Traceback (most recent call last):
  File stdin, line 1, in module
  File ..\python-3.3.2.amd64\lib\json\__init__.py, line 236, in dumps
return _default_encoder.encode(obj)
  File ..\python-3.3.2.amd64\lib\json\encoder.py, line 191, in encode
chunks = self.iterencode(o, _one_shot=True)
  File ..\python-3.3.2.amd64\lib\json\encoder.py, line 249, in iterencode
return _iterencode(o, 0)
  File ..\python-3.3.2.amd64\lib\json\encoder.py, line 173, in default
raise TypeError(repr(o) +  is not JSON serializable)
TypeError: False is not JSON serializable

--
components: Extension Modules, Library (Lib)
messages: 191887
nosy: miscjunk
priority: normal
severity: normal
status: open
title: json.dumps() claims numpy.bool_ is not serializable
type: crash
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18303
___
___
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-25 Thread Jeremy Kloth

Jeremy Kloth added the comment:

Here are some results after a detailed investigation:

- in debug, each variable declaration in a block is allocated on the stack
- in debug, r_object() uses 1416 bytes of stack 
- in release, r_object() uses 512 bytes of stack
- default stack size is 1MB
- stack for python_d.exe has been already up'ed to 210

So it seems that the best option would be to increase the stack size used when 
linking (/STACK:).  I would suggest increasing it to 3MB using /STACK:3145728.

--

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



[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread miscjunk

miscjunk added the comment:

numpy.ndarray is also not serializable by json.dumps()

import numpy as np
import json

a = np.array([1,2,3,4])
json.dumps(a) #crash
json.dumps(a[0]) #this works!

--
title: json.dumps() claims numpy.bool_ is not serializable - json.dumps() 
claims numpy.ndarray and numpy.bool_ are not serializable

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



[issue18138] ssl.SSLContext.add_cert()

2013-06-25 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
nosy: +jcea

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



[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread R. David Murray

R. David Murray added the comment:

I would (naively) not expect either of these to be serializable.  They are not 
base data types, which is all the json module handles unless you add extra 
handlers yourself.

'crash' means interpreter crash (segfault), by the way.

--
nosy: +r.david.murray
type: crash - behavior

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



[issue18159] ConfigParser getters not available on SectionProxy

2013-06-25 Thread Łukasz Langa

Łukasz Langa added the comment:

There are several reasons why `get*()` methods are redefined on the section 
proxy. First of all, explicit is better than implicit. Secondly, the order of 
arguments is different: `parser.get()` has the fallback argument as the last 
(and keyword-only), whereas `parser['section'].get()` behaves like a mapping. 
You can do `parser['section'].get('key', 'some-fallback-value')` and 
`parser['section'].get('no-such-key')` returns None instead of raising 
`NoOptionError`.

This makes it difficult to automagically support parser `get*()` methods on the 
section proxy. This is why I decided to adapt a different mechanism: register a 
converter and a getter is automatically available:

   cp = ConfigParser()
   cp.converters['list'] = lambda value: value.strip().split()
   cp.getlist('section', 'l')
  ['a', 'b', 'c']
   cp['section'].getlist('l')
  ['a', 'b', 'c']
   cp.getdict('section', 'd')
  Traceback (most recent call last):
  ...
  AttributeError: 'ConfigParser' object has no attribute 'getdict'
   cp['section'].getdict('d')
  Traceback (most recent call last):
  ...
  AttributeError: 'ConfigParser' object has no attribute 'getdict'

This ensures that you can easily add new converters in subclasses or single 
instances and that the parser-level API and section-level API work like they 
should. This also makes implementing custom getters easier since there's no 
logic involved besides the conversion. And if you happen to need custom logic 
anyway, you can register a converter that is a callable class.

--
keywords: +patch
stage:  - patch review
type: behavior - enhancement
Added file: http://bugs.python.org/file30704/issue18159-3.diff

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



[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread miscjunk

miscjunk added the comment:

Thanks for the explanation. I suppose this should be posted to the numpy 
tracker then? Would it be possible for numpy to 'just work' with the json 
module? Or will the final resolution be to use a handler (the default= 
parameter in json.loads) ?

Thanks

--

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



[issue16114] incorrect path in subprocess.Popen() FileNotFoundError message

2013-06-25 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I backported the fix to this in the subprocess32 3.2.5rc1 release I made a week 
or two ago.

--
resolution:  - fixed
status: open - closed

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



[issue18304] ElementTree gets awkward to use if there is an xmlns

2013-06-25 Thread Bryce Nesbitt

New submission from Bryce Nesbitt:

ElementTree offers a wonderful and easy API for parsing XML... but if there is 
a namespace involved it suddenly gets ugly.  This is a proposal to fix that.  
First an example:

--
!/usr/bin/python
# Demonstrate awkward behavior of namespaces in ElementTree
import xml.etree.cElementTree as ET

xml_sample_one = \
?xml version=1.0?
presets
thing stuff=some stuff/
thing stuff=more stuff/
/presets

root = ET.fromstring(xml_sample_one)
for child in root.iter('thing'):
print child.tag

xml_sample_two = \
?xml version=1.0?
presets xmlns=http://josm.openstreetmap.de/tagging-preset-1.0;
thing stuff=some stuff/
thing stuff=more stuff/
/presets

root = ET.fromstring(xml_sample_two)
for child in 
root.iter('{http://josm.openstreetmap.de/tagging-preset-1.0}thing'):
print child.tag
--

Because of the namespace in the 2nd example, a {namespace} name keeps 
{namespace} getting {namespace} in {namespace} {namespace} the way.

Online there are dozens of question on how to deal with this, for example: 
http://stackoverflow.com/questions/11226247/python-ignore-xmlns-in-elementtree-elementtree

With wonderfully syntactic solutions like 'item.tag.split(})[1][0:]'

-
How about if I could set any root to have an array of namespaces to suppress:

root = ET.fromstring(xml_sample_two)
root.xmlns_at_root.append('{namespace}')

Or even just a boolean that says I'll take all my namespaces without 
qualification?

--
components: Extension Modules
messages: 191894
nosy: brycenesbitt
priority: normal
severity: normal
status: open
title: ElementTree gets awkward to use if there is an xmlns
type: enhancement
versions: Python 2.7

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



[issue18303] json.dumps() claims numpy.ndarray and numpy.bool_ are not serializable

2013-06-25 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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