Re: tkinter resizable text with grid

2018-12-06 Thread Christian Gollwitzer

Am 07.12.18 um 03:00 schrieb Paulo da Silva:
Às 21:15 de 06/12/18, Rick Johnson escreveu:  

I kinda have a love/hate relationship with Tkinter and IDLE.
On one hand i find them to be practical[2] and simple[3] and
on the other, i find them to be poorly designed and
unintuitive. And it's a real shame, because, both of these
libraries have tons of potential, *IF*, they were designed
probably and the shortcomings of TclTk were abstracted away
behind a more Pythonic interface.


hahaha...
I'm using Tk from both Tcl and Python, and to me it seems like exactly 
the other way around. Tkinter feels clumsy compared to the "original" 
Tcl/Tk, because of some overzealous OOP-wrapping. "grid" is a good 
example; in Tcl, it is not a member of the widgets but instead a free 
function. It can take more than one slave, so, for instance


grid .x .y .z
grid .a  x .b


creates a 3x2 grid of widgets with the lower middle cell empty. No 
fiddling with row and column counting. For some strange reason the 
Tkinter designers decided that grid should be a method of the slave, 
which makes it feel much more clumsy.



I fully agree. Nevertheless, what I miss more is the lack of more
complex mega widgets - scrollable list of widgets with insert, append
and remove methods and perhaps a spreadsheet like widget are two big
ones. There are others smaller, like a single scrollable text with two
scroll bars that hide when not needed, tab multi-choice container, etc ...


These widgets do exist for Tcl/Tk. You can use a tablelist for both a 
list of widgets or a multi-column listbox


https://wiki.tcl-lang.org/page/tablelist

For the spreadsheet, TkTable is another solution which is more close to 
Excel:

https://wiki.tcl-lang.org/page/Tktable

"Tab multi-choice container" sounds to me like a ttk::notebook widget
https://wiki.tcl-lang.org/page/notebook

Another handy extension is TkDnD, which brings support for native 
Drag'n'drop, i.e. you can drop files from a file manager into your 
application:


https://github.com/petasis/tkdnd

- not to be confused with a cheap substitute 
https://kite.com/python/docs/Tkdnd which only supports drag/drop within 
one application instance.


The "problem" with these pacakges, they are written in Tcl and/or C, is 
that they are not distributed along the Tk core and consequently there 
are no well-maintained Python wrappers availabe. In the Tcl community, 
these packages are considered "essential" for more complex GUI 
programming. So instead of complaining about lacking support in Tk, the 
Python community should do their homework and provide wrappers to the 
most common Tk extensions.


Christian

--
https://mail.python.org/mailman/listinfo/python-list


[issue35429] Incorrect use of raise NotImplemented

2018-12-06 Thread Roman Yurchak


Roman Yurchak  added the comment:

Resolved in https://bugs.python.org/issue33023

--
resolution:  -> duplicate

___
Python tracker 

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



[issue34864] In Idle, Mac tabs make editor status line disappear.

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 10665544a97b6616898faafc12ac9d06505d0690 by Miss Islington (bot) 
in branch '3.6':
bpo-34864: warn if "Prefer tabs when opening documents" set to "Always" 
(GH-10464)
https://github.com/python/cpython/commit/10665544a97b6616898faafc12ac9d06505d0690


--

___
Python tracker 

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



[issue35436] Add missing PyErr_NoMemory() calls

2018-12-06 Thread Zackery Spytz


New submission from Zackery Spytz :

The attached PR adds some missing PyErr_NoMemory() calls.

--

___
Python tracker 

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



Re: Creating type evaluation annotation

2018-12-06 Thread dieter
Marek Mosiewicz  writes:
> ...
> I know that Python 3 has possibility to have indicate
> type for varibale or param
> What could be great to have possibility to annotate any 
> class with what I call "type evaluator" function.
> That could check method signature with rules specific 
> for given type.
> The simplest evaluator would simply check if signature
> is same as method definition. 
> But it could go futher. It could check whatever is valid 
> logic for creating methods in given class and whatever 
> are valid params for given method.
> Even more powerful evaluator could be not only
> valid/not valid indicator. It could validate
> and suggest next param or method part name for given
> written part of call. That could make python IDEs
> much more powerful
> From my experience having signature checking and
> hinting params when writing code is really big win.

You *can* do all that in Python -- even though you need
something beyond what Python typically comes with.

First, you need a formalisms to describe what should be checked.
There are various alternatives: I am using "zope.interface" (to
describe method signatures) and "zope.schema" (to describe
the "type" of attributes).

Next, you need something that does the checking.
Again, there are alternatives. I prefer to check things
in test suites -- and not permanently during productive use.
But, Python has the powerfull "metaclass" concept.
A metaclass allows you to customize class construction
and e.g. to instrument all defined methods to perform automatic
checks.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35436] Add missing PyErr_NoMemory() calls

2018-12-06 Thread Zackery Spytz


Change by Zackery Spytz :


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

___
Python tracker 

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



[issue35436] Add missing PyErr_NoMemory() calls

2018-12-06 Thread Zackery Spytz


Change by Zackery Spytz :


--
components: Extension Modules, Interpreter Core
nosy: ZackerySpytz
priority: normal
severity: normal
status: open
title: Add missing PyErr_NoMemory() calls
type: behavior
versions: Python 2.7, 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



[issue35435] Documentation of 3.3 is available

2018-12-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Documentation is available for all versions going back to Python 1.4.

https://docs.python.org/release/1.4/

As it should be: I'm surely not the only person who has need to check old 
versions of the documentation from time to time. Not everyone is using the 
latest version of Python, and some times we need to write code that supports 
old versions. Leaving the old docs available is not merely "doesn't hurt", but 
is positively a GOOD thing to do.

We shouldn't remove the docs from the server, and we shouldn't break existing 
URLs.

I don't think there's much we can do about search engines: they have their 
secret algorithms for ranking pages, and whatever comes up is what comes up, 
and I doubt we can control that.

