[issue37936] gitignore file is too broad

2019-08-24 Thread Greg Price


New submission from Greg Price :

There are a number of files that we track in the repo, but are nevertheless 
covered by `.gitignore`.

This *mostly* doesn't change anything, because Git itself only cares what 
`.gitignore` has to say about files that aren't already tracked.  But:

* It affects any new files someone might add that are covered by the same 
unintentionally-broad patterns.  In that case it'd be likely to cause some 
confused debugging into why Git wasn't seeing the file; or possibly loss of 
work, if the person didn't notice that the file had never been committed to Git.

* More immediately, other tools that aren't Git but consult the Git ignore 
rules don't necessarily implement this wrinkle. In particular this is 
unfortunately a WONTFIX bug in ripgrep / `rg`: 
https://github.com/BurntSushi/ripgrep/issues/1127 .

I learned of the `rg` bug (and, for that matter, refreshed myself on just how 
Git itself handles this case) after some confusion today where I was looking 
with for references to a given macro, thought I'd looked at all of them... and 
then later noticed through `git log -p -S` a reference in `PC/pyconfig.h` with 
no subsequent change deleting it. Turned out it was indeed there and I needed 
to take account of it.

Here's the list of affected files:

$ git ls-files -i --exclude-standard 
.gitignore
Doc/Makefile
Lib/test/data/README
Modules/Setup
PC/pyconfig.h
Tools/freeze/test/Makefile
Tools/msi/core/core.wixproj
Tools/msi/core/core.wxs
Tools/msi/core/core_d.wixproj
Tools/msi/core/core_d.wxs
Tools/msi/core/core_en-US.wxl
Tools/msi/core/core_files.wxs
Tools/msi/core/core_pdb.wixproj
Tools/msi/core/core_pdb.wxs
Tools/unicode/Makefile

Fortunately this is not hard to fix.  The semantics of `.gitignore` have a 
couple of gotchas, but once you know them it's not really any more complicated 
to get the behavior exactly right.  And I've previously spent the hour or two 
to read up on it... and when I forget, I just consult my own short notes :), at 
the top of this file:
https://github.com/zulip/zulip/blob/master/.gitignore

I have a minimal fix which takes care of all the files above. I'll post that 
shortly, and I may also write up a more thorough fix that tries to make it easy 
not to fall into the same Git pitfall again.

--
components: Build
messages: 350355
nosy: Greg Price
priority: normal
severity: normal
status: open
title: gitignore file is too broad
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



[issue37936] gitignore file is too broad

2019-08-24 Thread Greg Price


Change by Greg Price :


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

___
Python tracker 

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



[issue37935] Improve performance of pathlib.scandir()

2019-08-24 Thread SilentGhost


Change by SilentGhost :


--
nosy: +pitrou
stage:  -> patch review

___
Python tracker 

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



[issue37929] IDLE: OK sometimes fails to close configdialog

2019-08-24 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue37929] IDLE: OK sometimes fails to close configdialog

2019-08-24 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-15452 with a fix.

--

___
Python tracker 

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



[issue37797] Add name attribute to NameError

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue37797] Add name attribute to NameError

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -15145

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +15146
pull_request: https://github.com/python/cpython/pull/15453

___
Python tracker 

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



[issue37797] Add name attribute to NameError

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +15147
pull_request: https://github.com/python/cpython/pull/15453

___
Python tracker 

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



[issue37934] Docs: Clarify NotImplemented use cases

2019-08-24 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
nosy: +jdemeyer

___
Python tracker 

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



[issue29535] datetime hash is deterministic in some cases

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset e9c90aa43144b0be1e4e393e8cb549573437a5da by Serhiy Storchaka in 
branch 'master':
bpo-29535: Remove promize about hash randomization of datetime objects. 
(GH-15269)
https://github.com/python/cpython/commit/e9c90aa43144b0be1e4e393e8cb549573437a5da


--

___
Python tracker 

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



[issue29535] datetime hash is deterministic in some cases

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15148
pull_request: https://github.com/python/cpython/pull/15454

___
Python tracker 

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



[issue37937] Mention ``frame.f_trace`` in :func:`sys.settrace` docs.

2019-08-24 Thread Ram Rachum


Change by Ram Rachum :


--
assignee: docs@python
components: Documentation
nosy: cool-RR, docs@python
priority: normal
pull_requests: 15149
severity: normal
status: open
title: Mention ``frame.f_trace`` in :func:`sys.settrace` docs.
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



[issue37884] Optimize Fraction() and statistics.mean()

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> I'm with Raymond here; I don't think this change is desirable for the math 
> module, either with or without the leading underscore in the name.

Could you please explain what is wrong in adding a helper function which will 
help to convert different types of numbers to integer ratio correctly?

