[issue40435] IDLE should catch user config file UnicodeDecodeError

2020-04-29 Thread 左迟

左迟  added the comment:

Well, I have uploaded my ~/.idlerc/config-main.cfg. And apeeding 
"encodin=utf-8" is my first time to edit config-main.cfg file manually.
The content of config-main.cfg is below:
  1 [EditorWindow]
  2 font-size = 16
  3 font-bold = False
  4 encoding = utf-8
  5 font = courier new
  6
Just let me know if I could help you.

--
Added file: https://bugs.python.org/file49101/config-main.cfg

___
Python tracker 

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



[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Tim Peters


Change by Tim Peters :


--
resolution: fixed -> not a bug

___
Python tracker 

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



[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

And just to add on, the reason this gives you the correct result in Python 2 is 
that `/` performs integer division whereas in Python 3 the `/` operator 
provides a float as a result.

See https://docs.python.org/3/howto/pyporting.html#division for more details.

--
nosy: +ammar2
resolution:  -> fixed
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Hi,

The behaviour you are calling "gibbrish" is correct, as the expression 
`(p-1)/2` calculates a 64-bit floating point number, which may lose 
precision even for small values of p, but will definitely lose precision 
for large p.

Calling `int()` on that float will not recover the lost precision.

So there is no bug here, this is expected behaviour with floats. Please 
remember that floats are not mathematically exact Real numbers like we 
learn about in school, they have limited precision.

To avoid the float conversion, use the floor-division operator 
`(p-1)//2` as you mention. If `p` is an int, the result will be exact.

--
nosy: +steven.daprano
title: pow(a,b,p) where b=int((p-1)/2) spits out gibbrish for big p -> pow(a, 
b, p) where b=int((p-1)/2) spits out gibbrish for big p

___
Python tracker 

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



[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Basic ICT Repairs


Basic ICT Repairs  added the comment:

Hi, I was calculating Legendre coefficients, and quadratic residues and 
encountered what I believe to be a bug while using this code: 

for a in range (5):
exp=int((p-1)/2)
x=pow(a,exp,p)
print(x)

If p is an odd prime, then x can have three values [-1,0,1] - where (-1) refers 
to (p-1). The code works well for reasonably small primes (like 9973). But with 
big primes(see below), python 3.7 spits out gibberish. Same code in python 2.7 
works well.

The problem in python 3.7 can be avoided if exp is defined thusly :  
exp=(p-1)//2

Here is the prime I tried it on : 
p = 
101524035174539890485408575671085261788758965189060164484385690801466167356667036677932998889725476582421738788500738738503134356158197247473850273565349249573867251280253564698939768700489401960767007716413932851838937641880157263936985954881657889497583485535527613578457628399173971810541670838543309159139

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



[issue40446] pow(a, b, p) where b=int((p-1)/2) spits out gibbrish for big p

2020-04-29 Thread Basic ICT Repairs


New submission from Basic ICT Repairs :

Hi, I was calculating Legendre coefficients, and quadratic residues and 
encountered what I believe to be a bug while using this code: 

for a in range (5):
exp=int((p-1)/2)
x=pow(a,exp,p)
print(x)

If p is an odd prime, then x can have three values [-1,0,-1] - where "-1" 
refers to p-1. The code works well for reasonably small primes (like 9973). But 
with big primes(see below), python 3.7 spits out gibberish. Same code in python 
2.7 works well.

The problem in python 3.7 can be avoided if exp is defined thusly :  
exp=(p-1)//2

Here is the prime I tried it on : 
p = 
101524035174539890485408575671085261788758965189060164484385690801466167356667036677932998889725476582421738788500738738503134356158197247473850273565349249573867251280253564698939768700489401960767007716413932851838937641880157263936985954881657889497583485535527613578457628399173971810541670838543309159139

--
messages: 367735
nosy: Basic ICT Repairs
priority: normal
severity: normal
status: open
title: pow(a,b,p) where b=int((p-1)/2) spits out gibbrish for big p

___
Python tracker 

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



[issue39562] Asynchronous comprehensions don't work in asyncio REPL

2020-04-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think we should backport the fix 4454057269b995341b04d13f0bf97f96080f27d0 
(change constants) to 3.8 given that the likelihood of users using the actual 
hardcoded value of the constants instead of the constants themselves is very 
low. Also, given the collision, it would be fixing a bug present still in 3.8. 

If we revert 9052f7a41b90f2d34011c8da68f9a4facebc8a97 we would have two bugs in 
3.8: collision of constants and asyncio repr not working properly.

--

___
Python tracker 

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



[issue40405] asyncio.as_completed documentation misleading

2020-04-29 Thread Kyle Stanley


Kyle Stanley  added the comment:

@Bar as requested by Guido, let's continue the discussion in the PR: 
https://github.com/python/cpython/pull/19753#pullrequestreview-403185142.

--

___
Python tracker 

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



[issue40394] difflib.SequenceMatcher.find_longest_match default arguments

2020-04-29 Thread Tim Peters


Tim Peters  added the comment:

All done.  Thank you, Lewis!  You're now an official Python contributor, and 
are entitled to all the fame, fortune, and power that follows.  Use your new 
powers only for good :-)

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



[issue40394] difflib.SequenceMatcher.find_longest_match default arguments

2020-04-29 Thread Tim Peters


Tim Peters  added the comment:


New changeset 3209cbd99b6d65aa18b3beb124fac9c792b8993d by lrjball in branch 
'master':
bpo-40394 - difflib.SequenceMatched.find_longest_match default args (GH-19742)
https://github.com/python/cpython/commit/3209cbd99b6d65aa18b3beb124fac9c792b8993d


--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-29 Thread Carl Meyer


Carl Meyer  added the comment:

Right, although I think it still makes sense to link both LibCST and parso 
since they provide different levels of abstraction that would be suitable for 
different types of tools (e.g. I would rather write an auto-formatter on top of 
parso, because LibCST's careful parsing and assignment of whitespace would 
mostly just get in the way, but I'd rather write any kind of refactoring 
tooling on top of LibCST.)

Another tool that escaped my mind when writing the PR that should probably be 
linked also is Baron/RedBaron (https://github.com/PyCQA/redbaron); 457 stars 
makes it slightly more popular than LibCST (but it's also been around a lot 
longer.)

--

___
Python tracker 

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



[issue40441] Plural typo in Design and History FAQ

2020-04-29 Thread Ammar Askar


Change by Ammar Askar :


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

___
Python tracker 

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



[issue40377] APPDATA location in Microsoft Store version

2020-04-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
resolution:  -> third party

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset 95e208dce505c542b8e4f8f42c57e6d4793b6895 by Miss Islington (bot) 
in branch '3.8':
bpo-40443: Remove unused imports in idlelib (GH-19801)
https://github.com/python/cpython/commit/95e208dce505c542b8e4f8f42c57e6d4793b6895


--

___
Python tracker 

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



[issue40316] Add zero function to time, datetime, which acts as the use case of replace to limit resolution

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I recommend posting this to python-ideas for discussion.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset 48ef06b62682c19b7860dcf5d9d610e589a49840 by Miss Islington (bot) 
in branch '3.7':
bpo-40443: Remove unused imports in idlelib (GH-19801)
https://github.com/python/cpython/commit/48ef06b62682c19b7860dcf5d9d610e589a49840


--

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

It's typically not up to the core devs to pick a winning third party library; 
we tend to recommend libraries that are already essentially category winners, 
like requests. In a sense pointing to LibCST *and* parso is redundant because 
LibCST builds on parso. Comparing stars on GitHub:
- LibCST: 423
- parso: 296
- awpa: 10

--

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +19129
pull_request: https://github.com/python/cpython/pull/19808

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19130
pull_request: https://github.com/python/cpython/pull/19809

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:


New changeset 6900f16d2207ca4fc252fa9d778ca0b13a3c95e0 by Victor Stinner in 
branch 'master':
bpo-40443: Remove unused imports in idlelib (GH-19801)
https://github.com/python/cpython/commit/6900f16d2207ca4fc252fa9d778ca0b13a3c95e0


--
nosy: +terry.reedy

___
Python tracker 

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



[issue40389] No straightforward way to get repr of Optional

2020-04-29 Thread Guido van Rossum


Change by Guido van Rossum :


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



[issue40389] No straightforward way to get repr of Optional

2020-04-29 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 138a9b9c2a394f30f222c23391f9515a7df9d809 by Vlad Serebrennikov in 
branch 'master':
bpo-40389: Improve repr of typing.Optional (#19714)
https://github.com/python/cpython/commit/138a9b9c2a394f30f222c23391f9515a7df9d809


--
nosy: +gvanrossum

___
Python tracker 

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



[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-29 Thread Domenico Ragusa


Domenico Ragusa  added the comment:

I may have forgotten to use the proper format for the title of each
commit, should I delete the pull request and make a new one or can it
be fixed when (or if) it's pulled?

On Thu, Apr 30, 2020 at 2:03 AM Roundup Robot  wrote:
>
>
> Change by Roundup Robot :
>
>
> --
> nosy: +python-dev
> nosy_count: 5.0 -> 6.0
> pull_requests: +19128
> stage:  -> patch review
> pull_request: https://github.com/python/cpython/pull/19807
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue40283] Documentation of turtle.circle()

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

It would be bizarre if the current doc were correct, but have you verified by 
experiment that the change is correct?

The patch itself would be trivial, hence the keyword addition.  PR author can 
request that I review.

--
keywords: +easy, newcomer friendly
nosy: +terry.reedy
stage:  -> needs patch
type: resource usage -> behavior
versions: +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



[issue40269] Inconsistent complex behavior with (-1j)

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

After reading through the comments, I don't think we should change 
repr(complex) unless there is computational issue, such as eval(repr(z) != z.  
Raymond, I agree with your overlooked doc tweek.  If you submit a PR, you can 
ask me to review.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset b1e11c31c523dc082985e9de779ceeb47224e536 by Victor Stinner in 
branch 'master':
bpo-40443: Remove unused imports in tests (GH-19804)
https://github.com/python/cpython/commit/b1e11c31c523dc082985e9de779ceeb47224e536


--

___
Python tracker 

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



[issue40444] multiprocessing.Pool deadlocks with only print statements

2020-04-29 Thread Darin Tay


Darin Tay  added the comment:

Ah yes, I should have mentioned this is on Linux!  I also got around to testing 
on 3.8.2 (linux), where it still reproduces.

--

___
Python tracker 

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



[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-29 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +19128
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19807

___
Python tracker 

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



[issue40262] SSL recv_into requires the object to implement __len__ unlike socket one

2020-04-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue40444] multiprocessing.Pool deadlocks with only print statements

2020-04-29 Thread Tim Peters


Tim Peters  added the comment:

Just noting that the program runs to completion without issues under 3.8.1, but 
on Win10.  Of course Windows doesn't support fork().

--
nosy: +tim.peters

___
Python tracker 

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



[issue40256] Python 3.8 Not Launching on Bootcamp Windows 10.

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I presume you mean the Mac Bootcamp program that allows one to run Windows on 
Macs.  I don't know if it runs *all* Windows programs or whether we 
specifically support running Windows python under Bootcamp.  I imagine that 
there might be problems with some GUI and graphics programs.

IDLE depends on multiple stdlibs, in particular tkinter, which depends on 
tcl/tk.  To test if the Windows versions work under Bootcamp, run "python -m 
tkinter" in Command Prompt.  You should see a tk window with text and a 
click-me button.  If that works, try "python -m turtle".  It should draw and 
erase a couple of patterns.  If both work, "python -m test".  Then try "python 
-m idlelib" and report any error messages that appear.

--
components: +macOS
nosy: +ned.deily, ronaldoussoren, terry.reedy

___
Python tracker 

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



[issue40360] Deprecate lib2to3 (and 2to3) for future removal

2020-04-29 Thread Peter Ludemann


Peter Ludemann  added the comment:

The documentation change gives two possible successors:

https://libcst.readthedocs.io/ (https://github.com/Instagram/LibCST)
https://parso.readthedocs.io/

And I've also seen this mentioned: https://github.com/pyga/awpa

Is it possible to settle on one of these as the successor to the lib2to3 
parser? It would be nice to avoid a 2nd deprecation in the future ...

--

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 57572b103ebd8732ac21922f0051a7f140d0e405 by Victor Stinner in 
branch 'master':
bpo-40443: Remove unused imports in tests (GH-19805)
https://github.com/python/cpython/commit/57572b103ebd8732ac21922f0051a7f140d0e405


--

___
Python tracker 

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



[issue40445] compileall.compile_dir docs aren't updated for bpo-38112

2020-04-29 Thread Shantanu


Change by Shantanu :


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

___
Python tracker 

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



[issue40445] compileall.compile_dir docs aren't updated for bpo-38112

2020-04-29 Thread Shantanu


New submission from Shantanu :

While the signature was updated in the documentation, the text below wasn't, 
and still reflects the old default of 10.

https://docs.python.org/3.9/library/compileall.html#compileall.compile_dir

--
assignee: docs@python
components: Documentation
messages: 367714
nosy: docs@python, hauntsaninja
priority: normal
severity: normal
status: open
title: compileall.compile_dir docs aren't updated for bpo-38112
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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19126
pull_request: https://github.com/python/cpython/pull/19805

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19125
pull_request: https://github.com/python/cpython/pull/19804

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19124
pull_request: https://github.com/python/cpython/pull/19803

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19123
pull_request: https://github.com/python/cpython/pull/19802

___
Python tracker 

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



[issue40334] PEP 617: new PEG-based parser

2020-04-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset 69e802ed812e38cb68a4ab74af64b4f719b6cc78 by Lysandros Nikolaou in 
branch 'master':
bpo-40334: Fix test_peg_parser to actually use the old parser (GH-19778)
https://github.com/python/cpython/commit/69e802ed812e38cb68a4ab74af64b4f719b6cc78


--

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue40444] multiprocessing.Pool deadlocks with only print statements

2020-04-29 Thread Darin Tay


New submission from Darin Tay :

I ran into a deadlock that I've reduced to a small and consistent repro, tested 
on 3.7.5 and 3.8.0.


Reading through https://bugs.python.org/issue6721 now I suspect it is just 
another case of that, but not certain.


In particular, I'm not using any explicit threads, though presumably 
multiprocessing.Pool is using one under-the-hood.  If so, it seems a bit rough 
that multiprocessing can by itself cause the fork issues it tries to warn about 
("Note that safely forking a multithreaded process is problematic.")



# This very quickly and consistently hangs after a few attempts on my machines
def run(x):
print("Worker with ", x)
return x

def main():
for i in range(1000):
print("Attempt #", i)
from multiprocessing import Pool

with Pool(processes=16, maxtasksperchild=1) as p:
for entry in p.imap_unordered(run, range(50)):
print("Main received back ", entry)


if __name__ == "__main__":
main()

--
components: Library (Lib)
messages: 367712
nosy: DarinTay
priority: normal
severity: normal
status: open
title: multiprocessing.Pool deadlocks with only print statements
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue40443] Remove unused imports in the stdlib (April 2020 edition)

2020-04-29 Thread STINNER Victor


New submission from STINNER Victor :

Attached PRs removed unused imports from the Python standard library.

I used pyflakes and looked for "imported but unused" warnings. I ignored tons 
of warnings, since many are false alarms: imports done on purpose.

Previous editions:

* 2014: bpo-20976
* 2017: bpo-29919

--
components: Library (Lib), Tests
messages: 367711
nosy: vstinner
priority: normal
severity: normal
status: open
title: Remove unused imports in the stdlib (April 2020 edition)
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



[issue40434] Update of reasoning why there is no case statement

2020-04-29 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

What is your reasoning on referencing just  one of the PEPs and not both of 
them?

--
nosy: +nanjekyejoannah

___
Python tracker 

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



[issue40291] socket library support for CAN_J1939

2020-04-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

Thanks, good luck using this!

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



[issue40291] socket library support for CAN_J1939

2020-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset 360371f79c48f15bbcee7aeecacf97a899913b25 by karl ding in branch 
'master':
bpo-40291: Add support for CAN_J1939 sockets (GH-19538)
https://github.com/python/cpython/commit/360371f79c48f15bbcee7aeecacf97a899913b25


--
nosy: +miss-islington

___
Python tracker 

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



[issue40254] pyspecific directives are not translatable

2020-04-29 Thread Terry J. Reedy


Change by Terry J. Reedy :


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



[issue40441] Plural typo in Design and History FAQ

2020-04-29 Thread Joannah Nanjekye


Joannah Nanjekye  added the comment:

After merging the associated PR, I believe this is resolved. Thanks Alex for 
reporting and solving this

--
nosy: +nanjekyejoannah
stage:  -> resolved

___
Python tracker 

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



[issue40402] Race condition in multiprocessing/connection.py: broken handle

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-39995: race condition in concurrent.futures. More specific to 
_ThreadWakeup class, but with similar symptoms.

--
nosy: +vstinner

___
Python tracker 

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



[issue40440] allow array.array construction from memoryview w/o copy

2020-04-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

array.array should copy the content, to be able to modify it. It implements 
both the storage for data and the view of that storage.

What you want is already implemented as the memoryview object.

>>> import array
>>> x = array.array('b', [1,2,3,4])
>>> x
array('b', [1, 2, 3, 4])
>>> z = memoryview(x).cast('h')
>>> z

>>> list(z)
[513, 1027]
>>> z[0] = 42
>>> x
array('b', [42, 0, 3, 4])
>>> x.append(4)
Traceback (most recent call last):
  File "", line 1, in 
BufferError: cannot resize an array that is exporting buffers

--
nosy: +serhiy.storchaka, skrah

___
Python tracker 

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



[issue40442] Spurious warning emitted during fork() can deadlock a multi-threaded process

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner

___
Python tracker 

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



[issue40427] importlib of module results in different id than when imported with import keyword

2020-04-29 Thread John Andersen


John Andersen  added the comment:

Thank you! :) I must have missed that somehow

--

___
Python tracker 

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



[issue40440] allow array.array construction from memoryview w/o copy

2020-04-29 Thread Benjamin Keen


Change by Benjamin Keen :


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

___
Python tracker 

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



[issue40435] IDLE should catch user config file UnicodeDecodeError

2020-04-29 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I want this left open to fix IDLE exiting instead of continuing.  The original 
IDLE authors could not anticipate all the things that users around the world 
(and OS developers) might do, and we maintainers are still plugging holes as 
they are reported.

>From the original report, I am slightly surprised that your fix worked.  
>Please either upload your revised config-main.cfg or paste it into a reply.  
>Changing it should not, that I know of, affect the reading of other .cfg 
>files, only the subsequent loading of .py files.  Even then, it would have to 
>end with an "[EditorWindow]" section, so that "encoding=utf-8" would be in the 
>proper section.

(I should also check the error messaging for un-readable .py files too)

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

___
Python tracker 

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



[issue6721] Locks in the standard library should be sanitized on fork

2020-04-29 Thread Deomid Ryabkov


Deomid Ryabkov  added the comment:

https://bugs.python.org/issue40442 is a fresh instance of this, entirely 
self-inflicted.

--
nosy: +rojer

___
Python tracker 

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



[issue40442] Spurious warning emitted during fork() can deadlock a multi-threaded process

2020-04-29 Thread Deomid Ryabkov


Change by Deomid Ryabkov :


--
type:  -> behavior

___
Python tracker 

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



[issue40442] Spurious warning emitted during fork() can deadlock a multi-threaded process

2020-04-29 Thread Deomid Ryabkov


New submission from Deomid Ryabkov :

I know, I know - forking a multi-threaded process is bad. But it happens.

This is related  to https://bugs.python.org/issue40399 and 
https://bugs.python.org/issue6721 but is distinct because the problem is 
entirely self-inflicted.

What happens:

1) A multithreaded program forks using one of the functions, such as 
os.forkpty()
2) In the child process the Python interpreter, in its PyOS_AfterFork_Child 
function ([1]) tries to kill all the threads other than the one doing the 
forking.
3) Among the objects being destroyed may include file or socket objects that 
are now being destroyed too, without having been previosuly closed, which 
triggers a ResourceWarning in the finalizer [2], [3].
4) Default action for warnings is to write to sys.stderr
5) A mutex used in BufferedIO is held by some other (now deceased thread).
6) Deadlock in _enter_buffered_busy [4].

