[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Tim Peters

Tim Peters added the comment:

The only sane way to do things "like this" is to allow types to define their 
own special methods (like `__isnan__()`), in which case the math module defers 
to such methods when they exist.  For example, this is how 
`math.ceil(Fraction)` works, by deferring to `Fraction.__ceil__()`.  The math 
module itself knows nothing else about what `ceil(Fraction)` could possibly 
mean.  All it knows is "if the type has __ceil__ use that, else convert to 
float first".

I'm also -1 on adding masses of if/else if/else if/.../else constructs to the 
math module to build in knowledge of the builtin numeric types.  Do it "right" 
or not at all.

I'd just be -0 on adding masses of new __isnan__, __isinf__, ..., special 
methods.  They're just not useful enough often enough.

--
nosy: +tim.peters

___
Python tracker 

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



[issue27766] Add ChaCha20 Poly1305 to SSL ciphers

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

See #27850. ChaCha20 is even less relevant for 3.3 an 3.4. It either requires 
LibreSSL, patch #26470 or a patched OpenSSL installation.

--
nosy: +georg.brandl, larry
stage:  -> commit review

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

Larry, Georg

I haven't pushed the new cipher suite list to 3.3 and 3.4 yet. It can break 
compatibility with ancient IE versions on Windows XP machines. The risk of 3DES 
is small for a typical application.

--
nosy: +georg.brandl, larry

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-09-06 Thread Christian Heimes

Changes by Christian Heimes :


--
stage:  -> commit review

___
Python tracker 

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



[issue27766] Add ChaCha20 Poly1305 to SSL ciphers

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d209fd77 by Christian Heimes in branch '3.5':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/d209fd77

New changeset 6f4f19217d9b by Christian Heimes in branch '2.7':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/6f4f19217d9b

New changeset f586742e56cb by Christian Heimes in branch 'default':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/f586742e56cb

--
nosy: +python-dev

___
Python tracker 

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



[issue27850] Remove 3DES from cipher list (sweet32 CVE-2016-2183)

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d209fd77 by Christian Heimes in branch '3.5':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/d209fd77

New changeset 6f4f19217d9b by Christian Heimes in branch '2.7':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/6f4f19217d9b

New changeset f586742e56cb by Christian Heimes in branch 'default':
Issues #27850 and #27766: Remove 3DES from ssl default cipher list and add 
ChaCha20 Poly1305.
https://hg.python.org/cpython/rev/f586742e56cb

--
nosy: +python-dev

___
Python tracker 

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



[issue27323] ncurses putwin() fails in test_module_funcs

2016-09-06 Thread Xavier de Gaye

Xavier de Gaye added the comment:

> Just wondering, how you built Python with ncurses 6.0 Xavier?

I am using archlinux ncurses 6.0 [1] (sorry for the delay, no internet on a 
sail crossing).

[1] https://www.archlinux.org/packages/core/x86_64/ncurses/

--

___
Python tracker 

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



[issue17884] Try to reuse stdint.h types like int32_t

2016-09-06 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Mark Dickinson

Mark Dickinson added the comment:

> As a convenience for whom?

I was referring to the general math module model. Being able to type `sqrt(2)` 
rather than having to type `sqrt(float(2))` or `sqrt(2.0)` is a convenience.

--

___
Python tracker 

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



[issue17884] Try to reuse stdint.h types like int32_t

2016-09-06 Thread Benjamin Peterson

Benjamin Peterson added the comment:

In 3.6, I just deprecated support for platforms without "long long". 
https://bugs.python.org/issue27961 "deprecated" is a strong word because I 
couldn't actually find a modern Python version that compiles without it. I'm 
informed that the MSVC we're since 3.5 will have stdint.h available. I think we 
should start requiring it.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Mark Dickinson

Mark Dickinson added the comment:

> It shouldn't be hard to do the equivalent of:

Right, that's not hard at all. But is it what we *want* to do? Why do you 
single out `int` for special treatment, but not `Fraction` or `Decimal`? How 
should the implementation handle Fraction objects, and why? How should the 
implementation handle a Fraction-like object implemented by a user? Why only 
objects of exact type `int`, but not instances of subclasses? Your suggestion 
replaces a straightforward mental model (math.isnan converts its input to 
float, then operates on it, just like almost all other math module functions) 
with something more complicated.

-1 from me.

--

___
Python tracker 

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



[issue23085] update internal libffi copy to 3.2.1

2016-09-06 Thread Zachary Ware

Zachary Ware added the comment:

I'm closing this as superseded by #27976, which deprecates building with the 
bundled libffi.

--
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
superseder:  -> Deprecate building with bundled copy of libffi on non-Darwin 
POSIX platforms

___
Python tracker 

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



[issue27976] Deprecate building with bundled copy of libffi on non-Darwin POSIX platforms

2016-09-06 Thread Zachary Ware

Changes by Zachary Ware :


--
components: +ctypes

___
Python tracker 

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



[issue27976] Deprecate building with bundled copy of libffi on non-Darwin POSIX platforms

2016-09-06 Thread Zachary Ware

New submission from Zachary Ware:

Nosy list copied from #23085.

Here's a patch that deprecates building _ctypes with the bundled copy of libffi 
(Modules/_ctypes/libffi/).  The default on all platforms (other than Windows) 
is now to use a system copy of libffi; use the '--without-system-ffi' flag to 
./configure to use the bundled copy.  On non-Darwin platforms, a warning will 
be emitted noting that Modules/_ctypes/libffi will not be distributed with 3.7.

--
components: Build
files: deprecate_bundled_libffi.diff
keywords: patch
messages: 274576
nosy: Arfrever, Chi Hsuan Yen, berker.peksag, chris.jerdonek, doko, fabiovmp, 
gustavotemple, koobs, lemburg, meador.inge, ned.deily, r.david.murray, 
steve.dower, tim.golden, xdegaye, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: Deprecate building with bundled copy of libffi on non-Darwin POSIX 
platforms
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file44399/deprecate_bundled_libffi.diff

___
Python tracker 

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



[issue6135] subprocess seems to use local encoding and give no choice

2016-09-06 Thread Steve Dower

Steve Dower added the comment:

> universal_newlines uses the locale encoding which is a good choice in
most cases.

Well, some cases, and only really by accident. I won't hide the parameter, but 
it is promoted as "frequently used" and I'll make sure to document encoding 
before universal_newlines. Call it a very weak deprecation.

The new patch also removes the openers, which I think were solving a problem we 
don't have right now.

--
Added file: http://bugs.python.org/file44398/6135_3.patch

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-06 Thread R. David Murray

R. David Murray added the comment:

If you want to help out with tracking this down, you could hg bisect the 
commits and find out which one broke it.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Steven D'Aprano

Steven D'Aprano added the comment:

As a convenience for whom? Certainly not the poor user, who thinks that 
math.isnan(x) should return False if the number x is not a NAN. Since 
neither 10**1 nor 10**10 are NANs, why should one return correctly 
and the other raise a completely spurious OverflowError?

I cannot speak for the implementation, except as a wild guess. It 
shouldn't be hard to do the equivalent of:

if type(x) == int: return False  # Intentionally excluding subclasses.
try:
y = float(x)
except OverflowError:
return False
else:
... # existing implementation

but since I know nothing about the C implementation maybe I'm completely 
wrong. But as far as the user's cognitive load, I don't think that:

"math.isnan(x) might return the expected result, or it might raise 
OverflowError"

is *simpler* for the user than:

"math.isnan(x) will return the expected result".

--

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Mark Dickinson

Mark Dickinson added the comment:

Related: #18842

--

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Mark Dickinson

Mark Dickinson added the comment:

I see this as a documentation issue: the vast majority of math module functions 
are designed to operate on floats, and if given a non-float input, simply 
convert that input to a float as a convenience. If we start special-casing math 
module functions for int, Fraction, and Decimal inputs, the module is going to 
become much more complicated both in terms of implementation and in terms of 
cognitive load for the user.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue27969] Suppress unnecessary message when running test_gdb

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e75bf8e5526 by Benjamin Peterson in branch '2.7':
suppress stderr output when checking gdb (closes #27969)
https://hg.python.org/cpython/rev/5e75bf8e5526

New changeset 2c4359ff4d6d by Benjamin Peterson in branch '3.5':
suppress stderr output when checking gdb (closes #27969)
https://hg.python.org/cpython/rev/2c4359ff4d6d

New changeset 6e827e97c064 by Benjamin Peterson in branch 'default':
merge 3.5 (#27969)
https://hg.python.org/cpython/rev/6e827e97c064

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue26896] mix-up with the terms 'importer', 'finder', 'loader' in the import system and related code

2016-09-06 Thread Brett Cannon

Brett Cannon added the comment:

It sounds like you have a backport ready, Senthil. Is that true? If so then go 
ahead and apply the changes.

You're right it could be backported, I just didn't due to laziness/lack of time.

--

___
Python tracker 

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



[issue27974] Remove dead code in importlib._bootstrap

2016-09-06 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy: +eric.snow, ncoghlan

___
Python tracker 

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



[issue27975] math.isnan(int) and math.isinf(int) should not raise OverflowError

2016-09-06 Thread Steven D'Aprano

New submission from Steven D'Aprano:

Currently, math.isnan(n) and math.isinf(n) for n an int may raise OverflowError 
if n is too big to convert to a float, e.g.:

py> math.isnan(10**1)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: int too large to convert to float


But this conversion is unnecessary. int does not support either INF or NAN, so 
there is no need to convert the value to float first. If the argument is an 
int, the result must be False.

The same applies to Fraction.

--
messages: 274568
nosy: steven.daprano
priority: normal
severity: normal
status: open
title: math.isnan(int) and math.isinf(int) should not raise OverflowError

___
Python tracker 

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



[issue27967] Remove unused variables causing compile warnings in sqlite3 module

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ecaa1af8fe04 by Benjamin Peterson in branch '2.7':
fix unused variable warnings in pysqlite (closes #27967)
https://hg.python.org/cpython/rev/ecaa1af8fe04

--
nosy: +python-dev
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue6135] subprocess seems to use local encoding and give no choice

2016-09-06 Thread STINNER Victor

STINNER Victor added the comment:

Steve Dower added the comment:
> Given specifying an encoding will do the same thing as universal_newlines 
> would have, should I just "hide" references to universal_newlines in the doc? 
> (i.e. only mention it under a versionchanged banner, rather than 
> front-and-centre)

No. Don't hide universal_newlines, it's different than encoding.
universal_newlines uses the locale encoding which is a good choice in
most cases.

--

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread STINNER Victor

STINNER Victor added the comment:

UTF codecs must not encode surrogate characters:
http://unicodebook.readthedocs.io/issues.html#non-strict-utf-8-decoder-overlong-byte-sequences-and-surrogates

Python 3 is right, sadly it's too late to fix Python 2.

--

___
Python tracker 

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



[issue27974] Remove dead code in importlib._bootstrap

2016-09-06 Thread Xiang Zhang

New submission from Xiang Zhang:

_ManageReload in importlib._bootstrap seems obsolete since reve729b946cc03, 
remove it?

--
files: importlib__bootstrap.patch
keywords: patch
messages: 274564
nosy: brett.cannon, xiang.zhang
priority: normal
severity: normal
status: open
title: Remove dead code in importlib._bootstrap
type: enhancement
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44397/importlib__bootstrap.patch

___
Python tracker 

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



[issue27575] dict viewkeys intersection slow for large dicts

2016-09-06 Thread David Su

David Su added the comment:

ping

--

___
Python tracker 

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



[issue6135] subprocess seems to use local encoding and give no choice

2016-09-06 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, excellent point about "encoding='utf-8'" already being a less cryptic 
replacement for universal_newlines=True, so consider my questions withdrawn :)

As far as universal_newlines goes, that needs to remain documented for the sake 
of folks reading code that uses it, and folks that need compatibility with 
older versions, but +1 for recommending specifying an encoding over using that 
flag for new 3.6+ code.

--

___
Python tracker 

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



[issue6135] subprocess seems to use local encoding and give no choice

2016-09-06 Thread Steve Dower

Steve Dower added the comment:

Given specifying an encoding will do the same thing as universal_newlines would 
have, should I just "hide" references to universal_newlines in the doc? (i.e. 
only mention it under a versionchanged banner, rather than front-and-centre)

--

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Christoph Reiter

Christoph Reiter added the comment:

On Tue, Sep 6, 2016 at 4:10 PM, Eryk Sun  wrote:
> Lone surrogate codes aren't valid Unicode. In Python 3 they get used 
> internally for tricks like the "surrogateescape" error handler. In Python 
> 3.4+. the 'surrogatepass' error handler allows encoding and decoding lone 
> surrogates:

To add some context: I was writing tests for windows paths containing
surrogates (e.g. os.listdir can return them)

--

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-09-06 Thread Sohaib Ahmad

New submission from Sohaib Ahmad:

urllib.urlretrieve() fails on ftp:
- start and complete a transfer
- immediately start another transfer
The second transfer will fail with the following error:
[Errno ftp error] 200 Type set to I

I am using urllib.urlretrieve(url, filename) to retrieve two files (one by one) 
from FTP server.

Sample code to reproduce the problem is attached. Please update url1 and url2 
with correct values.

This problem was reported several years ago and was fixed but it is now 
reproducible on latest python 2.7 package (2.7.12).

http://bugs.python.org/issue1067702

I tried the same scenario on 2.7.10 and it worked fine. So a patch after 2.7.10 
must have broken something.

--
components: Library (Lib)
files: multiple_ftp_download.py
messages: 274559
nosy: Sohaib Ahmad
priority: normal
severity: normal
status: open
title: urllib.urlretrieve() fails on second ftp transfer
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file44396/multiple_ftp_download.py

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Christoph Reiter

Christoph Reiter added the comment:

On Tue, Sep 6, 2016 at 3:43 PM, Xiang Zhang  wrote:
>
> Xiang Zhang added the comment:
>
> With the latest build, even encode will fail:

With Python 3 you have to use the "surrogatepass" error handler. I
assumed this was the default in Python 2 since it worked with other
codecs.

--

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-09-06 Thread Xiang Zhang

Xiang Zhang added the comment:

My PC is Ubuntu15.10, kernel 4.2, though CPU not Skylake. Everything works fine.

test_aead_aes_gcm (test.test_socket.LinuxKernelCryptoAPI) ... skipped "('[Errno 
2] No such file or directory', 'aead', 'gcm(aes)')"
test_aes_cbc (test.test_socket.LinuxKernelCryptoAPI) ... ok
test_drbg_pr_sha256 (test.test_socket.LinuxKernelCryptoAPI) ... ok
test_hmac_sha1 (test.test_socket.LinuxKernelCryptoAPI) ... ok
test_sendmsg_afalg_args (test.test_socket.LinuxKernelCryptoAPI) ... ok
test_sha256 (test.test_socket.LinuxKernelCryptoAPI) ... ok

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27962] null poiter dereference in set_conversion_mode due uncheck _ctypes_conversion_encoding