I expect that the only thing we could do is put a prominent note at the top of 
each page "This is an unsupported version of the docs, for the latest version 
see blah blah blah" and link to the most recent version.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue34864] In Idle, Mac tabs make editor status line disappear.

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 2db190bb356d00422087e1286637887efb8d97c5 by Miss Islington (bot) 
in branch '3.7':
bpo-34864: warn if "Prefer tabs when opening documents" set to "Always" 
(GH-10464)
https://github.com/python/cpython/commit/2db190bb356d00422087e1286637887efb8d97c5


--

___
Python tracker 

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



[issue35435] Documentation of 3.3 is available

2018-12-06 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

It seems like all other versions (3.2, 3.1, 3.0) are still available too, just 
not updated anymore.

I'm thinking it's ok to leave these documentation.
While we don't support these versions anymore,  they still exists, and they're 
even still available for download from python.org/downloads. It doesn't hurt to 
keep these docs.

--
nosy: +Mariatta

___
Python tracker 

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



[issue34864] In Idle, Mac tabs make editor status line disappear.

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10249

___
Python tracker 

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



[issue34864] In Idle, Mac tabs make editor status line disappear.

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10248

___
Python tracker 

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



[issue34864] In Idle, Mac tabs make editor status line disappear.

2018-12-06 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 9ebe8794f003dadfff578a066ea503a3e37ffe1d by Terry Jan Reedy (Tal 
Einat) in branch 'master':
bpo-34864: warn if "Prefer tabs when opening documents" set to "Always" (#10464)
https://github.com/python/cpython/commit/9ebe8794f003dadfff578a066ea503a3e37ffe1d


--

___
Python tracker 

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



[issue35435] Documentation of 3.3 is available

2018-12-06 Thread Stéphane Wirtel

New submission from Stéphane Wirtel :

Today, I was looking for the doc of unittest.mock and the result from 
DuckDuckGo was this link: 
https://docs.python.org/3.3/library/unittest.mock-examples.html

In the devguide, we stopped the support and everything about this version, in 
the bug tracker, 3.3 is not available.

Maybe we could remove the doc from the server.

--
assignee: docs@python
components: Documentation
messages: 331271
nosy: docs@python, matrixise, mdk
priority: normal
severity: normal
status: open
title: Documentation of 3.3 is available

___
Python tracker 

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



[issue32805] Possible integer overflow when call PyDTrace_GC_DONE()

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


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

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 324e1790094708538acf2e7795f9c44e3732aaf7 by Serhiy Storchaka in 
branch '2.7':
[2.7] bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934). 
(GH-11001) (GH-11008)
https://github.com/python/cpython/commit/324e1790094708538acf2e7795f9c44e3732aaf7


--

___
Python tracker 

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



[issue35434] Wrong bpo linked in What's New in 3.8

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 16501b70826695991b3a151dfc538f010be5c765 by Miss Islington (bot) 
(Mariatta) in branch 'master':
bpo-35434 Fix wrong issue number in what's new in 3.8 (GH-11012)
https://github.com/python/cpython/commit/16501b70826695991b3a151dfc538f010be5c765


--
nosy: +miss-islington

___
Python tracker 

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



[issue35434] Wrong bpo linked in What's New in 3.8

2018-12-06 Thread Mariatta Wijaya


Mariatta Wijaya  added the comment:

Thanks! This has been fixed.

--
nosy: +Mariatta
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



[issue35434] Wrong bpo linked in What's New in 3.8

2018-12-06 Thread Mariatta Wijaya


Change by Mariatta Wijaya :


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

___
Python tracker 

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



[issue34977] Release Windows Store app containing Python

2018-12-06 Thread Steve Dower


Change by Steve Dower :


--
stage: patch review -> commit review

___
Python tracker 

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



[issue34977] Release Windows Store app containing Python

2018-12-06 Thread Steve Dower


Steve Dower  added the comment:

Making the release experimental as part of the next 3.7 update was approved by 
Ned (over email), so I merged the build. As soon as we snap for the RC I'll 
kick off an update and make the store page public, and hopefully can promote it 
enough to get eyes on it.

Unfortunately, I discovered as part of a test submission that the minimum 
Windows version matters, and it's a version that hasn't been rolled out fully 
yet because of some bugs, so there may not be that many people who can use it 
this first time. But that will improve over time, and I'm sure I can find 
enough people to flush out issues before the next release (anyone on the 
Windows Insiders program should be fine).

--

___
Python tracker 

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



[issue34977] Release Windows Store app containing Python

2018-12-06 Thread Steve Dower


Steve Dower  added the comment:


New changeset 253209149389e6793a052034e1f2d97691086f18 by Steve Dower in branch 
'3.7':
[3.7] bpo-34977: Add Windows App Store package (GH-10245)
https://github.com/python/cpython/commit/253209149389e6793a052034e1f2d97691086f18


--

___
Python tracker 

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



[issue34977] Release Windows Store app containing Python

2018-12-06 Thread Steve Dower


Steve Dower  added the comment:


New changeset 468a15aaf9206448a744fc5eab3fc21f51966aad by Steve Dower in branch 
'master':
bpo-34977: Add Windows App Store package (GH-10245)
https://github.com/python/cpython/commit/468a15aaf9206448a744fc5eab3fc21f51966aad


--

___
Python tracker 

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



[issue35434] Wrong bpo linked in What's New in 3.8

2018-12-06 Thread Josh Rosenberg

New submission from Josh Rosenberg :

https://docs.python.org/3.8/whatsnew/3.8.html#optimizations begins with:

shutil.copyfile(), shutil.copy(), shutil.copy2(), shutil.copytree() and 
shutil.move() use platform-specific “fast-copy” syscalls on Linux, macOS and 
Solaris in order to copy the file more efficiently. ... more explanation ... 
(Contributed by Giampaolo Rodola’ in bpo-25427.)