This is bad because there is absolutely no way to avoid it without disabling 
warnings.
Even if the program is super careful to not do anything after forking other 
than exec, it doesn't help because the resource warning and the resulting 
deadlock is triggered by activity of the interpreter: it is the interpreter 
that orphans and is forcibly destroying the files and sockets, not the program 
that lost track of them.

[1] 
https://github.com/python/cpython/blob/beba1a808000d5fc445cb28eab96bdb4cdb7c959/Modules/posixmodule.c#L451

[2] 
https://github.com/python/cpython/blob/beba1a808000d5fc445cb28eab96bdb4cdb7c959/Modules/_io/fileio.c#L95

[3] 
https://github.com/python/cpython/blob/beba1a808000d5fc445cb28eab96bdb4cdb7c959/Modules/socketmodule.c#L4800

[4] 
https://github.com/python/cpython/blob/beba1a808000d5fc445cb28eab96bdb4cdb7c959/Modules/_io/bufferedio.c#L282

--
components: Library (Lib)
messages: 367701
nosy: rojer
priority: normal
severity: normal
status: open
title: Spurious warning emitted during fork() can deadlock a multi-threaded 
process
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



[issue40437] add string.snake function

2020-04-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

> One can also argue why python need to maintain str conversion at all if we 
> have such good extensions in different libs.