2016-09-06 Thread Eryk Sun

Changes by Eryk Sun :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> null poiter dereference in set_conversion_mode due uncheck 
_ctypes_conversion_errors

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Eryk Sun

Eryk Sun added the comment:

Probably Python 2's UTF-16 decoder should be as broken as the encoder, which 
will match the broken behavior of the UTF-8 and UTF-32 codecs:

>>> u'\ud83d\uda12'.encode('utf-8').decode('utf-8')
u'\ud83d\uda12'
>>> u'\ud83d\uda12'.encode('utf-32-le').decode('utf-32-le')
u'\ud83d\uda12'

Lone surrogate codes aren't valid Unicode. In Python 3 they get used internally 
for tricks like the "surrogateescape" error handler. In Python 3.4+. the 
'surrogatepass' error handler allows encoding and decoding lone surrogates: 

>>> u'\ud83d\uda12'.encode('utf-16le', 'surrogatepass')
b'=\xd8\x12\xda'
>>> _.decode('utf-16le', 'surrogatepass')
'\ud83d\uda12'

--
nosy: +eryksun

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Xiang Zhang

Xiang Zhang added the comment:

With the latest build, even encode will fail:

Python 3.6.0a4+ (default:dad4c42869f6, Sep  6 2016, 21:41:38) 
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> u"\ud83d".encode("utf-16-le")
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'utf-16-le' codec can't encode character '\ud83d' in 
position 0: surrogates not allowed

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27970] ssl: can't verify a trusted site with imcomplete certificate chain

