[issue39545] await is not supported in f-string in 3.6

2020-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, await was recognized only in asynchronous functions. f-strings involve a 
separate parsing step for subexpressions, and it is not aware that it is in an 
asynchronous function. Seems the fix was unintentional, but it should 
documented in any case.

--

___
Python tracker 

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



[issue39540] Logging docs don't address the creation of multiple loggers when a hierarchy is provided

2020-02-03 Thread Vinay Sajip


Vinay Sajip  added the comment:

That's an internal detail. In fact loggers aren't created for all loggers in 
the hierarchy - PlaceHolder objects are created internally for hierarchy 
ancestors, and converted to loggers if needed. The printout from your linked 
Stack Overflow question shows this.

This is not documented because it's internal implementation detail. How the 
dotted-name hierarchy works is documented.

--

___
Python tracker 

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



[issue14074] argparse allows nargs>1 for positional arguments but doesn't allow metavar to be a tuple

2020-02-03 Thread Cyker Way


Cyker Way  added the comment:

Tuple support is documented:

https://github.com/python/cpython/commit/98047eb806227f11212f6a42c242030a51964e30#diff-9c4a053d29149ba40370fb3e34faR1059

https://docs.python.org/3/library/argparse.html#metavar

>   Providing a tuple to ``metavar`` specifies a different display for each of 
> the arguments:

>From his word here I feel like our professor meant to support tuple metavar 
>but the implementation was not careful. He called for a patch eight years ago. 
>Let's summon him and see if he has changed his mind?

--

___
Python tracker 

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



[issue39549] The reprlib.Repr type should permit the “fillvalue” to be set by the user

2020-02-03 Thread Alexander Böhn

Change by Alexander Böhn :


--
keywords: +patch
pull_requests: +17716
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18343

___
Python tracker 

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread mpheath


Change by mpheath :


--
pull_requests: +17714
pull_request: https://github.com/python/cpython/pull/18342

___
Python tracker 

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread mpheath


mpheath  added the comment:

I have submitted 2 Pull Requests. One for 3.9 and the other for 3.8. Only way I 
knew was to create 2 separate branches to checkout, linked to version tags to 
get the correct patches for ast.py. Hope is OK.

--

___
Python tracker 

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



[issue39549] The reprlib.Repr type should permit the “fillvalue” to be set by the user

2020-02-03 Thread Alexander Böhn

New submission from Alexander Böhn :

Currently, the `reprlib.recursive_repr(…)` decorator allows a “fillvalue” 
parameter to be specified by the user. This is a string value that is used as a 
placeholder when calculating an objects’ repr – in the case of 
`recursive_repr(…)` the “fillvalue” defaults to '...' and may be set by the 
user to a string of any length.

There is no such user-defined “fillvalue” on the `reprlib.Repr` type, although 
the '...' string is hardcoded in its implementation and used throughout.

I propose that the hardcoded use of the '...' string in the code for the 
`reprlib.Repr` implementation should be replaced by a “fillvalue” attribute, 
set on the class in its `__init__(…)` method – and therefore overridable in 
subclasses, like the existing myriad “max*” instance attributes. 

PR to follow in short order.

--
components: Library (Lib)
messages: 361334
nosy: fish2000
priority: normal
severity: normal
status: open
title: The reprlib.Repr type should permit the “fillvalue” to be set by the user
type: behavior
versions: Python 2.7, 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



[issue39539] Improve Keccak support in hashlib including KangarooTwelve

2020-02-03 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

Christian added the SHA3 support so is probably best to comment on this. The 
way our hashlib code is structured we always use the 
https://github.com/python/cpython/tree/master/Modules/_sha3 implementation 
rather than OpenSSL for these algorithms due to the better functionality of 
that Keccak code.  So at first glance it should be reasonably straightforward 
to update it to accept an optional suffix constructor argument.

PR welcome.

--
stage:  -> needs patch

___
Python tracker 

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread mpheath


Change by mpheath :


--
pull_requests: +17713
pull_request: https://github.com/python/cpython/pull/18341

___
Python tracker 

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



[issue39514] http://sphinx.pocoo.org/

2020-02-03 Thread Berker Peksag


Berker Peksag  added the comment:

My PR has been merged and I've verified that the link is now point to 
https://www.sphinx-doc.org/. Closing this as 'fixed'.

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



[issue39539] Improve Keccak support in hashlib including KangarooTwelve

2020-02-03 Thread Mariatta


Mariatta  added the comment:

Added hashlib module experts.

--
nosy: +Mariatta, christian.heimes, gregory.p.smith

___
Python tracker 

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread mpheath


Change by mpheath :


--
keywords: +patch
pull_requests: +17712
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/18340

___
Python tracker 

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



[issue39548] Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop'

2020-02-03 Thread Stephen Balousek


Change by Stephen Balousek :


--
keywords: +patch
pull_requests: +17711
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18338

___
Python tracker 

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



[issue39548] Request fails when 'WWW-Authenticate' header for Digest Authentication does not contain 'qop'

2020-02-03 Thread Stephen Balousek


New submission from Stephen Balousek :

When making an HTTP request using an opener with an attached 
HTTPDigestAuthHandler, the request causes a crash when the returned 
'WWW-Authenticate' header for the 'Digest' domain does not return the optional 
'qop' value.

Response headers:
=
Content-Type: application/json
Content-Security-Policy: default-src 'self' 'unsafe-eval' 
'unsafe-inline';img-src 'self' data:
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Length: 600
WWW-Authenticate: Digest realm="ServiceManager", nonce="1580815098100956"
WWW-Authenticate: Basic realm="ServiceManager", charset="UTF-8"
Cache-Control: max-age=0, no-cache, no-store, must-revalidate
Expires: 0
Pragma: no-cache

Crash:
==
Error:   Exception: 'NoneType' object has no attribute 'split'
Traceback (most recent call last):
...
  File "/home/sbalousek/bin/restap.py", line 1317, in RunTest
status, payload, contentType = ExecuteRequest(baseUrl, test, tap);
  File "/home/sbalousek/bin/restap.py", line 1398, in ExecuteRequest
response= opener.open(request, payload, timeout);
  File "/usr/lib/python3.8/urllib/request.py", line 523, in open