Back when we were starting python 3.x there was discussion or removing these 
from str and bytes, but it was decided that breaking existing code just wasn't 
worth it. You can imagine how rarely b"Some String".swapcase() is used.

As I said, if we were designing the language from scratch today I doubt we 
would include swapcase, title, and capitalize, at least. I don't think using 
their existence as an argument to add more methods like them is very convincing.

--

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread jeffolsi10

jeffolsi10  added the comment:

Rémi Lapeyre not all of them.
I can give list of many examples where snake case is needed.

But the question is: Are we discussing if snake case is even needed
or are we discussing if this should be in python core.

Those are two totally different things. 

1. The need is shown in many questions over the internat. Again see 
stackoverflow.

2. To my understanding core should provide infra for the common simple usages. 
One can also argue why python need to maintain str conversion at all if we have 
such good extensions in different libs.


Are you saying that in your opinion people won't find it useful so there is no 
need for it or are you saying that no matter how many people would like it the 
feature should not be in Python core.

--

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The original issue was about different error messages in REPL and eval(). But 
it is not related to string prefixes. We have the same difference without 
involving strings:

>>> a b
  File "", line 1
a b
  ^
SyntaxError: invalid syntax
>>> eval("a b")
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 1
a b
  ^
SyntaxError: unexpected EOF while parsing