2016-09-06 Thread lilydjwg

lilydjwg added the comment:

I understand now, thank you!
It's much easier to work around such issues than fix other people's sites.

--

___
Python tracker 

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



[issue27866] ssl: get list of enabled ciphers

2016-09-06 Thread Berker Peksag

Changes by Berker Peksag :


--
status: open -> closed

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

Some distributions mess with the Kernel or disable user-space crypto. I have 
added some tweaks and fixed a couple of buildbots. I don't know what is going 
on with x86-64 Ubuntu 15.10 Skylake CPU. It's a Kernel 4.2 machine and should 
support AES-CBC.

--

___
Python tracker 

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



[issue27866] ssl: get list of enabled ciphers

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

I have relaxed the tests and stabilized the buildbots. Some Gentoo machines 
don't have ECDHE cipher suites enabled.

--
dependencies:  -Make OpenSSL module compatible with OpenSSL 1.1.0
resolution:  -> fixed
stage: patch review -> resolved

___
Python tracker 

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



[issue27970] ssl: can't verify a trusted site with imcomplete certificate chain

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

>From https://www.ssllabs.com/ssltest/analyze.html?d=miaosss.top

Chain issuesIncomplete
Extra download  COMODO RSA Domain Validation Secure Server CA 

Python does not support extra downloads of incomplete chains. The server must 
return the EE cert and all intermediate certs during the TLS handshake.

