[issue36725] Reference leak regression with Python3.8a3

2019-05-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
stage: patch review -> needs patch

___
Python tracker 

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



[issue36725] Reference leak regression with Python3.8a3

2019-05-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests:  -13139

___
Python tracker 

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



[issue36871] Misleading error from unittest.mock's assert_has_calls

2019-05-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

This is little tricky to fix since the call-matcher needs the signature and 
also the information over whether to add self or not for some cases. Similar 
open issues.

https://bugs.python.org/issue27715
https://bugs.python.org/issue26752

An approach suggested by Mario : https://bugs.python.org/issue26752#msg337023

--
nosy: +xtreak

___
Python tracker 

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



[issue24758] unittest.mock.Mock's new "unsafe" feature needs a better error message

2019-05-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Closing this as resolved since PR was merged. Thanks Zackery for the PR.

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Steven D'Aprano

Steven D'Aprano  added the comment:

Yes please for this!

The two usual versions are isqrt and nsqrt:

isqrt(n) = largest integer ≤ √n

nsqrt(n) = closest integer to √n

although to be honest I'm not sure what use cases there are for nsqrt.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue36822] Minor grammatical fix in glossary.rst

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue36822] Minor grammatical fix in glossary.rst

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 4f5febdf955240b6064bb5647dec084feaa98376 by Pablo Galindo (Sanyam 
Khurana) in branch '3.7':
[3.7] bpo-36822: Fix minor grammatical error in glossary.rst (GH-13145). 
(GH-13260)
https://github.com/python/cpython/commit/4f5febdf955240b6064bb5647dec084feaa98376


--

___
Python tracker 

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



[issue36684] codecov.io code coverage has not updated since 2019-04-13

2019-05-11 Thread Inada Naoki


Change by Inada Naoki :


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



[issue36684] codecov.io code coverage has not updated since 2019-04-13

2019-05-11 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 87068ed00927bdeaa2ae556e4241c16cf8a845eb by Inada Naoki (Gordon 
P. Hemsley) in branch 'master':
bpo-36684: Split out gcc and test coverage builds (GH-13146)
https://github.com/python/cpython/commit/87068ed00927bdeaa2ae556e4241c16cf8a845eb


--

___
Python tracker 

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



[issue36822] Minor grammatical fix in glossary.rst

2019-05-11 Thread Sanyam Khurana


Change by Sanyam Khurana :


--
pull_requests: +13170

___
Python tracker 

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



[issue34152] performance of some list slice assignment margin cases can be improved

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I concur with Raymond and Serhiy: this patch covers very exotic cases and 
complicates the surrounding code. I'm closing this issue.

Thanks, @sir-sigurd for the proposal

--
resolution:  -> rejected
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



[issue36777] unittest discover throws TypeError on empty packages

2019-05-11 Thread Gus Goulart


Change by Gus Goulart :


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

___
Python tracker 

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



[issue36833] Add tests for Datetime C API Macros

2019-05-11 Thread Edison Abahurire


Edison Abahurire  added the comment:

I'm now working on this as pbo-36782 awaits merging.

--
nosy: +anthony shaw

___
Python tracker 

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



[issue36863] argparse doesn't like options in the middle of arguments

2019-05-11 Thread rhubarbdog x


rhubarbdog x  added the comment:

I've just done a test and from a command shell (bash or whatever) the following 
python script when ran produces the following

$ python3 command.py 0ne thwo three
files:  ['0ne', 'thwo', 'three']
sensors 1
freq 1200

$ python3 command.py -s 5 0ne thwo three
files:  ['0ne', 'thwo', 'three']
sensors 5
freq 1200

$ python3 command.py  0ne -s 5 thwo three
usage: command.py [-h] [-s SENSORS] [-f FREQ] file [file ...]
command.py: error: unrecognized arguments: thwo three

i've attached the program command.py

--
status: pending -> open
Added file: https://bugs.python.org/file48327/command.py

___
Python tracker 

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



[issue36892] "Modules" section in Tutorial contains incorrect description about __init__.py

2019-05-11 Thread Ezio Melotti


Ezio Melotti  added the comment:

I agree that implicit namespace packages don't deserve more than a footnote in 
that page.

However, since I often have to answer questions about packages, I'm thinking 
that perhaps it would be better to expand that page and maybe have a page 
dedicated to modules and one to packages, where PEP 420 and other common issues 
could be covered in more details.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue36792] [Windows] time: crash on formatting time with de_DE locale

2019-05-11 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

I have managed to setup a VM that can reproduce the error.  Unfortunately, the 
error (heap corruption) is coming from within the UCRT.  Attempting to work 
around that, I came across another error in the UCRT.

Due to these errors in all available UCRT versions, the only available solution 
is to re-implement %Z handling in Python's implementation of strftime().

@steve.dower: If you could forward the following information to the interested 
parties for faster response, it would be great.

Everyone else, what follows contains UCRT internal details which is of no 
interest to Python.

In wcsftime() [ucrt\time\wcsftime.cpp, line 1018], the call to _mbstowcs_s_l() 
doesn't handle the error case of EILSEQ.  This error happens when the tzname 
(originally set by __tzset() from the Unicode name in the registry encoded to 
the ACP) contains an undecodable character.  In the 'de_DE' case, \u00E4.  
_mbstowcs_s_l returns without changing `wnum` (which is 0).  The 'Z' case then 
blindly subtracts 1 (wnum=-1) and advances the string pointer, now pointing 
*before* the start when the format is just L"%Z" (like Python has).  Now when 
wcsftime() is returning it stores a '\0' at that current position thus causing 
a heap corruption.