That's all correct, except bpo-25427 is about removing the pyvenv script; it 
should be referencing bpo-33671.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 331264
nosy: docs@python, giampaolo.rodola, josh.r
priority: low
severity: normal
status: open
title: Wrong bpo linked in What's New in 3.8
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



[issue35433] Correctly detect installed SDK versions

2018-12-06 Thread Steve Dower


Steve Dower  added the comment:

Looks good to me. I can't apply tags from my phone, apparently, so someone else 
will have to merge and mark the backport versions.

--

___
Python tracker 

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



[issue35433] Correctly detect installed SDK versions

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
nosy: +vstinner

___
Python tracker 

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



[issue35433] Correctly detect installed SDK versions

2018-12-06 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

Also, my buildbot *should* fail until this change is merged.

--

___
Python tracker 

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



Re: tkinter resizable text with grid

2018-12-06 Thread Paulo da Silva
Às 21:15 de 06/12/18, Rick Johnson escreveu:
> Paulo da Silva wrote:
> 
...

> 
> In Tkinter, if you have a "container"[1] that only has a
> single widget stuffed inside, and, you want that single
> widget to expand to fill the extents of its parent
> container, then, the pack geometry manager is the simplest
> approach.
> 
> w = create_a_widget()
> w.pack(fill=X|Y|BOTH, expand=YES)
Yes, I am aware of pack. Unfortunately the code fragment I posted is a
very small part of a larger widget.

...

> 
> I kinda have a love/hate relationship with Tkinter and IDLE.
> On one hand i find them to be practical[2] and simple[3] and
> on the other, i find them to be poorly designed and
> unintuitive. And it's a real shame, because, both of these
> libraries have tons of potential, *IF*, they were designed
> probably and the shortcomings of TclTk were abstracted away
> behind a more Pythonic interface.
> 

I fully agree. Nevertheless, what I miss more is the lack of more
complex mega widgets - scrollable list of widgets with insert, append
and remove methods and perhaps a spreadsheet like widget are two big
ones. There are others smaller, like a single scrollable text with two
scroll bars that hide when not needed, tab multi-choice container, etc ...

Unfortunately I rarely need gui programming and don't have the expertise
to address such task. Being tk so old, I wonder why no one developed
those expansions - continuing tix, for example. There are some
implementations but they seem not being maintained.

Pmw has some of the later, but it is not much stable for python3.

Thanks for responding
Paulo
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue9566] Compilation warnings under x64 Windows

2018-12-06 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

I've added two PRs (GH-11010 and GH-11011) along with bpo-35433 that should get 
3.x warning free (finally!) on 64-bit Windows.

--

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests: +10245

___
Python tracker 

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-12-06 Thread Jonathan Gossage


Change by Jonathan Gossage :


Added file: https://bugs.python.org/file47980/lock1.result.txt

___
Python tracker 

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



[issue35267] reproducible deadlock with multiprocessing.Pool

2018-12-06 Thread Jonathan Gossage


Jonathan Gossage  added the comment:

This is a great example of abusing the multi-processing API and thus
creating timing errors that lead to locks not being released. What is
happening is that the example attempts to transmit data that is too
big for the underlying pipe and this creates the timing errors since
the pipe that returns the result of invoking apply_async does not have
the capacity of transmitting the result of the worker process in a single
operation and accordingly the worker process returns prematurely while
still holding the pipe lock. This can be seen by testing the ready status
of the result returned by apply_async which will show whether the complete
result of the worker process has been received.
  
 The solution to this situation is simple, simply invoke get() on
 the asynchronous result returned by apply_async. Using this call has the
 effect of correctly synchronizing the pipe used by the low-level queues
 used by the Pool Manager and there will be no lock left active when it
 should'nt be. The script lock1.py contains code that implements this fix
 as well as verifying that everything has worked properly. The output from
 the script is found in the file lock1.result.txt.
  
 Because there is an API based solution to the problem plus the
 behavior of apply_async makes sense in that the process of transferring
 multi-buffer data is very CPU intensive and should be delegated to the
 worker process rather than to the main-line process, I do not recommend that
 any changes be made to the multiprocessing code in Python, rather the
 solution should use the available multiprocessing API correctly.

--
nosy: +Jonathan.Gossage
Added file: https://bugs.python.org/file47979/lock1.py

___
Python tracker 

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



[issue9566] Compilation warnings under x64 Windows

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
pull_requests: +10244

___
Python tracker 

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



[issue35432] str.format and string.Formatter bug with French (and other) locale

2018-12-06 Thread Eric V. Smith


Eric V. Smith  added the comment:

Possibly related to issue 33954?

--
nosy: +eric.smith

___
Python tracker 

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



[issue35433] Correctly detect installed SDK versions

2018-12-06 Thread Jeremy Kloth


Change by Jeremy Kloth :


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

___
Python tracker 

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



[issue35433] Correctly detect installed SDK versions

2018-12-06 Thread Jeremy Kloth


New submission from Jeremy Kloth :

In the process of eliminating compiler warnings on my buildbot, I needed to 
update VS2015 to the latest toolset (VS2015 Update 3).  This in turn now causes 
an error due about not having the required version of Windows SDK installed.

It seems that the detection logic for that uses a hard-coded list which may not 
be up-to-date (and possibly incorrect for some installs).  Referenced PR fixes 
this.

--
components: Build, Windows
messages: 331258
nosy: jkloth, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Correctly detect installed SDK versions
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