response = meth(req, response)
  File "/home/sbalousek/bin/restap.py", line 1065, in http_response
return self.process_response(request, response, 
HTTPErrorProcessor.http_response);
  File "/home/sbalousek/bin/restap.py", line 1056, in process_response
return handler(self, request, response);
  File "/usr/lib/python3.8/urllib/request.py", line 632, in http_response
response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 555, in error
result = self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 494, in _call_chain
result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 1203, in http_error_401
retry = self.http_error_auth_reqed('www-authenticate',
  File "/usr/lib/python3.8/urllib/request.py", line 1082, in 
http_error_auth_reqed
return self.retry_http_digest_auth(req, authreq)
  File "/usr/lib/python3.8/urllib/request.py", line 1090, in 
retry_http_digest_auth
auth = self.get_authorization(req, chal)
  File "/usr/lib/python3.8/urllib/request.py", line 1143, in get_authorization
if 'auth' in qop.split(','):
AttributeError: 'NoneType' object has no attribute 'split'

Diagnosis:
==
The crash is a result of an optional 'qop' value missing from the 
'WWW-Authenticate' header.

This bug was introduced in changes for issue 38686.

--
components: Library (Lib)
messages: 361330
nosy: Stephen Balousek
priority: normal
severity: normal
status: open
title: Request fails when 'WWW-Authenticate' header for Digest Authentication 
does not contain 'qop'
type: crash
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



[issue39547] hmac.new() default parameter change not mentioned in changelog

2020-02-03 Thread Will Bond


New submission from Will Bond :

When running code on Python 3.8 that previous was running 3.3, I ran into the 
issue that the default value for the digestmod parameter of hmac.new() has been 
changed to backwards-incompatible value.

I generally would have expected such a break to show up in 
https://docs.python.org/3/whatsnew/3.8.html#api-and-feature-removals. If not 
there, somewhere on the 3.8 changelog page.

--
assignee: docs@python
components: Documentation
messages: 361329
nosy: docs@python, wbond
priority: normal
severity: normal
status: open
title: hmac.new() default parameter change not mentioned in changelog
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



[issue39280] Don't allow datetime parsing to accept non-Ascii digits

2020-02-03 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



[issue8912] `make patchcheck` should check the whitespace of .c/.h files

2020-02-03 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



[issue19683] test_minidom has many empty tests

2020-02-03 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



[issue39108] random needs doc for "gauss" versus "normalvariate"

2020-02-03 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



[issue8627] Unchecked PyErr_WarnPy3k return value in Objects/typeobject.c

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

Let's close. This was only ever an issue in Python 2.

--
resolution:  -> out of date
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



[issue39088] test_concurrent_futures crashed with python.core core dump on AMD64 FreeBSD Shared 3.x

2020-02-03 Thread Kyle Stanley


Kyle Stanley  added the comment:

In GH-18228, an unrelated failure in test_concurrent_futures occurred (same as 
the one above):


Ran 354 tests in 496.802s
OK (skipped=35)
Warning -- files was modified by test_multiprocessing_spawn
  Before: []
  After:  ['python.core']


Full test logs: 
https://buildbot.python.org/all/#/builders/152/builds/259/steps/5/logs/stdio

--
nosy: +aeros

___
Python tracker 

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



[issue26967] argparse: allow_abbrev=False stops -vv from working

2020-02-03 Thread Kyle Meyer


Change by Kyle Meyer :


--
pull_requests: +17710
pull_request: https://github.com/python/cpython/pull/18337

___
Python tracker 

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



[issue39546] argparse: allow_abbrev=False is ignored for alternative prefix characters

2020-02-03 Thread Kyle Meyer


Change by Kyle Meyer :


--
keywords: +patch
pull_requests: +17709
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18337

___
Python tracker 

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



[issue39546] argparse: allow_abbrev=False is ignored for alternative prefix characters

2020-02-03 Thread Kyle Meyer


New submission from Kyle Meyer :

As of Python v3.8.0 (specifically commit b1e4d1b603), specifying
`allow_abbrev=False` does not disable abbreviation for prefix
characters other than '-'.

--8<---cut here---start->8---
import argparse

parser = argparse.ArgumentParser(prefix_chars='+', allow_abbrev=False)
parser.add_argument('++long')
print(parser.parse_args(['++lo=val']))
--8<---cut here---end--->8---

Observed output (with b1e4d1b603 and current master):

Namespace(long='val')

Expected (and observed with b1e4d1b603^ and 3.7.3):

usage: scratch.py [+h] [++long LONG]
scratch.py: error: unrecognized arguments: ++lo=val


I will follow up with a PR to propose a fix.

--
components: Library (Lib)
messages: 361326
nosy: kyleam
priority: normal
severity: normal
status: open
title: argparse: allow_abbrev=False is ignored for alternative prefix characters
type: behavior
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



[issue10572] Move test sub-packages to Lib/test

2020-02-03 Thread Brett Cannon


Brett Cannon  added the comment:

Someone probably needs to go through the stdlib to find which modules have 
tests outside of Lib/test/, and then figure out if there is still any 
justification for that. If there isn't then they should be moved to Lib/test.

--

___
Python tracker 

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



[issue39527] Update doc of argparse.rst

2020-02-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue39480] referendum reference is needlessly annoying

2020-02-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue38628] Issue with ctypes in AIX

2020-02-03 Thread David Edelsohn


David Edelsohn  added the comment:

How was Python compiled?  With GCC? Which version of GCC?
I assume that Python was built as a 64 bit application based on libc loading 
the 64 bit member shr_64.o.

Does the testcase work in 32 bit mode?
Does the testcase work if Python is compiled by XLC?

This likely is an incompatibility in libffi with libffi loading the registers 
incorrectly for the call into libc.a(shr_64.o).

It seems rather fragile to pass a struct that is supposed to have the same 
parameter layout as the function signature.

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-02-03 Thread David Edelsohn


David Edelsohn  added the comment:

I think that Victor means AIX kernel and filesystems are not prepared for Y2038.

--
nosy: +David.Edelsohn

___
Python tracker 

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



[issue39545] await is not supported in f-string in 3.6

2020-02-03 Thread Mariatta


Mariatta  added the comment:

The answer I got from Yury before was: "Before 3.7 async and await were not 
proper keywords, so the interpreter did not recognize them in some contexts."

