[issue31997] SSL lib does not handle trailing dot (period) in hostname or certificate

2017-11-09 Thread Christian Heimes

Christian Heimes  added the comment:

Trailing dots in hostname seem to be protocol specific, e.g. SMTP does not 
allow them. Unless you find a RFC that mandates support for trailing dots in 
TLS, I'm against a change in Python's TLS stack. It's too risky to mess up SNI, 
too.

I'd rather follow RFC 5890, make the caller deal with FQDN + trailing dot and 
require libraries to pass in a DNS Domain Names (a fully qualified domain name 
without a trailing dot) to server_hostname.

https://tools.ietf.org/html/rfc6125#section-2.2
https://tools.ietf.org/html/rfc5890#section-2.2

   (The complete name convention using a trailing dot described
   in RFC 1123 [RFC1123], which can be explicit as in "www.example.com."
   or implicit as in "www.example.com", is not considered in this
   specification.)

--
nosy: +alex, dstufft, janssen

___
Python tracker 

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



[issue31997] SSL lib does not handle trailing dot (period) in hostname or certificate

2017-11-09 Thread Christian Heimes

Christian Heimes  added the comment:

In the future Python will no longer use its own hostname verification code. 
Instead we are going to rely on OpenSSL to verify the hostname for us. A 
trailing dot also affects SNI. How do OpenSSL's functions 
SSL_set_tlsext_host_name() and X509_VERIFY_PARAM_set1_host() deal with a 
trailing dot?

How do TLS servers such as Apache mod_ssl, Apache mod_nss, nginx, Go's TLS 
server, ... deal with trailing dot in SNI?

--

___
Python tracker 

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



[issue31380] test_undecodable_filename() in Lib/test/test_httpservers.py broken on APFS

2017-11-09 Thread Matt Billenstein

Matt Billenstein  added the comment:

Reflected on the High Sierra buildbot now:  
http://buildbot.python.org/all/#/builders/14/builds/162

--
nosy: +mattbillenstein

___
Python tracker 

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



[issue28117] warning: dereferencing type-punned pointer will break strict-aliasing rules

2017-11-09 Thread Masayuki Yamamoto

Masayuki Yamamoto  added the comment:

Serhiy, would you open a PR? Your patch looks good to me.
I've been looking at the warning on my machine (ubuntu 16.04 x86), it's a bit 
annoying to me.

--
nosy: +masamoto

___
Python tracker 

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



[issue31997] SSL lib does not handle trailing dot (period) in hostname or certificate

2017-11-09 Thread Sam Napolitano

New submission from Sam Napolitano :

I recently came across an issue in the ssl library and have a simple fix to 
address it.

When doing hostname verification against an X.509 certificate, a trailing dot 
(period) in the hostname is matched against the certificate.  But the trailing 
dot should only be applied to the DNS lookup not the certificate match.

Conversely, a certificate that has a trailing dot in its commonName (probably 
rare but allowed) should match a hostname without the trailing dot.  As the ssl 
library is written now, both cases fail.

The truth table below shows the current python ssl DNS matching behavior.

++
|  #  hostnamecertificateMATCH   |
| ++ |
| |   dns  dns.   cname cname. | |
| ++ |
|  1   xxTRUE|
|  2   x  x  FALSE   |
|  3x   xFALSE   |
|  4x x  TRUE|
++

Case 1 and 4 currently match as both hostname and certificate strings match 
exactly when the trailing dot is either present or not.

Case 2 is unlikely, as certificates are rarely signed with a trailing dot in 
the subject commonName and if they were, clients would ALWAYS have to enter the 
hostname with a trailing dot to get a match.

Case 3 is more likely where the hostname has a trailing dot, but the 
certificate does not.  For example, "www.example.com." is used for the DNS 
lookup, but then, "www.example.com." will not match the certificate due to the 
trailing dot missing from the certificate.

I propose the truth table should be true in all cases and just ignore the 
trailing dot in both the hostname and certificate.

As best I can tell, the RFCs [1] are silent on this issue.  Although the 
hostname and commonName strings currently must match, there are a couple of 
precedents where ignoring the trailing dot is done in practice.