[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-06 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

+1 I have wanted this a number of times.

FWIW, most recently I wrote it like this:

def comb(n, r):
'Equivalent to factorial(n) // (factorial(r) * factorial(n-r))'
c = 1
r = min(r, n-r)
for i in range(1, r+1):
c = c * (n - r + i) // i
return c

I'm not sure is this is better than a single divide, but it kept the 
intermediate values from exploding in size, taking advantage of cancellation at 
each step.

Also, I'm not sure what the predominant choice for variable names should be, "n 
things taken r at a time" or "n things taken k at time".

Also, it's worth considering whether the function should be called "binomial", 
"choose", "combinations", or "comb".  The word "binomial" seems too application 
specific but would make sense if we ever introduced a "multinomial" 
counterpart.  The word "choose" is how we usually pronounce it.  The word 
"combinations" fits nicely with the related counting functions, "combinations, 
permutations, and factorial".  The word "comb" is short, works well with "perm" 
and "fact", and nicely differentiates itself as the integer counterparts of the 
combinatoric functions in the itertools module.

Wolfram uses both choose and Binomial[n,m]
SciPy uses comb(n, k).
Maple uses both numbcomb(n,m) and binomial(n,m).
TeX uses {n \choose k}

--
nosy: +mark.dickinson, rhettinger, tim.peters

___
Python tracker 

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



[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-06 Thread kellerfuchs


kellerfuchs  added the comment:

Yes, that was a copypasta mistake (and I also import factorial needlessly) as 
the file I prototyped it in had some other code for testing my proposed 
implementation.  :)

--

___
Python tracker 

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



[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-06 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

You import reduce but never use it :-)

+1 for this, I certainly miss it too.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue35432] str.format and string.Formatter bug with French (and other) locale

2018-12-06 Thread Bruno Chanal

New submission from Bruno Chanal :

The short story: Small numbers are not displayed properly when using a French 
(language) locale or similar, and formatting output with str.format or 
string.Formatter(). The problem probably extends to other locales.

Long story:

---
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 18.04.1 LTS
Release:18.04
Codename:   bionic
$ python3
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 locale
>>> locale.setlocale(locale.LC_ALL, '')
'fr_CA.UTF-8'
>>> print('{:n}'.format(10))# Garbled output

>>> print('{:n}'.format(1)) # OK
10 000
>>> # Note: narrow non-break space used as thousands separator
... pass
>>> locale.format_string('%d', 10, grouping=True)  # OK
'10'
>>> locale.format_string('%d', 10123)  # OK
'10123'
>>> locale.format_string('%d', 10123, grouping=True)   # OK thousands separator 
>>> \u202f
'10\u202f123'
>>> import string
>>> print(string.Formatter().format('{:n}', 10))  # Same problem with Formatter
AB
>>> print(string.Formatter().format('{:n}', 1))
10 000

locale aware functions implementing the {:n} formatting code, such as 
str.format and string.Formatter, generate garbled output with small numbers 
under a French locale.

However, locale.format_string('%d', numeric_value) produces valid strings. In 
other words, it's a workaround for the time being...

The problem seems to originate from a new version of Ubuntu: I ran the same 
program about 18 months ago and didn't notice any problem.

My 0.02 $ worth of analysis: the output from the str.locale function is some 
random and changing value with small numbers. The behavior is reminiscent of 
invalid memory reads in C functions, e.g., mismatch of  parameter in function 
calls, or similar. The value is not consistent. It feels like format does not 
expect and deal properly with long Unicode characters as part of numbers. The 
space character is a NARROW NON-BREAK SPACE, in most Ubuntu French locales (and 
quite a few others) however.

The problem shows up in Python 3.6 and 3.7.

This might also be a security issue...

--
components: Interpreter Core
messages: 331254
nosy: canuck7
priority: normal
severity: normal
status: open
title: str.format and string.Formatter bug with French (and other) locale
type: behavior
versions: Python 3.6

___
Python tracker 

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



Re: Creating type evaluation annotation

2018-12-06 Thread Thomas Jollans
On 06/12/2018 11:48, Marek Mosiewicz wrote:
> I'm Java developer,but had some experience with Python based
> ERP software. It is quite serious application and I feel 
> unconfortable with not having type checking. I do not say language
> should be static, but having checking method signature
> is big win. For example in refactoring.

I get the feeling that you're essentially describing mypy.

> I know that Python 3 has possibility to have indicate
> type for varibale or param
> What could be great to have possibility to annotate any 
> class with what I call "type evaluator" function.
> That could check method signature with rules specific 
> for given type.
> The simplest evaluator would simply check if signature
> is same as method definition. 
> But it could go futher. It could check whatever is valid 
> logic for creating methods in given class and whatever 
> are valid params for given method.
> Even more powerful evaluator could be not only
> valid/not valid indicator. It could validate
> and suggest next param or method part name for given
> written part of call. That could make python IDEs
> much more powerful
> From my experience having signature checking and
> hinting params when writing code is really big win.
> I could simply refactor 10 lines of code in
> Java, but same for Python is much more difficult
> 
> Best regards,
> Marek Mosiewicz
> 
> 

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35430] Lib/argparse.py uses `is` for string comparison

2018-12-06 Thread Roman Yurchak


Roman Yurchak  added the comment:

Thanks, Alexey and Serhiy! Looking at the code more closely I would agree. I 
guess changing the value of the suppress object to something else to avoid the 
warning, has a potential of breaking code that relies on the current 
functionality and is not worth it...

--

___
Python tracker 

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



[issue35430] Lib/argparse.py uses `is` for string comparison

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I concur with Alexey. This is a correct use of the 'is' operator.

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



[issue35431] The math module should provide a function for computing binomial coefficients

2018-12-06 Thread kellerfuchs


New submission from kellerfuchs :

A recuring pain point, for me and for many others who use Python for 
mathematical computations, is that the standard library does not provide a 
function for computing binomial coefficients.

I would like to suggest adding a function, in the math module, with the 
following signature:

  binomial(n: Integral, k: Integral) -> Integral

A simple native Python implementation would be:

  from functools import reduce
  from math import factorial
  from numbers import Integral

  def binomial(n: Integral, k: Integral) -> Integral:
  if k < 0 or n < 0:
  raise ValueError("math.binomial takes non-negative parameters.")

  k = min(k, n-k)
  num, den = 1, 1
  for i in range(k):
  num = num * (n - i)
  den = den * (i + 1)

  return num//den