You also can't pass the intermediate cert as a CA cert. It's not a trust 
anchor. You could load both the trust anchor and intermediate cert as CA certs 
(concatenate intermediate and root certs), but that is potentially dangerous. 
Safer way is 
https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_add0_chain_cert.html but 
Python does not have an API for SSL_CTX_add0_chain_cert().

Best solution: get the server fixed. It doesn't behave correctly.

--

___
Python tracker 

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



[issue27970] ssl: can't verify a trusted site with imcomplete certificate chain

2016-09-06 Thread lilydjwg

lilydjwg added the comment:

Please read my code. I've provided the CA certificate; this should work because 
I've downloaded the certificate manually and feed it to Python.

openssl command line tool works. gnutls-cli works too. wget (with openssl) 
works too. curl (with openssl) fails like Python but I don't understand why.

I've successfully done things like this before, but now I encounter a site that 
Python can't verify with the correct CA certificate (that other tools accept).

--

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Christoph Reiter

Christoph Reiter added the comment:

Same problem on 3.3.6. But works on 3.4.5. So I guess this was fixed but not 
backported.

--

___
Python tracker 

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



[issue27972] Confusing error during cyclic yield

2016-09-06 Thread Max von Tettenborn

New submission from Max von Tettenborn:

Below code reproduces the problem. The resulting error is a RecursionError and 
it is very hard to trace that to the cause of the problem, which is the runner 
task and the stop task yielding from each other, forming a deadlock.