Currently you need to write a complex code if you need to convert a general 
number to integer ratio:

try:
as_integer_ratio = x.as_integer_ratio
except AttributeError:
n = x.numerator
d = x.denominator
else:
n, d = as_integer_ratio()

(and maybe even more complex if you want to add fast path for int).

--

___
Python tracker 

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



[issue37908] Add some examples of ArgumentParser.exit()

2019-08-24 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue37830] continue and break in finally with return in try results with segfault

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ef61c524ddeeb56da3858b86e349e7288d68178e by Serhiy Storchaka in 
branch 'master':
bpo-37830: Fix compilation of break and continue in finally. (GH-15320)
https://github.com/python/cpython/commit/ef61c524ddeeb56da3858b86e349e7288d68178e


--

___
Python tracker 

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



[issue37830] continue and break in finally with return in try results with segfault

2019-08-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
pull_requests: +15151
pull_request: https://github.com/python/cpython/pull/15456

___
Python tracker 

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



[issue37908] Add some examples of ArgumentParser.exit()

2019-08-24 Thread hai shi


hai shi  added the comment:

Adding an example of ArgumentParser.exit(), because some user would like 
cathing errors manually or consider exit progress or not when an error occurs.

I have not add example of ArgumentParser.error(), because i can not think some 
user scenarios:(

--

___
Python tracker 

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



[issue37908] Add an example of ArgumentParser.exit()

2019-08-24 Thread hai shi


Change by hai shi :


--
title: Add some examples of ArgumentParser.exit() -> Add an example of 
ArgumentParser.exit()
type:  -> resource usage

___
Python tracker 

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



[issue29535] datetime hash is deterministic in some cases

2019-08-24 Thread miss-islington


miss-islington  added the comment:


New changeset 076d0b9f5def35aeb0f8e8aadf658dc35aace81d by Miss Islington (bot) 
in branch '3.8':
bpo-29535: Remove promize about hash randomization of datetime objects. 
(GH-15269)
https://github.com/python/cpython/commit/076d0b9f5def35aeb0f8e8aadf658dc35aace81d


--
nosy: +miss-islington

___
Python tracker 

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



[issue28269] [MinGW] Can't compile Python/dynload_win.c due to static strcasecmp

2019-08-24 Thread miss-islington


miss-islington  added the comment:


New changeset 920ec4b7763d64b3742d7ddd339ad11cdbec62e9 by Miss Islington (bot) 
in branch '3.8':
bpo-28269: Replace strcasecmp with system function _stricmp. (GH-13095)
https://github.com/python/cpython/commit/920ec4b7763d64b3742d7ddd339ad11cdbec62e9


--
nosy: +miss-islington

___
Python tracker 

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



[issue37908] Add an example of ArgumentParser.exit()

2019-08-24 Thread hai shi


Change by hai shi :


--
nosy: +bethard

___
Python tracker 

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



[issue29535] datetime hash is deterministic in some cases

2019-08-24 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
type: security -> behavior
versions:  -Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28269] [MinGW] Can't compile Python/dynload_win.c due to static strcasecmp

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Thank you for your PR Minmin. It was decided to not backport it to 3.7.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue37830] continue and break in finally with return in try results with segfault

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset ed146b52a3b6537689324e3bd9952055f9c6b43d by Serhiy Storchaka in 
branch '3.8':
[3.8] bpo-37830: Fix compilation of break and continue in finally. (GH-15320) 
(GH-15456)
https://github.com/python/cpython/commit/ed146b52a3b6537689324e3bd9952055f9c6b43d


--

___
Python tracker 

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



[issue37830] continue and break in finally with return in try results with segfault

2019-08-24 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For forbidding 'break', 'continue' and 'return' in the 'finally' clause please 
open a topic on Python-Dev.

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Pradyun Gedam


Pradyun Gedam  added the comment:

There's a need for a pip 19.2.3, since there's a bug in wheel tagging logic 
hasn't been updated for CPython 3.8's new tags. I'll be cutting that release, 
and filing a PR for updating bundled pip & setuptools, sometime in the next 24 
hours. (I just got back from my final mid-semester exam, and really should 
relax for a bit)

I'm not sure whether we should mark this a release blocker.

--

___
Python tracker 

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



[issue37938] refactor PyLong_As*() functions

2019-08-24 Thread Sergey Fedoseev


Change by Sergey Fedoseev :


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

___
Python tracker 

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



[issue37938] refactor PyLong_As*() functions

2019-08-24 Thread Sergey Fedoseev


New submission from Sergey Fedoseev :

PyLong_As*() functions have a lot of duplicated code, creating draft PR with 
attempt to deduplicate them.