As far as I can tell, all of the math module is implemented in C, so this 
should be done in C too, but the implemented behaviour should be equivalent.

I will submit a Github pull request once I have a ready-to-review patch.

Not starting a PEP, per [PEP 1]:
> Small enhancements or patches often don't need a PEP and can be injected into 
> the Python development workflow with a patch submission to the Python issue 
> tracker.

[PEP 1]: https://www.python.org/dev/peps/pep-0001/#id36

--
messages: 331251
nosy: kellerfuchs
priority: normal
severity: normal
status: open
title: The math module should provide a function for computing binomial 
coefficients
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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +10242

___
Python tracker 

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



[issue35430] Lib/argparse.py uses `is` for string comparison

2018-12-06 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

argparse.SUPPRESS is an opaque value to be used by argparse clients. It could 
be anything, it just happens to be a string. So the code doesn't compare 
strings but checks whether a supplied object *is* the opaque value. I do not 
see any problem with this code, though one way to avoid LGTM diagnostics would 
be to use a non-string opaque value instead.

--
nosy: +izbyshev

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 7a2cf1e7d3bf300e98c702589d405734f4a8fcf8 by Serhiy Storchaka in 
branch '3.6':
bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934). (GH-11001)
https://github.com/python/cpython/commit/7a2cf1e7d3bf300e98c702589d405734f4a8fcf8


--

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 6485aa6eb1024672f08afdd577e2b5792eb6b03c by Miss Islington (bot) 
in branch '3.7':
bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934)
https://github.com/python/cpython/commit/6485aa6eb1024672f08afdd577e2b5792eb6b03c


--
nosy: +miss-islington

___
Python tracker 

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



[issue35430] Lib/argparse.py uses `is` for string comparison

2018-12-06 Thread Roman Yurchak


Change by Roman Yurchak :


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

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +10240

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10239

___
Python tracker 

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



[issue33023] Unable to copy ssl.SSLContext

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset 42b1d6127bd8595522a78a75166ebb9fba74a6a2 by Serhiy Storchaka in 
branch 'master':
bpo-33023: Fix NotImplemented to NotImplementedError. (GH-10934)
https://github.com/python/cpython/commit/42b1d6127bd8595522a78a75166ebb9fba74a6a2


--

___
Python tracker 

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



Re: Creating type evaluation annotation

2018-12-06 Thread Jon Ribbens
On 2018-12-06, Marek Mosiewicz  wrote:
> I'm Java developer,but had some experience with Python based
> ERP software. It is quite serious application and I feel 
> unconfortable with not having type checking. I do not say language
> should be static, but having checking method signature
> is big win. For example in refactoring.
> I know that Python 3 has possibility to have indicate
> type for varibale or param

Are you talking about http://www.mypy-lang.org/ ?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35430] Lib/argparse.py uses `is` for string comparison

2018-12-06 Thread Roman Yurchak


New submission from Roman Yurchak :

Lib/argparse.py uses `is` for string comparison,

`
221:if self.heading is not SUPPRESS and self.heading is not None:
247:if text is not SUPPRESS and text is not None:
251:if usage is not SUPPRESS:
256:if action.help is not SUPPRESS:
290:if part and part is not SUPPRESS])
679:if action.default is not SUPPRESS:
1130:if self.dest is not SUPPRESS:
1766:if action.dest is not SUPPRESS:
1768:if action.default is not SUPPRESS:
1851:if argument_values is not SUPPRESS:
2026: if action.help is not SUPPRESS]
`

where `SUPPRESS = '==SUPPRESS=='`. Unless I'm missing something this can 
produce false negatives if the variable that we compare against is a slice from 
another string. Using equality is probably safer in any case.

Detected with LGTM.com analysis.

--
components: Library (Lib)
messages: 331246
nosy: rth
priority: normal
severity: normal
status: open
title: Lib/argparse.py uses `is` for string comparison
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



[issue35429] Incorrect use of raise NotImplemented

2018-12-06 Thread Roman Yurchak


Change by Roman Yurchak :


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

___
Python tracker 

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



[issue35429] Incorrect use of raise NotImplemented

2018-12-06 Thread Roman Yurchak


New submission from Roman Yurchak :

In two places in stdlib, `raise NotImplemented` is used instead of `raise 
NotImplementedError`. The former is not valid and produces,

```
>>> raise NotImplemented('message')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'NotImplementedType' object is not callable
```

--
components: Library (Lib)
messages: 331244
nosy: rth
priority: normal
severity: normal
status: open
title: Incorrect use of raise NotImplemented
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



[issue35411] FTP tests of test_urllib2net fail on Travis CI: 425 Security: Bad IP connecting.

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

test_urllib2net still fails on Travis CI. See for example 
https://api.travis-ci.org/v3/job/464509821/log.txt.

--
nosy: +benjamin.peterson, ned.deily, serhiy.storchaka
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



[issue35428] xml.etree.ElementTree.tostring violates W3 standards allowing encoding='unicode' without error

2018-12-06 Thread EZ

New submission from EZ :

The documentation[0] for 3.x of xml.etree.ElementTree.tostring is quite clear:

> Use encoding="unicode" to generate a Unicode string.

See also the creation of the problem:
https://bugs.python.org/issue10942

This is a violation of W3 standards, referenced by the ElementTree 
documentation[1] claiming it must conform to these standards, which state:

...it is a fatal error for an entity including an encoding declaration to be 
presented to the XML processor in an encoding other than that named in the 
declaration