I think, an easy to make mistake like that should raise a clearer exception. 
And maybe I am mistaken, but it should in principle be possible for the event 
loop to detect a cyclic yield, right?


import asyncio


class A:
@asyncio.coroutine
def start(self):
self.runner_task = asyncio.ensure_future(self.runner())

@asyncio.coroutine
def stop(self):
self.runner_task.cancel()
yield from self.runner_task

@asyncio.coroutine
def runner(self):
try:
while True:
yield from asyncio.sleep(5)
except asyncio.CancelledError:
yield from self.stop()
return


def do_test():
@asyncio.coroutine
def f():
a = A()
yield from a.start()
yield from asyncio.sleep(1)
yield from a.stop()

asyncio.get_event_loop().run_until_complete(f())

--
components: asyncio
messages: 274547
nosy: Max von Tettenborn, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: Confusing error during cyclic yield
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue27971] utf-16 decoding can't handle lone surrogates

2016-09-06 Thread Christoph Reiter

New submission from Christoph Reiter:

Using Python 2.7.12

>>> u"\ud83d".encode("utf-16-le")
'=\xd8'
>>> u"\ud83d".encode("utf-16-le").decode("utf-16-le")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/encodings/utf_16_le.py", line 16, in decode
return codecs.utf_16_le_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 0-1: 
unexpected end of data
>>>

--
components: Unicode
messages: 274546
nosy: ezio.melotti, haypo, lazka
priority: normal
severity: normal
status: open
title: utf-16 decoding can't handle lone surrogates
versions: Python 2.7

___
Python tracker 

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



[issue27958] 'zlib compression' not found in set(['RLE', 'ZLIB', None])

2016-09-06 Thread Christian Heimes

Changes by Christian Heimes :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue27866] ssl: get list of enabled ciphers

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset dad4c42869f6 by Christian Heimes in branch 'default':
Issue 27866: relax get_cipher() test even more. Gentoo buildbot has no ECDHE
https://hg.python.org/cpython/rev/dad4c42869f6

--

___
Python tracker 

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



[issue27970] ssl: can't verify a trusted site with imcomplete certificate chain

2016-09-06 Thread Christian Heimes

Christian Heimes added the comment:

Yes, that is to be expected. Python does not use AIA to fetch missing certs. 
The server must return all intermediate certs. Browsers have workarounds and 
local caches, Python doesn't. Other tools like curl behave the same.

--
nosy: +christian.heimes
resolution:  -> wont fix
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e3b83bfa02c5 by Christian Heimes in branch 'default':
Issue 27744: skip test if AF_ALG socket bind fails
https://hg.python.org/cpython/rev/e3b83bfa02c5

--

___
Python tracker 

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



[issue27350] Compact and ordered dict

2016-09-06 Thread INADA Naoki

Changes by INADA Naoki :


Added file: http://bugs.python.org/file44395/compact-dict.patch

___
Python tracker 

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



[issue27970] ssl: can't verify a trusted site with imcomplete certificate chain

2016-09-06 Thread lilydjwg

New submission from lilydjwg:

This fails:

Python 3.5.2 (default, Jun 28 2016, 08:46:01)
[GCC 6.1.1 20160602] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> import socket
>>> s = socket.socket()
>>> c = 
>>> ssl.create_default_context(cafile='COMODORSADomainValidationSecureServerCA.crt')
>>> s = c.wrap_socket(s, server_hostname='miaosss.top')
>>> s.connect(('miaosss.top', 443))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/ssl.py", line 1019, in connect
self._real_connect(addr, False)
  File "/usr/lib/python3.5/ssl.py", line 1010, in _real_connect
self.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 988, in do_handshake
self._sslobj.do_handshake()
  File "/usr/lib/python3.5/ssl.py", line 633, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed 
(_ssl.c:645)

But openssl can succeed:

openssl s_client -connect miaosss.top:443 -CAfile 
COMODORSADomainValidationSecureServerCA.crt -servername miaosss.top

endswith "Verify return code: 0 (ok)"

