[issue33934] locale.getlocale() seems wrong when the locale is yet unset (python3 on linux)

2018-06-24 Thread Nicolas Hainaux

Nicolas Hainaux  added the comment:

I understand that the statement "when python starts, it runs using the C 
locale..." should not be correct anymore (and the doc should then be updated), 
but in fact this statement is still true on the systems I tested; only, the 
output of locale.getlocale() at start is in contradiction with the locale 
really set in fact.

It looks like the setting done by setlocale(LC_ALL, "") at an early stage is 
lost at some point (only locale.getlocale() seems to "remember" it).

For instance, my box locale is 'fr_FR.UTF-8', so the decimal point is a comma, 
but when starting python 3.7:


>>> import locale
>>> locale.str(2.4)
'2.4' # Wrong: if the locale in use is 'fr_FR.UTF-8', then 
'2,4' is expected instead
>>> locale.getlocale()
('fr_FR', 'UTF-8')
>>> locale.localeconv()
{'int_curr_symbol': '', 'currency_symbol': '', 'mon_decimal_point': '', 
'mon_thousands_sep': '', 'mon_grouping': [], 'positive_sign': '', 
'negative_sign': '', 'int_frac_digits': 127, 'frac_digits': 127, 
'p_cs_precedes': 127, 'p_sep_by_space': 127, 'n_cs_precedes': 127, 
'n_sep_by_space': 127, 'p_sign_posn': 127, 'n_sign_posn': 127, 'decimal_point': 
'.', 'thousands_sep': '', 'grouping': []}
>>>


Note that the output of localeconv() does match C locale, not 'fr_FR.UTF-8'.

Compare this with the outputs of locale.str() and locale.localeconv() when the 
locale is explicitly set at start:


>>> import locale
>>> locale.setlocale(locale.LC_ALL, '')
'LC_CTYPE=fr_FR.utf8;LC_NUMERIC=fr_FR.UTF-8;LC_TIME=fr_FR.UTF-8;LC_COLLATE=fr_FR.utf8;LC_MONETARY=fr_FR.UTF-8;LC_MESSAGES=fr_FR.utf8;LC_PAPER=fr_FR.UTF-8;LC_NAME=fr_FR.UTF-8;LC_ADDRESS=fr_FR.UTF-8;LC_TELEPHONE=fr_FR.UTF-8;LC_MEASUREMENT=fr_FR.UTF-8;LC_IDENTIFICATION=fr_FR.UTF-8'
>>> locale.str(2.4)
'2,4'   # Correct!
>>> locale.localeconv() # Output of localeconv() does match 'fr_FR.UTF-8' 
>>> locale
{'int_curr_symbol': 'EUR ', 'currency_symbol': '€', 'mon_decimal_point': ',', 
'mon_thousands_sep': '\u202f', 'mon_grouping': [3, 0], 'positive_sign': '', 
'negative_sign': '-', 'int_frac_digits': 2, 'frac_digits': 2, 'p_cs_precedes': 
0, 'p_sep_by_space': 1, 'n_cs_precedes': 0, 'n_sep_by_space': 1, 'p_sign_posn': 
1, 'n_sign_posn': 1, 'decimal_point': ',', 'thousands_sep': '\u202f', 
'grouping': [3, 0]}
>>>


Maybe the title of this issue should be turned to "at start, the C locale is in 
use in spite of locale.getlocale()'s output (python3 on linux)"?




As to the behaviour on Windows, I guess this is another topic (locales 
belonging to another world on Windows)... but it may be interesting to note 
that it complies with the current documentation: at start python 3.6 also uses 
the C locale, and the output of locale.getlocale() is consistent with that. 
Here is a test on Windows 10:

Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 18:11:49) [MSC v.1900 64 bit 
(AMD64)] on win32

>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.localeconv()
{'decimal_point': '.', 'thousands_sep': '', 'grouping': [], 'int_curr_symbol': 
'', 'currency_symbol': '', 'mon_decimal_point': '', 'mon_thousands_sep': '', 
'mon_grouping': [], 'positive_sign': '', 'negative_sign': '', 
'int_frac_digits': 127, 'frac_digits': 127, 'p_cs_precedes': 127, 
'p_sep_by_space': 127, 'n_cs_precedes': 127, 'n_sep_by_space': 127, 
'p_sign_posn': 127, 'n_sign_posn': 127}
>>> locale.str(2.4)
'2.4'
>>> locale.getdefaultlocale()
('fr_FR', 'cp1252')

--
components: +Library (Lib) -Documentation