--
nosy: +Mariatta

___
Python tracker 

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



[issue39480] referendum reference is needlessly annoying

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

Speaking as a British, UK-based Python contributor who's unhappy with recent 
political developments in the UK, I say let's close this.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue39544] Pathlib PureWindowsPath sorting incorrect (is not natural sort)

2020-02-03 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Library (Lib), Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue39544] Pathlib PureWindowsPath sorting incorrect (is not natural sort)

2020-02-03 Thread Eryk Sun


Eryk Sun  added the comment:

> Right now PureWindowsPath does probably something like NTFS sorting, 
> but NTFS is not Windows and from a function called 'WindowsPath' I 
> expect a path that would be given in Windows Explorer.

NTFS stores the names in a directory as a btree that's sorted 
case-insensitively according to the filesystem's casing table. Other 
filesystems such as FAT32 store names in arbitrary order, maybe FIFO order with 
reuse of slot indexes when files are deleted, or maybe based on hashing the 
filename.

The Windows file API does not sort the results of a directory listing. It's up 
to applications to decide how a listing will be presented. You cite what 
Explorer does as a standard for "Windows", but there is no such standard that I 
know of. Maybe implementing a natural sort for Path instances is desirable, but 
I disagree that appealing to what Explorer does should be the sole basis for 
this decision. Anyway, it would be a breaking change, which certainly cannot be 
implemented in 3.8.

Currently sorting is based on the case-folded parts:

 def casefold_parts(self, parts):
return [p.lower() for p in parts]

--
nosy: +eryksun
versions: +Python 3.9 -Python 3.8

___
Python tracker 

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



[issue30825] csv.Sniffer does not detect lineterminator

2020-02-03 Thread Max Vorobev


Change by Max Vorobev :


--
keywords: +patch
pull_requests: +17708
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/18336

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Change by Vincent Michel :


Added file: https://bugs.python.org/file48883/comparing_conversions.py

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Vincent Michel  added the comment:

@mark.dickinson
> To be clear: the following is flawed as an accuracy test, because the 
> *multiplication* by 1e9 introduces additional error.

Interesting, I completely missed that! 

But did you notice that the full conversion might still perform better when 
using only floats?

```
>>> from fractions import Fraction as F 
>>>   
>>> r = 1580301619906185300 
>>>  
>>> abs(int(r / 1e9 * 1e9) - r) 
>>>  
84
>>> abs(round(F(r / 10**9) * 10**9) - r)
>>>
89
```

I wanted to figure out how often that happens so I updated my plotting, you can 
find the code and plot attached.

Notice how both methods seems to perform equally good (the difference of the 
absolute errors seems to average to zero). I have no idea about why that 
happens though.

--
Added file: 
https://bugs.python.org/file48882/Comparing_conversions_over_5_us.png

___
Python tracker 

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



[issue39400] pydoc: Use of MANPAGER variable is incorrect

2020-02-03 Thread Ronan Pigott


Ronan Pigott  added the comment:

Any reason a change like this could not be added to a 3.8.x release?

Like I pointed out in the PR, pydoc's use of MANPAGER is undocumented and, as 
far as I'm concerned, incorrect.

A lot of software references idiosyncratic _PAGER vars, but pydoc 
reuses MANPAGER instead of something like PYDOC_PAGER. I don't think it's such 
a bad idea to reuse MANPAGER considering the two programs serve a similar 
function, but I think matching man's interpretation of MANPAGER is then the 
only reasonable behavior pydoc can take. If it does not, pydoc is by-default 
broken on plenty of otherwise fine setups.

As it stands, pydoc is broken _because_ of undocumented behavior. A user 
reading the docs carefully still might not recognize that pydoc is preferring 
their MANPAGER value over PAGER. For that reason, I'd call this a bugfix. The 
bug here could be considered that pydoc references MANPAGER _at all_. However, 
given what I think is the intent of the original code - to allow pydoc to 
benefit from a user's MANPAGER customization - I've tried to update pydoc to 
reflect that intent in the PR, rather than remove the feature.

I think this change could be eligible for 3.8.x. Thoughts?

--

___
Python tracker 

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



[issue39480] referendum reference is needlessly annoying

2020-02-03 Thread Aurora


Change by Aurora :


--
type:  -> enhancement

___
Python tracker 

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



[issue39545] await is not supported in f-string in 3.6

2020-02-03 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The following code is compiled in 3.7, but is a syntax error in 3.6.

async def f(x):
f"{await x}"

I have not found mentioning this change in What's New, and it looks 
grammatically correct. It looks as a bug in 3.6.

It may be too later to fix it in 3.6, but at least it should be documented.

--
assignee: docs@python
components: Documentation, Interpreter Core
messages: 361317
nosy: docs@python, eric.smith, serhiy.storchaka
priority: normal
severity: normal
status: open
title: await is not supported in f-string in 3.6
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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

To be clear: the following is flawed as an accuracy test, because the 
*multiplication* by 1e9 introduces additional error.

# int/int: int.__truediv__(int)
>>> abs(t - int(t/10**9 * 1e9))
172

Try this instead, which uses the Fractions module to get the exact error. (The 
error is converted to a float before printing, for convenience, to show the 
approximate size of the errors.)

>>> from fractions import Fraction as F
>>> exact = F(t, 10**9)
>>> int_int = t / 10**9
>>> float_float = t / 1e9
>>> int_int_error = F(int_int) - exact
>>> float_float_error = F(float_float) - exact
>>> print(float(int_int_error))
8.85650634765625e-08
>>> print(float(float_float_error))
-1.49853515625e-07

--

___
Python tracker 

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



[issue39544] Pathlib PureWindowsPath sorting incorrect (is not natural sort)

2020-02-03 Thread tegavu

New submission from tegavu :

Wrong behavior in pathlib.PureWindowsPath - sorting does not use natural sort.