Web browsers allow a trailing dot in the URI and will accept a certificate even 
when the certificate doesn't have a trailing dot.  For example, visit Google 
with trailing dot (https://www.google.com./) from a browser of your choice and 
check certificate.  It should check out as valid. [2]

Also, at least two language SSL libraries, Ruby [3] and Go [4], match 
certificates when hostnames contain a trailing dot.  Lastly cURL [5] ignores 
trailing dots in certs and hostnames.

In summary, I don't feel the current python ssl library is wrong - it is 
following an interpretation of the RFC.  But I think it can be more permissive, 
following the spirit of the RFC without sacrificing security.

Patch attached with code change.  If accepted, I can do a more formal PR, 
backport to 2.7 and add tests.

Thoughts?
-Sam


Example of issue


Python 3.7.0a2+ (heads/master-dirty:cbe1756e3e, Nov  3 2017, 15:56:14)
[Clang 8.1.0 (clang-802.0.42)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> cert = {'subject': ((('commonName', 'example.com'),),)}
>>> ssl.match_hostname(cert, "example.com")## Case 1 from truth table
>>> ssl.match_hostname(cert, "example.com.")   ## Case 3 from truth table
Traceback (most recent call last):
  File "", line 1, in 
  File ".../cpython/Lib/ssl.py", line 330, in match_hostname
% (hostname, dnsnames[0]))
ssl.CertificateError: hostname 'example.com.' doesn't match 'example.com'

>>> cert = {'subject': ((('commonName', 'example.com.'),),)}
>>> ssl.match_hostname(cert, "example.com.")   ## Case 4 from truth table
>>> ssl.match_hostname(cert, "example.com")## Case 2 from truth table
Traceback (most recent call last):
  File "", line 1, in 
  File ".../cpython/Lib/ssl.py", line 330, in match_hostname
% (hostname, dnsnames[0]))
ssl.CertificateError: hostname 'example.com' doesn't match 'example.com.'

References
==

[1] RFCs - there may be other RFCs addressing X.509 certificates

https://tools.ietf.org/html/rfc6125
https://tools.ietf.org/html/rfc5280
https://tools.ietf.org/html/rfc3986

[2] Old Mozilla thread discussing the trailing dot:

https://bugzilla.mozilla.org/show_bug.cgi?id=134402#c36

I quote:

Yes, it's ok to match "www.example.com." (trailing) to the cert with 
"www.example.com" (no trailing)
It's also OK to match "www.example.com" (no trailing) to the cert with 
"www.example.com." (trailing)

[3] Ruby

Ironically Ruby doesn't even take the trailing dot into consideration as it 
splits the strings using dot as the delimiter.

irb> "www.example.com".split('.') == "www.example.com.".split('.')
=> true

https://github.com/ruby/openssl/blob/master/lib/openssl/ssl.rb#L295

[4] Go

The trailing dot is explicitly removed in Go TLS library.

https://github.com/golang/go/blob/master/src/crypto/x509/verify.go#L913

[5] cURL

cURL strips trailing dot following behavior in browsers.


[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-09 Thread Nick Coghlan

Nick Coghlan  added the comment:

Antoine, it's not a wishy-washy compromise, it's a compromise based on the fact 
that code that has been factored out to a support module is far more likely to 
have a test suite than code that's directly in __main__.

Thus the logic for the revised default filters is as follows:

* code running in __main__ will see deprecation warnings when it runs
* code running outside __main__ will see deprecation warnings when its test 
suite runs

If someone is publishing code that's not in a main module, and they *don't* 
have a test suite for that code yet, then they have bigger problems to worry 
about than not seeing deprecation warnings.

--

___
Python tracker 

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



[issue10049] Add a "no-op" (null) context manager to contextlib

2017-11-09 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reverting to "Needs patch", as the currently attached patch is for the "No 
behaviour" variant that always returns None from __enter__().

(hniksic, would you still be willing to sign the Python CLA? If so, then your 
patch could be used as the basis for an updated implementation. Otherwise I'd 
advise anyone working on this to start from scratch)

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue10049] Add a "no-op" (null) context manager to contextlib

2017-11-09 Thread Nick Coghlan

Nick Coghlan  added the comment:

Reopening this based on several years of additional experience with context 
managers since I wrote https://bugs.python.org/issue10049#msg119514 when 
originally closing it.

The version I'm now interested in adding is the one from 
https://bugs.python.org/issue10049#msg281556 - rather than being completely 
without behaviour, the null context manager should accept the value to be 
returned from the call to __enter__ as an optional constructor parameter 
(defaulting to None). That allows even context managers that return a value 
from __enter__ to be made optional in a relatively obvious way that doesn't 
involve fundamentally rearranging the code.

I think the overhead argument against the use of ExitStack() for this purpose 
also has merit (so I'd be curious to see relative performance numbers collected 
with perf), but it's not my main motive for changing my mind.

--
resolution: rejected -> 
status: closed -> open
title: Add a "no-op" (null) context manager to contextlib (Rejected: use 
contextlib.ExitStack()) -> Add a "no-op" (null) context manager to contextlib

___
Python tracker 

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