Ok, no deal breaker, we can just update the _tzname array when we call 
setlocale().  Alas, another error :(  If _tzset() is called a second time, it 
fails when encoding the Unicode name due to an uninitialized variable.  In 
tzset_from_system_nolock() [ucrt\time\tzset.cpp, line 158], the function 
__acrt_WideCharToMultiByte() [appcrt\locale\widechartomultibyte.cpp] does not 
set the `lpUsedDefaultChar` flag when FALSE.  This is only an issue, it seems, 
on subsequent calls as `used_default_char` can be non-zero prior to the call.  
A non-zero value there, causes the tzname to be set to the empty string even if 
the conversion succeeded.

--

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 26f55c29f2316648939ad12a9d3730a2118da2ea by Pablo Galindo in 
branch 'master':
bpo-36817: Do not decrement reference for expr_text on fstring = parsing 
failure (GH-13256)
https://github.com/python/cpython/commit/26f55c29f2316648939ad12a9d3730a2118da2ea


--

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +13168

___
Python tracker 

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



[issue36892] "Modules" section in Tutorial contains incorrect description about __init__.py

2019-05-11 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

In my experience, beginners have enough trouble getting packages right without 
complicating the tutorial with a rarely-used advanced feature like namespace 
packages.

I don't think this needs more than perhaps a footnote, if that.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue36886] Failed to construct CodeType on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

After PR 13255 is merged, let's open a new issue for the notice in types.rst to 
keep the discussion isolated.

--

___
Python tracker 

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



[issue36892] "Modules" section in Tutorial contains incorrect description about __init__.py

2019-05-11 Thread musou1500


New submission from musou1500 :

"Modules" section in the tutorial says that
https://docs.python.org/3/tutorial/modules.html
"The __init__.py files are required to make Python treat directories containing 
the file as packages. "

But, thanks to PEP 420, __init__.py is not required after Python 3.3.
https://www.python.org/dev/peps/pep-0420/

--
assignee: docs@python
components: Documentation
messages: 342228
nosy: docs@python, musou1500
priority: normal
severity: normal
status: open
title: "Modules" section in Tutorial contains incorrect description about 
__init__.py
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue36886] Failed to construct CodeType on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

>Understandable as well, just thinking that a CYA sentence in types.rst: 
>"These types are not supposed to be instantiated outside of CPython internals 
>and constructor signatures can vary between python versions.
>And maybe the docstrings. I rarely open the documentation on python.org and 
>work most of the time by calling `help()` or `?` in IPython, so having some 
>information saying this is non-public in the docstring would make sens to me. 
>I'm happy to do it if it is deemed useful.

I am +1 to such a sentence, but I think this is a decision that more core devs 
should agree on. Taking into account previous history (like the linked commit) 
and
the fact that promising stability on such internal pieces will prevent us from 
making critical optimizations I assume that others will agree, but I am still 
important
to know that there is a consensus.

I would recommend opening such PR if you have some time and let others review 
it as well.

--

___
Python tracker 

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



[issue36886] Failed to construct CodeType on Python-3.8.0a4

2019-05-11 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

> There are other projects that have already added a fix for the new parameter 
> positionally. If we add it to be the last (that still will break the old 
> call) we would break them again.

Understandable


> The documentation never documented the arguments for the code type (probably 
> on purpose)

Understandable as well, just thinking that a CYA sentence in types.rst: 
"These types are not supposed to be instantiated outside of CPython internals 
and constructor signatures can vary between python versions.

And maybe the docstrings. I rarely open the documentation on python.org and 
work most of the time by calling `help()` or `?` in IPython, so having some 
information saying this is non-public in the docstring would make sens to me. 

I'm happy to do it if it is deemed useful.

--

___
Python tracker 

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



[issue36886] Failed to construct CodeType on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch
pull_requests: +13167
stage: resolved -> patch review

___
Python tracker 

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



[issue36886] Failed to construct CodeType on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
title: problem with Types on Python-3.8.0a4 -> Failed to construct CodeType on 
Python-3.8.0a4

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

As a final note, notice that when keyword-only arguments were implemented, the 
parameter was not added at the end of the constructor:

commit 4f72a78684bbfcdc43ceeabb240ceee54706c4b0
Author: Guido van Rossum 
Date:   Fri Oct 27 23:31:49 2006 +

Jiwon Seo's PEP 3102 implementation.
See SF#1549670.
The compiler package has not yet been updated.


--- a/Objects/codeobject.c
+++ b/Objects/codeobject.c
@@ -41,7 +41,8 @@ intern_strings(PyObject *tuple)


 PyCodeObject *
-PyCode_New(int argcount, int nlocals, int stacksize, int flags,
+PyCode_New(int argcount, int kwonlyargcount,
+  int nlocals, int stacksize, int flags,
   PyObject *code, PyObject *consts, PyObject *names,
   PyObject *varnames, PyObject *freevars, PyObject *cellvars,
   PyObject *filename, PyObject *name, int firstlineno,

--

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
status: closed -> open

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> and/or to CodeType docs to indicate the signature has changed in 3.8 ?

The documentation never documented the arguments for the code type (probably on 
purpose), so not sure if adding a notice there will help much:

https://docs.python.org/3.8/library/types.html#types.CodeType

We can maybe add something more clear to the "what's new" section or the 
changelog.

--

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> If it is supposed to be stable can the `posonlyargcount` be moved to   be the 
> last argument ?

There are other projects that have already added a fix for the new parameter 
positionally. If we add it to be the last (that still will break the old call) 
we would break them again.

--

___
Python tracker 

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



[issue27805] io.open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2019-05-11 Thread Zackery Spytz


Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.7, Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue27805] io.open('/dev/stdout', 'a') raises OSError with errno=ESPIPE

2019-05-11 Thread Zackery Spytz


Change by Zackery Spytz :


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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Matthias Bussonnier


Matthias Bussonnier  added the comment:

If types is not supposed to be stable, could a warning be added at top of 
https://docs.python.org/3/library/types.html that it should not be considered 
stable, and/or to CodeType docs to indicate the signature has changed in 3.8 ?

If it is supposed to be stable can the `posonlyargcount` be moved to   be the 
last argument ?

--
nosy: +mbussonn

___
Python tracker 

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



[issue36880] Returning None from a callback with restype py_object decrements None's refcount too much

2019-05-11 Thread anthony shaw


anthony shaw  added the comment:

Thanks Eryk that saved a lot of debugging. 

dgelessus - if you want to write a patch for CPython am happy to take you 
through this and get it over the line. 

Else: am Happy to write a test against the gc counter and a patch for this

--

___
Python tracker 

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



[issue35925] test_httplib test_nntplib test_ssl fail on ARMv7 Debian buster bot (OpenSSL 1.1.1a)

2019-05-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +13165

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 5833e94d8615ea18b14e4830ecdb868aec81b378 by Pablo Galindo in 
branch 'master':
bpo-36817: Fix reference leak for expr_text in f-string = parsing (GH-13249)
https://github.com/python/cpython/commit/5833e94d8615ea18b14e4830ecdb868aec81b378


--

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue36891] Additional startup plugin for vendors