Everything below was written based on W7x64 & Python 3.8.1 
(tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on 
win32.

The documentation 
(https://docs.python.org/3/library/pathlib.html#general-properties) states: 
"Paths of a same flavour are comparable and orderable."

This can be done like this:

from pathlib import *
print( PureWindowsPath('C:\\1') < PureWindowsPath('C:\\a') )

This returns True. This is expected because 1 is sorted before a on Windows.

This sorting also works well for harder cases where other sorting functions 
fail: !1 should be before 1 and !a should be before a.

But it fails with natural sorting:

from pathlib import *
print( PureWindowsPath('C:\\15') < PureWindowsPath('C:\\100') )

This returns False.

This is a bug in my opinion, since PureWindowsPath should sort like 
Windows(Explorer) would sort. 

Right now PureWindowsPath does probably something like NTFS sorting, but NTFS 
is not Windows and from a function called 'WindowsPath' I expect a path that 
would be given in Windows Explorer.

In case a simple `dir` on Windows sorts by NTFS names (I am not sure!), 
PureWindowsPath also fails, since (for example) "[" < "a" should be False.

See this image for comparison:
https://i.imgur.com/GjBhWsS.png

Here is a string that can be used directly as a list to check sorting:

test_list = ['15', '100', '1', '!', '#', '$', '%', '&', "'", '(', ')', '+', 
'+1', '+a', ',', '-', ';', '=', '@', '[', ']', '^', '_', '`', 'a', 
'foo0', 'foo_0', '{', '}', '~', '§', '°', '´', 'µ', '€']

--
messages: 361315
nosy: tegavu
priority: normal
severity: normal
status: open
title: Pathlib PureWindowsPath sorting incorrect (is not natural sort)
type: behavior
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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

> int/int is less accurate than float/float for t=1580301619906185300

No, int/int is more accurate here. If a and b are ints, a / b is always 
correctly rounded on an IEEE 754 system, while float(a) / float(b) will not 
necessarily give a correctly rounded result. So for an integer a, `a / 10**9` 
will _always_ be at least as accurate as `a / 1e9`.

--

___
Python tracker 

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



[issue38558] Data Structures documentation out of sync with new Walrus operator

2020-02-03 Thread miss-islington


miss-islington  added the comment:


New changeset d01ae1b22330992eadc7b2a0842ead544f7e507d by Miss Islington (bot) 
in branch '3.8':
bpo-38558: Link to further docs from walrus operator mention in tutorial 
(GH-16973)
https://github.com/python/cpython/commit/d01ae1b22330992eadc7b2a0842ead544f7e507d


--

___
Python tracker 

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



[issue38558] Data Structures documentation out of sync with new Walrus operator

2020-02-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +17707
pull_request: https://github.com/python/cpython/pull/18335

___
Python tracker 

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



[issue38558] Data Structures documentation out of sync with new Walrus operator

2020-02-03 Thread Julien Palard


Julien Palard  added the comment:


New changeset 5807efd4c396d5718325e21f5a14e324a77ff77c by Adorilson Bezerra in 
branch 'master':
bpo-38558: Link to further docs from walrus operator mention in tutorial 
(GH-16973)
https://github.com/python/cpython/commit/5807efd4c396d5718325e21f5a14e324a77ff77c


--
nosy: +mdk

___
Python tracker 

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



[issue29988] with statements are not ensuring that __exit__ is called if __enter__ succeeds

2020-02-03 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
pull_requests: +17706
stage: test needed -> patch review
pull_request: https://github.com/python/cpython/pull/18334

___
Python tracker 

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



[issue39543] Py_DECREF(): use inlined _Py_Dealloc()

2020-02-03 Thread STINNER Victor


New submission from STINNER Victor :

In bpo-35059, I converted Py_DECREF() macro to a static inline function (commit 
2aaf0c12041bcaadd7f2cc5a54450eefd7a6ff12).

Then in bpo-35134, I moved _Py_Dealloc() macro to the newly created 
Include/cpython/object.h header file (commit 
6eb996685e25c09499858bee4be258776e603c6f).

The problem is that when Py_DECREF() was converted to a static inline function, 
it stopped to use the *redefine* _Py_Dealloc() fast macro, but instead use the 
slow regular function call:

PyAPI_FUNC(void) _Py_Dealloc(PyObject *);

Py_DECREF() performance is critical for overall Python performance.

I will work on a PR to fix this issue.


See also bpo-39542 which updates object.h and cpython/object.h.

--
components: C API
messages: 361310
nosy: vstinner
priority: normal
severity: normal
status: open
title: Py_DECREF(): use inlined _Py_Dealloc()
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



[issue39542] Cleanup object.h header

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 49932fec62c616ec88da52642339d83ae719e924 by Victor Stinner in 
branch 'master':
bpo-39542: Simplify _Py_NewReference() (GH-18332)
https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924


--

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Vincent Michel  added the comment:

@serhiy.storchaka
> 1580301619906185300/10**9 is more accurate than 1580301619906185300/1e9.

I don't know exactly what `F` represents in your example but here is what I get:

>>> r = 1580301619906185300 
>>>  
>>> int(r / 10**9 * 10**9) - r  
>>>  
172
>>> int(r / 1e9 * 10**9) - r
>>>  
-84

@vstinner
> I suggest to only document in time.time() is less accurate than 
> time.time_ns().

Sounds good!

--

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

I compare nanoseconds (int):

>>> t=1580301619906185300

# int/int: int.__truediv__(int)
>>> abs(t - int(t/10**9 * 1e9))
172

# int/float: float.__rtruediv__(int)
>>> abs(t - int(t/1e9 * 1e9))
84

# float/int: float.__truediv__(int)
>>> abs(t - int(float(t)/10**9 * 1e9))
84

# float/float: float.__truediv__(float)
>>> abs(t - int(float(t)/1e9 * 1e9))
84

=> int/int is less accurate than float/float for t=1580301619906185300


You compare seconds (float/Fraction):

>>> from fractions import Fraction as F
>>> t=1580301619906185300

# int / int
>>> float(F(t/10**9) * 10**9 - t)
88.5650634765625

# int / float
>>> float(F(t/1e9) * 10**9 - t)
-149.853515625

=> here int/int looks more accurate than int/float


And we get different conclusion :-)

--

___
Python tracker 

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



[issue39542] Cleanup object.h header

2020-02-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +17705
pull_request: https://github.com/python/cpython/pull/18332

___
Python tracker 

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



[issue39542] Cleanup object.h header

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 4b524161a0f9d50d782e739a3708434ffd4e94a5 by Victor Stinner in 
branch 'master':
bpo-39542: Move object.h debug functions to internal C API (GH-18331)
https://github.com/python/cpython/commit/4b524161a0f9d50d782e739a3708434ffd4e94a5


--

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

>>> 1580301619906185300/10**9
1580301619.9061854
>>> 1580301619906185300/1e9
1580301619.9061852
>>> float(F(1580301619906185300/10**9) * 10**9 - 1580301619906185300)
88.5650634765625
>>> float(F(1580301619906185300/1e9) * 10**9 - 1580301619906185300)
-149.853515625

1580301619906185300/10**9 is more accurate than 1580301619906185300/1e9.

--

___
Python tracker 

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



[issue39542] Cleanup object.h header

2020-02-03 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +17704
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18331

___
Python tracker 

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



[issue39540] Logging docs don't address the creation of multiple loggers when a hierarchy is provided

2020-02-03 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue39542] Cleanup object.h header