[issue31222] datetime.py implementation of .replace inconsistent with C implementation

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset b9a40aca2935d2569191844c88f8b61269e383cb by Victor Stinner (Miss 
Islington (bot)) in branch '3.6':
bpo-31222: Make (datetime|date|time).replace return subclass type in Pure 
Python (GH-4176) (#4356)
https://github.com/python/cpython/commit/b9a40aca2935d2569191844c88f8b61269e383cb


--

___
Python tracker 

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



[issue31985] Deprecate openfp() in aifc, sunau and wave

2017-11-09 Thread Brian Curtin

Brian Curtin  added the comment:

I think https://github.com/python/cpython/pull/4344 covers what you're looking 
for.

--

___
Python tracker 

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



[issue31996] `setuptools.setup` parameter `py_modules` is undocumented

2017-11-09 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you for your report, but the correct place to report issues with 
packaging.p.o is https://github.com/pypa/python-packaging-user-guide

--
nosy: +berker.peksag
resolution:  -> third party
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



[issue31996] `setuptools.setup` parameter `py_modules` is undocumented

2017-11-09 Thread Luther Thompson

New submission from Luther Thompson :

I wrote my own distribution package with only one module, but the module file 
was not being installed along with the dist info file. I found by looking up 
the code for the `six` module that `setup` has a `py_modules` parameter which 
apparently must be used to make the installation work. This module is not 
mentioned anywhere in 
https://packaging.python.org/tutorials/distributing-packages/.

--
assignee: docs@python
components: Documentation
messages: 305997
nosy: Luther Thompson, docs@python
priority: normal
severity: normal
status: open
title: `setuptools.setup` parameter `py_modules` is undocumented
type: enhancement
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



[issue31299] Add "ignore_modules" option to TracebackException.format()

2017-11-09 Thread Dmitry Kazakov

Dmitry Kazakov  added the comment:

I only recently realized that trace.Trace accepts two similar arguments, namely 
ignoremods and ignoredirs. Should we try to make the API and implementation of 
the functionality proposed here conform to that of trace.Trace's ignoremods? 
Would Python-Ideas be a more appropriate place to discuss this?

--

___
Python tracker 

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



[issue31985] Deprecate openfp() in aifc, sunau and wave

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

audiotests.py. Create class AudioMiscTests and inherit classes AifcMiscTest, 
SunauMiscTest, WaveMiscTest from it instead of AudioTests. There is more work 
because there was no base for misc tests, but this will make adding other 
common misc test easier.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

So we're saving memory and CPU time.  Cool!

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Olivier Grisel

Olivier Grisel  added the comment:

More benchmarks with the unix time command:

```

(py37) ogrisel@ici:~/code/cpython$ git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
(py37) ogrisel@ici:~/code/cpython$ time python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 10.677s
=> peak memory usage: 5.936 GB

real0m11.068s
user0m0.940s
sys 0m5.204s
(py37) ogrisel@ici:~/code/cpython$ time python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 5.089s
=> peak memory usage: 5.978 GB

real0m5.367s
user0m0.840s
sys 0m4.660s
(py37) ogrisel@ici:~/code/cpython$ git checkout 
issue-31993-pypickle-dump-mem-optim 
Switched to branch 'issue-31993-pypickle-dump-mem-optim'
(py37) ogrisel@ici:~/code/cpython$ time python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 6.974s
=> peak memory usage: 2.014 GB

real0m7.300s
user0m0.368s
sys 0m4.640s
(py37) ogrisel@ici:~/code/cpython$ time python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 10.873s
=> peak memory usage: 2.014 GB

real0m11.178s
user0m0.324s
sys 0m5.100s
(py37) ogrisel@ici:~/code/cpython$ time python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 4.233s
=> peak memory usage: 2.014 GB

real0m4.574s
user0m0.396s
sys 0m4.368s
```

User time is always better in the PR than on master but is also much slower 
than system time (disk access) in any case. System time is much less 
deterministic.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Olivier Grisel

Olivier Grisel  added the comment:

Note that the time difference is not significant. I rerun the last command I 
got:

```
(py37) ogrisel@ici:~/code/cpython$ python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 4.187s
=> peak memory usage: 2.014 GB
```

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

But the total runtime is higher? (6 s. vs. 5 s.)  Can you post the CPU time?  
(as measured by `time`, for example)

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Olivier Grisel

Olivier Grisel  added the comment:

I wrote a script to monitor the memory when dumping 2GB of data with python 
master (C pickler and Python pickler):

```
(py37) ogrisel@ici:~/code/cpython$ python ~/tmp/large_pickle_dump.py
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 5.141s
=> peak memory usage: 4.014 GB
(py37) ogrisel@ici:~/code/cpython$ python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 5.046s
=> peak memory usage: 5.955 GB
```

This is using protocol 4. Note that the C pickler is only making 1 useless 
memory copy instead of 2 for the Python pickler (one for the concatenation and 
the other because of the framing mechanism of protocol 4).

Here the output with the Python pickler fixed in python/cpython#4353:

```
(py37) ogrisel@ici:~/code/cpython$ python ~/tmp/large_pickle_dump.py 
--use-pypickle
Allocating source data...
=> peak memory usage: 2.014 GB
Dumping to disk...
done in 6.138s
=> peak memory usage: 2.014 GB
```


Basically the 2 spurious memory copies of the Python pickler with protocol 4 
are gone.

Here is the script: 
https://gist.github.com/ogrisel/0e7b3282c84ae4a581f3b9ec1d84b45a

--

___
Python tracker 

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



[issue31985] Deprecate openfp() in aifc, sunau and wave

2017-11-09 Thread Brian Curtin

Brian Curtin  added the comment:

Serhiy, where should a common test that covers all three of these go? I'm not 
seeing an obvious place for it.

--

___
Python tracker 

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



[issue31985] Deprecate openfp() in aifc, sunau and wave

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
title: Deprecate aifc.openfp -> Deprecate openfp() in aifc, sunau and wave

___
Python tracker 

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



[issue30952] [Windows] include Math extension in SQlite

2017-11-09 Thread Big Stone

Big Stone  added the comment:

Please apologize. I indeed went off-topic. I can understand few person find 
this request usefull, and over-react to defend it.

Sorry again.

--
status: pending -> open

___
Python tracker 

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



[issue31778] ast.literal_eval supports non-literals in Python 3

2017-11-09 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

Just a comment on what I guess is the intended use of literal_eval(), i.e. 
taking a potentially untrusted string and turning it into a Python object.  
Exposing the whole of the Python parser to potential attackers would make me 
very worried.  Parsing code for all of Python syntax is just going to be very 
complicated and there can easily be bugs there.  Generating an AST and then 
walking over it to see if it is safe is also scary.  The "attack surface" is 
too large.  This is similar to the Shellshock bug. If you can trust the 
supplier of the string then okay but I would guess that literal_eval() is going 
to get used for untrusted inputs.

It would be really nice to have something like ast.literal_eval() that could be 
used for untrusted strings.  I would implement it by writing a retricted 
parser.  Keep it extremely simple.  Validate it by heavy code reviews and 
extensive testing (e.g. fuzzing).

--
nosy: +nascheme

___
Python tracker 

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



[issue31222] datetime.py implementation of .replace inconsistent with C implementation

2017-11-09 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4312

___
Python tracker 

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



[issue31992] Make iteration over dict_items yield namedtuples

2017-11-09 Thread Eric V. Smith

Eric V. Smith  added the comment:

I cannot imagine this ever happening, for performance reasons.

You should write your own wrapper around items, if you want this behavior.

--
nosy: +eric.smith

___
Python tracker 

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



[issue27987] obmalloc's 8-byte alignment causes undefined behavior

2017-11-09 Thread Neil Schemenauer

Neil Schemenauer  added the comment:

FYI, this would seem to be an incentive to get my "bitmaps for small GC 
objects" idea implemented.  I.e.

https://mail.python.org/pipermail/python-dev/2017-September/149307.html

If implemented, the extra size of the PyGC_Head would only apply to "large" 
objects.  In my prototype, I'm thinking of using 512 bytes as the size limit 
for small GC objects.

--
nosy: +nascheme

___
Python tracker 

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



[issue31222] datetime.py implementation of .replace inconsistent with C implementation

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset 191e993365ac3206f46132dcf46236471ec54bfa by Victor Stinner (Paul 
Ganssle) in branch 'master':
bpo-31222: Make (datetime|date|time).replace return subclass type in Pure 
Python (#4176)
https://github.com/python/cpython/commit/191e993365ac3206f46132dcf46236471ec54bfa


--
nosy: +haypo

___
Python tracker 

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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: patch review -> 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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 1bce4efdb4624561adce62e544dbe20ec2627ae2 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-31927: Fix reading arbitrary data when parse a AF_BLUETOOTH address 
(GH-4235) (GH-4352) (#4355)
https://github.com/python/cpython/commit/1bce4efdb4624561adce62e544dbe20ec2627ae2


--

___
Python tracker 

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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4310

___
Python tracker 

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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 596286f8f3c8e53ef010d6298464775dc900a515 by Serhiy Storchaka in 
branch '3.6':
[3.6] bpo-31927: Fix bugs in socketmodule.c on NetBSD and other issues. 
(GH-4235) (#4352)
https://github.com/python/cpython/commit/596286f8f3c8e53ef010d6298464775dc900a515


--

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +rhettinger, serhiy.storchaka
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue31995] Set operations documentation error

2017-11-09 Thread Alexander Mentis

New submission from Alexander Mentis :

Documentation for set/frozenset says |=, &=, -=, ^= operators do not apply to 
immutable instances of frozenset. This is incorrect. These operators can be 
used on frozenset; however, they behave differently on frozenset than on set. 
When used with set, they modify the target set in place. When used with 
frozenset, they return a new frozenset that replaces the target frozenset.

--
assignee: docs@python
components: Documentation
messages: 305981
nosy: Alexander Mentis, docs@python
priority: normal
severity: normal
status: open
title: Set operations documentation error
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue31994] json encoder exception could be better

2017-11-09 Thread Jason Hihn

New submission from Jason Hihn :

Given this traceback:
  File 
"/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/encoder.py",
 line 184, in default
raise TypeError(repr(o) + " is not JSON serializable")
TypeError: 7.0374198 is not JSON serializable

It would actually be better to have the error reported as type(o)+ " is not 
JSON serializable."  because at first glance, 7.0374198 *is* serializable. In 
this specific case, the issue can be fixed by attempting to serialize float(o), 
because it is a ndarray. Maybe there's a better way to do numpy types or some 
kind of automatic conversion but for now, this is only a request to alter the 
message, I'd hope to something like:

repr(o) + " of type " + type(o) + " is not JSON serializable"

It's it's really more about the type rather than the value being serialized.

--
components: Extension Modules
messages: 305980
nosy: Jason Hihn
priority: normal
severity: normal
status: open
title: json encoder exception could be better
type: enhancement
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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Would be nice to see benchmarks.

And what about C version?

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
stage: needs patch -> patch review

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As for the C pickler, currently it dumps the whole pickle into an internal 
buffer before calling write() at the end.  You may want to make writing more 
incremental.  See Modules/_pickler.c (especially _Pickler_Write()).

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue14124] _pickle.c comment/documentation improvement

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Roundup Robot

Change by Roundup Robot :


--
keywords: +patch
pull_requests: +4309
stage: needs patch -> patch review

___
Python tracker 

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



[issue19907] gettext - Non ascii chars in header

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Of course, +1 for fixing this.

--

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You don't need to add a test for a performance enhancement.

--
stage:  -> needs patch
type: resource usage -> performance
versions:  -Python 3.4, Python 3.5, Python 3.6, Python 3.8

___
Python tracker 

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



[issue31993] pickle.dump allocates unnecessary temporary bytes / str

2017-11-09 Thread Olivier Grisel

New submission from Olivier Grisel :

I noticed that both pickle.Pickler (C version) and pickle._Pickler (Python 
version) make unnecessary memory copies when dumping large str, bytes and 
bytearray objects.

This is caused by unnecessary concatenation of the opcode and size header with 
the large bytes payload prior to calling self.write.

For protocol 4, an additional copy is caused by the framing mechanism.

I will submit a pull request to fix the issue for the Python version. I am not 
sure how to test this properly. The BigmemPickleTests seems to be skipped on my 
16 GB laptop.

--
components: Library (Lib)
messages: 305975
nosy: Olivier.Grisel, pitrou
priority: normal
severity: normal
status: open
title: pickle.dump allocates unnecessary temporary bytes / str
type: resource usage
versions: Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

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



[issue21322] Pathlib .owner() and .group() methods fail on broken links

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue29416] Path.mkdir can get into a recursive error loop

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> fixed
stage: commit review -> resolved
status: pending -> closed