I suggest to revert this change and close the issue.

--

___
Python tracker 

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



[issue40358] pathlib's relative_to should behave like os.path.relpath

2020-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you for your work on this Domenico. For reviewing the code, would you 
mind creating a Github pull request for it as described here 
https://devguide.python.org/pullrequest/

--
nosy: +ammar2

___
Python tracker 

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



[issue40441] Plural typo in Design and History FAQ

2020-04-29 Thread alexpovel

New submission from alexpovel :

The documentation under "Design and History FAQ" has a typo in its "Why doesn’t 
Python have a “with” statement for attribute assignments?" section:

https://docs.python.org/3/faq/design.html#why-doesn-t-python-have-a-with-statement-for-attribute-assignments

where it says:

> Some language have a construct that looks like this:

which should of course read:

> Some languages have a construct that looks like this:

Attached is a git diff patch file.

--
assignee: docs@python
components: Documentation
files: fix_plural_typo_in_documentation.patch
keywords: patch
messages: 367696
nosy: alexpovel, docs@python
priority: normal
pull_requests: 19120
severity: normal
status: open
title: Plural typo in Design and History FAQ
versions: Python 3.8
Added file: 
https://bugs.python.org/file49100/fix_plural_typo_in_documentation.patch

___
Python tracker 

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