2020-02-03 Thread STINNER Victor


New submission from STINNER Victor :

In bpo-39489, I removed the COUNT_ALLOCS special build. The object.h header can 
now be cleaned up to simplify the code.

--
components: C API
messages: 361305
nosy: vstinner
priority: normal
severity: normal
status: open
title: Cleanup object.h header
versions: Python 3.9

___
Python tracker 

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



[issue35108] inspect.getmembers passes exceptions from object's properties through

2020-02-03 Thread Tom Augspurger


Change by Tom Augspurger :


--
keywords: +patch
pull_requests: +17703
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18330

___
Python tracker 

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



[issue30256] Adding a SyncManager Queue proxy to a SyncManager dict or Namespace proxy raises an exception

2020-02-03 Thread Philipp Rehs


Change by Philipp Rehs :


--
type:  -> behavior

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure which kind of problem you are trying to solve here. time.time() 
does lose precision because it uses the float type. Comparing time.time() and 
time.time_ns() tricky because of that. If you care of nanosecond precision, 
avoid float whenever possible and only store time as integer.

I'm not sure how to compat time.time() float with time.time_ns(). Maybe 
math.isclose() can help.

I don't think that Python is wrong here, time.time() and time.time_ns() work 
are expected, and I don't think that time.time() result can be magically more 
accurate: 1580301619906185300 nanoseconds (int) cannot be stored exactly as 
floating point number of seconds.

I suggest to only document in time.time() is less accurate than time.time_ns().

--

___
Python tracker 

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



[issue39502] test_zipfile fails on AIX due to time.localtime

2020-02-03 Thread Michael Felt


Michael Felt  added the comment:

Not sure I understand what bug I am supposed to report. I apologize if 
my message https://bugs.python.org/issue39502#msg361116.

I assume your comment re: time.localtime(91301504) comes from this bit 
of the test message (mtime_ns=913015040).

Assuming our TZ used are different I am verifying AIX works correctly 
for the constant 91301504

root@x065:[/data/prj/python/python3-3.9]./python
Python 3.9.0a3+ (heads/master-dirty:78c7183f47, Feb  3 2020, 14:10:40) [C] on 
aix
Type "help", "copyright", "credits" or "license" for more information.
>>> import time

>>> time.gmtime(91301504)
time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=17, tm_min=31, 
tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0)
>>> time.localtime(91301504)
time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=17, tm_min=31, 
tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0)

root@x065:[/data/prj/python/python3-3.9]set | grep TZ
TZ=UTC0

Again, my apologies for the confusion: the message
"skipped 'Linux VFS/XFS kernel bug detected: mtime_ns=913015040" only 
occurs when the test is run on a NFS
mount hosted by a SAN based on a Linux kernel.

When I specify --tempdir=/tmp (i.e., using jfs2 as filesystem) the test passes 
normally.

On 03/02/2020 09:40, STINNER Victor wrote:
> STINNER Victor  added the comment:
>
>> test_add_file_after_2107 (test.test_zipfile.StoredTestsWithSourceFile) ... 
>> skipped 'Linux VFS/XFS kernel bug detected: mtime_ns=913015040'
> AIX kernel seems to have a bug. You should report it to AIX.
>
 time.localtime(91301504)
> time.struct_time(tm_year=1972, tm_mon=11, tm_mday=22, tm_hour=18, tm_min=31, 
> tm_sec=44, tm_wday=2, tm_yday=327, tm_isdst=0)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue34972] json dump silently converts int keys to string

2020-02-03 Thread Facundo Batista


Facundo Batista  added the comment:

I understand (and agree with) the merits of automatically converting the int to 
str when dumping to a string.

However, this result really surprised me:

>>> json.dumps({1:2, "1":3})
'{"1": 2, "1": 3}'

Is it a valid JSON?

--
nosy: +facundobatista

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

But they are not single-digit integers. And more, int(float(a)) != a.

--

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Larry Hastings


Larry Hastings  added the comment:

> The problem is that there is a double rounding in
> time = float(time_ns) / 1e9
> 1. When convert time_ns to float.
> 2. When divide it by 1e9.

I'm pretty sure that in Python 3, if you say
   c = a / b
and a and b are both "single-digit" integers, it first converts them both into 
doubles and then performs the divide.  See long_true_divide() in 
Objects/longobject.c, starting (currently) at line 3938.

--

___
Python tracker 

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



[issue39541] distutils: Remove bdist_wininst (Windows .exe installers) in favor of bdist_wheel (.whl)

2020-02-03 Thread Paul Ganssle


Paul Ganssle  added the comment:

Per my reasoning in the discourse thread, I disagree with this move. I think 
that this should be handled in setuptools, which is where we tend to handle 
breaking changes or even enhancements to distutils.

If we do this in setuptools, we'll get a backport of the deprecation and 
removal back to 3.5, and it will make it easier to maintain setuptools.

The deprecation of bdist_wininst in Python 3.8 already made it harder to 
maintain setuptools with no real benefit to the CPython project, I would prefer 
to not repeat this mistake.

--
nosy: +p-ganssle

___
Python tracker 

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



[issue36034] Suprise halt caused by -Werror=implicit-function-declaration in ./Modules/posixmodule.c

2020-02-03 Thread Michael Felt


Michael Felt  added the comment:

closing. Will open a new issue with a correct description of the issue at hand. 
The problem is related to 64-bit mode (which was not mentioned before) and 
minor() major() macro definitions.

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