___
Python tracker 

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



[issue14975] import unicodedata, DLL load failed on Python 2.7.3

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue28827] f-strings: format spec should not accept unicode escapes

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> not a bug
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue30213] ZipFile from 'a'ppend-mode file generates invalid zip

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> duplicate
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue30035] [RFC] PyMemberDef.name should be const char *

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> out of date
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue25849] files, opened in unicode (text): write() returns symbols count, but seek() expect offset in bytes

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: pending -> closed

___
Python tracker 

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



[issue27142] Default int value with xmlrpclib / xmlrpc.client

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
resolution:  -> rejected
stage:  -> resolved
status: pending -> closed

___
Python tracker 

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



[issue30952] [Windows] include Math extension in SQlite

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> pending

___
Python tracker 

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



[issue30952] [Windows] include Math extension in SQlite

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

"If you want SQlite because of its performance, recent version starts to do 
multi-threading, and/or fear to leave other langages a stupid sizeable 
performance advantage, then you may perhaps don't leave the situation as it is."

I'm not sure of what you are asking here. Is it related to the math module? If 
not, you might open a different issue.


"then you may perhaps don't leave the situation as it is"

Reminder: Python is developed by volunteers working in their free time. It's 
not a product for which you pay a commercial support.

"Look at latest Intel cpu shooting for quadcore, Iphone 8 being 6 cores, latest 
stable nodejs gaining a big speed bump, ... etc ... etc... and the need of 
efficiency to keep the planet cool enough."