2019-05-11 Thread SilentGhost


SilentGhost  added the comment:

This is a larger issue then the PR might lead one to believe. Have you had 
discussion on python-ideas or in other forums about this?

--
nosy: +SilentGhost, ncoghlan
versions: +Python 3.8 -Python 3.7

___
Python tracker 

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



[issue36891] Additional startup plugin for vendors

2019-05-11 Thread vx1920


New submission from vx1920 :

Proposed modification in site.py allows "sitevendor" customization plugin in 
addition to existed "sitecustomize" and "usercustomuze". More info displayed 
when "python.exe -m site" typed from command line.
Vendors of Python sites (like Anaconda) can place there their own startup code. 
Mentioned "sitecustomize"  and "usercustomuze" works as before.

--
components: Library (Lib)
messages: 342218
nosy: vx1920
priority: normal
pull_requests: 13164
severity: normal
status: open
title: Additional startup plugin for vendors
type: enhancement
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



[issue36890] python-3.7.3-macosx10.6.pkg verification error on macOS 10.6 Snow Leopard

2019-05-11 Thread Ned Deily


Ned Deily  added the comment:

Thank you for the report.  It appears that macOS installer packages produced on 
current versions of macOS can no longer be successfully opened by the macOS 
10.6 (Snow Leopard) system installer.  This used to work.  Perhaps a 
certificate or something else has changed.  I can try repackaging the Python 
installer package using an older macOS tool chain but I probably will not be 
able to get to this for a few days because of travel.

--
priority: normal -> critical
title: python-3.7.3-macosx10.6.pkg verification error -> 
python-3.7.3-macosx10.6.pkg verification error on macOS 10.6 Snow Leopard

___
Python tracker 

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



[issue36822] Minor grammatical fix in glossary.rst

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 90fb04c1e23c0fddd438bd0f73e7c018cacef4bc by Pablo Galindo (Sanyam 
Khurana) in branch 'master':
bpo-36822: Fix minor grammatical error in glossary.rst (GH-13145)
https://github.com/python/cpython/commit/90fb04c1e23c0fddd438bd0f73e7c018cacef4bc


--
nosy: +pablogsal

___
Python tracker 

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



[issue34975] start_tls() difficult when using asyncio.start_server()

2019-05-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

I believe stream transport should be replaced.
If you have time please do this change.

Also please take a look at #36889 for merging StreamWriter and StreamReader.
It can simplify the replacement strategy.

Anyway, please keep your PR open at least.
The plan is: either merge your PR before writer/reader merging or land unified 
streams first and adopt the PR to new API.

Another thing that should be done before 3.8 feature freeze is support for 
sendfile in streams API. Hopefully, it is much simpler: no need for transport 
changing etc.

--

___
Python tracker 

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



[issue35925] test_httplib test_nntplib test_ssl fail on ARMv7 Debian buster bot (OpenSSL 1.1.1a)

2019-05-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
pull_requests: +13163
stage: backport needed -> patch review

___
Python tracker 

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



[issue36890] python-3.7.3-macosx10.6.pkg verification error

2019-05-11 Thread Ned Deily


Change by Ned Deily :


--
assignee:  -> ned.deily

___
Python tracker 

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



[issue36890] python-3.7.3-macosx10.6.pkg verification error

2019-05-11 Thread S. J. Cunningham

New submission from S. J. Cunningham :