___
Python tracker 

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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-24 Thread Vinay Sajip


Change by Vinay Sajip :


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



[issue33897] Add a restart option to logging.basicConfig()

2018-06-24 Thread Vinay Sajip


Vinay Sajip  added the comment:


New changeset cf67d6a934b51b1f97e72945b596477b271f70b8 by Vinay Sajip (Dong-hee 
Na) in branch 'master':
bpo-33897: Add a 'force' keyword argument to logging.basicConfig(). (GH-7873)
https://github.com/python/cpython/commit/cf67d6a934b51b1f97e72945b596477b271f70b8


--

___
Python tracker 

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



[issue33952] doc Fix typo in str.upper() documentation

2018-06-24 Thread Andrés Delfino

Change by Andrés Delfino :


--
keywords: +patch
pull_requests: +7504
stage:  -> patch review

___
Python tracker 

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



[issue33952] doc Fix typo in str.upper() documentation

2018-06-24 Thread Andrés Delfino

New submission from Andrés Delfino :

Doc says:

Note that str.upper().isupper() might be False if s...

Should say:

Note that s.upper().isupper() might be False if s...

PR fixes this.

--
assignee: docs@python
components: Documentation
messages: 320395
nosy: adelfino, docs@python
priority: normal
severity: normal
status: open
title: doc Fix typo in str.upper() documentation
type: enhancement
versions: Python 2.7, 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



[issue24567] random.choice IndexError due to double-rounding

2018-06-24 Thread Tim Peters


Tim Peters  added the comment:

There are a couple bug reports here that have been open for years, and it's 
about time we closed them.

My stance:  if any platform still exists on which "double rounding" is still a 
potential problem, Python _configuration_ should be changed to disable double 
rounding on such platforms (there's usually a C compiler flag that can make 
this happen, but even if there isn't a couple lines of inline assembler could 
be added at Python startup to set the Pentium's FPU "precision control" bits to 
"round to 53 bits" mode).

`random` is a red herring here!  We don't want gratuitously different results 
across 754 boxes in any operations.

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2018-06-24 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

On Jun 23, 2018, at 18:56, Nick Coghlan  wrote:
> 
> My request (wearing my "BDFL-delegate for packaging interoperability 
> standards" hat) is that proponents of the change resist the temptation to 
> view the problem that way :)
> 
> Path files are used extensively across the Python packaging ecosystem to 
> implement additional environment management features beyond those provided 
> natively by interpreter implementations, and while we've added native 
> equivalents for some of them (namespace packages, virtual environments), 
> we're far from having added support for all of them (dynamic package version 
> selection, virtual environment chaining, editable package installs that still 
> publish correct PEP 376 package metadata, etc).

Still, I firmly believe they’re a wart being abused for purposes they weren’t 
really intended for.  It’s a trick of implementation that lines beginning with 
`import` are exec’d.  That being said…

> Or, alternatively, the idea can be broken up into smaller, lower impact 
> changes that still help to address the import system and end user environment 
> maintainability issues, but don't involve breaking backwards compatibility.

+1 on working on *much* better debuggability and discoverability for .pth files 
first, and then consider their eventual deprecation, replacement, and/or 
removal.

--

___
Python tracker 

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