Ok, now you are really off-topic.

*I* don't know anything about sqlite. That's why I asked how this feature is 
supposed to be implemented.

If nobody proposes a pull request or explain how to implement it, this issue is 
not going to make progress ;-)

--

___
Python tracker 

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



[issue31778] ast.literal_eval supports non-literals in Python 3

2017-11-09 Thread Serhiy Storchaka

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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4308

___
Python tracker 

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



[issue31992] Make iteration over dict_items yield namedtuples

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Oh, no! Tuples is one of the most charming features of Python. Use tuples, folk!

--
nosy: +rhettinger, serhiy.storchaka

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Fixed by PR 4349 (changeset 15e14538f90cabc87473a489316fdb81af76cfb2).

--
resolution:  -> fixed
stage: patch review -> 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



[issue28759] access to mkfifo, mknod and hard links is controled by SELinux MAC on Android

2017-11-09 Thread Xavier de Gaye

Change by Xavier de Gaye :


--
pull_requests: +4307

___
Python tracker 

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



[issue31977] threading.Condition can not work with threading.Semaphore

2017-11-09 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue31992] Make iteration over dict_items yield namedtuples

2017-11-09 Thread Richard Neumann

New submission from Richard Neumann :

Currently, iterating over dict_items will yield plain tuples, where the first 
item will be the key and the second item will be the respective value.