Firefox and SSLlabs 
(https://www.ssllabs.com/ssltest/analyze.html?d=miaosss.top) both show it's 
trusted.

--
messages: 274542
nosy: lilydjwg
priority: normal
severity: normal
status: open
title: ssl: can't verify a trusted site with imcomplete certificate chain
type: behavior
versions: Python 3.5

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread Andre Merzky

Andre Merzky added the comment:

I think we are on the same page then, thanks.  

AFAIU, the C-level signal handler results in a flag being set, which is 
evaluated at some later point in time[1], after a certain number of opcodes 
have been executed.  Could it be that those opcodes blindly continue to walk 
into the `else` clause despite the sleep interruption?

[1] 
https://docs.python.org/3/library/signal.html#execution-of-python-signal-handlers

--

___
Python tracker 

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



[issue27866] ssl: get list of enabled ciphers

2016-09-06 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9377ed49746b by Christian Heimes in branch 'default':
Issue 27866: relax test case for set_cipher() and allow more cipher suites
https://hg.python.org/cpython/rev/9377ed49746b

--

___
Python tracker 

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



[issue1067702] urllib fails with multiple ftp transfers

2016-09-06 Thread Sohaib Ahmad

Sohaib Ahmad added the comment:

The problem is reproducible on latest python 2.7 package (2.7.12).

I tried the same scenario on 2.7.10 and it worked fine. I am not sure if this 
issue can be reopened or should I create a new one?

In my case first transfer succeeds but second ftp transfer fails with the error:
[Errno ftp error] 200 Type set to I

I am using urllib.urlretrieve(url, local_path) to retrieve two files (one by 
one) from FTP server.

--
nosy: +Sohaib Ahmad

___
Python tracker 

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



[issue18844] allow weights in random.choice

2016-09-06 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Latest draft patch attached (w/o tests or docs).
Incorporates consultation from Alan Downey and Jake Vanderplas.

* Population and weights are separate arguments (like numpy.random.choice() and 
sample() in R).  Matches the way data would arrive in Pandas.  Easily extracted 
from a Counter or dict using keys() and values().  Suitable for applications 
that sample the population multiple times but using different weights.  See 
https://stat.ethz.ch/R-manual/R-devel/library/base/html/sample.html and 
http://docs.scipy.org/doc/numpy/reference/generated/numpy.random.choice.html

* Excludes a replacement=False option. That use case necessarily has integer 
weights and may be better suited to the existing random.sample() rather than 
trying to recompute a CDF on every iteration as we would have to in this 
function.

* Allows cumulative_weights to be submitted instead of individual weights.  
This supports uses cases where the CDF already exists (as in the ThinkBayes 
examples) and where we want to periodically reuse the same CDF for repeated 
samples of the same population -- this occurs in resampling applications, Gibbs 
sampling, and Monte Carlo Markov Chain applications.  Per Jake, "MCMC/Gibbs 
Sampling approaches generally boil down to a simple weighted coin toss at each 
step" and "It's definitely common to do aggregation of multiple samples, e.g. 
to compute sample statistics"

* The API allows the weights to be integers, fractions, decimals, or floats.  
Likewise, the population and weights can be any Sequence.  Population elements 
need not be hashable.

* Returning a list means that the we don't have to save state in mid-stream 
(that is why we can't use a generator).  A list feeds nicely into Counters, 
mean, median, stdev, etc for summary statistics.  Returning a list parallels 
what random.sample() does, keeping the module internally consistent.

* Default uniform weighting falls back to random.choice() which would be more 
efficient than bisecting.

* Bisecting tends to beat other approaches in the general case.  See 
http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python

* Incorporates error checks for len(population)==len(cum_weights) and for 
conflicting specification of both weights and cumulative weights.

There API is not perfect and there are some aspects that give me heartburn.  1) 
Not saving the computed CDF is waste and forces the user to pre-build the CDF 
if they want to save it for later use (the API could return both the selections 
and the CDF but that would be awkward and atypical).  2) For the common case of 
having small integer weights on a small population, the bisecting approach is 
slower than using random.choice on a population expanded to include the 
selections multiple times in proportion to their weights (that said, short of 
passing in a flag, there is no cheap easy way for this function to detect that 
case and give it a fast path).  3) Outputting a list is inefficient if all 
you're doing with result is summarizing it with a Counter, histogram tool, 
mean, median, or stdev.  4)  There is no cheap way to check to see if the user 
supplied cum_weights is sorted or if the weights contain negative values.

--
Added file: http://bugs.python.org/file44394/weighted_choice.diff

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin

George Slavin added the comment:

The docs say the sleep call will end if a signal is caught, so once the
main thread wakes, it won't go back to sleep.

On Sep 6, 2016 12:35 AM, "Andre Merzky"  wrote:

>
> Andre Merzky added the comment:
>
> Hi George,
>
> > From these results, it appears there is no guarentee that the signal
> handler will run before the main thread continues execution at the
> time.sleep(500) line.  This would explain why we advance to the else clause
> before the exception is raised.
>
> To me it looks like the problem pops up *way* before the `sleep(100)` (or
> whatever) finishes, in fact it looks consistently like the sleep is indeed
> interrupted after one second.  I would it thus interpret differently, as
> the code should not be able to advance to the `else` clause at that time.
>
> Is that different for you?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27106] configparser.__all__ is incomplete