I can't Install the latest python-3.7.3-macosx10.6.pkg on my 10.6.8 system.  
Error message says failure to verify.  I posted on the forms as suggested 
(https://python-forum.io/Thread-Cannot-Install-python-3-7-3-macosx10-6-pkg) but 
have received no response.  Would appreciate any help.


I cannot instal the latest version of Python (python-3.7.3-macosx10.6.pkg) on 
Mac OS 10.6.8.  The installer throws the following error:

The operation couldn’t be completed. (com.apple.installer.pagecontroller error 
-1.)

Couldn't open "python-3.7.3-macosx10.6.pkg".

And leaves the following messages in the console log.


5/9/19 4:00:25 PM   Installer   @(#)PROGRAM:Install  
PROJECT:Install-596.1
5/9/19 4:00:25 PM   Installer   @(#)PROGRAM:Installer  
PROJECT:Installer-430.1
5/9/19 4:00:25 PM   Installer   Hardware: MacBookPro3,1 @ 2.20 GHz (x 
2), 4096 MB RAM
5/9/19 4:00:25 PM   Installer   Running OS Build: Mac OS X 10.6.8 
(10K549)
5/9/19 4:00:25 PM   Installer   Failed to verify data against 
certificate.
5/9/19 4:00:25 PM   Installer   Invalid Distribution File/Package

--
components: macOS
messages: 342214
nosy: ned.deily, ronaldoussoren, steve_314
priority: normal
severity: normal
status: open
title: python-3.7.3-macosx10.6.pkg verification error
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



[issue36878] ast.parse with type_comments=True should allow extra text after # type: ignore

2019-05-11 Thread Ivan Levkivskyi


Ivan Levkivskyi  added the comment:


New changeset d8320ecb86da8df7c13d8bf8582507f736aa2924 by Ivan Levkivskyi 
(Michael J. Sullivan) in branch 'master':
bpo-36878: Allow extra text after `# type: ignore` comments (GH-13238)
https://github.com/python/cpython/commit/d8320ecb86da8df7c13d8bf8582507f736aa2924


--

___
Python tracker 

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



[issue36870] test_asyncio: test_drain_raises() fails randomly on Windows

2019-05-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
components: +asyncio
nosy: +asvetlov, yselivanov

___
Python tracker 

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



[issue36889] Merge StreamWriter and StreamReader into just asyncio.Stream

2019-05-11 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue36889] Merge StreamWriter and StreamReader into just asyncio.Stream

2019-05-11 Thread Andrew Svetlov


New submission from Andrew Svetlov :

The separation was a bad idea, sorry. Both classes are coupled too much.
1. Writer should know about the reader to make `drain()` work
2. Reader has no .close() method.

The idea is: 
1. Merge StreamReader and StreamWriter into just a Stream.
2. The Stream should support three modes: readonly, writeonly, readwrite.
3. Keep StreamReader/StreamWriter but deprecate these classes.
4. Replace all asyncio internals to use Stream class.

--
components: asyncio
messages: 342212
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Merge StreamWriter and StreamReader into just asyncio.Stream
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



[issue36780] Interpreter exit blocks waiting for futures of shut-down ThreadPoolExecutors

2019-05-11 Thread Hrvoje Nikšić

Change by Hrvoje Nikšić :


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

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Opened PR13249 to fix the leak

--
stage: patch review -> resolved

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue35947] Update libffi_msvc to current version of libffi

2019-05-11 Thread STINNER Victor


STINNER Victor  added the comment:

I am talking about the commit whixh removed the directory. I am happy that
someone succeeded to write it ;-)

--

___
Python tracker 

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



[issue36856] faulthandler._stack_overflow doesn't work on x86-linux with KPTI enabled

2019-05-11 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6236c9823ef3e8e2229b0598d3d8189adf5e00f2 by Victor Stinner (Xi 
Ruoyao) in branch 'master':
bpo-36856: Handle possible overflow in faulthandler_stack_overflow (GH-13205)
https://github.com/python/cpython/commit/6236c9823ef3e8e2229b0598d3d8189adf5e00f2


--

___
Python tracker 

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



[issue36888] Create a way to check that the parent process is alive for deamonized processes

2019-05-11 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
nosy: +davin, pitrou

___
Python tracker 

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



[issue36817] Add = to f-strings for easier debugging.

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Commit 9a4135e939bc223f592045a38e0f927ba170da32 introduced a reference leak:

https://buildbot.python.org/all/#/builders/80/builds/587/steps/3/logs/stdio


Bisect results for test_future:

0:00:00 load avg: 10.04 [1/1] test_future
beginning 9 repetitions
123456789
.
test_future leaked [24, 24, 24, 24] references, sum=96
test_future leaked [24, 24, 24, 24] memory blocks, sum=96
test_future failed

== Tests result: FAILURE ==

1 test failed:
test_future

Total duration: 300 ms
Tests result: FAILURE
9a4135e939bc223f592045a38e0f927ba170da32 is the first bad commit
commit 9a4135e939bc223f592045a38e0f927ba170da32
Author: Eric V. Smith 
Date:   Wed May 8 16:28:48 2019 -0400

bpo-36817: Add f-string debugging using '='. (GH-13123)

If a "=" is specified a the end of an f-string expression, the f-string 
will evaluate to the text of the expression, followed by '=', followed by the 
repr of the value of the expression.

:04 04 303c86dc65bb09cade6b8f2a0fa3f97715f1793b 
7ddfc1c6c5f86bf6d0a38a64ff1415c7ca55a5fe M  Doc
:04 04 88a8dc9ffb46d652d086168e18e6a1265e0bfb92 
847032e70ebd74ad7e828f8013acc7bdc4570779 M  Include
:04 04 119e11a4f2fa3966ca300d06dd44c46dcbae11a8 
ed8c093aecd82a6b886d83218681df886f653206 M  Lib
:04 04 9c8d303bc3b468a06c39389520795bd34cfc7534 
36b368a8e4ddd3f470c99b68b00a4a3a30c8c2b1 M  Misc
:04 04 ac4c322bf5eb2685c31b375bb8a7d49a7b6a9ed9 
8e311dcfcafb1260eb5c617783318088a029b067 M  Parser
:04 04 e9db8405b51b7f72015f70556ce611c371450731 
9c3da4ade5f48b3a2e842d845cafa58ba21089a3 M  Python
bisect run success

--
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue36794] asyncio.Lock documentation in Py3.8 lacks parts presented in documentation in Py3.6

2019-05-11 Thread Stéphane Wirtel

Stéphane Wirtel  added the comment:

Hi Hrvoje Nikšić,

Thank you for the CLA, now, we need the opinion from Yury and their approval, I 
am not an expert of the asyncio.

Thank you,

--

___
Python tracker 

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



[issue34916] Add create_window_function() to sqlite3.Connection

2019-05-11 Thread Berker Peksag


Berker Peksag  added the comment:

Issue 35360 will cover updating our Windows and macOS installers. I'm 
retargeting this issue to add a create_window_function() method to the 
Connection object. I already have a WIP branch and am going to submit a PR 
later this weekend.

--
assignee:  -> berker.peksag
components: +Extension Modules
nosy: +berker.peksag
stage:  -> needs patch
title: include sqlite-3.25+ (with window functions) -> Add 
create_window_function() to sqlite3.Connection
type: behavior -> 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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Could you please add this in the documentation?

Yes, definitely!

--

___
Python tracker 

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



[issue36876] Global C variables are a problem.

2019-05-11 Thread Christian Heimes


Change by Christian Heimes :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-11 Thread Christian Heimes


Christian Heimes  added the comment:

Update: 3.6 and earlier raised SSLError for untrusted or expired certs. Only 
hostname mismatch was not wrapped into URLError.

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> I'd spell that as `1 + isqrt(n - 1)`.

Could you please add this in the documentation?

--

___
Python tracker 

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



[issue36868] New behavior of OpenSSL hostname verification not exposed, incorrectly documented

2019-05-11 Thread Christian Heimes


Christian Heimes  added the comment:

The entry in whatsnew is a documentation bug. Initially I wanted to expose 
host_flags and wrote the whatnew entry for it. Later we decided against the 
flag and an only implemented the hostname_checks_common_name switch 
(https://docs.python.org/3/library/ssl.html#ssl.SSLContext.hostname_checks_common_name).

1) SSLContext.host_flags in whatsnew is a bug. I'm updating the text.

2/3/4) The _host_flags attribute and the HOSTFLAG_* attributes are for internal 
use only to provide the hostname_checks_common_name flag.

5) Underscore is not a valid character for hostnames in A, , CNAME, and 
similar DNS record types. It's used in e.g. SRV record types, but an 
application will never directly connect to a SRV record address. It looks like 
OpenSSL interprets RFC 6125 (https://tools.ietf.org/html/rfc6125#section-6.4.3) 
strictly and requires valid DNS names.

I wonder, how did you get your DNS server to accept underscores? In theory you 
should run into a DNS exception earlier.

--
keywords:  -patch
stage: patch review -> 

___
Python tracker 

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



[issue36867] Make semaphore_tracker track other system resources

2019-05-11 Thread Pierre Glaser


Pierre Glaser  added the comment:

Shared memory segments are now tracked by the brand new resource_tracker!
Thanks Antoine for the review.

Does anyone have an opinion on introducing a public API for users to make the
resource_tracker track resources of their choice?

What We have in mind is:
- making public the existing resource_tracker.register/unregister
- adding a new function, resource_tracker.make_trackable(resource_type,
  cleanup_func), where:

* resource_type is a string (an identifier that will be used each time a
  resource of the type resource_type needs tracking, via the call
  resource_tracker.register(resource_name, resource_type)
* cleanup_func must be a callable taking a single string as argument (the
  name of the resource that needs tracking). This function will be called
  after the end of a process for reach resource of type resource_type the
  process did not clean properly

Under the hood, make_trackable simply populates resource_tracker._CLEANUP_FUNCS
with new items.

Here is a simple example:
import os
import resource_tracker
import shutil
from multiprocessing import util

class ClassCreatingAFolder:
"""Class where each instance creates a temporary folder.

Each temporary folder is supposed to exist for the duration of the 
instance
that created it.
"""
def __init__(self, folder_name):
self.folder_name = folder_name
os.mkdir(folder_name)

# any instance normally garbage-collected should remove its 
folder, and
# notice the resource_tracker that its folder was correctly 
removed.
util.Finalize(self, ClassCreatingAFolder.cleanup, 
args=(folder_name,))

# If this session quits abruptly, the finalizer will not be 
called for
# the instances of ClassCreatingAFolder that were still alive
# before the shutdown. The resource_tracker comes into play, 
and removes
# the folders associated to each of these resources.
resource_tracker.register(
folder_name, # argument to shutil.rmtree
"ClassCreatingAFolder")

@staticmethod
def cleanup(folder_name):
resource_tracker.unregister(folder_name, "ClassCreatingAFolder")
shutil.rmtree(folder_name)

# Tell the resource_tracker how to cleanup resources created by
# ClassCreatingAFolder instances
resource_tracker.make_trackable("ClassCreatingAFolder", shutil.rmtree)


Typical resources that can be made trackable include memmaped objects,
temporary folders. Our use-case is joblib that has its own mmap type that we
would like to track using the semaphore_tracker.

Any thoughts?

--

___
Python tracker 

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



[issue36868] New behavior of OpenSSL hostname verification not exposed, incorrectly documented

2019-05-11 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue36888] Create a way to check that the parent process is alive for deamonized processes

2019-05-11 Thread Thomas Moreau


Change by Thomas Moreau :


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

___
Python tracker 

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



[issue36888] Create a way to check that the parent process is alive for deamonized processes

2019-05-11 Thread Thomas Moreau


New submission from Thomas Moreau :

In the std lib, the semaphore_tracker and the Manager rely on daemonized 
processes that are launched with server like loops. The cleaning of such 
processes is made complicated by the fact that there is no cannonical way to 
check that the parent process is alive.

I propose to add in context a parent_process function that would give access to 
a Process object representing the parent process. This way, we could benefit 
from sentinel to improve the clean up of this process that can be left dangling 
in case of hard stop from the main interpreter.

--
components: Library (Lib)
messages: 342199
nosy: tomMoral
priority: normal
severity: normal
status: open
title: Create a way to check that the parent process is alive for deamonized 
processes
type: enhancement
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue36866] Certificate verification errors in urllib.request become URLError

2019-05-11 Thread Christian Heimes


Christian Heimes  added the comment:

Starting with 3.7, all OpenSSL and certificate-related exceptions are derived 
from SSLError. SSLError is a subclass of OSError. For backwards compatibility, 
SSLCertVerificationError is both a subclass of SSLError and ValueError.

>>> ssl.CertificateError

>>> ssl.CertificateError.__mro__
(, , , , , , 
)

The new behavior is more consistent than the previous. Now all SSL handshake 
errors are wrapped in URLError. In 3.6 and earlier unsupported TLS version, 
cipher suite mismatch, and similar were wrapped in URLError. Certificate 
related issues like untrusted cert, expired cert, hostname verification failure 
was not wrapped in URLError. You had to check error.reason for SSL-related 
errors any way.

I like to argue that the ssl module in 3.7 handles exceptions more consistently 
and is an improvement. The URLError behavior change is an unfortunate but 
reasonable side effect.

Ned, what do you think?

--

___
Python tracker 

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



[issue36880] Returning None from a callback with restype py_object decrements None's refcount too much

2019-05-11 Thread Russell Keith-Magee


Change by Russell Keith-Magee :


--
nosy: +freakboy3742

___
Python tracker 

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



[issue36837] Make il8n tools available from `python -m`

2019-05-11 Thread Toshio Kuratomi


Toshio Kuratomi  added the comment:

Scratch what I said in 
https://bugs.python.org/issue36837?@ok_message=msg%20342005%20created%0Aissue%2036837%20message_count%2C%20messages%20edited%20ok&@template=item#msg342005