This has some disadvantages when e.g. sorting dict items by value and key:

def sort_by_value_len(dictionary):
return sorted(dictionary.items(), key=lambda item: (len(item[1]), 
item[0]))

I find this index accessing extremely unelegant and unnecessarily hard to read.

If dict_items would instead yield namedtuples like

DictItem = namedtuple('DictItem', ('key', 'value'))

this would make constructs like

def sort_by_value_len(dictionary):
return sorted(dictionary.items(), key=lambda item: (len(item.value), 
item.key))

possible and increase code clarity a lot.
Also, namedtuples mimic the behaviour of plain tuples regarding unpacking and 
index accessing, so that backward-compatipility should exist.

--
components: Library (Lib)
messages: 305970
nosy: Richard Neumann
priority: normal
severity: normal
status: open
title: Make iteration over dict_items yield namedtuples
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue31927] Fix compiling the socket module on NetBSD 8 and other issues

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset d3187158c09cf899e9849f335bdff10594209167 by Serhiy Storchaka in 
branch 'master':
bpo-31927: Fix bugs in socketmodule.c on NetBSD and other issues. (#4235)
https://github.com/python/cpython/commit/d3187158c09cf899e9849f335bdff10594209167


--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
pull_requests: +4306
stage: resolved -> patch review

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Then let the statu quo wins!

--

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-09 Thread Guido van Rossum

Guido van Rossum  added the comment:

> Such a middle ground is just a wishy-washy decision-by-committee compromise.

Fine, but since *I* won't tolerate these warnings on for everything, this is 
the best you can do. If you don't like it, the status quo wins.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

I suggest to fix the tests, the code looks good to me.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Because the default behavior is different in Python 2 and Python 3. In Python 3 
this is a TypeError. In Python 2 all objects are comparable by default.

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

kqueue_event_richcompare() returns NotImplemented if other is not an event:

if (!kqueue_event_Check(o)) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}

So I don't understand why tests started to fail with the commit 
ce51890894be46f8f9d991a1d0ea1455fc41ccdc.

--

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you Antoine!

--

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue28441] Change sys.executable to include executable suffix

2017-11-09 Thread Erik Bray

Change by Erik Bray :


