[issue39481] Implement PEP 585 (Type Hinting Generics In Standard Collections)

2020-03-16 Thread Łukasz Langa

Łukasz Langa  added the comment:

Submitted a request for consideration by the Steering Council: 
https://github.com/python/steering-council/issues/21

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> So 3.8 branch + 9ad58acbe8b90b4d0f2d2e139e38bb5aa32b7fb6 + 
> 4d96b4635aeff1b8ad41d41422ce808ce0b971c8 is working for me.

I can confirm that these commits together fix the problem.

Victor, are you OK if we backport both changes to 3.8?

--

___
Python tracker 

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Can you try applying 4f384af067d05b16a554bfd976934fca9f87a1cf and 
4d96b4635aeff1b8ad41d41422ce808ce0b971c8 together?

--

___
Python tracker 

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Oh, sorry, I missed your last message.

--

___
Python tracker 

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-03-16 Thread Arkadiusz Miśkiewicz

Arkadiusz Miśkiewicz  added the comment:

This one is also needed on 3.8 to get it not hang with 1) test case.

So 3.8 branch + 9ad58acbe8b90b4d0f2d2e139e38bb5aa32b7fb6 + 
4d96b4635aeff1b8ad41d41422ce808ce0b971c8 is working for me.

commit 4d96b4635aeff1b8ad41d41422ce808ce0b971c8
Author: Victor Stinner 
Date:   Sat Feb 1 02:30:25 2020 +0100

bpo-39511: PyThreadState_Clear() calls on_delete (GH-18296)

PyThreadState.on_delete is a callback used to notify Python when a
thread completes. _thread._set_sentinel() function creates a lock
which is released when the thread completes. It sets on_delete
callback to the internal release_sentinel() function. This lock is
known as Threading._tstate_lock in the threading module.

The release_sentinel() function uses the Python C API. The problem is
that on_delete is called late in the Python finalization, when the C
API is no longer fully working.

The PyThreadState_Clear() function now calls the
PyThreadState.on_delete callback. Previously, that happened in
PyThreadState_Delete().

The release_sentinel() function is now called when the C API is still
fully working.

--

___
Python tracker 

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



[issue39977] Python aborts trying to load libcrypto.dylib

2020-03-16 Thread foldr


New submission from foldr :

Good morning.

I recently updated my system to MacOS Catalina and python crashes if it tries 
to load libcrypto.dylib. I have attached the crash report generated by MacOS.

Steps to reproduce:

Calling a binary that loads the library causes the crash:
$ luigi
[1]70375 abort  luigi
$ dex2call
[1]70451 abort  dex2call

Loading the library from the interpreter triggers the crash too:

$ python
Python 3.7.6 (default, Dec 30 2019, 19:38:28)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dex2call
[1]70536 abort  python

I have tested with https://pypi.org/project/luigi/ and 
https://pypi.org/project/dex2call/.

Invoking python without any script or with (I suppose) a script that does not 
require libcrypto works fine:

$ python
Python 3.7.6 (default, Dec 30 2019, 19:38:28)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ python ~/scripts/yt2nb.py
Traceback (most recent call last):
  File "/Users/foldr/scripts/yt2nb.py", line 6, in 
e = xml.etree.ElementTree.parse(sys.argv[1]).getroot()
IndexError: list index out of range

The content of yt2nb.py is:
 
#!/usr/bin/env python3

import xml.etree.ElementTree
import sys

e = xml.etree.ElementTree.parse(sys.argv[1]).getroot()
for outline in e.iter('outline'):
if "type" in outline.attrib and outline.attrib["type"] == "rss":
url = outline.attrib['xmlUrl']
name = outline.attrib['title']#.encode("utf-8")
print("%s youtube \"~%s\"" % (url, str(name)))

I have Python installed from brew and the crash report has all the relevant 
version numbers.

Let me know if you need more information for testing or reproducibility.

Thank you.
Daniel.

--
components: macOS
files: python-crash.txt
messages: 364306
nosy: foldr, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Python aborts trying to load libcrypto.dylib
type: crash
versions: Python 3.7
Added file: https://bugs.python.org/file48976/python-crash.txt

___
Python tracker 

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



[issue36287] Make ast.dump() not output optional default fields

2020-03-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

@serhiy.storchaka, with these ASDL signatures, I have a patch that would omit 
default values for both Nones and [] in case they are redundant. But this is a 
bit different than your approach so I wanted to ask what's your opinion about 
adding an extra argument called omit_defaults, and only omit defaults it 
present. I'm adding this because unlike your first patch, these aren't actually 
defaults when creating the objects (like ast.Module(body=[x]) != 
ast.Module(body=[x], type_ignores=[])) so doing anything other than looking to 
that representation would be different than the actual result. What're your 
opinions about this? (I'm submitting the initial version of the patch before 
doing a PR)

--
Added file: https://bugs.python.org/file48975/ast.patch

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread Bruce Merry


Bruce Merry  added the comment:

> static_buffers is not a static variable. It is auto local variable.
> So I think other thread don't hijack it.