[issue24567] random.choice IndexError due to double-rounding

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Attaching a patch for 3.6 and 3.7.  Haven't had a chance to run timings yet.  
Since it involves adding code to the inner loop, presumably it will have a 
noticeable affect on speed.  Am not sure how to test this (I don't seem to be 
able to reproduce the OP's problem on any system I have access to).  I'm not 
even sure whether the double rounding still exists any extant platform and if 
so whether we could just turn it off as part of the configuration.

At any rate, I don't think the code in 2.7 should change at all.  That tool is 
almost at end-of-life and we should be very conservative with it at this point.

--
Added file: https://bugs.python.org/file47650/random_double_round.diff

___
Python tracker 

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



[issue33711] Could not find externals/db-* in msi.py on license generation

2018-06-24 Thread Zachary Ware


Zachary Ware  added the comment:

Thanks for the patch, Ivan, and the review, Anselm!

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



[issue33711] Could not find externals/db-* in msi.py on license generation

2018-06-24 Thread Zachary Ware


Zachary Ware  added the comment:


New changeset b18f09835720e14ac7d4cca1815fdcdcecd5d8d4 by Zachary Ware 
(native-api) in branch '2.7':
bpo-33711: Fix license generation error in installer build script (GH-7241)
https://github.com/python/cpython/commit/b18f09835720e14ac7d4cca1815fdcdcecd5d8d4


--

___
Python tracker 

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



[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-06-24 Thread Tim Peters


Tim Peters  added the comment:

Raymond, I'd say scaling is vital (to prevent spurious infinities), but 
complications beyond that are questionable, slowing things down for an 
improvement in accuracy that may be of no actual benefit.

Note that your original "simple homework problems for kids to machine learning 
and computer vision" doesn't include cases where good-to-the-last-bit accuracy 
is important, but at least in machine learning and computer vision apps 
primitives may be called an enormous number of times - "speed matters" to them.

Perhaps add an optional "summer" argument defaulting to __builtins__.sum?  Then 
the user who wants to pay more for tighter error bounds can pass in whatever 
they like, from a raw Kahan summer, through one of its improvements, to 
math.fsum.  There just isn't a "one size fits all" answer.

--

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread miss-islington


miss-islington  added the comment:


New changeset cef5da5441776090026c735ca1c9fa277f8b9931 by Miss Islington (bot) 
in branch '3.6':
bpo-33951: IDLE test_configdialog: call page.update in setUpClass (GH-7892)
https://github.com/python/cpython/commit/cef5da5441776090026c735ca1c9fa277f8b9931


--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2018-06-24 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I would also add that editable installs should not break in the process. They 
are important.

--
nosy: +pitrou

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7503

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread miss-islington


miss-islington  added the comment:


New changeset b3bac968fe5beb6e6e334903519b2c8ce5bb366b by Miss Islington (bot) 
in branch '3.7':
bpo-33951: IDLE test_configdialog: call page.update in setUpClass (GH-7892)
https://github.com/python/cpython/commit/b3bac968fe5beb6e6e334903519b2c8ce5bb366b


--
nosy: +miss-islington

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have modified the PR to avoid creating an extra pipe in the tracker (the pipe 
is created as part of the test). To allow testing with the -R option:

./python -m test test_multiprocessing_fork -v -m test_semaphore_tracker_sigint 
-R 3:3

I had to assure that we restart the tracker in the test so it does not reuse a 
closed file descriptor.

--

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 2af9f5d334eeca58887d177faf0012c63a03 by Terry Jan Reedy (Tal 
Einat) in branch 'master':
bpo-33951: IDLE test_configdialog: call page.update in setUpClass (GH-7892)
https://github.com/python/cpython/commit/2af9f5d334eeca58887d177faf0012c63a03


--

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +7502

___
Python tracker 

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



[issue32554] random.seed(tuple) uses the randomized hash function and so is not reproductible

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm thinking of something like this:

$ git diff
diff --git a/Lib/random.py b/Lib/random.py
index 1e0dcc87ed..f479e66ada 100644
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -136,12 +136,17 @@ class Random(_random.Random):
 x ^= len(a)
 a = -2 if x == -1 else x

-if version == 2 and isinstance(a, (str, bytes, bytearray)):
+elif version == 2 and isinstance(a, (str, bytes, bytearray)):
 if isinstance(a, str):
 a = a.encode()
 a += _sha512(a).digest()
 a = int.from_bytes(a, 'big')

+elif not isinstance(a, (type(None), int, float, str, bytes, 
bytearray)):
+_warn('Seeding based on hashing is deprecated.\n'
+  'The only supported seed types are None, int, float, '
+  'str, bytes, and bytearray.', DeprecationWarning, 2)
+
 super().seed(a)
 self.gauss_next = None

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

The process seems to use its own stderr and it cannot be captured from the 
parent without modifying it AFAIK.

--

___
Python tracker 

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



[issue31861] aiter() and anext() built-in functions

2018-06-24 Thread Joshua Bronson


Change by Joshua Bronson :


--
nosy: +jab

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Is it possible to notify the ping / noop reply on stderr instead of introducing 
a new pipe?

--

___
Python tracker 

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



[issue33089] Add multi-dimensional Euclidean distance function to the math module

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Would it be reasonable for me to get started with a "mostly good enough" 
version using scaling and Kahan summation?

from operator import sub
from math import sqrt, fabs

def kahan_summation(seq):
# https://en.wikipedia.org/wiki/Kahan_summation_algorithm#The_algorithm
csum = 0
err = 0
for x in seq:
x -= err
nsum = csum + x
err = (nsum - csum) - x
csum = nsum
return csum

def hypot(*sides):
scale = max(map(fabs, sides))
return scale * sqrt(kahan_summation((s / scale)**2 for s in sides))

def dist(p, q):
return hypot(*map(sub, p, q))

assert all(hypot(*([1]*d)) == sqrt(d) for d in range(1, 1))
print(dist(p=(11, 4, 10), q=(9, 10, 13.5)))

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I have updated the PR implementing a PONG command in the semaphore and updating 
the test. I have tested on the failing buildbots (gcc110.fsffrance.org) and it 
works. Notice that a new pipe for the child to write was needed as the child is 
continuously reading from the original one and therefore we cannot use the same 
one.

--

___
Python tracker 

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



[issue33945] concurrent.futures ProcessPoolExecutor submit() blocks on results being written

2018-06-24 Thread Thomas Moreau


Thomas Moreau  added the comment:

This behavior results from the fact that in 3.6, the result_queue is used to 
pass messages to the queue_manager_thread. This behavior has been changed in 
3.7 as we rely on a _ThreadWakeup object.

In 3.6, when the result_queue is filled with many large objects, the call to 
result_queue.put(None) will hang while the previous objects are being handled 
by the queue_manager_thread, causing a latency in the submit.

--

___
Python tracker 

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



[issue33945] concurrent.futures ProcessPoolExecutor submit() blocks on results being written

2018-06-24 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'm not sure what happens exactly in your workload, but waiting 20 seconds when 
posting some data on an unbounded queue sounds enormous.

--
nosy: +tomMoral

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Tal Einat


Tal Einat  added the comment:

For the "no-op" we'll need a way to know that it was processed.  To that end, 
I'd make the semaphore tracker recognize a new command e.g. "PING", upon which 
it would write something e.g. "PONG" into its end of the pipe.

--

___
Python tracker 

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



[issue33711] Could not find externals/db-* in msi.py on license generation

2018-06-24 Thread Anselm Kruis


Anselm Kruis  added the comment:

I'm build msi installers regularly and I can confirm the issue.
PR 7241 is ok and should be merged.

--
nosy: +anselm.kruis

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

@pitrou I think that should be ideal. The reason is that if we send an invalid 
command the cache is not cleared and the semaphore tracker will warn when the 
process finishes which is precisely what the test is avoiding.

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Additionally, as I commented in the PR, apart from the race condition I think 
the test should be modified so it fails if the warning is raised and not 
expected:

>The problem is that the test was silently failing when SIGINT was >being 
>delivered as the test does not check that no warnings are >raised. Notice that 
>the presence of a warning means that the process >died and therefore SIGINT 
>did kill the process, which is precisely >what the test checks that does not 
>happen.

>I think in order to check that the test works as intended without the >need to 
>run the suite with -Wall, we need to modify the test.

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Sorry, I was wrong, it does not die. I am investigating this solution using 
stderr.

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

We can easily add a 'NOOP' command to the semaphore tracker if it helps solve 
that issue.

--

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

@taleinat Sadly, if the semaphore_tracker receives an invalid command, it 
raises and dies, making the test impossible:

 cmd, name = line.strip().split(b':')
 if cmd == b'REGISTER':
 cache.add(name)
 elif cmd == b'UNREGISTER':
 cache.remove(name)
 else:
 raise RuntimeError('unrecognized command %r' % cmd)

--

___
Python tracker 

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



[issue33899] Tokenize module does not mirror "end-of-input" is newline behavior

2018-06-24 Thread Ammar Askar


Change by Ammar Askar :


--
keywords: +patch
pull_requests: +7501
stage:  -> patch review

___
Python tracker 

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



[issue33833] ProactorEventLoop raises AssertionError

2018-06-24 Thread twisteroid ambassador


Change by twisteroid ambassador :


--
pull_requests: +7500

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-06-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The entirely abstract example LGTM.

As for concrete real word examples, the possible one is changing the current 
working directory:

cwd = os.getcwd()
try:
os.chdir(target_dir)
yield
finally:
os.chdir(cwd)

--

___
Python tracker 

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



[issue33927] Allow json.tool to have identical infile and outfile

2018-06-24 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi Pablo, while this patch should fix both problems, I'm not sure how to write 
a regression test for this, `assert_python_ok` in 
https://github.com/python/cpython/pull/7865/files#diff-7d4645839a05727ebdf39226fd56e29cR97
 forks the interpreter so I'm not sure I can check for unclosed fd during the 
test.

Should I call 
https://github.com/remilapeyre/cpython/blob/04b2ade751b318460c1f0f9566676ef519358328/Lib/json/tool.py#L18
 directly and mock `io.open` and `os.close`?

--

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-06-24 Thread Nick Coghlan


Nick Coghlan  added the comment:

Similar to closing, we have dedicated context managers for stdout and stderr 
redirection now: 
https://docs.python.org/3/library/contextlib.html#contextlib.redirect_stdout

Redirecting stdin could be a good example though, since we've so far chosen not 
to provide a standard context manager for that (it's a sufficiently uncommon 
use case that we haven't seen the need to add it directly).

--

___
Python tracker 

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



[issue33466] Distutils does not support the compilation of Objective-C++ (“.mm”) files

2018-06-24 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Patch looks good to me, and back porting to 3.6/3.7 should be safe enough.

I haven't merged yet because I need to study the devguid a bit before I do so 
(especially w.r.t. back porting)

--
components: +macOS
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue33468] Add try-finally contextlib.contextmanager example

2018-06-24 Thread Tal Einat


Tal Einat  added the comment:

A possible concrete example: Capturing sys.stdout and/or sys.stderr for 
testing, as in test.support.captured_output.

--
nosy: +taleinat

___
Python tracker 

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



[issue33613] test_multiprocessing_fork: test_semaphore_tracker_sigint() fails with -W error

2018-06-24 Thread Tal Einat


Tal Einat  added the comment:

You can know that the semaphore tracker is running by sending it an invalid 
command and seeing the error written to stderr.  The semaphore tracker either 
inherits sys.stderr from the parent process (if possible) or uses its own.  
This is a bit of a hack, but might be worth it to avoid another wasted second 
on every run of the test suite.

--
nosy: +taleinat

___
Python tracker 

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



[issue32142] heapq.heappop - documentation misleading or doesn't work

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

We could apply David Murray's suggested wording but I don't think it would 
actually help anyone.  There are worked out examples from basic to advanced and 
a detailed section on the theory as well.

ISTM, that prior to reading the docs, the OP likely already had an incorrect 
mental model that caused the misreading of "maintaining" as "restoring".

For the most part, these docs have stood the test of time.  I don't see any 
StackOverflow questions about this either.  I recommend marking this as closed 
(the OP seems to now have a clear understanding of this so there isn't an open 
problem to be resolved).

--

___
Python tracker 

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



[issue33933] Error message says dict has no len

2018-06-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think this is an exact duplicate of issue32500.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> PySequence_Length() raises TypeError on dict type

___
Python tracker 

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



[issue32554] random.seed(tuple) uses the randomized hash function and so is not reproductible

2018-06-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

This is what I meant. Emit a deprecation warning for input types other than 
explicitly supported types (but I didn't think about float), and raise an error 
in future.

--

___
Python tracker 

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



[issue32554] random.seed(tuple) uses the randomized hash function and so is not reproductible

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Maybe deprecate using a hash?

Any deprecation will likely break some existing code, but it would be nice to 
restrict inputs types to int, float, bytes, bytearray, or str.  Then we could 
remove all reference to hashing.

--

___
Python tracker 

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



[issue25478] Consider adding a normalize() method to collections.Counter()

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Vedran, Counters do explicitly support floats, decimals, ints, fractions, etc. 

Also, total() needs to be a method rather than a property to be consistent with 
the existing API and for clarity that a computation is being performed (as 
opposed to looking up a running total or other cheap operation).

--

___
Python tracker 

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



[issue33933] Error message says dict has no len

2018-06-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread Zachary Ware


Change by Zachary Ware :


--
pull_requests: +7499

___
Python tracker 

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



[issue33774] Document that @lru_cache caches based on exactly how the function arguments are specified

2018-06-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I propose this, "Distinct argument patterns may be considered to be distinct 
calls with distinct results even if the underlying function sees them as 
equivalent calls."

--

___
Python tracker 

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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread Tal Einat


New submission from Tal Einat :

The issue occurs when running the following on Windows 10 Pro 64-bit on the 
latest master branch (ea737751b10fff752aafed0231e8a02b82ba365d):

python -m test -ugui -m test_highlight_target_text_mouse test_idle

(This test failed for perhaps an unrelated reason on Travis CI for GH-7887.   I 
encountered the issue while investigating that failure.)

--
assignee: terry.reedy
components: IDLE
messages: 320357
nosy: taleinat, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE test failing only when called by itself: 
HighPageTest.test_highlight_target_text_mouse
type: behavior
versions: 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



[issue33951] IDLE test failing only when called by itself: HighPageTest.test_highlight_target_text_mouse

2018-06-24 Thread Tal Einat


Change by Tal Einat :


--
keywords: +patch
pull_requests: +7498
stage:  -> patch review

___
Python tracker 

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