--
pull_requests: +4305

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 0a2ff23fe6efb1653d655ac19d0a4e1629fd8d95 by Antoine Pitrou in 
branch 'master':
Silence error output in test_concurrent_futures (bpo-21423) (#4347)
https://github.com/python/cpython/commit/0a2ff23fe6efb1653d655ac19d0a4e1629fd8d95


--

___
Python tracker 

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



[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

2017-11-09 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
components: +Interpreter Core
nosy: +ncoghlan
stage:  -> needs patch
versions: +Python 3.7

___
Python tracker 

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



[issue31989] setattr on a property gives a very unhelpful exception

2017-11-09 Thread R. David Murray

R. David Murray  added the comment:

This is a duplicate of #27794.

--
nosy: +r.david.murray
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> setattr a read-only property; the AttributeError should show 
the attribute that failed
versions: +Python 3.8 -Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue31991] Race condition in wait with timeout for multiprocessing.Event

2017-11-09 Thread Thomas Moreau

New submission from Thomas Moreau :

If the methods `set` and `clear` of `multiprocessing.Event` are called one 
after another, while a `multiprocessing.Process` calls `wait`, the  `Event` 
does not match the documented behavior 
(https://docs.python.org/3.7/library/threading.html#threading.Event.wait) and 
the call to wait can return `False` even though the call to wait did not 
timeout (This happens both with `timeout=30` or `timeout=None`).

Attached is a script reproducing this issue.
The documentation should either be changed or the behavior should be updated.

--
components: Library (Lib)
files: concurrent_event.py
messages: 305960
nosy: tomMoral
priority: normal
severity: normal
status: open
title: Race condition in wait with timeout for multiprocessing.Event
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47256/concurrent_event.py

___
Python tracker 

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



[issue31265] Remove doubly-linked list from C OrderedDict

2017-11-09 Thread STINNER Victor

Change by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +4304
stage:  -> patch review

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Serhiy, I think I have found a way to deal with the logging output:
https://github.com/python/cpython/pull/4347

--
stage: patch review -> 

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Oh, I didn't test on 2.7.

The old code contradicted the common comparison behavior. It allowed comparing 
select.kevent with other objects only for equality as for identity. `kevent == 
other` always returned False even if `other == kevent` returned True. `kevent < 
other` raised a TypeError.

The new code uses the default behavior. `kevent == other` returns the same as 
`other == kevent` (False by default if types are not comparable, but may return 
True if `other.__eq__(kevent)` returns True). `kevent < other` returns the same 
as `other > kevent`. E.g. raises a TypeError by default in Python 3. But in 
Python 2 all objects are comparable by default, and this breaks a test which 
expects that select.kevent is not comparable.

There are two ways to fix this:

1. Make select.kevent non-comparable again. This contradicts the default 
behavior and I don't know reasons why it should be non-comparable, but this was 
an existing behavior.

2. Remove the tests or change them to test that comparing select.kevent with 
other object doesn't raise an error.

--

___
Python tracker 

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



[issue31987] Ctypes Packing Bitfields Incorrectly - GCC both Linux and Cygwin

2017-11-09 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you for your report. I believe this is a duplicate of issue 29753.

--
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Ctypes Packing Bitfields Incorrectly - Linux
type:  -> behavior

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I'm not well experienced with logging, but if we can change the logging in 
subprocesses, I think we could change it to not output messages at all. It 
would be better to save logging messages in subprocesses and check that 
expected logging messages are emitted in the main process. There is 
assertLogs(), but it works only with logging in the same process.

--

___
Python tracker 

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



[issue30487] DOC: automatically create a venv and install Sphinx when running make

2017-11-09 Thread Caleb Hattingh

Caleb Hattingh  added the comment:

No worries. I've made a new PR 4346. The old one was unsalvagable I'm afraid. 
Too many other people got added to the notifications list as a result of my 
incorrect rebase.  The new one is fine.

--

___
Python tracker 

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



[issue30487] DOC: automatically create a venv and install Sphinx when running make

2017-11-09 Thread Caleb Hattingh

Change by Caleb Hattingh :


--
keywords: +patch
pull_requests: +4303

___
Python tracker 

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



[issue21423] concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argument

2017-11-09 Thread Vinay Sajip

Vinay Sajip  added the comment:

> What is the best way to silence logging in subprocesses?

Are you referring to the output shown in msg305601? If it's caused by logging 
statements, the best way would be either to pipe stderr to /dev/null or to 
change the logging to use sys.stdout (sys.stderr is just the default) and then 
pipe stdout to /dev/null.

I hope I haven't misunderstood your question, but I fear I may have.

--

___
Python tracker 

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



[issue31990] Pickling deadlocks in thread with python -m

2017-11-09 Thread Werner Smidt

New submission from Werner Smidt :

Hi there

I recently stumbled on an interesting behaviour.  I won't call it an error, 
because I think it's a mistake I made.  

BACKGROUND: I want to spawn threads that handle pickled data.  This works 
really well. However, I would like to execute the python script in question as 
a module, i.e. python -m mymodule. This is merely for aesthetic purposes.

The attached script has two functions:
1. Pickle/unpickle an instance of a `namedtuple`
2. Pickle/unpickle a string

Each of these functions are run in the main thread and then in subsequent 
spawned threads. 

If I run the script attached with "python testqueuepickle.py", it works fine.  
I get the data pickled/unpickled in the respective functions and nothing 
deadlocks and everything is printed to screen. If, however, I run it with the 
"-m" option (python -m testqueuepickle.py) , the program deadlocks at the 
pickling of the "namedtuple" instance. The pickling/unpickling of the string 
appears to be unaffected. 

Programming practices aside, what do you think could be the cause of this?

--
files: testqueuepickle.py
messages: 305953
nosy: Werner Smidt
priority: normal
severity: normal
status: open
title: Pickling deadlocks in thread with python -m
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file47255/testqueuepickle.py

___
Python tracker 

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



[issue10049] Add a "no-op" (null) context manager to contextlib (Rejected: use contextlib.ExitStack())

2017-11-09 Thread Hrvoje Nikšić

Hrvoje Nikšić  added the comment:

For what it's worth, we are still using our own null context manager function 
in critical code. We tend to avoid contextlib.ExitStack() for two reasons:

1) it is not immediately clear from looking at the code what ExitStack() means. 
(Unlike the "contextmanager" decorator, ExitStack is unfamiliar to most 
developers.)

2) ExitStack's __init__ and __exit__ incur a non-negligible overhead compared 
to a true do-nothing context manager.

It doesn't surprise me that projects like Tensor Flow introduce their own 
versions of this decorator. Having said that, I can also understand why it 
wasn't added. It is certainly possible to live without it, and ExitStack() is a 
more than acceptable replacement for casual use.

--

___
Python tracker 

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



[issue10049] Add a "no-op" (null) context manager to contextlib (Rejected: use contextlib.ExitStack())

2017-11-09 Thread Albert Zeyer

Albert Zeyer  added the comment:

Note that this indeed seems confusing. I just found this thread by search for a 
null context manager. Because I found that in TensorFlow they introduced 
_NullContextmanager in their code and I wondered that this is not provided by 
the Python stdlib.

--
nosy: +Albert.Zeyer

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

Same failure on x86-64 El Capitan 2.7/
http://buildbot.python.org/all/#builders/98/builds/17

==
FAIL: test_create_event (test.test_kqueue.TestKQueue)
--
Traceback (most recent call last):
  File 