Encoding for 'unicode' does not appear in the named declarations 
(https://www.iana.org/assignments/character-sets/character-sets.xhtml) 
referenced by the same documentation[1].

Handling of a fatal error, must, in part: 

Once a fatal error is detected, however, the processor MUST NOT continue normal 
processing (i.e., it MUST NOT continue to pass character data and information 
about the document's logical structure to the application in the normal way)

[0] https://docs.python.org/3.2/library/xml.etree.elementtree.html
[1] The encoding string included in XML output should conform to the 
appropriate standards. For example, “UTF-8” is valid, but “UTF8” is not. See 
http://www.w3.org/TR/2006/REC-xml11-20060816/#NT-EncodingDecl and 
http://www.iana.org/assignments/character-sets.

--
components: XML
messages: 331242
nosy: Zim
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.tostring violates W3 standards allowing 
encoding='unicode' without error
type: behavior
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



Re: Creating type evaluation annotation

2018-12-06 Thread Terry Reedy

On 12/6/2018 5:48 AM, Marek Mosiewicz wrote:

I'm Java developer,but had some experience with Python based
ERP software. It is quite serious application and I feel
unconfortable with not having type checking. I do not say language
should be static, but having checking method signature
is big win. For example in refactoring.
I know that Python 3 has possibility to have indicate
type for varibale or param
What could be great to have possibility to annotate any
class with what I call "type evaluator" function.
That could check method signature with rules specific
for given type.


This and the following needs simple concrete examples.  Withing such, my 
eyes glaze over.



The simplest evaluator would simply check if signature
is same as method definition.
But it could go futher. It could check whatever is valid
logic for creating methods in given class and whatever
are valid params for given method.
Even more powerful evaluator could be not only
valid/not valid indicator. It could validate
and suggest next param or method part name for given
written part of call. That could make python IDEs
much more powerful
 From my experience having signature checking and
hinting params when writing code is really big win.
I could simply refactor 10 lines of code in
Java, but same for Python is much more difficult

Best regards,
 Marek Mosiewicz





--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list


[issue22005] datetime.__setstate__ fails decoding python2 pickle

2018-12-06 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

NumPy starves from the same issue. In NumPy this problem was solved by 
requiring encoding='latin1' passed to unpickler. It makes sense to use the same 
approach for datetime classes.

--
versions: +Python 3.7, Python 3.8 -Python 2.7, 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



[issue26415] Excessive peak memory consumption by the Python parser

2018-12-06 Thread A. Skrobov


A. Skrobov  added the comment:

@Serhiy: incredibly, this patch from 2.5 years ago required very minor changes 
to apply to the latest master. Shows how ossified the parser is :-)

Now posted as https://github.com/python/cpython/pull/10995

--

___
Python tracker 

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



Creating type evaluation annotation

2018-12-06 Thread Marek Mosiewicz
I'm Java developer,but had some experience with Python based
ERP software. It is quite serious application and I feel 
unconfortable with not having type checking. I do not say language
should be static, but having checking method signature
is big win. For example in refactoring.
I know that Python 3 has possibility to have indicate
type for varibale or param
What could be great to have possibility to annotate any 
class with what I call "type evaluator" function.
That could check method signature with rules specific 
for given type.
The simplest evaluator would simply check if signature
is same as method definition. 
But it could go futher. It could check whatever is valid 
logic for creating methods in given class and whatever 
are valid params for given method.
Even more powerful evaluator could be not only
valid/not valid indicator. It could validate
and suggest next param or method part name for given
written part of call. That could make python IDEs
much more powerful
From my experience having signature checking and
hinting params when writing code is really big win.
I could simply refactor 10 lines of code in
Java, but same for Python is much more difficult

Best regards,
Marek Mosiewicz


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26415] Excessive peak memory consumption by the Python parser

2018-12-06 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +10236

___
Python tracker 

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



[issue35427] logging UnicodeDecodeError from undecodable strftime output

2018-12-06 Thread Mark Dickinson


Mark Dickinson  added the comment:

Here's a bug report from someone else running into the same issue on Scrapy; 
looks like they worked around the issue by simply removing the timezone 
information from the `datefmt` (which is what we ended up doing, too): 

https://github.com/scrapy/scrapy/issues/1270

--

___
Python tracker 

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



[issue35427] logging UnicodeDecodeError from undecodable strftime output

2018-12-06 Thread Mark Dickinson

New submission from Mark Dickinson :

We're seeing UnicodeDecodeErrors on Windows / Python 2.7 when using logging on 
a Japanese customer machine. The cause turns out to be in the log record 
formatting, where unicode fields are combined with non-decodable bytestrings 
coming from strftime.

More details: we were using the following formatter:

_LOG_FORMATTER = logging.Formatter(
"%(asctime)s %(levelname)s:%(name)s:%(message)s",
datefmt="%Y-%m-%dT%H:%M:%S%Z",
)

In the logging internals, that `datefmt` gets passed to `time.strftime`, which 
on the machine in question produced a non-ASCII bytestring (i.e., type `str`). 
When combined with other Unicode strings in the log record, this gave the 
`UnicodeDecodeError`.

I'm unfortunately failing to reproduce this directly on my own macOS / UK 
locale machine, but it's documented that `time.strftime` returns a value 
encoded according to the current locale. In this particular case, the output we 
were getting from the `time.strftime` call looked like:

"2018-12-06T23:57:14\x93\x8c\x8b\x9e (\x95W\x8f\x80\x8e\x9e)"

which assuming an encoding of cp932 decodes to something plausible:

>>> s.decode("cp932")
u'2018-12-06T23:57:14\u6771\u4eac (\u6a19\u6e96\u6642)'
>>> print(s.decode("cp932"))
2018-12-06T23:57:14東京 (標準時)

It looks as though the logging module should be explicitly decoding the 
strftime output before doing formatting, using for example what's recommended 
in the strftime documentation [1]:

strftime().decode(locale.getlocale()[1])


Code links: this is the line that's producing non-decodable bytes: 

https://github.com/python/cpython/blob/49cedc51a68b4cd2525c14ab02bd1a483d8be389/Lib/logging/__init__.py#L425

... and this is the formatting operation that then ends up raising 
UnicodeDecodeError as a result of those:

https://github.com/python/cpython/blob/49cedc51a68b4cd2525c14ab02bd1a483d8be389/Lib/logging/__init__.py#L469