[issue39489] Remove COUNT_ALLOCS special build

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

Done, I remove COUNT_ALLOCS macro and all associated code.

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Vincent Michel  added the comment:

> The problem is that there is a double rounding in [...]

Actually `float(x) / 1e9` and `x / 1e9` seems to produce the same results:

```
import time
import itertools
now = time.time_ns()
  
for x in itertools.count(now):
assert float(x) / 1e9 == x / 1e9
```

> The formula `time = time_ns / 10**9` may be more accurate.

Well that seems to not be the case, see the plots and the corresponding code. I 
might have made a mistake though, please let me know if I got something wrong :)

--

___
Python tracker 

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



[issue32542] memory not freed, aka memory leak continues...

2020-02-03 Thread Michael Felt


Michael Felt  added the comment:

Not an issue in 3.9, so, closing: "not relevant"

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



[issue39489] Remove COUNT_ALLOCS special build

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c6e5c1123bac6cbb4c85265155af5349dcea522e by Victor Stinner in 
branch 'master':
bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)
https://github.com/python/cpython/commit/c6e5c1123bac6cbb4c85265155af5349dcea522e


--

___
Python tracker 

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



[issue28290] BETA report: Python-3.6 build messages to stderr: AIX and "not GCC"

2020-02-03 Thread Michael Felt


Michael Felt  added the comment:

Closing, as not longer relevant.

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The problem is that there is a double rounding in

time = float(time_ns) / 1e9

1. When convert time_ns to float.
2. When divide it by 1e9.

The formula

time = time_ns / 10**9

may be more accurate.

--
nosy: +lemburg, mark.dickinson, rhettinger, stutzbach

___
Python tracker 

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



[issue39541] distutils: Remove bdist_wininst (Windows .exe installers) in favor of bdist_wheel (.whl)

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

I created a topic in the Packaging discourse to announce this removal:
https://discuss.python.org/t/remove-distutils-bdist-wininst-command/3115

I plan to merge my PR at the end of the week, except if someone speaks out to 
request to keep the deprecated command.

--

___
Python tracker 

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



[issue39541] distutils: Remove bdist_wininst (Windows .exe installers) in favor of bdist_wheel (.whl)

2020-02-03 Thread STINNER Victor


Change by STINNER Victor :


--
keywords: +patch
pull_requests: +17702
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18329

___
Python tracker 

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



[issue39541] distutils: Remove bdist_wininst (Windows .exe installers) in favor of bdist_wheel (.whl)

2020-02-03 Thread STINNER Victor


New submission from STINNER Victor :

The distutils bdist_wininst has been deprecated in Python 3.8 by bpo-37481 in 
favor of bdist_wheel.

See "Deprecate bdist_wininst" discussion:
https://discuss.python.org/t/deprecate-bdist-wininst/1929

I now propose to remove it from the Python code base to ease the Python 
maintenance.

One of the project project which used .exe Windows installer was Pillow, but 
this project doesn't publish .exe installers since Pillow 6.2.0 (October 2019):

* "No more deprecated bdist_wininst .exe installers #4029 [hugovk]"
* https://github.com/python-pillow/Pillow/pull/4029

Attached PR removes bdist_wininst: use bdist_whell instead.

--
components: Library (Lib)
messages: 361290
nosy: vstinner
priority: normal
severity: normal
status: open
title: distutils: Remove bdist_wininst (Windows .exe installers) in favor of 
bdist_wheel (.whl)
versions: Python 3.9

___
Python tracker 

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



[issue39524] Escape sequences in doc string of ast._pad_whitespace

2020-02-03 Thread Amir Mohamadi


Amir Mohamadi  added the comment:

But in both cases the 'Output' will contain '\\':
"Replace all chars except '\\f\\t' in a line with spaces."

--
nosy: +Amir

___
Python tracker 

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



[issue39491] Import PEP 593 (Flexible function and variable annotations) support already implemented in typing_extensions

2020-02-03 Thread Jakub Stasiak


Change by Jakub Stasiak :


--
nosy: +levkivskyi

___
Python tracker 

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



[issue39491] Import PEP 593 (Flexible function and variable annotations) support already implemented in typing_extensions

2020-02-03 Thread Jakub Stasiak


Change by Jakub Stasiak :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread STINNER Victor


STINNER Victor  added the comment:

Yeah, time.time(), time.monotonic() and time.perf_counter() can benefit of a 
note suggestion to use time.time_ns(), time.monotonic_ns() or 
time.perf_counter_ns() to better precision.

--

___
Python tracker 

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



[issue39540] Logging docs don't address the creation of multiple loggers when a hierarchy is provided

2020-02-03 Thread Alexander McFarlane


New submission from Alexander McFarlane :

If `logger_name` is a hierarchy format (e.g. `logger_name = 'parent.child'`) 
and the logger name `'parent'` has not been created, the function call 
`logging.getLogger(logger_name)` will create all loggers in the hierarchy (in 
this instance two loggers, `'parent'` and `'parent.child'` will be created)

This is not documented anywhere in the logging documentation. Suggest that this 
is detailed under `logging.getLogger`

More info...
https://stackoverflow.com/q/59990300/4013571

--
assignee: docs@python
components: Documentation
messages: 361287
nosy: docs@python, flipdazed
priority: normal
severity: normal
status: open
title: Logging docs don't address the creation of multiple loggers when a 
hierarchy is provided
type: enhancement
versions: 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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Vincent Michel  added the comment:

Thanks for your answers, that was very informative!

> >>> a/10**9
> 1580301619.9061854
> >>> a/1e9
> 1580301619.9061852
>
> I'm not sure which one is "correct".


Originally, I thought `a/10**9` was more precise because I ran into the 
following case while working with hundreds of nanoseconds (because windows):

```
r = 1580301619906185900
print("Ref   :", r)
print("10**7 :", int(r // 100 / 10**7 * 10 ** 7) * 100)
print("1e7   :", int(r // 100 / 1e7 * 10 ** 7) * 100)
print("10**9 :", int(r / 10**9 * 10**9))
print("1e9   :", int(r / 1e9 * 10**9))
[...]
Ref   : 1580301619906185900
10**7 : 1580301619906185800
1e7   : 1580301619906186200
10**9 : 1580301619906185984
1e9   : 1580301619906185984
```