--
components: Interpreter Core
messages: 350367
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: refactor PyLong_As*() functions

___
Python tracker 

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



[issue36946] Possible signed integer overflow in slice handling

2019-08-24 Thread Batuhan


Batuhan  added the comment:

Should we close this?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37664] Update bundled pip and setuptools

2019-08-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Added lukasz since last beta is by Monday.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue37925] --embed not included in python3.8-config usage/--help

2019-08-24 Thread Batuhan


Change by Batuhan :


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

___
Python tracker 

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



[issue19867] pickletools.OpcodeInfo.code is a string

2019-08-24 Thread Batuhan


Batuhan  added the comment:

What should we do then, close?

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37797] Add name attribute to NameError

2019-08-24 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests:  -15147

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Yugi


New submission from Yugi :

I was trying to handle path to work on both '/' and '\' but when I tried to run 
the code like they said on: 
https://stackoverflow.com/questions/3167154/how-to-split-a-dos-path-into-its-components-in-python
I have no idea why the terminal on my PC doesnt have the same output like 
everybody was discussing at the time the questions and answers were posted.
OS: ubuntu 16.04 LTS, Intel Core i5-7500, 16GB/1TB, Intel HD Graphics 630
python version: 3.5.2
I borrowed a mac pro 2015 to check if it had the same output like my PC but it 
had not. my friend has python 3.7.1 installed and the output is: 
['d:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'] (on my PC, it is: 
['d:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt']). I'm totally new to Python 
and I'm very sorry if this issue is already reported. Thank you!

--
files: Screenshot from 2019-08-24 21-41-52.png
messages: 350371
nosy: Yugi
priority: normal
severity: normal
status: open
title: os.path.normpath change some characters of a path into kinda 'hex number'
type: behavior
versions: Python 3.5
Added file: https://bugs.python.org/file48560/Screenshot from 2019-08-24 
21-41-52.png

___
Python tracker 

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



[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

Now that XML has pretty print option with issue14465 would it be handy to add a 
command line tool pretty printer similar to json.tool? This can be written as 
one-liner similar to json pretty printing but I think it's a good option and 
having a command line tool also helps in piping the output to other commands 
like filtering particular tags. I tried searching mailing list and couldn't 
find any discussions along these lines. There were some concerns around using 
external tools and  in https://bugs.python.org/issue14465#msg324098 . I thought 
to open this to gather feedback.

Branch : https://github.com/tirkarthi/cpython/tree/bpo14465-xml-tool


python -m xml.tool /tmp/person.xml

  
Idly
  
  
Dosa
  


# Get all breakfast tags

python -m xml.tool /tmp/person.xml | grep breakfast
Idly
Dosa

--
components: Library (Lib)
messages: 350372
nosy: eli.bendersky, rhettinger, scoder, serhiy.storchaka, xtreak
priority: normal
severity: normal
status: open
title: Add xml.tool to pretty print XML like json.tool
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



[issue37754] Persistence of Shared Memory Segment after process exits

2019-08-24 Thread Vinay Sharma


Change by Vinay Sharma :


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

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I guess '\f' translates to \x0c and using raw string helps with this.

>>> ord('\f')
12
>>> '\f'
'\x0c'
>>> var = "d:\stuff\morestuff\furtherdown\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff
  urtherdown\THEFILE.txt
>>> os.path.normpath(var)
'd:\\stuff\\morestuff\x0curtherdown\\THEFILE.txt'

# Use raw string

>>> var = r"d:\stuff\morestuff\furtherdown\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff\furtherdown\THEFILE.txt
>>> os.path.normpath(var)
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'

# Or escape back slashes

>>> var = "d:\\stuff\\morestuff\\furtherdown\\THEFILE.txt"
>>> var
'd:\\stuff\\morestuff\\furtherdown\\THEFILE.txt'
>>> print(os.path.normpath(var))
d:\stuff\morestuff\furtherdown\THEFILE.txt

--
nosy: +xtreak

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset a4e2991bdc993b60b6457c8a38d6e4a1fc845781 by Jason R. Coombs 
(shireenrao) in branch 'master':
bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170)
https://github.com/python/cpython/commit/a4e2991bdc993b60b6457c8a38d6e4a1fc845781


