[issue35631] Improve typing docs wrt abstract/concrete collection types

2018-12-31 Thread Ville Skyttä

Ville Skyttä  added the comment:

(s/generic collection types/abstract collection types/ in the initial message)

--

___
Python tracker 

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2018-12-31 Thread Ville Skyttä

Change by Ville Skyttä :


--
keywords: +patch, patch
pull_requests: +10774, 10775
stage:  -> patch review

___
Python tracker 

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2018-12-31 Thread Ville Skyttä

Change by Ville Skyttä :


--
keywords: +patch, patch, patch
pull_requests: +10774, 10775, 10776
stage:  -> patch review

___
Python tracker 

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2018-12-31 Thread Ville Skyttä

Change by Ville Skyttä :


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

___
Python tracker 

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



[issue35631] Improve typing docs wrt abstract/concrete collection types

2018-12-31 Thread Ville Skyttä

New submission from Ville Skyttä :

The typing docs for List includes a note to use generic collection types, but 
lists AbstractSet and Mapping which aren't generally replacements for a List. 
It would be better to remove those types from the List note and add 
corresponding ones to Dict and Set which are currently lacking it.

Additionally, some examples in the typing docs are in violation of the above 
stated preference, using Lists and Dicts as parameters.

--
assignee: docs@python
components: Documentation
messages: 332842
nosy: docs@python, scop
priority: normal
severity: normal
status: open
title: Improve typing docs wrt abstract/concrete collection types
type: enhancement

___
Python tracker 

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



[issue35629] hang and/or leaked processes with multiprocessing.Pool(...).imap(...)

2018-12-31 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Weirdly enough, it works with iPython:

$ ipython3
Python 3.7.1 (default, Nov  6 2018, 18:49:54)
Type 'copyright', 'credits' or 'license' for more information
IPython 6.4.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import multiprocessing

In [2]: tuple(multiprocessing.Pool(4).imap(print, (1, 2, 3)))
...:
1
2
3
Out[2]: (None, None, None)

In [3]:

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35596] Fatal Python error: initfsencoding: unable to load the file system codec zipimport.ZipImportError: can't find module 'encodings'

2018-12-31 Thread Steve Dower


Steve Dower  added the comment:

Yes, we've established that zipimport is rejecting .pyc files now, but we need 
to dig through it to figure out why. I haven't had time yet, but if someone 
else can then don't wait for me.

--

___
Python tracker 

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



[issue33987] IDLE: use ttk.Frame for ttk widgets

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10772

___
Python tracker 

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



[issue33987] IDLE: use ttk.Frame for ttk widgets

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10773

___
Python tracker 

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



[issue33987] IDLE: use ttk.Frame for ttk widgets

2018-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

We don't really need a new issue.  Mark's opening post was generic.  I grepped 
for ttk to get existing ttk imports and am making Frame and LabelFrame the 
first item or items for each import.  I won't worry about whether any 
background is visible, as this could change.

Cheryl, please note the import convention and review the diff when posted.

--
stage: patch review -> test needed
title: IDLE: add ttk.Frame inside searchbaseToplevel -> IDLE: use ttk.Frame for 
ttk widgets

___
Python tracker 

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



[issue33987] IDLE: add ttk.Frame inside searchbaseToplevel

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch, patch, patch
pull_requests: +10771, 10772, 10773
stage: test needed -> patch review

___
Python tracker 

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



[issue33987] IDLE: add ttk.Frame inside searchbaseToplevel

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch
pull_requests: +10771
stage: test needed -> patch review

___
Python tracker 

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



[issue33987] IDLE: add ttk.Frame inside searchbaseToplevel

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
keywords: +patch, patch
pull_requests: +10771, 10772
stage: test needed -> patch review

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2018-12-31 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Kellar and Yash, my suggestion is to separate the work into two phases.

Start with an initial patch that implements this simplest possible 
implementation, accompanied by clean documentation and thorough testing.