Oh yes, quite right. I should have looked closer at the code first before 
commenting. I think this can be closed as not-a-bug, unless +tzickel has 
example code that gives the wrong output?

> perhaps add an if to check if the backing object is really mutable ? 
> (Py_buffer.readonly)

It's not just the buffer data being mutable that's an issue, it's the owning 
object. It's possible for an object to expose a read-only buffer, but also 
allow the buffer (including its size or address) to be mutated through its own 
API.

> Also, semi related, (dunno where to discuss it), would a good .join() 
> optimization be to add an optional length parameter, like .join(iterable, 
> length=10)

You could always open a separate bug for it, but I can't see it catching on 
given that one needs to modify one's code for it.

--

___
Python tracker 

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



[issue39879] Update language reference to specify that dict is insertion-ordered.

2020-03-16 Thread Furkan Önder

Furkan Önder  added the comment:

I sent pr. All tests passed successfully. If accepted, this will be my first 
contribution :)
https://github.com/python/cpython/pull/19027

--

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread Inada Naoki


Inada Naoki  added the comment:

>
>
>
> perhaps add an if to check if the backing object is really mutable ?
> (Py_buffer.readonly)
>
>

Py_buffer.readonly doesn't mean immutable.  You can create read only buffer
from bytearray too.

Current logic uses PyBytes_CheckExact.  It is safe and enough for most
cases.

--

___
Python tracker 

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



[issue39360] python3.8 regression - ThreadPool join via __del__ hangs forever

2020-03-16 Thread Arkadiusz Miśkiewicz

Arkadiusz Miśkiewicz  added the comment:

On master test 1) hangs before commit below and works after commit below. 
Unfortunately applying that commit to 3.8 branch doesn't help - 3.8 still 
hangs. Some other fix is also needed I guess

commit 9ad58acbe8b90b4d0f2d2e139e38bb5aa32b7fb6
Author: Victor Stinner 
Date:   Mon Mar 9 23:37:49 2020 +0100

bpo-19466: Py_Finalize() clears daemon threads earlier (GH-18848)

Clear the frames of daemon threads earlier during the Python shutdown to
call objects destructors. So "unclosed file" resource warnings are now
emitted for daemon threads in a more reliable way.

Cleanup _PyThreadState_DeleteExcept() code: rename "garbage" to
"list".

--

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread Inada Naoki


Inada Naoki  added the comment:

static_buffers is not a static variable. It is auto local variable.
So I think other thread don't hijack it.

--

___
Python tracker 

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



[issue39879] Update language reference to specify that dict is insertion-ordered.

2020-03-16 Thread Furkan Önder

Change by Furkan Önder :


--
nosy: +furkanonder
nosy_count: 4.0 -> 5.0
pull_requests: +18375
pull_request: https://github.com/python/cpython/pull/19027

___
Python tracker 

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



[issue39952] Using VS2019 to automatically build Python3 and it failed to build

2020-03-16 Thread Lin Gao


Lin Gao  added the comment:

Hi,

Thanks for your reply and info!

I've tried to use you provided --no-tkinter to re-build python3.6. And now 
There is only one error left. Have you encountered this problem? 

build -e -r --no-tkinter -v "/p:PlatformToolset=v142" 
"/p:WindowsTargetPlatformVersion=10.0.18362.0"

Error:
LINK : fatal error LNK1181: cannot open input file 
'Microsoft.VisualStudio.Setup.Configuration.Native.lib' [F:
   \gitP\python\cpython\PCbuild\_distutils_findvs.vcxproj]

--

___
Python tracker 

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



[issue39638] Keep ASDL signatures for AST nodes

2020-03-16 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue38938] Possible performance improvement for heaqq.merge()

2020-03-16 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Are there any algorithmic optimizations in the Python version or it was just 
rewritten from a generator function to a class? If yes, how hard to keep the 
functional design?

--

___
Python tracker 

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



[issue39638] Keep ASDL signatures for AST nodes

2020-03-16 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:


New changeset 4ab362cec6dc68c798b3e354f687cf39e207b9a9 by Batuhan Taşkaya in 
branch 'master':
bpo-39638: Keep ASDL signatures in the AST nodes (GH-18515)
https://github.com/python/cpython/commit/4ab362cec6dc68c798b3e354f687cf39e207b9a9


--

___
Python tracker 

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



[issue39976] Add "**other_popen_kwargs" to subprocess API signatures in docs

2020-03-16 Thread Nick Coghlan


New submission from Nick Coghlan :

Two of my colleagues missed the "The arguments shown above are merely the most 
common ones, ..." caveat on the subprocess.run documentation, and assumed that 
Python 3.5 only supported the "cwd" option in the low level Popen API, and not 
any of the higher level APIs.

Something we could potential do is include a "**other_popen_kwargs" placeholder 
in the affected API signatures (run, call, check_call, check_output) that makes 
it clear there are more options beyond the explicitly listed ones.