[issue35829] datetime: parse "Z" timezone suffix in fromisoformat()

2020-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

There's been some additional discussion on 
https://discuss.python.org/t/parse-z-timezone-suffix-in-datetime/2220

--
nosy: +ammar2

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I don't understand the motivation, why would it be very useful when working 
with titles of columns that are to be used in databases columns?

Databases can handle columns with spaces in their name:

postgres=# create temporary table foo ("column with spaces" text);
CREATE TABLE
Time: 29,973 ms
postgres=# insert into foo values ('bar');
INSERT 0 1
Time: 0,746 ms
postgres=# select * from foo;
 column with spaces 

 bar
(1 row)

Time: 3,452 ms


There is also various library available to do this on Pypi like 
https://github.com/okunishinishi/python-stringcase and 
https://github.com/jpvanhal/inflection. I'm pretty sure I used inflection at 
one company and it worked great.

Finally, the issue on the Pandas repository says how to do it: you can use 
Series.apply.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

Indeed, reverting commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 makes it work 
with both parsers:

~/github/python/master master*
❯ ./python -X oldparser
Python 3.9.0a6+ (heads/master-dirty:84724dd239, Apr 29 2020, 20:29:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
>>>

~/github/python/master master*
❯ ./python
Python 3.9.0a6+ (heads/master-dirty:84724dd239, Apr 29 2020, 20:29:53)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
>>>

--

___
Python tracker 

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



[issue40439] Error in an external reference

2020-04-29 Thread Ammar Askar


Ammar Askar  added the comment:

Thank you for the report Patrick! 

For reference this is on the lexical analysis page: 
https://docs.python.org/3/reference/lexical_analysis.html

> A non-normative HTML file listing all valid identifier characters for Unicode 
> 4.1 can be found at 
> https://www.dcl.hpi.uni-potsdam.de/home/loewis/table-3131.html.


Looking at the page on 
https://web.archive.org/web/20200312045240/https://www.dcl.hpi.uni-potsdam.de/home/loewis/table-3131.html

it seems like it was just a giant table containing all the valid XID_START and 
XID_CONTINUE characters. We could just remove the link or point it to the 
section in the current unicode database we use 
https://www.unicode.org/Public/13.0.0/ucd/DerivedCoreProperties.txt
where it lists all the characters:

> # Derived Property: XID_Start

Would you like to make a pull request for this?

--
keywords: +newcomer friendly
nosy: +ammar2, loewis

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Pablo Galindo Salgado

Pablo Galindo Salgado  added the comment:

> If it's all handled by the tokenizer, how come it's different in the 
> newparser?

Is not different in the new parser: both parsers have analogous behaviour now:

~/github/python/master master
❯ ./python
Python 3.9.0a6+ (heads/master:84724dd239, Apr 29 2020, 20:26:52)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
  File "", line 1
norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
 ^
SyntaxError: invalid string prefix
>>>

~/github/python/master master
❯ ./python -X oldparser
Python 3.9.0a6+ (heads/master:84724dd239, Apr 29 2020, 20:26:52)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
  File "", line 1
norm=lambda m: m+(m and(m[-1]!='\n'and'\n'or'')or'\n')
   ^
SyntaxError: invalid string prefix


This issue is exclusively due to the changes in 
https://github.com/python/cpython/pull/19476 if I understand correctly.

--

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Guido van Rossum


Guido van Rossum  added the comment:

If it's all handled by the tokenizer, how come it's different in the new
parser?

Anyway, it seems we really have to support what the old parser supported
here. I don't know exactly what rules it uses. Maybe only look for a string
quote following a name that can definitely be a string prefix?

--

___
Python tracker 

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



[issue40291] socket library support for CAN_J1939

2020-04-29 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
nosy: +orsenthil

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> What's also possible is to handle keywords at tokenizer level

Sadly, the tokenizer is unaware of keywords (maybe except async and await 
because their history as soft keywords) as that distinction usually is up to 
the parser as the parser is the one who knows about the grammar. Introducing 
keywords in the tokenizer would couple them too much IMHO apart from other 
possible problems.

--

___
Python tracker 

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



[issue40440] allow array.array construction from memoryview w/o copy

2020-04-29 Thread Benjamin Keen


New submission from Benjamin Keen :

Currently the array.array object can export a memoryview, but there is no way 
to construct one from a memoryview without making a copy of the underlying 
data.  So in that sense array.array only supports one half of the buffer 
protocol and this is to allow for the other half.

This proposal is to allow the array object to be constructed from an existing 
exported buffer without copying and reallocating the memory, permitting 
operations that can modify the underlying buffer's contents but not the 
allocation.

This is useful when working with many small pieces of one very large underlying 
buffer that you do not want to copy, when desiring to work with different parts 
of it with different types, and as part of a way to work with shared memory in 
multiple processes.

I will shortly have a PR for this, including updates for the documentation and 
unit tests.

 - Modules/arraymodule.c already must check if the array object has exported a 
buffer for methods that might resize. If the array was constructed from an 
imported buffer, the same restrictions apply.  So the object just needs to know 
whether it is constructed from a Py_Buffer or not and check in the same places 
it checks for the export count being nonzero. So the code doesn't need to be 
perturbed that much.

- Only MemoryView objects with contiguous layout, size, and alignment 
compatible with the data type of the array element are allowed.

- I'm proposing this is only for when it's an actual memoryview object, not 
just if the object can export buffers. This preserves more of the existing 
behavior.

- Currently you /can/ initialize an array with a type-compatible memoryview - 
but it makes a copy, iterating the elements and the types have to match, not 
just in size. We could maintain exact backward compatibility by adding an extra 
argument to array.array() or another letter to the format specifier; my current 
patch doesn't do this though.

---
Example of current behavior:

>>> import array
>>> x = array.array('b', [1,2,3,4])
>>> y = memoryview(x)
>>> z = array.array('b', y)
>>> z
array('b', [1, 2, 3, 4])
>>> z[0] = 42
>>> x
array('b', [1, 2, 3, 4])
>>> z
array('b', [42, 2, 3, 4])
 # x and z are backed by different memory
>>> x.append(17)
Traceback (most recent call last):
  File "", line 1, in 
BufferError: cannot resize an array that is exporting buffers
 # this is because y is still a live object
>>> z.append(17)
 # it is really a copy, x and y are irrelevant to z
>>> z
array('b', [42, 2, 3, 4, 17])


Example of new behavior:

>>> import array
>>> x = array.array('b', [1,2,3,4])
>>> x
array('b', [1, 2, 3, 4])
>>> y = memoryview(x)
>>> z = array.array('b', y)
>>> z
array('b', [1, 2, 3, 4])
>>> z[0] = 42
>>> x
array('b', [42, 2, 3, 4])
>>> x.append(4)
Traceback (most recent call last):
  File "", line 1, in 
BufferError: cannot resize an array that is exporting buffers
>>> z.append(4)
Traceback (most recent call last):
  File "", line 1, in 
BufferError: cannot resize an array constructed from an imported buffer

--
components: Library (Lib)
messages: 367688
nosy: bjkeen
priority: normal
severity: normal
status: open
title: allow array.array construction from memoryview w/o copy
type: enhancement

___
Python tracker 

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



[issue40234] Disallow daemon threads in subinterpreters optionally.

2020-04-29 Thread Jesús Cea Avión

Change by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread jeffolsi10


jeffolsi10  added the comment:

I feel this should be in core.
I still don't understand why capitalize is supported and others do not.
snake case is very well defined. Issues like tabs and spaces are not relevant. 
can you show example that you have that dilemma?

To be honest I don't feel very strongly about it. I thought it would be cool to 
have native support for it as this is a small feature which isn't subject to 
changes thus shouldn't be break and has a lot of usage. I see many people 
implement it themselves with regex and other methods. 

Feel free to close this if I didn't convince you it.
I opened this because I thought it can help others.. I can live without this 
being supported in Python native.

--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-04-29 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 84724dd239c30043616487812f6a710b1d70cd4b by Dong-hee Na in branch 
'master':
bpo-1635741: Port _stat module to multiphase initialization (GH-19798)
https://github.com/python/cpython/commit/84724dd239c30043616487812f6a710b1d70cd4b


--

___
Python tracker 

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



[issue40438] Python 3.9 eval on list comprehension sometimes returns coroutines

2020-04-29 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> This can be closed, but for completeness, the test you ran didn't verify that 
> the bug was fixed. This is because the hard coded compile flags I gave in my 
> example seem to have changed in Python 3.9 (is this documented?). 

Yes, this is documented on What's New.

> Which does produce the correct output as expected. So, the issue can remain 
> closed. I am curious what the bug in 3.9.0a5 was though if you have any 
> speculations.

See issue 39562

--

___
Python tracker 

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



[issue40438] Python 3.9 eval on list comprehension sometimes returns coroutines

2020-04-29 Thread Jonathan Crall


Jonathan Crall  added the comment:

This can be closed, but for completeness, the test you ran didn't verify that 
the bug was fixed. This is because the hard coded compile flags I gave in my 
example seem to have changed in Python 3.9 (is this documented?). 

In python3.8 the compile flags I specified correspond to division, 
print_function, unicode_literals, and absolute_import. 

python3.8 -c "import __future__; print(__future__.print_function.compiler_flag 
| __future__.division.compiler_flag | __future__.unicode_literals.compiler_flag 
| __future__.absolute_import.compiler_flag)"