This isn't an issue on Python 3, and I was unable to reproduce it on my 
non-Windows machine; that particular form of strftime output may well be 
specific to Windows (or possibly even specific to Japanese flavours of Windows).


[1] https://docs.python.org/2/library/time.html#time.strftime

--
components: Library (Lib)
messages: 331238
nosy: mark.dickinson
priority: normal
severity: normal
status: open
title: logging UnicodeDecodeError from undecodable strftime output
type: behavior
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



[issue33127] Python 2.7.14 won't build ssl module with Libressl 2.7.0

2018-12-06 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +10235

___
Python tracker 

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



[issue34987] A possible null pointer dereference in _pickle.c's save_reduce()

2018-12-06 Thread Zackery Spytz


Change by Zackery Spytz :


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



Re: tkinter resizable text with grid

2018-12-06 Thread Paulo da Silva
Às 08:24 de 06/12/18, Peter Otten escreveu:
> Paulo da Silva wrote:
> 
...
> 
> You have to set the column/row weight of the /master/:
> 
>   master.grid_columnconfigure(1, weight=1)
>   master.grid_rowconfigure(1, weight=1)
Ok. That works!


> 
> Also, columns and rows usually start with 0.
>  
Yes, I know that. I have other stuff there.

Thank you very much Peter.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:

Follow-up: bpo-35425, "test_eintr fails randomly on AMD64 FreeBSD 10-STABLE 
Non-Debug 3.7: TypeError: 'int' object is not callable".

--

___
Python tracker 

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



[issue35330] When using mock to wrap an existing object, side_effect requires return_value

2018-12-06 Thread Mario Corchero


Change by Mario Corchero :


--
keywords: +patch
pull_requests: +10234
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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 3f0e8e225e2275d22c4bd2e8f8f212b6a8b849aa by Miss Islington (bot) 
in branch '3.6':
bpo-35363: test_eintr uses print(flush=True) (GH-10990)
https://github.com/python/cpython/commit/3f0e8e225e2275d22c4bd2e8f8f212b6a8b849aa


--

___
Python tracker 

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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset 560fa4db17983ce37c1453c057901c627b2c3abc by Miss Islington (bot) 
in branch '3.7':
bpo-35363: test_eintr uses print(flush=True) (GH-10990)
https://github.com/python/cpython/commit/560fa4db17983ce37c1453c057901c627b2c3abc


--

___
Python tracker 

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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10233

___
Python tracker 

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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 0644b33821b70efbf0ac1ec1fb8729b05796564a by Victor Stinner in 
branch 'master':
bpo-35363: test_eintr uses print(flush=True) (GH-10990)
https://github.com/python/cpython/commit/0644b33821b70efbf0ac1ec1fb8729b05796564a


--

___
Python tracker 

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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10232

___
Python tracker 

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



[issue35426] test_signal.test_interprocess_signal() race condition

2018-12-06 Thread STINNER Victor


New submission from STINNER Victor :

test_signal.test_interprocess_signal() has a race condition:

with self.subprocess_send_signal(pid, "SIGUSR1") as child: # here
self.wait_signal(child, 'SIGUSR1', SIGUSR1Exception)

The test only except SIGUSR1Exception inside wait_signal(), but the signal can 
be sent during subprocess_send_signal() call. assertRaises(SIGUSR1Exception) 
should surround these two lines instead. wait_signal() shouldn't handle the 
signal.

Or wait_signal() should call subprocess_send_signal().


It seems like Python 2.7 has the proper design. It might be a regression 
introduced by myself in:

commit 32eb840a42ec0e131daac48d43aa35290e72571e
Author: Victor Stinner 
Date:   Tue Mar 15 11:12:35 2016 +0100

Issue #26566: Rewrite test_signal.InterProcessSignalTests

* Add Lib/test/signalinterproctester.py
* Don't disable the garbage collector anymore
* Don't use os.fork() with a subprocess to not inherit existing signal 
handlers
  or threads: start from a fresh process
* Don't use UNIX kill command to send a signal but Python os.kill()
* Use a timeout of 10 seconds to wait for the signal instead of 1 second
* Always use signal.pause(), instead of time.wait(1), to wait for a signal
* Use context manager on subprocess.Popen
* remove code to retry on EINTR: it's no more needed since the PEP 475
* remove unused function exit_subprocess()
* Cleanup the code


FAIL: test_interprocess_signal (test.test_signal.PosixTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/test_signal.py",
 line 62, in test_interprocess_signal
assert_python_ok(script)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/support/script_helper.py",
 line 157, in assert_python_ok
return _assert_python(True, *args, **env_vars)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/support/script_helper.py",
 line 143, in _assert_python
res.fail(cmd_line)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/support/script_helper.py",
 line 84, in fail
err))
AssertionError: Process return code is 1
command line: 
['/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/python', '-X', 
'faulthandler', '-I', 
'/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/signalinterproctester.py']

stdout:
---

---

stderr:
---
E/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/subprocess.py:858:
 ResourceWarning: subprocess 64567 is still running
  ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback

==
ERROR: test_interprocess_signal (__main__.InterProcessSignalTests)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/signalinterproctester.py",
 line 68, in test_interprocess_signal
with self.subprocess_send_signal(pid, "SIGUSR1") as child:
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/signalinterproctester.py",
 line 50, in subprocess_send_signal
return subprocess.Popen(args)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/subprocess.py",
 line 775, in __init__
restore_signals, start_new_session)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/subprocess.py",
 line 1476, in _execute_child
part = os.read(errpipe_read, 5)
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/signalinterproctester.py",
 line 22, in sigusr1_handler
raise SIGUSR1Exception
SIGUSR1Exception

--
Ran 1 test in 0.223s

FAILED (errors=1)
---

--

Ran 43 tests in 31.872s

FAILED (failures=1, skipped=2)
test test_signal failed

--
components: Tests
messages: 331233
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_signal.test_interprocess_signal() race condition
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