Once everyone has agreed on the API (i.e. calling it "comb()", how to handle 
various input datatypes, and handling of corner cases), and the patch is 
applied, only then turn to a second pass for optimizations (special casing 
various types, minimizing how big intermediate values can get by doing early 
cancellation, exploiting even/odd patterns etc).

--

___
Python tracker 

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



[issue33987] IDLE: add ttk.Frame inside searchbaseToplevel

2018-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The change is trivial and there was already a Frame test, which initially 
failed.  I will open another issue about similar changes needed elsewhere.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

This issue looks complete to me unless there is something simple not previously 
mentioned.

Fixing cancel would be a separate issue.

Separating window and frame needs separate discussion on a separate issue, and 
is not a priority now.  Model popups are different from independent listed 
windows, so I an not sure what we will want to do for a future tabbed window.

A more immediate concern to me is finishing ttk conversion, including using ttk 
frames for ttk widgets.  (See #33987 for why.)

--

___
Python tracker 

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



[issue33987] IDLE: add ttk.Frame inside searchbaseToplevel

2018-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

*35598 converted config_key to ttk, including a t tk frame inside toplevel.

--

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2018-12-31 Thread Suriyaa Sundararuban


Suriyaa Sundararuban  added the comment:

Done.

--

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2018-12-31 Thread Suriyaa Sundararuban


Change by Suriyaa Sundararuban :


--
keywords: +patch, patch, patch
pull_requests: +10767, 10768, 10769
stage:  -> patch review

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2018-12-31 Thread Suriyaa Sundararuban


Change by Suriyaa Sundararuban :


--
keywords: +patch, patch
pull_requests: +10767, 10768
stage:  -> patch review

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2018-12-31 Thread Suriyaa Sundararuban


Change by Suriyaa Sundararuban :


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

___
Python tracker 

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



[issue35630] Missing code tag for "python3" in README.rst

2018-12-31 Thread Suriyaa Sundararuban


New submission from Suriyaa Sundararuban :

Currently there is no code tag for "python3" in the sentence "This will install 
Python as python3." (Location: 
https://github.com/python/cpython#build-instructions).

I'm working on this small improvement.

--
assignee: docs@python
components: Documentation
messages: 332832
nosy: docs@python, suriyaa
priority: normal
severity: normal
status: open
title: Missing code tag for "python3" in README.rst
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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10765

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
pull_requests:  -10766

___
Python tracker 

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



[issue35626] Python dictreader KeyError issue

2018-12-31 Thread Eric V. Smith


Eric V. Smith  added the comment:

Steven is correct: your problem is that in the first example you're reading the 
header row before you pass the file to DictReader, so the DictReader cannot 
know what your columns are named. (Actually, your code uses the second row of 
your file as the column names: you should have been able to determine this by 
looking at the value of "row" that was printed).

I'm going to close this issue. Please do some more investigation. If you can 
produce a short example that we can execute ourselves, including any needed 
data files, and you think it still shows an error, please feel free to reopen 
this issue.

--
nosy: +eric.smith
resolution:  -> not a bug
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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread miss-islington


miss-islington  added the comment:


New changeset 74e46483773fa2ed03ed02f1b5e3fb0a4691535e by Miss Islington (bot) 
in branch '3.7':
bpo-35598: IDLE - Globalize some config_key objects (GH-11392)
https://github.com/python/cpython/commit/74e46483773fa2ed03ed02f1b5e3fb0a4691535e


--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10764, 10765, 10766

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset b4ea8bb080f63ef27682f3f9bbaa4d12a83030b1 by Terry Jan Reedy 
(Cheryl Sabella) in branch 'master':
bpo-35598: IDLE - Globalize some config_key objects (GH-11392)
https://github.com/python/cpython/commit/b4ea8bb080f63ef27682f3f9bbaa4d12a83030b1


--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10764, 10765

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10764

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2018-12-31 Thread Tal Einat


Tal Einat  added the comment:


New changeset ede0b6fae20290bf22b6ee1b9a1e1179d750f360 by Tal Einat in branch 
'master':
bpo-20182: AC convert Python/sysmodule.c (GH-11328)
https://github.com/python/cpython/commit/ede0b6fae20290bf22b6ee1b9a1e1179d750f360


--

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2018-12-31 Thread Tal Einat


Tal Einat  added the comment:


New changeset ede0b6fae20290bf22b6ee1b9a1e1179d750f360 by Tal Einat in branch 
'master':
bpo-20182: AC convert Python/sysmodule.c (GH-11328)
https://github.com/python/cpython/commit/ede0b6fae20290bf22b6ee1b9a1e1179d750f360


--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2018-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Can I work on C implementation if no-one else is doing it right now?

Sounds fine to me. You might want to coordinate with @kellerfuchs to see what 
the status of their PR is; maybe the two of you can collaborate?

@kellerfuchs: are you still planning to work on this?

--

___
Python tracker 

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



[issue35629] hang and/or leaked processes with multiprocessing.Pool(...).imap(...)

2018-12-31 Thread Anthony Sottile


New submission from Anthony Sottile :

This simple program causes a hang / leaked processes (easiest to run in an 
interactive shell):

import multiprocessing
tuple(multiprocessing.Pool(4).imap(print, (1, 2, 3)))

$ python3.6
Python 3.6.7 (default, Oct 22 2018, 11:32:17) 
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> tuple(multiprocessing.Pool(4).imap(print, (1, 2, 3)))
1
2
3
<<>>
^CProcess ForkPoolWorker-1:
Traceback (most recent call last):
Process ForkPoolWorker-2:
Process ForkPoolWorker-3:
Process ForkPoolWorker-4:
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 746, in next
item = self._items.popleft()
IndexError: pop from an empty deque

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 750, in next
self._cond.wait(timeout)
  File "/usr/lib/python3.6/threading.py", line 295, in wait
waiter.acquire()
KeyboardInterrupt


$ python3.7
Python 3.7.2 (default, Dec 25 2018, 03:50:46) 
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import multiprocessing
>>> tuple(multiprocessing.Pool(4).imap(print, (1, 2, 3)))
1
2
3
(None, None, None)
>>> 
KeyboardInterrupt
Process ForkPoolWorker-3:
Process ForkPoolWorker-1:
Process ForkPoolWorker-2:
Process ForkPoolWorker-4:
>>> Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 110, in worker
task = get()
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 351, in get
with self._rlock:
  File "/usr/lib/python3.7/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
KeyboardInterrupt
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 110, in worker
task = get()
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 351, in get
with self._rlock:
  File "/usr/lib/python3.7/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
KeyboardInterrupt
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 110, in worker
task = get()
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 351, in get
with self._rlock:
  File "/usr/lib/python3.7/multiprocessing/synchronize.py", line 95, in 
__enter__
return self._semlock.__enter__()
KeyboardInterrupt
Traceback (most recent call last):
  File "/usr/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.7/multiprocessing/pool.py", line 110, in worker
task = get()
  File "/usr/lib/python3.7/multiprocessing/queues.py", line 352, in get
res = self._reader.recv_bytes()
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 216, in 
recv_bytes
buf = self._recv_bytes(maxlength)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 407, in 
_recv_bytes
buf = self._recv(4)
  File "/usr/lib/python3.7/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt


(python3.8 shows the same behaviour as python3.7)
$ ./python --version --version
Python 3.8.0a0 (heads/master:ede0b6fae2, Dec 31 2018, 09:19:17) 
[GCC 7.3.0]


python2.7 also has similar behaviour.

I'm told this more reliably hangs on windows, though I don't have windows on 
hand.

I've "fixed" my code to explicitly open / close the pool:

with contextlib.closing(multiprocessing.Pool(jobs)) as pool:
tuple(pool.imap(...))


I suspect a refcounting / gc bug

--
components: Library (Lib)
messages: 332825
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: hang and/or leaked processes with multiprocessing.Pool(...).imap(...)
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/arch

[issue35606] Add prod() function to the math module

2018-12-31 Thread Mark Dickinson


Mark Dickinson  added the comment:

[Raymond]

> or to implement particular NaN/Inf handling not present in a naive 
> implementation

On this subject, some effort has been made in the past to make (almost) all the 
math module functions behave consistently with respect to things like 
exceptions, overflow, infinities, nans, signed zeros, etc. (There are 
unfortunately some exceptions to the general rule, like math.pow.) If possible, 
I'd like to see any implementation of math.prod do the same; I'd prefer us to 
get this right initially rather than tweak the definition to make subtle 
possibly-breaking changes to the implementation later.

That is, the ideal behaviour would include things like:

(a) a product of finite floating-point (or convertible-to-float) numbers should 
raise an exception on overflow. Probably OverflowError, though ValueError 
wouldn't be indefensible either.

(b) a product involving infinities but no NaNs or zeros should return an 
appropriately-signed infinity (where the sign is determined by an xor of all 
the signs of the inputs)

(c) a product involving both infinities and zeros (but not NaNs) should raise 
ValueError

(d) a product involving a NaN at any point should just return NaN

The combination of these can get a bit awkward: for example, if a list starts 
with `[1e300, 1e300, ...]`, then it's not necessarily correct to raise 
`OverflowError` after processing the first two inputs, because if there's a NaN 
somewhere later in the list then that NaN should dominate the result. However, 
IEEE 754 allows some leeway here for its "Reduction operations" (section 9.4 of 
the to-be-superseded-any-day-now 2008 version of the standard), stating:

> Numerical results and exceptional behavior, including the invalid operation 
> exception, may differ among implementations due to the precision of 
> intermediates and the order of evaluation.

BTW, if we wanted to go for IEEE 754 compliance, the operation to implement 
would be "scaledProd", which takes a vector of inputs and returns a float along 
with an exponent; this allows taking products of long lists of floats without 
needing to worry about underflow or overflow. That's probably not what we want 
here, but the spec of scaledProd might help guide us with the implementation of 
prod.

--

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2018-12-31 Thread Tal Einat


Tal Einat  added the comment:

AFAICT, this issue can finally be closed!

--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -10763

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2018-12-31 Thread Tal Einat


Tal Einat  added the comment:

Note that the problematic part of the Modules/_hashopenssl.c AC conversion was 
reverted, as part of GH-11379.

--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

PR11392 is the first refactor.  It moves translate_key to the module level and 
also moves the definitions of the key tuples to the module level since they are 
used in more than one place (and they don't change).

As a side note, I'll do the refactoring over several PRs to try to make it 
manageable to review.

(PR11377 was the first version of this, but somehow I really messed it and 
couldn't get it back.)

--

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -10762

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
Removed message: https://bugs.python.org/msg332776

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10761, 10762

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10761, 10762, 10763

___
Python tracker 

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



[issue35598] IDLE: Modernize config_key module

2018-12-31 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +10761

___
Python tracker 

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



[issue20182] Derby #13: Convert 50 sites to Argument Clinic across 5 files

2018-12-31 Thread Tal Einat


Tal Einat  added the comment:


New changeset ede0b6fae20290bf22b6ee1b9a1e1179d750f360 by Tal Einat in branch 
'master':
bpo-20182: AC convert Python/sysmodule.c (GH-11328)
https://github.com/python/cpython/commit/ede0b6fae20290bf22b6ee1b9a1e1179d750f360


--

___
Python tracker 

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



[issue33039] int() and math.trunc don't accept objects that only define __index__

2018-12-31 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

>I think we should also consider changing the type creation behaviour in 3.8

@ncoghlan is this what's being done in PyTypeReady?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2018-12-31 Thread June Kim


June Kim  added the comment:

Here is my environment

---system
CPU: Intel i5 @2.67GHz
RAM: 8G
OS: Windows 10 Home (64bit)
OS version: 1803
OS build: 17134.472

---python
version1: 3.7.1 AMD64 on win32
version2: 3.7.2 AMD64 on win32
Python path: (venv)/Scripts/python.exe
IDE: VS Code(1.30.1)
Terminal: Git Bash

--

___
Python tracker 

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



[issue35431] Add a function for computing binomial coefficients to the math module

2018-12-31 Thread Yash Aggarwal


Yash Aggarwal  added the comment:

Can I work on C implementation if no-one else is doing it right now?

--
nosy: +FR4NKESTI3N

___
Python tracker 

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



[issue35596] Fatal Python error: initfsencoding: unable to load the file system codec zipimport.ZipImportError: can't find module 'encodings'

2018-12-31 Thread wwq


wwq  added the comment:

I have tried zipping the stdlib myself form normal version's "Python37\Lib" 
with all files were end with ".py"(without "site-packages" of course). And then 
everything work fine. Maybe the loader only reject ".pyc" file from zip load?

--
nosy: +wwqgtxx

___
Python tracker 

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



[issue35628] Allow lazy loading of translations in gettext.

2018-12-31 Thread s-ball


New submission from s-ball :

When working on i18n, I realized that msgfmt.py did not generate any hash 
table.  One step further, I realized that the gettext.py would not have used it 
because it unconditionnaly loads the whole translation files and contains the 
following TODO message: 

TODO:
- Lazy loading of .mo files.  Currently the entire catalog is loaded into
memory, but that's probably bad for large translated programs.  Instead,
the lexical sort of original strings in GNU .mo files should be exploited
to do binary searches and lazy initializations.  Or you might want to use
the undocumented double-hash algorithm for .mo files with hash tables, but
you'll need to study the GNU gettext code to do this.

I have studied the code, and found that it should not be too complex to 
implement it in pure Python. I have posted a message on python-ideas about it 
and here are my conclusion:

Features:

The gettext module should be allowed to load lazily the catalogs from mo 
file. This lazy load should be optional and make use of the hash tables 
from mo files when they are present or revert to a binary search. The 
translation strings should be cached for better performances.

API changes:

3 functions from the gettext module will have 2 new optional parameter 
named caching, and keepopen:

gettext.bindtextdomain(domain, localedir=None) would become
gettext.bindtextdomain(domain, localedir=None, caching=None, keepopen=False)

gettext.translation(domain, localedir=None, languages=None, class_=None, 
fallback=False, codeset=None) would become
gettext.translation(domain, localedir=None, languages=None, class_=None, 
fallback=False, codeset=None, caching=None, keepopen=False)

gettext.install(domain, localedir=None, codeset=None, names=None) would 
become
gettext.install(domain, localedir=None, codeset=None, names=None, 
caching=None, keepopen=False)

The new caching parameter could receive the following values:
caching=None: revert to the previour eager loading of the full catalog. 
It will be the default to allow previous application to see no change
caching=1: lazy loading with unlimited cache
caching=n where n is a positive (>=0) integer value: lazy loading with a 
LRU cache limited to n strings

The keepopen parameter would be a boolean:
keepopen=False (default): the mo file is only opened before loading a 
translation string and closed immediately after - it is also opened once 
when the GNUTranslation class is initialized to load the file description
keepopen=True: the mo file is kept open during the lifetime of the 
GNUTranslation object.
This parameter is ignored and not used if caching is None

Implementation:
==
The current GNUTranslation class loads the content of the mo file to 
build a dictionnary where the original strings are the keys and the 
translated keys the values. Plural forms use a special processing: the 
key is a 2 tuple (singular original string, order), and the value is the 
corresponding translated string - order=0 is normally for the singular 
translated string.

The proposed implementation would simply replace this dictionary with a 
special mapping subclass when caching is not None. That subclass would 
use same keys as the original directory and would:
- first search in its cache
- if not found in cache and if the hashtable has not a zero size search 
the original string by hash
- if not found in cache and if the hashtable has a zero size, search the 
original string with a binary search algorithm.
- if a string is found, it should feed the LRU cache, eventually 
throwing away the oldest entry (entries)

That should allow to implement the new feature with minimal refactoring 
for the gettext module.

But I also propose to change msgfmt.py to build the hashtable. IMHO, the 
function should lie in the standard library probably as a submodule of gettext 
to allow various Python projects (pybabel, django) to directly use it instead 
of developping their own ones.

I will probably submit a PR in a while but it will will require some time to 
propose a full implementation with a correct test coverage.

--
components: Library (Lib)
messages: 332815
nosy: s-ball
priority: normal
severity: normal
status: open
title: Allow lazy loading of translations in gettext.
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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2018-12-31 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I just tried your script in "9a3ffc" (3.7.2final) and "260ec2c36a" (3.7.1final) 
and it worked on both without halting the main process.

I'm on MacOS Sierra, can you give more details about your environment?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue32492] C Fast path for namedtuple's property/itemgetter pair

2018-12-31 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
status: open -> closed

___
Python tracker 

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



[issue32492] C Fast path for namedtuple's property/itemgetter pair

2018-12-31 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 052b2dfdc967a8c061ff9561534e905009b88b8c by Serhiy Storchaka in 
branch 'master':
bpo-32492: Tweak _collections._tuplegetter. (GH-11367)
https://github.com/python/cpython/commit/052b2dfdc967a8c061ff9561534e905009b88b8c


--

___
Python tracker 

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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2018-12-31 Thread June Kim


New submission from June Kim :

## Test code ##
## Modified a bit from the original written by Doug Hellmann
## https://pymotw.com/3/multiprocessing/communication.html

import multiprocessing
import time


class Consumer(multiprocessing.Process):
def __init__(self, task_queue, result_queue):
multiprocessing.Process.__init__(self)
self.task_queue = task_queue
self.result_queue = result_queue

def run(self):
proc_name = self.name
while True:
print('Getting task')
next_task = self.task_queue.get()
print(f'task got: {next_task}')
if next_task is None:
print('{}: Exiting'.format(proc_name))
self.task_queue.task_done()
break
print('{}: {}'.format(proc_name, next_task))
answer = next_task()
self.task_queue.task_done()
self.result_queue.put(answer)


class Task:
def __init__(self, a, b):
self.a = a
self.b = b

def __call__(self):
time.sleep(0.1)
return '{self.a} * {self.b} = {product}'.format(
self=self, product=self.a * self.b)

def __str__(self):
return '{self.a} * {self.b}'.format(self=self)


def test():
tasks = multiprocessing.JoinableQueue()
results = multiprocessing.Queue()
num_consumers = multiprocessing.cpu_count() * 2
print('Creating {} consumers'.format(num_consumers))
consumers = [Consumer(tasks, results) for i in range(num_consumers)]
[w.start() for w in consumers]
num_jobs = 10
print('Putting')
[tasks.put(Task(i, i)) for i in range(num_jobs)]
print('Poisoning')
[tasks.put(None) for i in range(num_consumers)]
print('Joining')
tasks.join()
while num_jobs:
result = results.get()
print('Result:', result)
num_jobs -= 1

###
1. This code works perfectly in 3.7.1 but halts the main process in 3.7.2
2. It seems the JoinableQueue is empty when it is accessed by processes.
3. IMHO, resource sharing mechanism in multiprocessing.queue seems not working 
properly.

--

___
Python tracker 

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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2018-12-31 Thread June Kim


Change by June Kim :


--
components: Library (Lib)
nosy: June Kim
priority: normal
severity: normal
status: open
title: multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1
type: behavior
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



[issue35626] Python dictreader KeyError issue

2018-12-31 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Can you please provide a *simple* and *complete* demonstration, including the 
*full* traceback? As given, we cannot run the supplied code and don't know what 
the contents of the csv file are supposed to be.

See here for more detail: http://www.sscce.org/

But my *guess*, on reading this, is that the line 

header = fin.readline()

causes the difference. In the first sample, you skip past the first line of the 
csv file, and so when the dictreader reads the rest of the file, it never sees 
the first row. But in the second example, it does see the first row.

What happens if you change the first example to this?

header = fin.readline()
print('Found ' + header)
fin.seek(0)
reader = csv.DictReader(fin)

Does that solve your problem?

Likewise, in the second case, if you change it to this:

open_f = open(filename, 'r', encoding='utf-8')
__ = open_f.readline()
read_it = csv.DictReader(open_f)


what happens?

--
components: +Library (Lib) -Build
nosy: +steven.daprano
type: crash -> behavior

___
Python tracker 

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



[issue35626] Python dictreader KeyError issue

2018-12-31 Thread Eduardo Orochena


New submission from Eduardo Orochena :

def load_file(filename):

with open(filename, 'r', encoding='utf-8') as fin:
header = fin.readline()
print('Found ' + header)

reader = csv.DictReader(fin)

for row in reader:
print(type(row), row)
print('Beds {} '.format(row['beds']))

This results in a KeyError exception

whilst 

open_f = open(filename, 'r', encoding='utf-8')

read_it = csv.DictReader(open_f)

for i in read_it:
print('Beds {}'.format(i['beds']))

behaves as expected

--
components: Build
messages: 332810
nosy: eorochena
priority: normal
severity: normal
status: open
title: Python dictreader KeyError issue
type: crash
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



[issue35624] Shelve sync issues while using Gevent

2018-12-31 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

Hi, thanks for opening a bug report. Can you provide a script that reproduce 
the issue?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35625] documentation of list, set & dict comprehension make no mention of buggy class scope behavior

2018-12-31 Thread bzip2


New submission from bzip2 :

The sections on list, set and dict comprehensions in the tutorial on data 
structures (ref. 1) state repeatedly that they are equivalent to for loops, but 
do not mention that this is not true in classes. In fact, the example used for 
nested list comprehensions (section 5.1.4) will work in a function, but not in 
a class. Similarly, there seems to be no mention of this scope "limitation" in 
the tutorial on classes (ref. 2), despite a section on scopes and namespaces 
(section 9.2) and another that mentions list comprehensions (section 9.10). The 
scope "limitation" is mentioned at the end of a section on resolution of names 
on a page about the execution model in the reference guide (ref. 3), and of 
course in various forums, where people may perhaps eventually find them after 
wasting time trying to figure out what they've done wrong.

If comprehensions are "equivalent" to for loops only under certain conditions 
(in a class, but only in a class, only one variable from outside the 
comprehension is accessible in the comprehension, and it must be the outermost 
iterable), they are not equivalent and should not be described as such. This 
"limitation" should be mentioned prominently wherever comprehensions are 
described, since both classes and comprehensions are presumably common 
constructs. When people read "is equivalent to" without a qualifier, they 
assume "is always equivalent to".

Returning to section 9.10 in ref. 2, the unique_words example is misleading 
because it strongly implies that nested for loops in a comprehension should 
work in a class. Since that's only true in some cases, the example should be 
qualified. More broadly, because that tutorial is about classes, the relevance 
of the last three sections should be revisited.

As an aside, I agree with the developers who consider this scope "limitation" a 
bug and not (paraphrasing) "just how the language works", since the exact same 
two lines of code, which depend on no other variables or functions, work in a 
function or module but not in a class.

1. https://docs.python.org/3/tutorial/datastructures.html
2. https://docs.python.org/3/tutorial/classes.html
3. https://docs.python.org/3/reference/executionmodel.html

--
assignee: docs@python
components: Documentation
messages: 332808
nosy: bzip2, docs@python
priority: normal
severity: normal
status: open
title: documentation of list, set & dict comprehension make no mention of buggy 
class scope behavior
type: behavior
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



[issue35609] Improve of abc.py docstring

2018-12-31 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



[issue35624] Shelve sync issues while using Gevent

2018-12-31 Thread Oded Engel


Change by Oded Engel :


--
type:  -> behavior

___
Python tracker 

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



[issue35624] Shelve sync issues while using Gevent

2018-12-31 Thread Oded Engel


New submission from Oded Engel :

Shelve method, sync, does not work when using gevent threading.
writeback was set to True, flag was set to 'c'.
only way to get the dbb synced is by closing and reopening the db.

--
components: Library (Lib)
messages: 332807
nosy: Oded Engel
priority: normal
severity: normal
status: open
title: Shelve sync issues while using Gevent
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