--

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15155
pull_request: https://github.com/python/cpython/pull/15461

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset c410f381bf66c48d84812e19e3ba7c2878511a3e by Jason R. Coombs (Miss 
Islington (bot)) in branch '3.8':
bpo-37772: fix zipfile.Path.iterdir() outputs (GH-15170) (#15461)
https://github.com/python/cpython/commit/c410f381bf66c48d84812e19e3ba7c2878511a3e


--

___
Python tracker 

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



[issue37772] zipfile.Path.iterdir() outputs sub directories many times or not at all

2019-08-24 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Thanks very much shireenrao for the PR, which is now merged with Python 3.8+. 
I've additionally backported the fix to zipp in 0.6.0.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue33694] test_asyncio: test_start_tls_server_1() fails on Python on x86 Windows7 3.7 and 3.x

2019-08-24 Thread Srinivas Nyayapati


Change by Srinivas Nyayapati :


--
pull_requests: +15156
pull_request: https://github.com/python/cpython/pull/15170

___
Python tracker 

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



[issue37940] Add xml.tool to pretty print XML like json.tool

2019-08-24 Thread Stefan Behnel


Stefan Behnel  added the comment:

Sounds like a good idea to add something like this.

Have a look here for some more ideas:
https://github.com/lxml/lxml/blob/master/tools/xpathgrep.py

ElementTree should be able to provide most of these features as well these days.

--
stage:  -> needs patch

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I noticed a very similar story in CHECK_BINOP.

How about we don't do any more of these :-)

I understand the desire to have an explicit return but don't think these minor 
aesthetics are worth it.  The existing code was correct. The patches increase 
the total code volume.  There are subtle differences during the transformation 
(macros don't require type declarations). They are a bit tedious to review and 
are eating up our time in the back and forth. All changes like this risk 
introducing bugs into otherwise correct code.  Minor code churn is rarely worth 
it.

May I suggest directing your efforts towards fixing known bugs or implementing 
requested features.  It isn't our goal to create more work for one another ;-)

--

___
Python tracker 

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



[issue37754] Consistency of Unix's shared_memory implementation with windows

2019-08-24 Thread Vinay Sharma


Vinay Sharma  added the comment:

Hi,
I just opened a PR implementing a fix very similar to your suggestions. I am 
using advisory locking using fcntl.flock.
And I am locking on file descriptors.
If you see my PR, in resource tracker I am opening a file 
"/dev/shm/", and trying to acquire exclusive lock on the same.
And it's working great on Linux.
Since, resource_tracker is spawned as a different process, I can't directly use 
file descriptors.

But macOS doesn't have any memory mapped files created by shm_open in /dev/shm. 
In fact, it doesn't store any reference to memory mapped files in the 
filesystem.

Therefore it get's difficult to get the file descriptor in resource tracker.
Also, is there a good way to pass file descriptors between processes.

Any ideas on the above issue will be much appreciated.

--
title: Persistence of Shared Memory Segment after process exits -> Consistency 
of Unix's shared_memory implementation with windows

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 5e63ab05f114987478a21612d918a1c0276fe9d2 by Raymond Hettinger 
(Greg Price) in branch 'master':
bpo-37812: Convert CHECK_SMALL_INT macro to a function so the return is 
explicit. (GH-15216)
https://github.com/python/cpython/commit/5e63ab05f114987478a21612d918a1c0276fe9d2


--

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue37754] Consistency of Unix's shared_memory implementation with windows

2019-08-24 Thread Vinay Sharma


Vinay Sharma  added the comment:

Also, shm_open returns an integer file descriptor.
And when this file descriptor is passed too fcntl.flock (in macOS) it throws 
the following error:
OSError: [Errno 45] Operation not supported

Whereas, the same code works fine on linux.

Therefore, I have doubts whether Macos flock implementation support locking 
shared_memory files.

--

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Eryk Sun


Eryk Sun  added the comment:

As Karthikeyan noted, in a regular string literal, backslash is an escape 
character that's used in the following escape sequences:

\N{name}   : named character
\U : 32-bit hexadecimal ordinal (e.g. \U0010)
\u : 16-bit hexadecimal ordinal (e.g. \u)
\xXX   : 8-bit hexadecimal ordinal (e.g. \xff)
\OOO   : 9-bit octal ordinal (e.g. \777)
\OO: 6-bit octal ordinal (e.g. \77)
\O : 3-bit octal ordinal (e.g. \7)

\a : \x07, \N{BEL}, \N{ALERT}
\b : \x08, \N{BS}, \N{BACKSPACE}
\t : \x09, \N{HT}, \N{TAB}, \N{CHARACTER TABULATION}, \N{HORIZONTAL 
TABULATION}
\n : \x0a, \N{LF}, \N{NL}, \N{LINE FEED}, \N{NEW LINE}
\v : \x0b, \N{VT}, \N{LINE TABULATION}, \N{VERTICAL TABULATION}
\f : \x0c, \N{FF}, \N{FORM FEED}
\r : \x0d, \N{CR}, \N{CARRIAGE RETURN}
\" : \x22, \N{QUOTATION MARK}
\' : \x27, \N{APOSTROPHE}
\\ : \x5c, \N{REVERSE SOLIDUS}

For a Windows path, either we can use a normal string literal with backslash 
path separators escaped by doubling them or we can use a raw string literal. 

One corner case with a raw string literal is that it can't end with an odd 
number of backslashes. We can address this in one of two ways. Either rely on 
the compiler's implicit concatenation of string literals, or rely on the 
system's path normalization to collapse multiple path separators (except at the 
beginning of a path). For example:

>>> print(r'C:\Users' '\\')
C:\Users\
>>> print(r'C:\Users\\')
C:\Users\\

The system normalizes the second case to collapse repeated backslashes. For 
example:

>>> print(os.path._getfullpathname(r'C:\Users\\'))
C:\Users\
>>> os.path.samefile(r'C:\Users\\', r'C:\Users' '\\')
True

We can also use forward slash as the path separator for file-system paths (but 
not registry paths), such as paths that we're passing to open() or os 
functions. I don't recommend this if a file-system path is to be passed as a 
command-line argument. Some programs use forward slash as a switch for 
command-line options. In this case first normalize the path via 
os.path.normpath, or via replace('/', '\\').

In some cases a path may be returned to us in Windows with a "\\?\" prefix 
(backslash only), which is sometimes referred to as an extended path. (More 
specifically, it's a native path in the device namespace.) This tells the 
Windows API to skip path normalization. If a path begins with exactly this 
prefix, then appending components to it with forward slash results in a path 
that will not work. Use os.path.join, or normalize the path via 
os.path.normpath to ensure the final path uses only backslash as the path 
separator.

--
nosy: +eryksun

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
pull_requests: +15157
pull_request: https://github.com/python/cpython/pull/15465

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset edd21129dd304e178ca8be82ba689488dfb58276 by Raymond Hettinger in 
branch 'master':
bpo-32118:  Simplify docs for sequence comparison (GH-15450)
https://github.com/python/cpython/commit/edd21129dd304e178ca8be82ba689488dfb58276


--

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15158
pull_request: https://github.com/python/cpython/pull/15466

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15159
pull_request: https://github.com/python/cpython/pull/15467

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 8ad22a42267d4ecb1c080d420933680cc126363e by Raymond Hettinger 
(Dong-hee Na) in branch 'master':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453)
https://github.com/python/cpython/commit/8ad22a42267d4ecb1c080d420933680cc126363e


--

___
Python tracker 

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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue32118] Doc for comparison of sequences with non-orderable elements

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 0ad85681de639792751ea53ec964d87d4ad45d71 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-32118:  Simplify docs for sequence comparison (GH-15450) (#15466)
https://github.com/python/cpython/commit/0ad85681de639792751ea53ec964d87d4ad45d71


--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue37939] os.path.normpath change some characters of a path into kinda 'hex number'

2019-08-24 Thread Eryk Sun


Eryk Sun  added the comment:

>\N{name}   : named character
>\U : 32-bit hexadecimal ordinal (e.g. \U0010)
>\u : 16-bit hexadecimal ordinal (e.g. \u)
>\xXX   : 8-bit hexadecimal ordinal (e.g. \xff)
>\OOO   : 9-bit octal ordinal (e.g. \777)
>\OO: 6-bit octal ordinal (e.g. \77)
>\O : 3-bit octal ordinal (e.g. \7)

Note that bytes literals do not implement \N, \U, and \u escape sequences -- 
e.g. b'\N{SPACE}' is literally just those 9 bytes, not b' '. Also, in bytes 
literals 9-bit octal sequences wrap around for the [256, 511] range -- e.g. 
b'\400' ==  b'\000' == b'\x00' and b'\777' == b'\377' == b'\xff'. I don't know 
whether the latter is intentional. I'd prefer for the compiler to raise a 
syntax error in this case. Asking for a byte value in the range [256, 511] is 
nonsense.

--

___
Python tracker 

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



[issue37941] python -m and runpy.run_module set different __name__ by default

2019-08-24 Thread Julian Berman


New submission from Julian Berman :