--
assignee: docs@python
components: Documentation
messages: 364295
nosy: docs@python, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add "**other_popen_kwargs" to subprocess API signatures in docs
type: enhancement
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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread tzickel


tzickel  added the comment:

Also, semi related, (dunno where to discuss it), would a good .join() 
optimization be to add an optional length parameter, like .join(iterable, 
length=10), and when running in that code-path, it would skip all the calls to 
(PySequence_Fast which converts no list to list), and all the pre calculation 
of length to calculate allocation size, and instead directly start copying from 
input until length is done, and if the iterable didn't have enough length to 
fill up, only then throw an exception ?

There are places where you know how much information you expect to be .joining 
(or you want to join just a part of it) ?

--

___
Python tracker 

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



[issue39975] Group of commands running in Python 3.7.6 Shell, but failing as Script file.

2020-03-16 Thread Noel del rosario


New submission from Noel del rosario :

Python 3.7.6 (tags/v3.7.6:43364a7ae0, Dec 19 2019, 00:42:30) [MSC v.1916 64 bit 
(AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

from future import absolute_import, division, print_function, unicode_literals
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow import keras
print(tf.version)
2.1.0

BUT IF I RUN THESE COMMANDS as a PYTHON SCRIPT FILE iy FAILS.
 RESTART: D:\PythonCode-1\tmp.py ===
Traceback (most recent call last):
File "D:\PythonCode-1\tmp.py", line 7, in
import tensorflow as tf
File "C:\Python37\lib\site-packages\tensorflow_init_.py", line 101, in
from tensorflow_core import *
File "C:\Python37\lib\site-packages\tensorflow_core_init_.py", line 40, in
from tensorflow.python.tools import module_util as _module_util
ModuleNotFoundError: No module named 'tensorflow.python.tools'; 
'tensorflow.python' is not a package

Why is it failing as a Script file ?
Is there something wrong in my Procedure ?

Hope to teceive your reply and Thanks in Advanced.

--
messages: 364293
nosy: rosarion
priority: normal
severity: normal
status: open
title: Group of commands running in Python 3.7.6 Shell, but failing as Script 
file.
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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread tzickel


tzickel  added the comment:

Also, in line:

https://github.com/python/cpython/blob/d07d9f4c43bc85a77021bcc7d77643f8ebb605cf/Objects/stringlib/join.h#L85

perhaps add an if to check if the backing object is really mutable ? 
(Py_buffer.readonly)

--

___
Python tracker 

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



[issue39972] Math library Bug Return None for "degrees(0)"

2020-03-16 Thread SilentGhost


Change by SilentGhost :


--
nosy: +Ion SKALAMERA
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue39972] Math library Bug Return None for "degrees(0)"

2020-03-16 Thread Hamid Nazari


Hamid Nazari  added the comment:

You seem to be calling `turtle.degrees()`, not `math.degrees()`.

Try this in your Repl.it: (which does not use cpython, rather it uses Skulpt)

import math
import turtle
print(turtle.degrees(0))
print(math.degrees(0))

--
nosy: +hamidnazari

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread Bruce Merry


Bruce Merry  added the comment:

Good catch! I'll take a look this week to see what makes sense for the use case 
for which I originally proposed this optimisation.

--

___
Python tracker 

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



[issue39972] Math library Bug Return None for "degrees(0)"

2020-03-16 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

math.degrees returns 0.0 and even has a test for this at 
https://github.com/python/cpython/blob/5b66ec166b81c8a77286da2c0d17be3579c3069a/Lib/test/test_math.py#L476
 . I am not sure of the environment under which repl.it runs as sys is not 
accessible. I guess it's an issue on their side.

./python.exe
Python 3.9.0a4+ (heads/master:5b66ec166b, Mar 16 2020, 10:41:43)
[Clang 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.degrees(0)
0.0

--
nosy: +xtreak

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread tzickel


Change by tzickel :


--
nosy: +bmerry, inada.naoki

___
Python tracker 

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



[issue39974] A race condition with GIL releasing exists in stringlib_bytes_join

2020-03-16 Thread tzickel


New submission from tzickel :

bpo 36051 added optimization to release GIL on certain conditions of bytes 
joining, but it has missed a critical path.

If the number of items joining is less or equal to NB_STATIC_BUFFERS (10) than 
static_buffers will be used to hold the buffers.

https://github.com/python/cpython/blob/5b66ec166b81c8a77286da2c0d17be3579c3069a/Objects/stringlib/join.h#L54

But then the decision to release the GIL or not (drop_gil) does not take this 
into consideration, and the GIL might be released and then another thread is 
free to do the same code path, and hijack the static_buffers for it's own 
usage, causing a race condition.

A decision should be made if it's worth for the optimization to not use the 
static buffers in this case (although it's an early part of the code...) or not 
drop the GIL anyhow if it's static buffers (a thing which might make this 
optimization not worth it, since based on length of data to join, and not 
number of items to join).

--
messages: 364288
nosy: tzickel
priority: normal
severity: normal
status: open
title: A race condition with GIL releasing exists in stringlib_bytes_join
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



<    1   2