2016-09-06 Thread Jacek Kołodziej

Jacek Kołodziej added the comment:

That's completely fine for me. I'm attaching the patch that just adds test for 
__all__, then. :)

--
Added file: http://bugs.python.org/file44393/configparser_all.v2.patch

___
Python tracker 

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



[issue27965] Automatic .py extension when saving with IDLE on OSX

2016-09-06 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
title: automatic .py extension -> Automatic .py extension when saving with IDLE 
on OSX
type:  -> behavior

___
Python tracker 

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



[issue27965] automatic .py extension

2016-09-06 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue is essentially a duplicate of $4832, in which Ned Deily added 
'defaultextension' in the code below.  Saving works fine on Windows, The added 
default extension is not shown in the input box of the SaveAs dialog but it is 
visible in file listing or in the IDLE editor title bar.  Ned said that with 
the his addition, it also worked on OSX.  Are you sure there is no extension in 
a file listing or title bar if you don't add .py?  What tcl/tk version are you 
using?  (See Help => About IDLE.)

The relevant code in idlelib/iomenu.py (IOBinding before 3.6),

filetypes = [
("Python files", "*.py *.pyw", "TEXT"),
("Text files", "*.txt", "TEXT"),
("All files", "*"),
]

defaultextension = '.py' if sys.platform == 'darwin' else ''
...
def asksavefile(self):
dir, base = self.defaultfilename("save")
if not self.savedialog:
self.savedialog = tkFileDialog.SaveAs(
parent=self.text,
filetypes=self.filetypes,
defaultextension=self.defaultextension)
filename = self.savedialog.show(initialdir=dir, initialfile=base)
return filename

--
components: +Tkinter
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread Andre Merzky

Andre Merzky added the comment:

Hi George, 

> From these results, it appears there is no guarentee that the signal handler 
> will run before the main thread continues execution at the time.sleep(500) 
> line.  This would explain why we advance to the else clause before the 
> exception is raised.

To me it looks like the problem pops up *way* before the `sleep(100)` (or 
whatever) finishes, in fact it looks consistently like the sleep is indeed 
interrupted after one second.  I would it thus interpret differently, as the 
code should not be able to advance to the `else` clause at that time.

Is that different for you?

--

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin

George Slavin added the comment:

In case anyone else sees this thread,  here's my trimmed down script to repro 
the issue:

#!/usr/bin/env python2

import threading   as mt
import signal
import time
import os

def sigusr2_handler(signum, frame):
raise RuntimeError('caught sigusr2')
signal.signal(signal.SIGUSR2, sigusr2_handler)

def sub(pid):
time.sleep(1)
os.kill(pid, signal.SIGUSR2)

try:
t = mt.Thread(target=sub, args=[os.getpid()])
t.start()
time.sleep(500)
except Exception as e:
print('except: %s' % e)
else:
print('unexcepted')
finally:
t.join()


When I run the above, I get the repro after hundreds of iterations.  From these 
results, it appears there is no guarentee that the signal handler will run 
before the main thread continues execution at the time.sleep(500) line.  This 
would explain why we advance to the else clause before the exception is raised.

--

___
Python tracker 

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



[issue27969] Suppress unnecessary message when running test_gdb

2016-09-06 Thread Xiang Zhang

New submission from Xiang Zhang:

Right now, when running test_gdb generates following message:

./python -m test test_gdb
Run tests sequentially
0:00:00 [1/1] test_gdb
*Python Exception  No module named gdb: 
*gdb: warning: 
*Could not load the Python gdb module from `/usr/local/share/gdb/python'.
*Limited Python support is available from the _gdb module.
*Suggest passing --data-directory=/path/to/gdb/data-directory.

test_gdb skipped -- Unable to parse output from gdb.Frame.select test
test_gdb skipped

1 test skipped:
test_gdb

Total duration: 166 ms
Tests result: SUCCESS

The messages prefixed * are messages generated by invoked gdb command and I 
think they are not needed to prompt to users.

test_gdb.patch tries to suppress them. After applied, the messages cleaner.

./python -m test test_gdb
Run tests sequentially
0:00:00 [1/1] test_gdb
test_gdb skipped -- Unable to parse output from gdb.Frame.select test
test_gdb skipped

1 test skipped:
test_gdb

Total duration: 159 ms
Tests result: SUCCESS

--
components: Tests
files: test_gdb.patch
keywords: patch
messages: 274532
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: Suppress unnecessary message when running test_gdb
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44392/test_gdb.patch

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread Andre Merzky

Andre Merzky added the comment:

Also thanks for the reply! :)

Interesting that our results differ: as said, my code stumbles over it rather 
frequently,  and I can't reproduce w/o ctypes activities.  But indeed, the 
latter might just reinforce a race condition which is present either way...  

Yes, I also observed that a print statement (or other activities) makes the 
problem appear less frequently -- I would also guess that it influences a 
potential race somewhere.

Thanks for looking into it!

Andre.

--

___
Python tracker 

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



[issue27889] ctypes interfers with signal handling

2016-09-06 Thread George Slavin

George Slavin added the comment:

Thanks for the reply!  I've managed to reproduce the issue without using 
ctypes, so we can exclude ctypes as the cause of the problem :)

The bug only occurs for me after hundreds of iterations of the script, so it is 
very intermittent.

>From my results, it appears the signal handler is called, but the exception 
>isn't caught in the try block (this matches your result).

>From the call stack it appears the exception handler is called at
"print 'unexcepted'", which is after the try block.

Interestingly, if I place a print after time.sleep, I cannot repro this issue.  
Maybe there is a race between the signal handler execution and execution of the 
try block in the main thread?  Adding the print might slow down the main thread 
enough that the race disappears.

I don't know the source that well, so I'll need to do some digging to get any 
more information.

I hope this helps!

-George Slavin

--

___
Python tracker 

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



[issue27968] test_coroutines generates some warnings

2016-09-06 Thread Xiang Zhang

New submission from Xiang Zhang:

./python -m test test_coroutines
Run tests sequentially
0:00:00 [1/1] test_coroutines
/home/angwer/cpython/Lib/test/test_coroutines.py:891: RuntimeWarning: coroutine 
'CoroutineTest.test_await_12..coro' was never awaited
  return await Awaitable()
/home/angwer/cpython/Lib/test/test_coroutines.py:35: RuntimeWarning: coroutine 
'CoroutineTest.test_await_9..bar' was never awaited
  buffer.append(coro.send(None))
Exception ignored in: .func at 0x7f481378f678>
RuntimeWarning: coroutine 'CoroutineTest.test_fatal_coro_warning..fun' 
was never awaited
Exception ignored in: .AI.__aiter__ at 0x7f481378f5c8>
RuntimeWarning: coroutine 'CoroutineTest.test_for_10..AI.__aiter__' was 
never awaited
Exception ignored in: .AI.__aiter__ at 0x7f481378f5c8>
RuntimeWarning: coroutine 'CoroutineTest.test_for_9..AI.__aiter__' was 
never awaited
/home/angwer/cpython/Lib/test/test_coroutines.py:555: RuntimeWarning: coroutine 
'CoroutineTest.test_func_13..g' was never awaited
  g().send('spam')
/home/angwer/cpython/Lib/test/test_coroutines.py:408: RuntimeWarning: coroutine 
'CoroutineTest.test_func_4..foo' was never awaited
  list(foo())
/home/angwer/cpython/Lib/test/test_coroutines.py:411: RuntimeWarning: coroutine 
'CoroutineTest.test_func_4..foo' was never awaited
  tuple(foo())
/home/angwer/cpython/Lib/test/test_coroutines.py:414: RuntimeWarning: coroutine 
'CoroutineTest.test_func_4..foo' was never awaited
  sum(foo())
/home/angwer/cpython/Lib/test/test_coroutines.py:417: RuntimeWarning: coroutine 
'CoroutineTest.test_func_4..foo' was never awaited
  iter(foo())
/home/angwer/cpython/Lib/test/test_coroutines.py:438: RuntimeWarning: coroutine 
'CoroutineTest.test_func_5..foo' was never awaited
  for el in foo(): pass
1 test OK.

Total duration: 290 ms
Tests result: SUCCESS

--
messages: 274529
nosy: giampaolo.rodola, gvanrossum, haypo, xiang.zhang, yselivanov
priority: normal
severity: normal
status: open
title: test_coroutines generates some warnings
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue27967] Remove unused variables causing compile warnings in sqlite3 module

2016-09-06 Thread Xiang Zhang

New submission from Xiang Zhang:

Compile py2.7 will generate two unused variable warnings in sqlite3 module. The 
variables have already not existed in py3.

/home/angwer/py2.7/Modules/_sqlite/cursor.c: In function 
‘pysqlite_cursor_dealloc’:
/home/angwer/py2.7/Modules/_sqlite/cursor.c:121:9: warning: variable ‘rc’ set 
but not used [-Wunused-but-set-variable]
 int rc;

/home/angwer/py2.7/Modules/_sqlite/statement.c: In function 
‘pysqlite_statement_dealloc’:
/home/angwer/py2.7/Modules/_sqlite/statement.c:414:9: warning: variable ‘rc’ 
set but not used [-Wunused-but-set-variable]
 int rc;

--
components: Library (Lib)
files: py2.7_sqlite_unused.patch
keywords: patch
messages: 274528
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: Remove unused variables causing compile warnings in sqlite3 module
versions: Python 2.7
Added file: http://bugs.python.org/file44391/py2.7_sqlite_unused.patch

___
Python tracker 

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



<    1   2   3