This seems brutally simple, to the point where I'm concerned I'm missing 
something (or have seen this issue filed elsewhere but can't find it), but 
`python -m` and `runpy.run_module` don't set the same __name__ -- specifically 
`runpy.run_module`, when given a non-package, defaults to setting __name__ to 
`mod_name`.

So, given package/foo.py, with the "common"

`if __name__ == "__main__":` check at the bottom, `python -m package.foo` 
successfully executes, but `runpy.run_module("package.foo")` exits silently, 
unless explicitly passed `runpy.run_module("package.foo", run_name="__main__").

[n.b. pep517.{build,check} is a specific example of such a module that 
advertises itself as wanting to be executed via `python -m`]

issue16737 seems related but not exactly the same from what I can tell.

--
messages: 350387
nosy: Julian
priority: normal
severity: normal
status: open
title: python -m and runpy.run_module set different __name__ by default

___
Python tracker 

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



[issue35235] Access violation on alloc in Windows x86-64 python, pymalloc_alloc

2019-08-24 Thread Victor Milovanov


Victor Milovanov  added the comment:

A bit more information: pool->freeblock for the broken pool looks like this:
0xXYZ?
while pool itself looks like this:
0x??XYZ000

--

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thank you again.  This was nice work.

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset d5a66bc56f68d0f7cc3470722a31d7f731754af6 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-37798: Test both Python and C versions in test_statistics.py (GH-15453) 
(GH-15467)
https://github.com/python/cpython/commit/d5a66bc56f68d0f7cc3470722a31d7f731754af6


--

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 69ee87e99cfe0b79389cffa92d126af868baf353 by Raymond Hettinger in 
branch 'master':
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) 
(GH-15465)
https://github.com/python/cpython/commit/69ee87e99cfe0b79389cffa92d126af868baf353


--

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread miss-islington


Change by miss-islington :


--
pull_requests: +15160
pull_request: https://github.com/python/cpython/pull/15469

___
Python tracker 

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



[issue24726] OrderedDict has strange behaviour when dict.__setitem__ is used.

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
assignee: rhettinger -> 

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a8424940b4873791fc178a9f19a7bf1779a6cf42 by Raymond Hettinger 
(Miss Islington (bot)) in branch '3.8':
bpo-14112: Allow beginners to explore shallowness in greater depth ;-) 
(GH-15465) (GH-15469)
https://github.com/python/cpython/commit/a8424940b4873791fc178a9f19a7bf1779a6cf42


--

___
Python tracker 

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



[issue14112] tutorial intro talks of "shallow copy" concept without explanation

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks Terry.

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



[issue9634] Add timeout parameter to Queue.join()

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

It's been 4 1/2 years since last activity.  Marking as closed again due to lack 
of interest and due to the rarity of need.  Also we know that a person can 
already customize join() via a subclass.

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


New submission from Raymond Hettinger :

The API for PyFloat_AsDouble() returns -1.0 to indicate an error.  
PyErr_Occurred() should only be called if there is a -1.0 return code.  This is 
the normal practice for those calls and it is a bit faster because it avoids 
unnecessary external call.

--
components: Argument Clinic
messages: 350395
nosy: larry, rhettinger
priority: normal
severity: normal
status: open
title: Generate correct error check for PyFloat_AsDouble
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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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

___
Python tracker 

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



[issue26093] __qualname__ different when calling generator object w/ functions.partial

2019-08-24 Thread Batuhan


Batuhan  added the comment:

This bug is fixed in 3.9 (probably in 3.8 too)

--
nosy: +BTaskaya

___
Python tracker 

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



[issue37942] Generate correct error check for PyFloat_AsDouble

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Note, the argument clinic is already generating code like this for return 
values in "class double_return_converter".  For example,

_return_value = _statistics__normal_dist_inv_cdf_impl(module, p, mu, sigma);
if ((_return_value == -1.0) && PyErr_Occurred()) {
goto exit;
}

--

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> May I suggest directing your efforts towards fixing known bugs or 
> implementing requested features.  It isn't our goal to create more work for 
> one another

There frequently is value in improving code readability, as it can improve 
maintainability in the long term, but I definitely understand your point.

--

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> Skipping this call for non-main thread in proactor implementation makes sense.

How do we identify whether or not set_wakeup_fd() is being called from a 
non-main thread?

--
nosy: +aeros167

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2019-08-24 Thread Tal Einat


Change by Tal Einat :


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

___
Python tracker 

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



[issue37903] IDLE Shell sidebar.

2019-08-24 Thread Tal Einat


Tal Einat  added the comment:

See PR GH-15474 with an implementation.

--

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Kyle Stanley  added the comment:

> How do we identify whether or not set_wakeup_fd() is being called from a 
> non-main thread?

Never mind, I think I found the answer to my own question and tested a patch 
locally, I'll open a PR.

--

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Change by Kyle Stanley :


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

___
Python tracker 

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



[issue34679] asyncio.add_signal_handler call fails if not on main thread

2019-08-24 Thread Kyle Stanley


Change by Kyle Stanley :


--
keywords: +needs review -patch

___
Python tracker 

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



[issue37812] Make implicit returns explicit in longobject.c (in CHECK_SMALL_INT)

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> May I suggest directing your efforts towards fixing known bugs or 
> implementing requested features.

Well, I would certainly be grateful for a review on my fix to #18236. ;-) 
There's also a small docs bug at GH-15301.

I do think there's significant value in making code easier to read and less 
tricky. If the project continues to be successful for a long time to come, then 
that means the code will be read many, many more times than it's written. But 
one particular spot where it seems our experiences interestingly differ is:

> They are a bit tedious to review and are eating up our time in the back and 
> forth.

As a reviewer I generally find it much less work to review a change when it's 
intended to have no effect on the code's behavior. First, because it's easier 
to confirm no effect than to pin down what the effects are; then because the 
whole set of questions about whether the effects are desirable doesn't arise. 
As a result I often ask contributors (to Zulip, say) to split a change into a 
series of small pure refactors, followed by a very focused diff for the 
behavior change.

So that's certainly background to my sending as many PRs that don't change any 
behavior as PRs that do.

I actually have quite a number of draft changes built up over the last few 
weeks. I've held back on sending them all at once, partly because I've felt I 
have enough open PRs and I wanted to get a better sense of how reviews go. 
Perhaps I'll go pick out a couple more of them that are bugfixes, features, and 
docs to send next.

(You didn't mention docs just now, but given the care I see you take in adding 
to them and in revising What's New, I think we agree that work there is 
valuable.)

--

___
Python tracker 

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



[issue18153] python imaplib - error 'unexpected response'

2019-08-24 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
title: python imaplib - error 'unexpected repsonse' -> python imaplib - error 
'unexpected response'

___
Python tracker 

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



[issue37798] Add C fastpath for statistics.NormalDist.inv_cdf()

2019-08-24 Thread Dong-hee Na


Dong-hee Na  added the comment:

Thank you for the mentoring of this work. 
It was great experience for me!

--

___
Python tracker 

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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2019-08-24 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue19072] classmethod doesn't honour descriptor protocol of wrapped callable

2019-08-24 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset 805f8f9afea116c5d4d000570e3d02ae84502f43 by Raymond Hettinger 
(Berker Peksag) in branch 'master':
bpo-19072: Make @classmethod support chained decorators (GH-8405)
https://github.com/python/cpython/commit/805f8f9afea116c5d4d000570e3d02ae84502f43


--

___
Python tracker 

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



[issue31956] Add start and stop parameters to the array.index()

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

There is a pending PR here : https://github.com/python/cpython/pull/4435 by 
phaqui. @phaqui do you want to finish your PR ?

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

Hmm, I'm a bit confused because:

* Your patch at GH-15251 replaces a number of calls to PyLong_FromLong with 
calls to the new _PyLong_FromUnsignedChar.

* That function, in turn, just calls PyLong_FromSize_t.

* And that function begins:

PyObject *
PyLong_FromSize_t(size_t ival)
{
PyLongObject *v;
size_t t;
int ndigits = 0;

if (ival < PyLong_BASE)
return PyLong_FromLong((long)ival);
// ...


* So, it seems like after your patch we still end up calling PyLong_FromLong at 
each of these callsites, just after a couple more indirections than before.

Given the magic of compilers and of hardware branch prediction, it wouldn't at 
all surprise me for those indirections to not make anything slower... but if 
the measurements are coming out *faster*, then I feel like something else must 
be going on. ;-)

Ohhh, I see -- I bet it's that at _PyLong_FromUnsignedChar, the compiler can 
see that `is_small_int(ival)` is always true, so the whole function just turns 
into get_small_int.  Whereas when compiling a call to PyLong_FromLong from some 
other file (other translation unit), it can't see that and can't make the 
optimization.

Two questions, then:

* How do the measurements look under LTO? I wonder if with LTO the linker is 
able to make the same optimization that this change helps the compiler make.

* Is there a particular reason to specifically call PyLong_FromSize_t? Seems 
like PyLong_FromLong is the natural default (and what we default to in the rest 
of the code), and it's what this ends up calling anyway.

--
nosy: +Greg Price

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

Oh also:

* What compiler, and what compilation flags, are you using in your 
benchmarking?  That seems relevant :)

--

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-24 Thread Jens Troeger

New submission from Jens Troeger :

I think this one’s quite easy to reproduce:

  Python 3.7.4 (default, Jul 11 2019, 01:08:00) 
  [Clang 10.0.1 (clang-1001.0.46.4)] on darwin
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import mimetypes
  >>> mimetypes.guess_extension("image/jpg")  # Expected ".jpg"
  >>> mimetypes.guess_extension("image/jpeg")  # Expected ".jpg"
  '.jpe'

According to MDN

  
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Complete_list_of_MIME_types

only "image/jpeg" is a valid MIME type; however, I’ve seen quite a bit of 
"image/jpg" out in the wild and I think that ought to be accounted for too.

Before I look into submitting a PR I wanted to confirm that this is an issue 
that ought to be fixed. I think it is.

--
components: Library (Lib)
messages: 350408
nosy: _savage
priority: normal
severity: normal
status: open
title: mimetypes.guess_extension() doesn’t get JPG right
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue37943] mimetypes.guess_extension() doesn’t get JPG right

2019-08-24 Thread Jens Troeger

Jens Troeger  added the comment:

Oops, forgot…

  >>> mimetypes.guess_extension("image/jpeg")  # Expected ".jpg" or ".jpeg"

as per referenced MDN. I personally would go with ".jpg" because that's the 
more common file name extension.

--

___
Python tracker 

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



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2019-08-24 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


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

___
Python tracker 

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



[issue37837] add internal _PyLong_FromUnsignedChar() function

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> Is there a particular reason to specifically call PyLong_FromSize_t? Seems 
> like PyLong_FromLong is the natural default (and what we default to in the 
> rest of the code), and it's what this ends up calling anyway.

Ah I see, the patch is meant to go on top of GH-15192, which makes 
PyLong_FromSize_t apply the small-int optimization itself.

As I just suggested on GH-15192, I'd like to see that PR apply the small-int 
optimization in the more broadly-used PyLong_FromUnsignedLong... and then I 
think the natural thing for this new function to do is to call that.

Still quite curious how LTO does, and also curious what compiler and flags 
you're using in benchmarks.

--

___
Python tracker 

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



[issue15542] Documentation incorrectly suggests __init__ called after direct __new__ call

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Since this has taken long on the tracker, I just opened a PR with proposed 
changes from Aaron.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue9253] argparse: optional subparsers

2019-08-24 Thread Ashwin Ramaswami


Change by Ashwin Ramaswami :


--
nosy: +epicfaace

___
Python tracker 

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



[issue16308] Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0

2019-08-24 Thread Ashwin Ramaswami


Ashwin Ramaswami  added the comment:

What's the status of this? Was paul.j3's patch ever reviewed?

--
nosy: +epicfaace

___
Python tracker 

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



[issue37636] Deprecate slicing and ordering operations on sys.version

2019-08-24 Thread Anthony Sottile


Anthony Sottile  added the comment:

I threw together a flake8 plugin which checks for these usage patterns:

https://github.com/asottile/flake8-2020


| Code   | Description |
||-|
| YTT101 | `sys.version[:...]` referenced (python3.10) |
| YTT102 | `sys.version[2]` referenced (python3.10)|
| YTT201 | `sys.version_info[0] == 3` referenced (python4) |
| YTT202 | `six.PY3` referenced (python4)  |
| YTT301 | `sys.version[0]` referenced (python10)  |

--

___
Python tracker 

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



[issue18236] str.isspace should use the Unicode White_Space property

2019-08-24 Thread Greg Price


Greg Price  added the comment:

> I've gone and made a patch for this change

Update:

* The preparatory changes in #37760 are now almost all merged; GH-15265 is the 
one piece remaining, and I'd be grateful for a review.

It's a generally straightforward and boring change that converts the main data 
structures of makeunicodedata.py from using length-18 tuples as records to 
using a dataclass, which I think makes subsequent changes that add features to 
that script much easier both to write and to review.

* I have a slightly updated version of the fix itself, which differs mainly by 
adding a test: https://github.com/gnprice/cpython/commit/9b3bf6739 Comments 
welcome there too.

--

___
Python tracker 

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



[issue16308] Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0

2019-08-24 Thread paul j3


paul j3  added the comment:

https://bugs.python.org/issue26510

https://bugs.python.org/issue33109

There was some flip/flop over whether required should be true by default or not 
- the current behavior is False, (the 3.3.0)

The lasting change since this issue in 2012 is that `add_subparsers` now takes 
the 'required' parameter.  And this is documented.

To avoid the problem raising in this issue, the subparsers should be defined 
with:

p1 = parser.add_subparsers(required=True, dest='cmd')

The 'dest' parameter is documented, but that fact that it is needed with 
required=True is not.  Without it you can get an error when missing-argument is 
being formatted.  Without it the error formatter doesn't know what to call this 
argument.   I've mentioned this in one or more issues.

See my SO answer for discussion on this:

https://stackoverflow.com/questions/23349349/argparse-with-required-subparser/23354355#23354355

--

___
Python tracker 

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



[issue23061] Update pep8 to specify explicitly 'module level' imports at top of file

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

Since this is a PEP related issue, it should be moved to the PEP Github 
repository here : https://github.com/python/peps . If it still exists.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue13341] Incorrect documentation for "u" PyArg_Parse format unit

2019-08-24 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

This is has taken years but am curious, are we allowed to patch Python 2 given 
its EOL is almost due.

--
nosy: +nanjekyejoannah

___
Python tracker 

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



  1   2   >