"/Users/buildbot/buildarea/2.7.billenstein-elcapitan/build/Lib/test/test_kqueue.py",
 line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

On also  AMD64 FreeBSD 10.x Shared 2.7:

http://buildbot.python.org/all/#/builders/97/builds/17

==
FAIL: test_create_event (test.test_kqueue.TestKQueue)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/2.7.koobs-freebsd10/build/Lib/test/test_kqueue.py", 
line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised

--

___
Python tracker 

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



[issue31893] Issues with kqueue

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

Test fails on x86 Tiger 2.7:

http://buildbot.python.org/all/#/builders/59/builds/17

==
FAIL: test_create_event (test.test_kqueue.TestKQueue)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/2.7.bolen-tiger/build/Lib/test/test_kqueue.py", 
line 39, in test_create_event
self.assertRaises(TypeError, cmp, ev, None)
AssertionError: TypeError not raised

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

___
Python tracker 

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



[issue30339] test_multiprocessing_main_handling: "RuntimeError: Timed out waiting for results" on x86 Windows7 3.x

2017-11-09 Thread STINNER Victor

STINNER Victor  added the comment:

Yet another similar bug on "x86 Windows7 3.x":

http://buildbot.python.org/all/#/builders/58/builds/134

==
FAIL: test_ipython_workaround 
(test.test_multiprocessing_main_handling.SpawnCmdLineTest)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_multiprocessing_main_handling.py",
 line 179, in test_ipython_workaround
self._check_script(script_name)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_multiprocessing_main_handling.py",
 line 156, in _check_script
rc, out, err = assert_python_ok(*run_args, __isolated=False)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\script_helper.py",
 line 151, in assert_python_ok
return _assert_python(True, *args, **env_vars)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\script_helper.py",
 line 137, in _assert_python
res.fail(cmd_line)
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\support\script_helper.py",
 line 79, in fail
err))
AssertionError: Process return code is 1
command line: 
['D:\\cygwin\\home\\db3l\\buildarea\\3.x.bolen-windows7\\build\\PCbuild\\win32\\python_d.exe',
 '-X', 'faulthandler', '-E', 'd:\\temp\\tmponku8v2m\\ipython.py', 'spawn']

stdout:
---

---

stderr:
---
Traceback (most recent call last):

  File "d:\temp\tmponku8v2m\ipython.py", line 23, in 

raise RuntimeError("Timed out waiting for results")

RuntimeError: Timed out waiting for results
---

--

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-09 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Recommend closing this and leaving it for StackOverflow.  I really don't want 
to further garbage-up the glossary.

--

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-09 Thread Raymond Hettinger

Change by Raymond Hettinger :


--
assignee: docs@python -> fdrake
nosy: +fdrake

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-09 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> And I'll repeat: I'm entirely happy with the "revert the change for __main__ 
> only" compromise, since it covers all the cases I care about.

And that's what I'm unhappy with.  We should either revert the change for all 
code, or not revert it at all.

Such a middle ground is just a wishy-washy decision-by-committee compromise.  
It will satisfy almost nobody (neither the people who don't want to see 
deprecation warnings, nor the ones who don't to miss them), is more complicated 
to remember, and will most certainly have to be revisited in a couple of years.

--

___
Python tracker 

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



[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

That, of course, wasn't my original suggestion, but since Mark started 
discussing other possible forms this could take, like round-to-nearest analogs 
of mod and divmod, I thought maybe it's worth pointing out this aspect and, 
yes, maybe the three-argument form would be nice. Essentially, this would be 
fractions.Fraction.__round__ then.

--

___
Python tracker 

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



[issue31978] make it simpler to round fractions

2017-11-09 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Mark said about round(x/y), not round(x/y, 1). Do you propose to add a three 
argument divide_and_round(x, y, ndigits)?

--

___
Python tracker 

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



[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

>>> for x in range(1,501):
for y in range(1,501):
if round(x/y, 1) != float(round(F(x,y), 1)):
print(x,y)

where F is fractions.Fraction
Sorry!

--

___
Python tracker 

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



[issue31978] make it simpler to round fractions

2017-11-09 Thread Wolfgang Maier

Wolfgang Maier  added the comment:

> (E.g., if both `a` and `b` are not-too-large integers, `round(a / b)` is 
> still "safe" in that it will give the same result as if a non-lossy integer 
> division is used.)

Well, it does not take particularly large a and b to break round's tie-breaking 
through rounding-to-even though:

>>> for x in range(1,501):
for y in range(1,501):
if round(x/y, 1) != float(round(F(x,y), 1)):
print(x,y)

1 20
2 40
3 20
3 60
4 80
5 100
6 40
6 120
7 20
7 140
8 160
9 20
9 60
9 180
10 200
11 220
12 80
12 240
13 20
13 260
14 40
14 280
15 100
15 300
16 320
17 340
18 40
18 120
18 360
19 20
19 380
20 400
21 20
21 60
21 140
21 420
22 440
23 20
23 460
24 160
24 480
25 500

...

--

___
Python tracker 

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