I decided to plot the conversion errors for different division methods over a 
short period of time. It turns out that:
- `/1e9` is equally or more precise than `/10**9` when working with nanoseconds
- `/10**7` is equally or more precise than `/1e7` when working with hundreds 
nanoseconds

This result really surprised me, I have no idea what is the reason behind this.

See the plots and code attached for more information.

In any case, this means there is no reason to change the division in 
`_PyTime_AsSecondsDouble`, closing this issue as wontfix sounds fine :)

---

As a side note, the only place I could find something similar mentioned in the 
docs is in the `os.stat_result.st_ctime_ns` documentation: 

https://docs.python.org/3.8/library/os.html#os.stat_result.st_ctime_ns

> Similarly, although st_atime_ns, st_mtime_ns, and st_ctime_ns are 
> always expressed in nanoseconds, many systems do not provide 
> nanosecond precision. On systems that do provide nanosecond precision,
> 1the floating-point object used to store st_atime, st_mtime, and 
> st_ctime cannot preserve all of it, and as such will be slightly 
> inexact. If you need the exact timestamps you should always use 
> st_atime_ns, st_mtime_ns, and st_ctime_ns.

Maybe this kind of limitation should also be mentioned in the documentation of 
`time.time_ns()`?

--
Added file: 
https://bugs.python.org/file48880/Comparing_division_errors_over_10_us.png

___
Python tracker 

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



[issue39484] time_ns() and time() cannot be compared on windows

2020-02-03 Thread Vincent Michel


Change by Vincent Michel :


Added file: https://bugs.python.org/file48881/comparing_errors.py

___
Python tracker 

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



[issue39087] [C API] No efficient C API to get UTF-8 string from unicode object.

2020-02-03 Thread Inada Naoki


Inada Naoki  added the comment:

Attached patch is the benchmark function I used in previous post.

--
Added file: https://bugs.python.org/file48879/bench-asutf8.patch

___
Python tracker 

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



[issue39087] [C API] No efficient C API to get UTF-8 string from unicode object.

2020-02-03 Thread Inada Naoki

Inada Naoki  added the comment:

I am still not sure about we should add new API only for avoiding cache.

* PyUnicode_AsUTF8String : When we need bytes or want to avoid cache.
* PyUnicode_AsUTF8AndSize : When we need C string, and cache is acceptable.


With PR-18327, PyUnicode_AsUTF8AndSize become 10+% faster than master branch, 
and same speed to PyUnicode_AsUTF8String.


## vs master

$ ./python -m pyperf timeit --compare-to=../cpython/python --python-names 
master:patched -s 'from _testcapi import unicode_bench_asutf8 as b' -- 'b(1000, 
"hello", "こんにちは")'
master: . 96.6 us +- 3.3 us
patched: . 83.3 us +- 0.3 us

Mean +- std dev: [master] 96.6 us +- 3.3 us -> [patched] 83.3 us +- 0.3 us: 
1.16x faster (-14%)


## vs AsUTF8String

$ ./python -m pyperf timeit -s 'from _testcapi import unicode_bench_asutf8 as 
b' -- 'b(1000, "hello", "こんにちは")'
.
Mean +- std dev: 83.2 us +- 0.2 us

$ ./python -m pyperf timeit -s 'from _testcapi import 
unicode_bench_asutf8string as b' -- 'b(1000, "hello", "こんにちは")'
.
Mean +- std dev: 81.9 us +- 2.1 us


## vs AsUTF8String (ASCII)

If we can not accept cache, PyUnicode_AsUTF8String is slower than 
PyUnicode_AsUTF8 when the unicode is ASCII string.  PyUnicode_GetUTF8Buffer 
helps only this case.

$ ./python -m pyperf timeit -s 'from _testcapi import unicode_bench_asutf8 as 
b' -- 'b(1000, "hello", "world")'
.
Mean +- std dev: 37.5 us +- 1.7 us

$ ./python -m pyperf timeit -s 'from _testcapi import 
unicode_bench_asutf8string as b' -- 'b(1000, "hello", "world")'
.
Mean +- std dev: 46.4 us +- 1.6 us

--

___
Python tracker 

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



[issue19237] Proposal : LCM function to complement GCD

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

See renewed discussion in #39479, which may lead to math.lcm being added in 3.9.

--

___
Python tracker 

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



[issue39536] Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux

2020-02-03 Thread Mark Dickinson


Change by Mark Dickinson :


--
superseder:  -> datetime.strftime("%Y") not consistent for years < 1000

___
Python tracker 

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



[issue39536] Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

> if you disagree with the resolution of that issue

Sorry, my mistake. That issue is still open.

--

___
Python tracker 

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



[issue39536] Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux

2020-02-03 Thread Mark Dickinson


Mark Dickinson  added the comment:

Closing as a duplicate of #13305. Feel free to add to the discussion there if 
you disagree with the resolution of that issue.

--
nosy: +mark.dickinson
resolution:  -> duplicate
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



[issue39087] [C API] No efficient C API to get UTF-8 string from unicode object.

2020-02-03 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +17701
pull_request: https://github.com/python/cpython/pull/18327

___
Python tracker 

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



[issue17659] no way to determine First weekday (based on locale)

2020-02-03 Thread Inada Naoki


Change by Inada Naoki :


--
pull_requests: +17700
pull_request: https://github.com/python/cpython/pull/18327

___
Python tracker 

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



[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon


Change by Mark Shannon :


--
keywords: +patch
pull_requests: +17699
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/18326

___
Python tracker 

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



[issue39539] Improve Keccak support in hashlib including KangarooTwelve

2020-02-03 Thread Gilles Van Assche

New submission from Gilles Van Assche :

Dear all,

I think it would be nice if hashlib would include the support of Keccak with a 
chosen suffix, as well as the fast instance KangarooTwelve (K12).

1) Currently, hashlib's interface for Keccak only supports the 6 instances of 
FIPS 202 (SHA3-* and SHAKE*). However, the instances in NIST SP 800-185 
(cSHAKE, KMAC, …) use a different suffix and therefore cannot be instantiated 
on top of the aforementioned 6 instances. Instead, simply adding the suffix as 
an argument to the constructor would enable a user to instantiate plain Keccak 
(as in Ethereum) or the SP 800-185 instances.