[issue33127] Python 2.7.14 won't build ssl module with Libressl 2.7.0

2018-12-06 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +10231

___
Python tracker 

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



[issue35425] test_eintr fails randomly on AMD64 FreeBSD 10-STABLE Non-Debug 3.7: TypeError: 'int' object is not callable

2018-12-06 Thread STINNER Victor


New submission from STINNER Victor :

I don't understand the error, it doesn't make sense. It *seems* like 
faulthandler.cancel_dump_traceback_later attribute has been set to an int, but 
I don't see how it could be possible. Or the call raises the TypeError? But the 
call can be summarized to:

Py_CLEAR(thread.file);

and I don't see how Py_CLEAR() can trigger a TypeError.

https://buildbot.python.org/all/#/builders/170/builds/175

ERROR: test_sigwaitinfo (__main__.SignalEINTRTest)

Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.7.koobs-freebsd10.nondebug/build/Lib/test/eintrdata/eintr_tester.py",
 line 71, in tearDown
faulthandler.cancel_dump_traceback_later()
TypeError: 'int' object is not callable

--
components: Tests
messages: 331232
nosy: pablogsal, vstinner
priority: normal
severity: normal
status: open
title: test_eintr fails randomly on AMD64 FreeBSD 10-STABLE Non-Debug 3.7: 
TypeError: 'int' object is not callable
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



[issue35363] test_eintr: test_open() hangs randomly on x86-64 El Capitan 3.x buildbot

2018-12-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10230

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset e44b5b2afa6fe2966d8caff45e36c0980413bb86 by Miss Islington (bot) 
in branch '3.6':
bpo-35424: test_multiprocessing: join 3 pools (GH-10986)
https://github.com/python/cpython/commit/e44b5b2afa6fe2966d8caff45e36c0980413bb86


--

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset b7c67c4d510a7a72a35983cc168dbb2ce796cb8c by Miss Islington (bot) 
in branch '3.7':
bpo-35424: test_multiprocessing: join 3 pools (GH-10986)
https://github.com/python/cpython/commit/b7c67c4d510a7a72a35983cc168dbb2ce796cb8c


--
nosy: +miss-islington

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I agree about making the multiprocessing API safer to use, but please let's 
have this discussion on a dedicated bug entry.

--

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Ok, I will modify my PR to pass a weak reference and raise.

--

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:

See https://bugs.python.org/issue34172#msg331216 for a more general discussion 
about how the multiprocessing API is supposed tobe used and multiprocessing 
objects lifetime.

--

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I think a weakref is fine.  You don't have to *pass* a weakref: just pass a 
normal ref and let the Result object take a weakref (and a reference to the 
cache perhaps).

--

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:

In general, I'm fine with adding a *weak* reference, especially if it helps to 
detect bugs.

--
nosy: +vstinner

___
Python tracker 

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



[issue35378] multiprocessing.Pool.imaps iterators do not maintain alive the multiprocessing.Pool objects

2018-12-06 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Although I think keeping the iterator is not a bad solution if done correctly, 
I think more and more that is not the best solution.

@Antoine, would you be ok passing a weak reference to the iterator and raising 
if the pool is dead?

I still think we should try to avoid hanging.

--

___
Python tracker 

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



[issue35359] [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\

2018-12-06 Thread STINNER Victor


Change by STINNER Victor :


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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10228

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread miss-islington


Change by miss-islington :


--
pull_requests: +10229

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 388c8c208d9d09bd28289c1e4776b947d4d0f0f0 by Victor Stinner in 
branch 'master':
bpo-35424: test_multiprocessing: join 3 pools (GH-10986)
https://github.com/python/cpython/commit/388c8c208d9d09bd28289c1e4776b947d4d0f0f0


--

___
Python tracker 

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



[issue35359] [2.7][Windows] Define _CRT_SECURE_NO_WARNINGS to build Modules\zlib\

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 49cedc51a68b4cd2525c14ab02bd1a483d8be389 by Victor Stinner in 
branch '2.7':
bpo-35359: Add _CRT_SECURE_NO_WARNINGS to pythoncore project (GH-10819)
https://github.com/python/cpython/commit/49cedc51a68b4cd2525c14ab02bd1a483d8be389


--

___
Python tracker 

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-35424: "multiprocessing.Pool: emit ResourceWarning".

I wrote 10986 to fix 2 tests which leak resources.

I have a question. Why do tests have to call "pool.join()" after "with pool:"? 
When I use a file, I know that the resources are released after "with file:".

Should Pool.__exit__() call Pool.join()?

This question reminds me my fix in socketserver (bpo-31151 and bpo-31233) which 
leaked processes and threads, and my bug bpo-34037 (asyncio leaks threads).

--

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread STINNER Victor


STINNER Victor  added the comment:

While testing PR 10974, I found two tests which emits ResourceWarning. I wrote 
10986 to fix them.

--

___
Python tracker 

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



[issue35424] multiprocessing.Pool: emit ResourceWarning

2018-12-06 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +10227

___
Python tracker 

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



[issue35384] The repr of ctypes.CArgObject fails for non-ascii character

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



[issue35384] The repr of ctypes.CArgObject fails for non-ascii character

2018-12-06 Thread miss-islington


miss-islington  added the comment:


New changeset f740818f3d92497c564d515a661039dc8434fc6c by Miss Islington (bot) 
in branch '3.7':
bpo-35384: The repr of ctypes.CArgObject no longer fails for non-ascii 
character. (GH-10863)
https://github.com/python/cpython/commit/f740818f3d92497c564d515a661039dc8434fc6c


--

___
Python tracker 

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



[issue33709] test.support.FS_NONASCII returns incorrect result in Windows with non-US locale

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



[issue34172] multiprocessing.Pool and ThreadPool leak resources after being deleted

2018-12-06 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I agree that reverting in bugfix branches was the right thing to do.  I think 
the fix should have remained in master, though.

--
stage: patch review -> 
versions:  -Python 2.7, 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



  1   2   >