Results in: 221184


In Python 3.9 the same code results in: 3538944


I can modify the MWE to accommodate these changes: 

./python -c "import __future__; print(eval(compile('[i for i in range(3)]', 
mode='eval', filename='fo', flags=__future__.print_function.compiler_flag | 
__future__.division.compiler_flag | __future__.unicode_literals.compiler_flag | 
__future__.absolute_import.compiler_flag)))"


Which does produce the correct output as expected. So, the issue can remain 
closed. I am curious what the bug in 3.9.0a5 was though if you have any 
speculations.

--

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

I remain unconvinced, but I'm only one person. You might want to bring this up 
on python-ideas to see if it can get some more support.

But be aware this is going to have much less support that the recent PEP 616 
removeprefix/removesuffix discussion, which went on for weeks or months, and 
involved writing a PEP.

While the Wikipedia page you cite discusses how to convert a string of words 
into snake case, a PEP will require much more detail. Just a few off the top of 
my head: What happens to multiple space: does that become a single underscore, 
or multiple? Is all whitespace converted to underscores, including newlines and 
tabs?  Does it work if the string is already in CamelCase?

I also don't think swapcase or capitalize (plus some others) would be added 
today if they didn't already exist.

To me, this seems like something that belongs on PyPI (like 
https://pypi.org/project/stringcase/), and not in the standard library.

--

___
Python tracker 

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



[issue40328] Add tools for generating mappings_XX.h

2020-04-29 Thread Dong-hee Na


Dong-hee Na  added the comment:


New changeset 113feb3ec2b08948a381175d33b6ff308d24fceb by Dong-hee Na in branch 
'master':
bpo-40328: Add tool for generating cjk mapping headers (GH-19602)
https://github.com/python/cpython/commit/113feb3ec2b08948a381175d33b6ff308d24fceb


--

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread jeffolsi10


jeffolsi10  added the comment:

it can. This is why I'm asking this.
Consider APIs that return list of names in camelCase. You must convert the keys 
to snakeCase to create tables from it as it's bad practice to have capitalised 
letters in columns or table names.

Further more, consider someone who wants to create tests to make sure all 
developers used snakeCase for function names. There are many many use cases.

You can also see the examples in stackoverflow that I posted. 500 votes up and 
there are many more.

Again I think this is totally in the domain of capitalize, swapcase which we 
already have. I think that snakeCase has way more use cases than capitalize.

--

___
Python tracker 

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



[issue40217] The garbage collector doesn't take in account that objects of heap allocated types hold a strong reference to their type

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Please backport to 3.8, then it will become part of 3.8.3rc1 which I'll be 
> releasing tomorrow.

I propose to *not* fix this bug in Python 3.8:

* Python 3.8 stdlib doesn't seem to be impacted by this bug
* The number of third party C extension modules impated by this bug is very low 
or even zero
* The bug severity is minor *in practice*
* A backport can cause a C extension to crash
* The implementation may still change before Python 3.9.0 final release

--

The worst thing which can happen with this bug is that a C extension module 
creates many types and these types are never deleted. Well, it's annoying, but 
it's unlikely to happen. Usually, types are created exactly once in C 
extensions.

--

I'm not 100% comfortable with backporting the fix. Python 3.8.0, 3.8.1 and 
3.8.2 have been released with the bug, and this issue is the first report. But 
I only saw the bug because many C extension modules of the Python 3.9 stdlib 
were converted to PyModuleDef_Init() and PyType_FromSpec().

--

I'm not comfortable to change the GC behavior in a subtle way in a 3.8.x minor 
release.

If a C extension module was impacted by this bug and decided to explicitly 
visit the type in its traverse function, this fix will crash the C extension 
crash...

--

At April 23, Serhiy proposed an alternative fix. But then he didn't propose a 
PR.

--

The bug only impacts C extension modules which use PyModuleDef_Init() and 
PyType_FromSpec().

Python 3.8 only uses PyModuleDef_Init() in the following modules:

vstinner@apu$ grep -l PyModuleDef_Init Modules/*.c
Modules/arraymodule.c
Modules/atexitmodule.c
Modules/binascii.c
Modules/_testmultiphase.c
Modules/xxlimited.c
Modules/xxmodule.c
Modules/xxsubtype.c

Python 3.8 only uses PyType_FromSpec() in the following modules:

$ grep -l PyType_FromSpec Modules/*.c
Modules/_curses_panel.c
Modules/_ssl.c
Modules/_testcapimodule.c
Modules/_testmultiphase.c
Modules/_tkinter.c
Modules/xxlimited.c

Intersection of the two sets: _testmultiphase and xxlimited, which are modules 
only used by the Python test suite.

It means that Python 3.8 standard library is *not* impacted by this bug.

Only third party C extension modules which use PyModuleDef_Init() *and* 
PyType_FromSpec() are impacted. Most C extension modules use statically 
allocated types and so are not impacted.

--

___
Python tracker 

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



[issue34990] year 2038 problem in compileall.py

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

I would prefer to mimick importlib._bootstrap_external which uses:

def _pack_uint32(x):
"""Convert a 32-bit integer to little-endian."""
return (int(x) & 0x).to_bytes(4, 'little')

Using 64-bit timestamp (PR 19651), treat timestamp as unsigned (PR 9892 and PR 
19708) have drawback:

* 64-bit timestamp make .pyc files larger
* unsigned timestamp no longer support timestamp before 1969 which can cause 
practical issues

"& 0x" looks dead simple, uses a fixed size of 4 bytes and doesn't have 
any limitation of year 2038.

The timestamp doesn't have to be exact. In practice, it sounds very unlikely 
that two timestamps are equal when compared using (ts1 & 0x) == (ts2 & 
0x). I expect file modification times to be close by a few days, not 
separated by 2**32 seconds (136 years).

Use hash based .pyc to avoid any issuse with file modification time: it should 
make Python more deterministic (more "reproducible").
https://docs.python.org/dev/reference/import.html#pyc-invalidation

--

___
Python tracker 

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



[issue39837] Make Azure Pipelines optional on GitHub PRs

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

> Otherwise there were so many posts I didn't find an explicit ask of what you 
> wanted changed, Victor.

I would like to make Azure Pipelines optional on GitHub PRs.

I changed the issue title to make my request more explicit.

--

___
Python tracker 

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



[issue40286] Add randbytes() method to random.Random

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

It removed the C implementation of randbytes(): it was the root issue which 
started discussions here and in bpo-40346. I rejected bpo-40346 (BaseRandom) 
and related PRs.

I close the issue.

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



[issue40286] Add randbytes() method to random.Random

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 2d8757758d0d75882fef0fe0e3c74c4756b3e81e by Victor Stinner in 
branch 'master':
bpo-40286: Remove C implementation of Random.randbytes() (GH-19797)
https://github.com/python/cpython/commit/2d8757758d0d75882fef0fe0e3c74c4756b3e81e


--

___
Python tracker 

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



[issue1635741] Py_Finalize() doesn't clear all Python objects at exit

2020-04-29 Thread Dong-hee Na


Change by Dong-hee Na :


--
pull_requests: +19119
pull_request: https://github.com/python/cpython/pull/19798

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-29 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

The TextIOWrapper uses an underlying BufferedWriter, which is thread-safe (and 
therefore has an internal lock).

--

___
Python tracker 

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



[issue40399] IO streams locking can be broken after fork() with threads

2020-04-29 Thread Delgan


Delgan  added the comment:

Yeah, I just wanted to illustrate the issue with a more realistic example. The 
thread is often abstracted away by a class or a library. Conclusion: do not 
abstract it away. :)

I've noticed that the mere fact of using "sys.stderr.write()", without even 
involving a queue, could cause the problem.

Out of curiosity: my understanding of "sys.stderr" being a "TextIOWrapper" 
implies it's not thread-safe. Therefore, do you have any idea of which lock is 
involved in this issue?

--

___
Python tracker 

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



[issue39837] Make Azure Pipelines optional on GitHub PRs

2020-04-29 Thread Brett Cannon


Brett Cannon  added the comment:

Best place to report workflow issues or to have discussions about it is 
https://github.com/python/core-workflow/. Otherwise there were so many posts I 
didn't find an explicit ask of what you wanted changed, Victor.

--

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Lysandros Nikolaou


Lysandros Nikolaou  added the comment:

What's also possible is to handle keywords at tokenizer level and return a 
different token type for each one of them (like with async and await), which is 
currently handled at parser level. This would enable us to allow reserved 
keywords right before a STRING token, thus covering all the possible broken 
code cases, but continue disallowing arbitrary NAMEs, which would mean better 
error-reporting in the case of invalid prefixes.

--

___
Python tracker 

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



[issue40346] Add random.BaseRandom to ease implementation of subclasses

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

I created this issue to propose PR 19631 (BaseRandom class) which looked like 
as a good idea to me: simple base class which fix different kind of problems.

But it seems like other people would prefer a complete rewrite from scratch and 
require a PEP.

I abandonned my BaseRandom PR #19631 and my PR 19700 since there is no clear 
consensus on these changes. I'm not interested to write a PEP to redesign the 
module random.

I also close this issue as rejected. If someone wants to enhance the random 
module, it seems like a PEP is needed: at least, please open a separated issue.

I wrote PR #19797 "Remove C implementation of Random.randbytes()" to address 
initial Raymond's concern on randbytes() implementation:
https://bugs.python.org/issue40286#msg366860

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



[issue40437] add string.snake function

2020-04-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

So then it appears the snake case function couldn't be used for database column 
names, without some additional processing. So, what is the use case for it?

I just don't see a lot of use for this.

--

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread jeffolsi10


jeffolsi10  added the comment:

I'd like also to point that there are few other cases:
https://stackoverflow.com/questions/11273282/whats-the-name-for-hyphen-separated-case

This is PascalCase: SomeSymbol
This is camelCase: someSymbol
This is snake_case: some_symbol

So a possible function could be:

convert_case(string, input_format, output_format)
for example:

convert_case(someSymbol, input_format='camelCase', output_format='snake_case')
output: some_symbol

It should be noted that you can not convert something without knowing what it 
is.
so something like : convert('helloworld','camelCase') can not be done because 
you don't know where one first word start and when one ends.

--

___
Python tracker 

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



[issue9216] FIPS support for hashlib

2020-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset e3dfb9b967c560f4d094092dcae4a16fc9634681 by Victor Stinner in 
branch 'master':
bpo-9216: Expose OpenSSL FIPS_mode() as _hashlib.get_fips_mode() (GH-19703)
https://github.com/python/cpython/commit/e3dfb9b967c560f4d094092dcae4a16fc9634681


--

___
Python tracker 

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



[issue40286] Add randbytes() method to random.Random

2020-04-29 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19118
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/19797

___
Python tracker 

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



[issue40437] add string.snake function

2020-04-29 Thread jeffolsi10


jeffolsi10  added the comment:

snake case has very specific definition :
https://en.wikipedia.org/wiki/Snake_case
I expect the function to implement the definition and not something that I or 
someone else desire.

As for your question about '$' char I could ask the same thing for lower()
The snake case convert only letters and space. It doesn't handle spacial chars. 
it ignores them.

--

___
Python tracker 

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



[issue40228] Make setting line number in frame more robust.

2020-04-29 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 57697245e1deafdedf68e5f21ad8890be591efc0 by Mark Shannon in 
branch 'master':
bpo-40228: More robust frame.setlineno. (GH-19437)
https://github.com/python/cpython/commit/57697245e1deafdedf68e5f21ad8890be591efc0


--

___
Python tracker 

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



[issue40439] Error in an external reference

2020-04-29 Thread Patrick A.

New submission from Patrick A. :

This URL doesn't exist anymore. If you click on this URL you have a 404 not 
found.

https://www.dcl.hpi.uni-potsdam.de/home/loewis/table-3131.html

The website was changed and Dr. Martin v. Löwis is not hosted on the new site.

Regards

--
assignee: docs@python
components: Documentation
messages: 367665
nosy: audpa31, docs@python
priority: normal
severity: normal
status: open
title: Error in an external reference
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

___
Python tracker 

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



[issue40246] Different error messages for same error - invalid string prefixes

2020-04-29 Thread Eric V. Smith


Eric V. Smith  added the comment:

I think you're right, since rb obviously works, too. I just wanted to make sure 
we're covering all the bases. There's some code in either the stdlib or the 
test suite where I generate all of the valid prefixes (it's something like 80 
prefixes). I can dig it up if anyone needs it.

--

___
Python tracker 

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



[issue40436] pythoninfo collect_gdb() blows up when gdb fails to run

2020-04-29 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks Miro for the bug report, it's now fixed ;-)

In PR 19792, Miro proposed to skip test_gdb is gdb is available but exit with 
non-zero exit code. I chose to raise a hard exception instead, to notify CI 
owners that something is wrong. I prefer to not make gdb error "silent". 
Otherwise, we may miss that python-gdb.py is no longer tested on a CI.

--

___
Python tracker 

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



[issue40436] pythoninfo collect_gdb() blows up when gdb fails to run

2020-04-29 Thread miss-islington


miss-islington  added the comment:


New changeset beba1a808000d5fc445cb28eab96bdb4cdb7c959 by Miss Islington (bot) 
in branch '3.7':
bpo-40436: Fix code parsing gdb version (GH-19792)
https://github.com/python/cpython/commit/beba1a808000d5fc445cb28eab96bdb4cdb7c959


--

___
Python tracker 

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



  1   2   >