2) K12 is an alternative hash function (and XOF) in the Keccak family. It is 
fast, parallelizable and it benefits directly from the cryptanalysis on the 
(unchanged) underlying permutation since 2008. This would be IMHO a valuable 
addition to hashlib. Among others, implementations of K12 can be found in the 
XKCP on GitHub.

Kind regards,
Gilles (co-designer of Keccak and K12)

--
components: Library (Lib)
messages: 361280
nosy: gvanas
priority: normal
severity: normal
status: open
title: Improve Keccak support in hashlib including KangarooTwelve
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39538] SystemError when set Element.attrib to non-dict

2020-02-03 Thread Serhiy Storchaka


New submission from Serhiy Storchaka :

The C implementation raises a SystemError after setting Element.attrib to 
non-dict.

>>> from xml.etree import ElementTree as ET
>>> e = ET.Element('a')
>>> e.attrib = 1
>>> e.get('x')
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/dictobject.c:1438: bad argument to internal function
>>> e.items()
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/dictobject.c:2732: bad argument to internal function
>>> e.keys()
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/dictobject.c:2712: bad argument to internal function

The only valid non-dict value is None (although it is an implementation detail).

>>> e.attrib = None
>>> e.get('x')
>>> e.items()
[]
>>> e.keys()
[]

The Python implementation raises an AttributeError (even for None).

>>> import sys
>>> sys.modules['_elementtree'] = None
>>> from xml.etree import ElementTree as ET
>>> e = ET.Element('a')
>>> e.attrib = 1
>>> e.get('x')
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython3.8/Lib/xml/etree/ElementTree.py", line 358, in 
get
return self.attrib.get(key, default)
AttributeError: 'int' object has no attribute 'get'
>>> e.items()
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython3.8/Lib/xml/etree/ElementTree.py", line 388, in 
items
return self.attrib.items()
AttributeError: 'int' object has no attribute 'items'
>>> e.keys()
Traceback (most recent call last):
  File "", line 1, in 
  File "/home/serhiy/py/cpython3.8/Lib/xml/etree/ElementTree.py", line 377, in 
keys
return self.attrib.keys()
AttributeError: 'int' object has no attribute 'keys'

Other way to trigger an error is via __setstate__().

--
components: Extension Modules, XML
messages: 361279
nosy: eli.bendersky, scoder, serhiy.storchaka
priority: normal
severity: normal
status: open
title: SystemError when set Element.attrib to non-dict
type: behavior
versions: Python 2.7, 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



[issue37404] asyncio sock_recv blocks on ssl sockets.

2020-02-03 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue38691] [easy] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-02-03 Thread Dong-hee Na


Dong-hee Na  added the comment:

@Ido Michael
I left review comments for you :)
Thanks for the contribution.

--
nosy: +corona10

___
Python tracker 

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



[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon


Change by Mark Shannon :


--
nosy: +nedbat, pablogsal, skip.montanaro -Mark.Shannon

___
Python tracker 

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



[issue39537] Change line number table format

2020-02-03 Thread Mark Shannon


New submission from Mark Shannon :

The current line number table format has two issues that need to be addressed.

1. There is no way to express that a bytecode does not have have a line number. 
The `END_ASYNC_FOR` bytecode, bytecodes for cleaning up the variable used to 
store exceptions in exception handles, and a few other cases, are all 
artificial and should have no line number.

2. It is inefficient to find a line number when tracing.
Currently, whenever the line number changes, the line number table must be 
re-scanned from the the start.


I propose to fix this by implementing a new line number table. 
Each instruction (currently pair of bytes) would have a one byte line-offset 
value. An offset of 0 indicates that the instruction has no line number.

In addition to the offset table there would be a table of bytecode-offset, 
base-line pairs. Following the pairs is the instruction count.
Adding the instruction count at the end means that the table is not just a 
table of start, line pairs, but also a table of (inclusive) start, line, 
(exclusive) end triples. This format makes it very easy to scan forwards and 
backwards.
Because each entry covers up to 255 lines, the table is very small.

The line of the bytecode at `n*2` (instruction `n`) is calculated as:

offset = lnotab[n]
if offset == 0:
line = -1 # artificial
else:
line_base = scan_table_to_find(n)
line = offset + line_base


The new format fixes the two issues listed above.
1. Having no line number is expressed by a 0 in the offset table.
2. Since the offset-base table is made up of absolute values, not relative 
ones, it can be reliably scanned backwards. It is even possible to use a binary 
search, although a linear scan will be faster in almost all cases. 


The number format would be larger than the old one. 
However, the code object is composed not only of code, but several tuples of 
names and constants as well, so increasing the size of the line number has a 
small effect overall.

--
components: Interpreter Core
messages: 361277
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Change line number table format
type: performance
versions: Python 3.9

___
Python tracker 

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



[issue36051] Drop the GIL during large bytes.join operations?

2020-02-03 Thread Inada Naoki


Change by Inada Naoki :


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



[issue36051] Drop the GIL during large bytes.join operations?

2020-02-03 Thread Inada Naoki


Inada Naoki  added the comment:


New changeset 869c0c99b94ff9527acc1ca060164ab3d1bdcc53 by Inada Naoki in branch 
'master':
bpo-36051: Fix compiler warning. (GH-18325)
https://github.com/python/cpython/commit/869c0c99b94ff9527acc1ca060164ab3d1bdcc53


--

___
Python tracker 

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



[issue39535] multiprocessing.Process file descriptor resource leak

2020-02-03 Thread Robert Pierce


Robert Pierce  added the comment:

It appears as if the problem is the sentinel FIFO opened by (for example) 
multiprocessing.popen_fork.Popen._launch(). It registers a finalization class 
to close the sentinel on garbage collection. Instead, it should be closed in 
poll() or wait() when the child process is reaped and known to be dead. The 
sentinel serves no purpose after the child is reaped, and waiting till garbage 
collection means that programs forking large numbers of processes cannot 
control file descriptor utilization.

--

___
Python tracker 

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



[issue39536] Datetime strftime: %Y exports years < 1000 with 3 digits instead of 4 on Linux

2020-02-03 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



  1   2   >