GNU msgfmt does extract the charset correctly.  (My previous test failed to 
write any output so it was using the .mo file I had written out with msgfmt.py. 
 I realized that this morning when I figured out why my C test program wasn't 
finding any message catalog.

For reference the three ways to extract strings with the three tools are:
* pygettext.py test.py
* pybabel extract -o messages.pot test.py
* xgettext test.py -o messages.pot test.py

and the three ways to generate catalogs via the three tools are:
* msgfmt3.7.py  es_MX/LC_MESSAGES/domain.po
* msgfmt es_MX/LC_MESSAGES/testc.po -o es_MX/LC_MESSAGES/testc.mo
* pybabel compile -D test -d . [--use-fuzzy]

--

___
Python tracker 

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



[issue36751] Changes in the inspect module for PEP 570

2019-05-11 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Opened PR 13245 to un-deprecate getfullargspec.

--

___
Python tracker 

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



[issue36751] Changes in the inspect module for PEP 570

2019-05-11 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
pull_requests: +13157

___
Python tracker 

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



[issue35495] argparse does not honor default argument for nargs=argparse.REMAINDER argument

2019-05-11 Thread paul j3


paul j3  added the comment:

Let me back off on that last suggestion.  The problems described here and in 
https://bugs.python.org/issue17050 only apply to a positional.

We could just add a note to the documentation to the effect.

This nargs is best used as an optional as illustrated, where the user 
can clearly identify which strings are the remainder.

--

___
Python tracker 

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



[issue36794] asyncio.Lock documentation in Py3.8 lacks parts presented in documentation in Py3.6

2019-05-11 Thread Hrvoje Nikšić

Hrvoje Nikšić  added the comment:

@matrixise I've signed the CLA in the meantime, and it's now confirmed by 
https://check-python-cla.herokuapp.com/

Thanks for the pointer.

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

> for the smallest int `a` satisfying `a * a >= n`

I'd spell that as `1 + isqrt(n - 1)`. I'd prefer to keep things simple and just 
add the one building block, rather than adding multiple variants.

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

Some more discussion of possible algorithms and variations here: 
https://github.com/mdickinson/snippets/blob/master/notebooks/Integer%20square%20roots.ipynb

(not sure why the LaTeX isn't all rendering properly at the bottom in the 
GitHub view; it's fine in my local notebook).

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What do you think about adding two integer square root functions -- for the 
largest int `a` satisfying `a * a <= n` and for the smallest int `a` satisfying 
`a * a >= n`? The latter case is also often encounter in practice. For example, 
this is the size of the smallest square table in which we can place n items, 
not more than one per cell. We could call these functions fllorsqtr() and 
ceilsqrt() (if there are no better standard names).

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I am wondering whether int(sqrt(float(n))) can be used as a good initial 
approximation.

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

> I am wondering whether int(sqrt(float(n))) can be used as a good initial 
> approximation.

It can, but I'd prefer to avoid floating-point arithmetic (we don't have any 
guarantees about the accuracy of sqrt, so you'd always need a check and a 
fallback for the case where sqrt isn't accurate enough), and there are other 
purely-integer-based ways to produce a fast initial approximation. I do have 
some plans to add optimizations, but wanted to get the basic algorithm in first.

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

FTR (not for Serhiy, but for others reading this), here's the previous 
discussion of the possibility of adding an imath module.

   https://mail.python.org/pipermail/python-ideas/2018-July/051917.html

While I'm happy for this to go in either math or a new imath module, I'm a bit 
sceptical that at this point we're going to get a useful imath module together 
in time for 3.8 (and I don't have bandwidth to do the imath work myself). How 
about we put it in math for now, and if we get around to imath before the 
3.8b1, I'm happy to have it move from math to imath?

--

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

+1, but I propose to add it to the new imath module and move also factorial() 
and gcd() to it. New binomial() or comb() function (issue35431) should be added 
in imath too.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


Change by Mark Dickinson :


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

___
Python tracker 

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



[issue36887] Add integer square root, math.isqrt

2019-05-11 Thread Mark Dickinson


New submission from Mark Dickinson :

The integer square root[1] is a common number-theoretic primitive, useful for 
example in primality testing. This is something I've had to code up myself 
multiple times, and is also something that's quite easy to get wrong, or 
implement in a way that's inefficient for large inputs.

I propose adding a math module function `math.isqrt` implementing the integer 
square root. Like `math.gcd`, it should accept any integer-like object `n` 
(i.e., `int`s and anything implementing `__index__`), and for nonnegative 
inputs, should return the largest int `a` satisfying `a * a <= n`.

Negative inputs should give a ValueError; non-integer inputs (including 
`float`s) should give a TypeError.

I'll create a PR shortly with a basic implementation; optimizations can happen 
later.


[1] https://en.wikipedia.org/wiki/Integer_square_root

--
assignee: mark.dickinson
components: Extension Modules
messages: 342187
nosy: mark.dickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: Add integer square root, math.isqrt
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



[issue36880] Returning None from a callback with restype py_object decrements None's refcount too much

2019-05-11 Thread Eryk Sun


Eryk Sun  added the comment:

This is due to an oversight in _CallPythonObject in 
Modules/_ctypes/callbacks.c. The setfunc protocol is to return None if there's 
no object to keep alive. This isn't applicable to py_object (i.e. O_set in 
Modules/_ctypes/cfield.c). So the problem is the unconditional decref of None 
in the following snippet from _CallPythonObject:

if (keep == NULL) /* Could not convert callback result. */
PyErr_WriteUnraisable(callable);
else if (keep == Py_None) /* Nothing to keep */
Py_DECREF(keep);
else if (setfunc != _ctypes_get_fielddesc("O")->setfunc) {
if (-1 == PyErr_WarnEx(PyExc_RuntimeWarning,
   "memory leak in callback function.",
   1))
PyErr_WriteUnraisable(callable);
}

I'd rewrite it as follows:

if (keep == NULL) { /* Could not convert callback result. */
PyErr_WriteUnraisable(callable);
} else if (setfunc != _ctypes_get_fielddesc("O")->setfunc) {
if (keep == Py_None) { /* Nothing to keep */
Py_DECREF(keep);
} else if (PyErr_WarnEx(PyExc_RuntimeWarning, "memory leak "
   "in callback function.", 1) == -1) {
PyErr_WriteUnraisable(callable);
}
}

--
keywords: +easy (C)
nosy: +eryksun

___
Python tracker 

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



[issue36827] Overriding __new__ method with itself changes behaviour of the class

2019-05-11 Thread Alexey Muranov


Alexey Muranov  added the comment:

I see that I am not the only one who got bitten by this unexpected behaviour 
(though the others might have not realised it).  There is a question ["Creating 
a singleton in Python"][1] on StackOverflow which was posted in 2011 and by now 
has the total of 737 upvotes.  Here is a code snippet from the question:

class Singleton(object):
_instance = None
def __new__(class_, *args, **kwargs):
if not isinstance(class_._instance, class_):
class_._instance = object.__new__(class_, *args, **kwargs)
return class_._instance

class MyClass(Singleton, BaseClass):
pass

[1]: https://stackoverflow.com/q/6760685

Currently this does not work as expected, try:

class Failed(Singleton):
def __init__(self, _):
pass

Failed(42)  # TypeError: object.__new__() takes exactly one argument ...

There is a similar code snippet in the accepted [answer][2] with 507 upvotes:

class Singleton(object):
_instances = {}
def __new__(class_, *args, **kwargs):
if class_ not in class_._instances:
class_._instances[class_] = super(Singleton, class_).__new__(
class_, *args, **kwargs
)
return class_._instances[class_]

class MyClass(Singleton):
pass

[2]: https://stackoverflow.com/a/6798042

This does not work either, for the same reason.

--

___
Python tracker 

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



[issue36512] future_factory argument for Thread/ProcessPoolExecutor

2019-05-11 Thread Stefan Hölzl

Stefan Hölzl  added the comment:

Here is a complete example.
Please consider this is a very simple example just to demonstrate what would be 
possible with my proposed changes.

In the following example you can see two things:
 * saving informations about the context in which a workload was submitted to 
the Executor in the Future
 * having a custom methods on the Future returned by the Executor

from concurrent.futures import Future, ThreadPoolExecutor


def workload(n):
# does some heavy calculations
return n


class Context:
def __init__(self, name):
self.name = name


class CustomFactory(Future):
def __init__(self):
super().__init__()
self.context = None

def is_from_context(self, ctx):
return self.context.name == ctx

def processed_result(self):
# processes the result
return self.result()


class ContextExecutor(ThreadPoolExecutor):
def __init__(self):
super().__init__(future_factory=CustomFactory)

def submit(self, workload, arg, context):
future = super().submit(workload, arg)
future.context = context
return future


context_executor = ContextExecutor()
futures = [
context_executor.submit(workload, 0, context=Context("A")),
context_executor.submit(workload, 1, context=Context("B")),
context_executor.submit(workload, 2, context=Context("A")),
]

futures_from_context_a = [f for f in futures if f.is_from_context("A")]
if all(f.done() for f in futures_from_context_a):
print("All Futures in context A are done")
processed_results = [f.processed_result() for f in futures_from_context_a]
print("Results:", processed_results)

--

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread SilentGhost


SilentGhost  added the comment:

This is a consequence of PEP 570 that implements positional-only arguments (see 
issue 36540). Those projects would have to update their code. Good that there 
are already open bugs for both projects.

--
components: +Interpreter Core -Windows
nosy: +SilentGhost, pablogsal
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type:  -> behavior

___
Python tracker 

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



[issue36886] problem with Types on Python-3.8.0a4

2019-05-11 Thread Big Stone


New submission from Big Stone :

remark: I get a similar error from two packages, when experimenting with 
Python-3.8.0a4 on Windows


import asyncio
await asyncio.sleep(0)
---
TypeError Traceback (most recent call last)
C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\IPython\core\interactiveshell.py
 in removed_co_newlocals(function)
139 CO_NEWLOCALS = 0x0002
140 code = function.__code__
--> 141 new_code = CodeType(
142 code.co_argcount,
143 code.co_kwonlyargcount,

TypeError: an integer is required (got type bytes)


or else:


import cloudpickle



import cloudpickle
1 0 1 3 19 b'\x87\x00f\x01d\x01d\x02\x84\x08\x01\x00|\x00\x89\x00d\x00S\x00' 
(None,  at 0x01B36B7D49B0, file 
"C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\cloudpickle\cloudpickle.py",
 line 107>, '_make_cell_set_template_code..inner..') () 
('value',) 
C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\cloudpickle\cloudpickle.py
 inner 106 b'\x00\x01\x0c\x01' ('cell',)
---
TypeError Traceback (most recent call last)
 in 
> 1 import cloudpickle

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\cloudpickle\__init__.py
 in 
  1 from __future__ import absolute_import
  2 
> 3 from cloudpickle.cloudpickle import *
  4 
  5 __version__ = '1.0.0'

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\cloudpickle\cloudpickle.py
 in 
165 
166 
--> 167 _cell_set_template_code = _make_cell_set_template_code()
168 
169 

C:\WinP\bd38\bu\WPy64-3800a4\python-3.8.0a4.amd64\lib\site-packages\cloudpickle\cloudpickle.py
 in _make_cell_set_template_code()
146 co.co_lnotab,
147 co.co_cellvars)
--> 148 return types.CodeType(
149 co.co_argcount,
150 co.co_kwonlyargcount,

TypeError: an integer is required (got type bytes)

--
components: Windows
messages: 342182
nosy: Big Stone, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: problem with Types on Python-3.8.0a4
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



[issue36879] bug with round() and "numpy floats"

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

BTW, there are various issues already open in the NumPy bug tracker, for 
example https://github.com/numpy/numpy/issues/11557

I propose closing this as "third party".

--

___
Python tracker 

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



[issue36879] bug with round() and "numpy floats"

2019-05-11 Thread Mark Dickinson


Mark Dickinson  added the comment:

> Maybe we should add something in the docs regarding the no-restriction point.

IMO, the docs are clear enough (and also long enough) already here. Just as 
with most other magic methods, classes from third-party packages can return 
whatever they like. It doesn't seem worth adding specific disclaimers about 
this everywhere that a magic method might be used. Otherwise, we should also 
add corresponding disclaimers about `__floor__`, `__ceil__`, `__trunc__`, 
`__pow__`, and so on, and I think that would just introduce an increase in 
documentation size without any overall increase in clarity or usefulness.

I'd prefer to stick to documenting that there _is_ a restriction where that's 
true (e.g., `__index__` or `__hash__`).

--

___
Python tracker 

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



[issue26317] Build Problem with GCC + Macintosh OS X 10.11 El Capitain

2019-05-11 Thread Jeffrey Kintscher


Jeffrey Kintscher  added the comment:

I got it to build PythonLauncher using clang and everything else using gcc 
8.3.0 by making a few configure script and makefile changes. Unfortunately, 
"make install" still fails because a python script that requires the unbuilt 
_scproxy module crashes. I'll work on fixing that next.

--

___
Python tracker 

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



[issue36879] bug with round() and "numpy floats"

2019-05-11 Thread Mark Dickinson


Change by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue36759] datetime: astimezone() results in OSError: [Errno 22] Invalid argument

2019-05-11 Thread SilentGhost


Change by SilentGhost :


--
status: open -> pending

___
Python tracker 

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



[issue36512] future_factory argument for Thread/ProcessPoolExecutor

2019-05-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Sorry, but in the provided snippet I see a class with an interface which looks 
close to executor.

There is no clear relationship with standard executors (e.g. is it inherited 
from ThreadExecutor?). Proposed `future_factory` is also absent.

Please, provide a real example if you want to convince us that the requested 
feature is important and desired.

--

___
Python tracker 

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



[issue36884] DeprecationWarning in test_asyncio.test_pep492.StreamReaderTests.test_readline

2019-05-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Nice catch!

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

___
Python tracker 

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



[issue36884] DeprecationWarning in test_asyncio.test_pep492.StreamReaderTests.test_readline

2019-05-11 Thread miss-islington


miss-islington  added the comment:


New changeset 79972f1fad5247ade34ef98ad987162a9a78401d by Miss Islington (bot) 
(Xtreak) in branch 'master':
bpo-36884: Fix DeprecationWarning in test_asyncio StreamReader instantiation 
(GH-13243)
https://github.com/python/cpython/commit/79972f1fad5247ade34ef98ad987162a9a78401d


--
nosy: +miss-islington

___
Python tracker 

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



[issue36884] DeprecationWarning in test_asyncio.test_pep492.StreamReaderTests.test_readline

2019-05-11 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Looking at the commit where similar tests were fixed I think passing 
_asyncio_internal=True fixes the issue so I have created a PR with the same.

--
stage: patch review -> 

___
Python tracker 

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



[issue36884] DeprecationWarning in test_asyncio.test_pep492.StreamReaderTests.test_readline

2019-05-11 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


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

___
Python tracker 

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



[issue36880] Returning None from a callback with restype py_object decrements None's refcount too much

2019-05-11 Thread anthony shaw


anthony shaw  added the comment:

In the stack it's calling none_dealloc() which should never happen.

Assume this is being triggered by ctypes PyCFuncPtr_call.

The stacktrace I'm getting comes after the double decref so it's not showing 
the root cause. Someone who knows ctypes better might be able to help

--

___
Python tracker 

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



[issue36885] Make makeunicode.py script more readable

2019-05-11 Thread Stefan Behnel


Change by Stefan Behnel :


--
title: Clean up makeunicode.py script -> Make makeunicode.py script more 
readable

___
Python tracker 

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



  1   2   >