[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



[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



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



[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



[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



[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


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



[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



[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



[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



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

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



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



[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



[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



[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



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

> 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



[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



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

2020-03-16 Thread Ido Michael


Ido Michael  added the comment:

Hey Eric,

I'm not sure what you mean, you don't recommend the change in general?
Or you just don't recommend Git for this and saying I should use Mercurial 
instead?

--

___
Python tracker 

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



[issue39939] Add str methods to remove prefixes or suffixes

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

The proposed change will affect many builtin types: bytes, bytearray, str, but 
also other types like collections.UserString. Would it make sense to summarize 
what has been said in the python-ideas thread into a PEP? It may good to 
specify things like:

>>> x = "A"*10**6
>>> x.cutprefix("B") is x
True

The specification can be just "that's an implementation detail" or "CPython 
implementation specific" :-)

I don't expect such PEP to be long nor controversial, but it may help to write 
it down.

--

___
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 Ma Lin


Ma Lin  added the comment:

I also planned to review this commit at some moment, I feel a bit unsteady 
about it.

If an optimization needs to be fine-tuned, and may introduces some pitfalls for 
future code maintenance, IMHO it is best to avoid doing this kind of 
optimization.

--
nosy: +Ma Lin

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f707d94af68a15afc27c1a9da5835f9456259fea by Hai Shi in branch 
'master':
bpo-39968: Convert extension modules' macros of get_module_state() to inline 
functions (GH-19017)
https://github.com/python/cpython/commit/f707d94af68a15afc27c1a9da5835f9456259fea


--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

There are multiple good reasons to replace macros with static inline functions:

* Parameter types and return value are well defined
* Less error-prone: avoid completely 
https://gcc.gnu.org/onlinedocs/gcc-9.3.0/cpp/Macro-Pitfalls.html#Macro-Pitfalls
* Variables have a well defined scope, reduce the risk of unexpected side 
effects

I merged the PR 19017: it uses better names for the function and it adds 
assert(state != NULL).

Be careful of bpo-39824: in some cases, the module state *can* be NULL: but I 
checked, and it's not the case here. Moreover, bpo-39824 may prevent NULL 
module state (let's see ;-)).

Thanks Hai Shi!


> minor disadvantage in code generation

Micro-benchmarks and machine code analysis was done in previous issues 
replacing macros with static inline functions, and the outcome is that there is 
no effect on performance. See for example bpo-35059: performance critical 
Py_INCREF() and Py_DECREF() functions are now static inline functions.

If someone is curious about the the machine code, you should use -O3 with 
PGO+LTO, which is what should be used on Linux distributions. If static inline 
functions are not inlined for whatever reason, I suggest to tune the compiler 
rather than moving back to ugly macros.

If you use configure --enable-shared, I now also strongly suggest to use 
-fno-semantic-interposition: it's now used on Fedora and RHEL to build Python 
libpython.

Note: Support for "static inline" is now explicitly required by the PEP 7 to 
build Python, since Python 3.6. And it's more and more used in Python header 
files.

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

Note: Hai Shi is working hard on converting modules to multiphase module 
initialization (PEP 489) which helps to cleanup the Python state at exit, and 
subinterpreters will likely benefit of that. This issue is related to this work.

--

___
Python tracker 

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



[issue39824] Multi-phase extension module (PEP 489): don't call m_traverse, m_clear nor m_free before the module state is allocated

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

I updated PR 18738 to document the incompatible change in What's New In Python 
3.9. Sadly, I expect that almost no third-party extension module implement the 
PEP 489 yet. So I expect that little or no third-party code is impacted in 
pratice.


> the module slots are then only needed if the module state actually gets 
> populated, so we can safely skip them if it never even gets allocated

That's also my understanding.

> custom module subclasses should clean up like any other class instance

That sounds like a reasonable compromise to me.

--

___
Python tracker 

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



[issue39892] Enable DeprecationWarnings by default when not explicit in unittest.main()

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



[issue38856] asyncio ProactorEventLoop: wait_closed() can raise ConnectionResetError

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



[issue39954] test_subprocess: test_specific_shell() fails on AMD64 FreeBSD Shared 3.x

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

Do you suggest to skip the test if returncode has a specific value?

--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, I forgot a cool advantage that I discovered late: debuggers and profilers 
understand inlined code and are able to get the name of the static inline 
function, whereas it's not possible to do that with macros. If I recall 
correctly, it works even if the function is inlined.

--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread hai shi


hai shi  added the comment:

Wow, thanks, victor. those msgs is very helpful to me.

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset c98f87fc330eb40fbcff627dfc50958785a44f35 by Dong-hee Na in branch 
'master':
bpo-37207: Use _PyArg_CheckPositional() for tuple vectorcall (GH-18986)
https://github.com/python/cpython/commit/c98f87fc330eb40fbcff627dfc50958785a44f35


--

___
Python tracker 

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



[issue39970] Combined behavior of datetime.datetime.timestamp() and datetime.datetime.utcnow() on non-UTC timezoned machines

2020-03-16 Thread Paul Ganssle


Paul Ganssle  added the comment:

@Yi Luan

I think you may misunderstand what the `.timestamp()` function does - it 
returns an epoch time, which is the amount of time (in seconds) elapsed since 
the Unix epoch: https://en.wikipedia.org/wiki/Unix_time

The number is not different depending on your time zone:

>>> from datetime import *
>>> from dateutil import tz

>>> dt = datetime(2019, 1, 1, tzinfo=timezone.utc)
>>> print(f"{dt}: {dt.timestamp()}")
2019-01-01 00:00:00+00:00: 1546300800.0

>>> dt = dt.astimezone(tz.gettz("America/New_York"))
>>> print(f"{dt}: {dt.timestamp()}")
2018-12-31 19:00:00-05:00: 1546300800.0

>>> dt = dt.astimezone(tz.gettz("Asia/Tokyo"))
>>> print(f"{dt}: {dt.timestamp()}")
2019-01-01 09:00:00+09:00: 1546300800.0

Note how the timestamp number is always the same.

Alexander's suggestion of using `datetime.now(tz=timezone.utc).timestamp()` is 
slightly misleading because `datetime.now().timestamp()` and 
`datetime.now(tz=timezone.utc).timestamp()` will always return the same value. 
I think he was just using that as shorthand for "replace datetime.utcnow() with 
datetime.now(tz=timezone.utc) in all cases".

When you have a naive datetime (with no tzinfo), the only options are to pick 
the time zone it represents and convert to UTC or to throw an error and say, 
"We don't know what time zone this represents, so we cannot do this operation." 
Python 2 used to throw an exception, but in Python 3 naive datetimes represent 
local times.

If you want "nominal number of seconds since 1970-01-01T00:00:00 *in this time 
zone*", you want something more like this:

  def seconds_since(dt, epoch=datetime(1970, 1, 1)):
return (dt.replace(tzinfo=None) - epoch).total_seconds()

That does not take into account total elapsed time from DST transitions and the 
like - to do that, you'll want something more like this:

  def seconds_elapsed_since(dt, epoch=datetime(1970, 1, 1)):
if epoch.tzinfo is None and dt.tzinfo is not None:
epoch = epoch.replace(tzinfo=dt.tzinfo)
return (dt - epoch).total_seconds()

I urge you not to do this in any sort of interop protocol, though, because 
integer timestamps are traditionally interpreted as Unix times, and if you 
start passing around an integer timestamp that represents "unix time plus or 
minus a few hours", you are likely to create bugs when someone mistakes it for 
a unix time.

--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b by Dong-hee Na in branch 
'master':
bpo-37207: Add _PyArg_NoKwnames() helper function (GH-18980)
https://github.com/python/cpython/commit/87ec86c425a5cd3ad41b831b54c0ce1a0c363f4b


--

___
Python tracker 

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



[issue39978] Vectorcall implementation should conform to PEP 590.

2020-03-16 Thread Mark Shannon


New submission from Mark Shannon :

The implementation of `PyObject_Vectorcall` adds unnecessary overhead to PEP 
590, which undermines its purpose.
The implementation was changed in https://github.com/python/cpython/pull/17052, 
which I objected to at the time.

The change has a negative impact on performance as it add calls to both 
`PyThreadState_GET()` and `_Py_CheckFunctionResult()`.

This is practically an invitation for callers to skip `PyObject_Vectorcall` and 
access the underlying function pointer directly, making `PyObject_Vectorcall` 
pointless.

https://github.com/python/cpython/pull/17052 should be reverted.

--
keywords: 3.9regression
messages: 364325
nosy: Mark.Shannon, petr.viktorin, vstinner
priority: normal
severity: normal
status: open
title: Vectorcall implementation should conform to PEP 590.
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



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

2020-03-16 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

Actually I have a better solution for this (which I hope to share really soon 
if it works.) I think we can do default value initialization for both Nones 
(with your patch) and lists, it requires a bit of extra work but  I think I can 
do it.

--

___
Python tracker 

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



[issue39978] Vectorcall implementation should conform to PEP 590.

2020-03-16 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

> cpython/Modules/readline.c:90:20: error: unknown type name
  'PyModule'
get_readline_state(PyModule *module)

Compile is failure after PR 19017 is merged on macOS.

--
nosy: +corona10

___
Python tracker 

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



[issue36078] argparse: positional with type=int, default=SUPPRESS raise ValueError

2020-03-16 Thread Tomáš Jeziorský

Tomáš Jeziorský  added the comment:

I found what appears to be a very similar issue so instead of creating a new 
issue I will place it here as a comment.

The following code:

==
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('letter', choices=['a', 'b', 'c'], 
default=argparse.SUPPRESS, nargs='?')
args = parser.parse_args([])
==

results in this error:

==
usage: pok.py [-h] [{a,b,c}]
pok.py: error: argument letter: invalid choice: '==SUPPRESS==' (choose from 
'a', 'b', 'c')
==

--
nosy: +jeyekomon

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

See also: https://github.com/python/cpython/runs/509226542#step:4:305

--

___
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-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 356c878fbf2a97aa3ab7951fd7456d219ff0b466 by Dong-hee Na in branch 
'master':
bpo-1635741: Port _statistics module to multiphase initialization (GH-19015)
https://github.com/python/cpython/commit/356c878fbf2a97aa3ab7951fd7456d219ff0b466


--

___
Python tracker 

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



[issue39978] Vectorcall implementation should conform to PEP 590.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

> The change has a negative impact on performance

How did you notice the slowdown? I ran benchmarks in 
https://github.com/python/cpython/pull/17052 and I didn't notice any 
performance overhead.

--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread Dong-hee Na


Dong-hee Na  added the comment:

I reopen this issue for the above problem

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

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread hai shi


Change by hai shi :


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

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread hai shi


hai shi  added the comment:

> See also: https://github.com/python/cpython/runs/509226542#step:4:305
Oh, thanks, Dong-hee Na. I create a PR for this typo error.

--

___
Python tracker 

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



[issue39979] Cannot tune scrypt with large enough parameters

2020-03-16 Thread Gle


New submission from Gle :

I can use scrypt KDF with the cryptography module
https://cryptography.io/en/latest/hazmat/primitives/key-derivation-functions/#cryptography.hazmat.primitives.kdf.scrypt.Scrypt
with large parameters (n=2**20, r=16, p=1)

On the other hand, using scrypt KDF from hashlib with the same parameters 
yields "Invalid combination of n, r, p, maxmem" (I use maxmem=0).

Shouldn't they behave the same ? As they both seem to be wrappers around 
OpenSSL ?

I've also included a set of functioning parameters as hashlib's scrypt works 
fine on small parameter values.

Notice that the output from hashlib's scrypt is different than the output from 
the cryptography module. Shouldn't they be the same ? (I'm no cryptography 
expert)

I would really like to be able to use scrypt for hardened password hashing 
using only python standard library's hashlib. Maybe I'm missing something ?

Python is great ! Thanks for all the good work !

--
components: Library (Lib)
files: compare.py
messages: 364334
nosy: Gle, christian.heimes, gregory.p.smith
priority: normal
severity: normal
status: open
title: Cannot tune scrypt with large enough parameters
type: crash
versions: Python 3.8
Added file: https://bugs.python.org/file48977/compare.py

___
Python tracker 

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



[issue36078] argparse: positional with type=int, default=SUPPRESS raise ValueError

2020-03-16 Thread paul j3


paul j3  added the comment:

You are right, this part of the same issue.

_get_value() tests '==SUPPRESS==' both for type and choices.

--

___
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 Ned Deily


Ned Deily  added the comment:

The crash report gives the reason for the crash:

Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as 
it does not have a stable ABI.

This means something you are importing is trying to access the deprecated macOS 
system version of OpenSSL's libcrypto and not a newer, third-party version 
supplied in this case by Homebrew.

Try importing _hashlib directly in the interpreter:

>>> import _hashlib

If you see the error then, you know that your Python installation has been 
built and linked incorrectly with the system OpenSSL libraries.  If not, then 
almost certainly a third-party package installed with this Pyrhon instance was 
built incorrectly and is trying to link to the system libcryto.  In either 
case, you should try re-installing those items using their latest versions.  
Good luck!

--
resolution:  -> third party
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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f6a58507820c67e8d0fb07875cd1b1d9f5e510a8 by Victor Stinner in 
branch 'master':
bpo-35370: PyEval_SetTrace() logs unraisable error (GH-18977)
https://github.com/python/cpython/commit/f6a58507820c67e8d0fb07875cd1b1d9f5e510a8


--

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +18378
pull_request: https://github.com/python/cpython/pull/19029

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

My mistake...

--
resolution:  -> not a bug

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5f104d56fa10f88098338b3f1ea74bcbe6924ca9 by Hai Shi in branch 
'master':
bpo-39968: Fix a typo error in get_readline_state() (GH-19028)
https://github.com/python/cpython/commit/5f104d56fa10f88098338b3f1ea74bcbe6924ca9


--

___
Python tracker 

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



[issue37207] Use PEP 590 vectorcall to speed up calls to range(), list() and dict()

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6ff79f65820031b219622faea8425edaec9a43f3 by Dong-hee Na in branch 
'master':
bpo-37207: Use PEP 590 vectorcall to speed up set() constructor (GH-19019)
https://github.com/python/cpython/commit/6ff79f65820031b219622faea8425edaec9a43f3


--

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

> As a note, the original request was for a Python-level tracing function (so 
> that in the future other Python implementations also provide that function) 
> -- does this need a PEP?

What do you mean by a Python-level tracing function?

--

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 046255c40fc0d9c5a4c528eb5955792fa08df66f by Victor Stinner in 
branch '3.8':
bpo-35370: PyEval_SetTrace() logs unraisable error (GH-18977) (GH-19029)
https://github.com/python/cpython/commit/046255c40fc0d9c5a4c528eb5955792fa08df66f


--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

> Compile is failure after PR 19017 is merged on macOS.

Oh, macOS job was marked as success on PR 19017 :-(
https://github.com/python/cpython/runs/509226542

But I confirm that I can read there:

"""
Failed to build these modules:
_tkinter  readline 
"""

--

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

>> As a note, the original request was for a Python-level tracing function (so 
>> that in the future other Python implementations also provide that function) 
>> -- does this need a PEP?

> What do you mean by a Python-level tracing function?

I mean that it's a function to be called from Python (not only from C) -- which 
hopefully could be adopted by other Python implementations in the long run. 

I.e.: something as adding a thread_id to sys.settrace -- 
sys.settrace(trace_func, thread_id=None).

--

___
Python tracker 

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



[issue25024] Allow passing "delete=False" to TemporaryDirectory

2020-03-16 Thread Anthony Sottile


Anthony Sottile  added the comment:

I would certainly like to see this, it would eliminate my last few hand rolled 
temporary directory contexts

Mauro would you be interested in re-posting this patch as a PR to github? (or 
allowing someone else to carry your patch forward?)

--
nosy: +Anthony Sottile

___
Python tracker 

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



[issue37695] Incorrect error message for `unget_wch(bytes_object)`

2020-03-16 Thread Anthony Sottile


Change by Anthony Sottile :


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



[issue36478] backport of pickle fixes to Python 3.5.7 uses C99 for loops

2020-03-16 Thread Anthony Sottile


Change by Anthony Sottile :


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



[issue39971] Error on documentation - Quick fix.

2020-03-16 Thread Diogo Flores


Diogo Flores  added the comment:

Agreed, Eric. Nevertheless, I think that this example might raise unnecessary 
confusion to someone new to Python, and hence the reason why I decided to open 
the issue. Anyhow, I trust your judgement and please feel free to leave things 
as is and close this issue.

PS: I really the work you did with dataclasses, and I actually explored the 
idea further with a small (300 LoC) library that adds runtime type checking for 
instances of dataclasses - if you are ever curious you can find the code on my 
GitHub at /dxflores/invis.

Thank you,
Diogo

--

___
Python tracker 

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



[issue35312] lib2to3.pgen2.parse.ParseError is not roundtrip pickleable

2020-03-16 Thread Anthony Sottile


Change by Anthony Sottile :


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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread hai shi


hai shi  added the comment:

> Oh, macOS job was marked as success on PR 19017 :-(

yeah, it's weird. This macOS job should be enhanced?

--

___
Python tracker 

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



[issue39824] Multi-phase extension module (PEP 489): don't call m_traverse, m_clear nor m_free before the module state is allocated

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think Cython makes use of PEP-489 so unless I am missing something all 
generated extensions use PEP-489 structures.

--

___
Python tracker 

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



[issue39968] port extension modules' macros of `get_module_state()` to inline function.

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

> This macOS job should be enhanced?

setup.py skips optional dependencies like readline on purpose.

readline is built again onx86-64 macOS 3.x buildbot worker and test_readline 
passed. I close the issue.

Thanks for the quick fix.

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



[issue37860] Add deploy preview for docs

2020-03-16 Thread Brett Cannon


Change by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

> I.e.: something as adding a thread_id to sys.settrace -- 
> sys.settrace(trace_func, thread_id=None).

What is the use case for this feature?

It seems quite complicated to implement the thread_id for 
sys.settrace(trace_func, thread_id=None).

Currently, there is no way for a thread to execute code directly in another 
thread. In asyncio, it has to through call_soon_threadsafe() which queues the 
function calls and the function is called "later" and the caller doesn't get 
the result.

https://docs.python.org/dev/library/asyncio-eventloop.html#asyncio.loop.call_soon_threadsafe

sys.setprofile() and sys.settrace() use the current Python thread state 
(tstate). The threading.enumerate() function returns threading.Thread 
instances, but it's not currently possible to get the Python thread state (C 
structure PyThreadState) from a Python threading.Thread object.

At the C level, Python doesn't maintain a list of thread. There is only 
threading.enumerate() which is implemented in Python.

PyDev.Debugger seems to use the C API. Can it continue to use the C API?

Note: There is threading.setprofile() and threading.settrace() which set a 
profile/trace function when *new* threads are spawned.

--

___
Python tracker 

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



[issue39656] shebanged scripts can escape from `venv` depending on how it was created

2020-03-16 Thread Anthony Sottile


Change by Anthony Sottile :


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

___
Python tracker 

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



[issue39959] (Possible) bug on multiprocessing.shared_memory

2020-03-16 Thread Jeff Fischer


Jeff Fischer  added the comment:

I've run into the same problem. It appears that the SharedMemory class is 
assuming that all clients of a segment are child processes from a single 
parent, and that they inherit the same resource_tracker. If you run separate, 
unrelated processes, you get a separate resource_tracker for each process. 
Then, when a process does a close() followed by a sys.exit(), the resource 
tracker detects a leak and unlinks the segment.

In my application, segment names are stored on the local filesystem and a 
specific process is responsible for unlinking the segment when it is shut down. 
I was able to get this model to work with the current SharedMemory 
implementation by having processes which are just doing a close() also call 
resource_tracker.unregister() directly to prevent their local resource trackers 
from destroying the segment.

I imagine the documentation needs some discussion of the assumed process model 
and either: 1) a statement that you need to inherit the resource tracker from a 
parent process, 2) a blessed way to call the resource tracker to manually 
unregister, or 3) a way to disable the resource tracker when creating the 
SharedMemory object.

--
nosy: +jfischer

___
Python tracker 

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



[issue39980] importlib.resources.path() may return incorrect path when using custom loader

2020-03-16 Thread Krzysztof Rusek


New submission from Krzysztof Rusek :

importlib.resources.path() function may return a path to a file with different 
contents than expected. This may happen when using a custom loader 
implementation that uses fake filenames (like '').

I'm attaching a reproduction test (resources.py).

--
components: Library (Lib)
files: resources.py
messages: 364352
nosy: Krzysztof Rusek
priority: normal
severity: normal
status: open
title: importlib.resources.path() may return incorrect path when using custom 
loader
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48978/resources.py

___
Python tracker 

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



[issue35370] Add _PyEval_SetTrace(tstate, func, arg) function

2020-03-16 Thread Fabio Zadrozny


Fabio Zadrozny  added the comment:

>> I.e.: something as adding a thread_id to sys.settrace -- 
>> sys.settrace(trace_func, thread_id=None).

> What is the use case for this feature?

The use case is having the user attach the debugger (either programmatically or 
by doing an attach to process) and be able to debug all threads, not just the 
current thread.

> It seems quite complicated to implement the thread_id for 
> sys.settrace(trace_func, thread_id=None).

Humm, isn't it just a matter of passing the proper tstate to _PyEval_SetTrace? 
It seems reasonably simple to do at C (i.e.: iterate the existing thread states 
to get the thread id and then pass the proper tsate to _PyEval_SetTrace -- 
which is roughly what is done in the debugger, although it's a bit more 
complicated because it supports Python 2.7 up to Python 3.8...).

> At the C level, Python doesn't maintain a list of thread. There is only 
> threading.enumerate() which is implemented in Python.

The tstate does contain the thread id, so, iterating the available tstates 
should be enough for that.

> PyDev.Debugger seems to use the C API. Can it continue to use the C API?

It can for CPython, but it can't for other Python implementations (and ideally 
I'd like to rely less on the CPython C-API -- because there's too much 
implementation details on it, things seem to break at each new version).

> Note: There is threading.setprofile() and threading.settrace() which set a 
> profile/trace function when *new* threads are spawned

Yes, I know about those, but it's not enough if the user attaches the debugger 
after the process is already running.

--

___
Python tracker 

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



[issue39980] importlib.resources.path() may return incorrect path when using custom loader

2020-03-16 Thread Krzysztof Rusek


Krzysztof Rusek  added the comment:

Maybe importlib.resources.path() should skip checking file existence when 
ResourceReader.resource_path() raises FileNotFoundError? Current logic:

@contextmanager
def path(package: Package, resource: Resource) -> Iterator[Path]:
resource = _normalize_path(resource)
package = _get_package(package)
reader = _get_resource_reader(package)
if reader is not None:
try:
yield Path(reader.resource_path(resource))
return
except FileNotFoundError:
pass
else:
_check_location(package)
# Fall-through for both the lack of resource_path() *and* if
# resource_path() raises FileNotFoundError.
package_directory = Path(package.__spec__.origin).parent
file_path = package_directory / resource
if file_path.exists():
yield file_path
else:


--

___
Python tracker 

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



[issue39981] Default values for AST Nodes

2020-03-16 Thread Batuhan Taskaya


New submission from Batuhan Taskaya :

For omitting some defaults, @serhiy.storchaka already added support to 
initialize some ast nodes with some default values (optional fields). An 
example;
>>> ast.Constant().kind is None
True

This isn't exactly a default value, but some kind of class attribute. I think 
we can push this one step further and initialize all kinds of default values 
(both optionals and sequences). An example;
>>> func = ast.FunctionDef("easy_func", ast.arguments(), body=[ast.Pass()])
>>> func = ast.fix_missing_locations(func)
>>> exec(compile(ast.Module(body=[func]), "", "exec"))
>>> easy_func()

compared to this (other way around, compiler gives errors so does most of the 
ast based tool, including ast.unparser)
>>> func = ast.FunctionDef("easy_func", ast.arguments(posonlyargs=[], args=[], 
>>> kwonlyargs=[], kw_defaults=[], defaults=[]), decorator_list=[], 
>>> body=[ast.Pass()])
>>> func = ast.fix_missing_locations(func)
>>> exec(compile(ast.Module(body=[func], type_ignores=[]), "", "exec"))
>>> easy_func()

--
components: Library (Lib)
messages: 364355
nosy: BTaskaya, benjamin.peterson, pablogsal, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Default values for AST Nodes
type: enhancement
versions: Python 3.9

___
Python tracker 

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



[issue39981] Default values for AST Nodes

2020-03-16 Thread Batuhan Taskaya


Change by Batuhan Taskaya :


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

___
Python tracker 

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



[issue26067] test_shutil fails when gid name is missing

2020-03-16 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +18381
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/19032

___
Python tracker 

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



[issue26067] test_shutil fails when gid name is missing

2020-03-16 Thread Matthias Braun


Matthias Braun  added the comment:

I have the same issue on my work macbook which has some form of network login 
configured. The primary group id of my user account there cannot be found in 
the group database and cannot be resolved to a name.

I'm not sure why that is but I am pretty sure there is no obligation that a gid 
must be resolvable to a name. I submitted a PR to just skip the last part of 
the test_shutil/chown if the uid/gid cannot be resolved to a name.

--
nosy: +Matthias Braun

___
Python tracker 

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



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

2020-03-16 Thread Éric Araujo

Éric Araujo  added the comment:

Yes, I recommend against this change.  Sorry for the time already spent :(

(I only named Mercurial because python-dev used it before, so I was comparing 
the behaviour of the two tools)

--

___
Python tracker 

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



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

2020-03-16 Thread Zachary Ware


Zachary Ware  added the comment:

I'm personally still in favor of the change.  This wouldn't be the first big 
movement of files in our repo and likely not the last, and I don't think 
git/GitHub's support (or lack thereof) for file moves is a good enough reason 
to not organize things better.

--

___
Python tracker 

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



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

2020-03-16 Thread Ned Deily


Ned Deily  added the comment:

> some vendors like to leave out the tests and not having them all under 'test' 
> prevents that from working cleanly

Yeah, but presumably all the major distributors have long ago figured out how 
to do this (it's not *that* hard) and, by moving the tests now, would actually 
make work for them :) (Granted, that's also not that hard)

Losing the history of a bunch of files would be a much more serious concern, 
IMHO.  If the files can't be moved without losing history, I'de be a definite 
-1 on this change; otherwise, a meh -0.

--

___
Python tracker 

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



[issue36017] test_grp

2020-03-16 Thread Matthias Braun


Change by Matthias Braun :


--
keywords: +patch
nosy: +Matthias Braun
nosy_count: 1.0 -> 2.0
pull_requests: +18382
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19033

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This code has introduced a regression in AIX in Python 3.7.7 as the new 
"test_maxcontext_exact_arith" test hangs indefinitely or just segfaults.

--
keywords: +3.7regression
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

This looks like a "new feature/improvement". Why was this code backported to a 
stable version?

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +ned.deily

___
Python tracker 

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



[issue39982] FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x

2020-03-16 Thread STINNER Victor


New submission from STINNER Victor :

AMD64 FreeBSD Shared 3.x:
https://buildbot.python.org/all/#/builders/152/builds/409

==
ERROR: testSendmsg (test.test_socket.SendmsgSCTPStreamTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 342, in _setUp
self.__setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 2716, in setUp
super().setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 2533, in setUp
super().setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 646, in setUp
conn, addr = self.serv.accept()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/socket.py", 
line 293, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

(...)

==
ERROR: testRecvmsgAfterClose (test.test_socket.RecvmsgSCTPStreamTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 342, in _setUp
self.__setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 2533, in setUp
super().setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 646, in setUp
conn, addr = self.serv.accept()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/socket.py", 
line 293, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

(...)

==
ERROR: testRecvmsgIntoGenerator (test.test_socket.RecvmsgIntoSCTPStreamTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 342, in _setUp
self.__setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 2533, in setUp
super().setUp()
  File 
"/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/test/test_socket.py",
 line 646, in setUp
conn, addr = self.serv.accept()
  File "/usr/home/buildbot/python/3.x.koobs-freebsd-564d/build/Lib/socket.py", 
line 293, in accept
fd, addr = self._accept()
ConnectionAbortedError: [Errno 53] Software caused connection abort

(...)

--
components: Tests
messages: 364362
nosy: koobs, vstinner
priority: normal
severity: normal
status: open
title: FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x
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



[issue39982] FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

It worked 10 days ago:
https://buildbot.python.org/all/#/builders/152/builds/382

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

> This looks like a "new feature/improvement". Why was this code backported to 
> a stable version?

Thanks for the lecture. This is an esoteric case between bugfix and
feature that only occurs with very large context precisions.

If Bloomberg isn't happy with _decimal, they can stop using it.
I'm not paid by them.

Which AIX buildbot fails? There are many green ones.

--

___
Python tracker 

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



[issue39932] test_multiprocessing_fork leaked [0, 2, 0] file descriptors on aarch64 RHEL8 Refleaks 3.7 buildbot

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

Bug seen on Pytho 3.7 branch, on Fedora Stable, RHEL7 and RHEL8, on different 
architectures.

aarch64 RHEL7 Refleaks 3.7:
https://buildbot.python.org/all/#builders/598/builds/22

PPC64LE RHEL7 Refleaks 3.7:
https://buildbot.python.org/all/#builders/414/builds/32

PPC64LE Fedora Stable Refleaks 3.7:
https://buildbot.python.org/all/#/builders/388/builds/31

--

___
Python tracker 

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



[issue39983] test.regrtest: test marked as failed (env changed), but no warning: test_multiprocessing_forkserver

2020-03-16 Thread STINNER Victor


New submission from STINNER Victor :

Tests run with --fail-env-changed. test_multiprocessing_forkserver failed with 
"env changed", but no warning was logged to explain why :-(

PPC64LE RHEL7 3.8:
https://buildbot.python.org/all/#/builders/401/builds/69

./python  ./Tools/scripts/run_tests.py -j 1 -u all -W --slowest 
--fail-env-changed --timeout=900 -j2 --junit-xml test-results.xml -j10

--
components: Tests
messages: 364365
nosy: vstinner
priority: normal
severity: normal
status: open
title: test.regrtest: test marked as failed (env changed), but no warning: 
test_multiprocessing_forkserver
versions: Python 3.8

___
Python tracker 

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



[issue39982] FreeBSD: SCTP tests of test_socket fails on AMD64 FreeBSD Shared 3.x

2020-03-16 Thread STINNER Victor


STINNER Victor  added the comment:

Same issue on AMD64 FreeBSD Shared 3.8:
https://buildbot.python.org/all/#builders/18/builds/162

It looks more like a recent FreeBSD upgrade than a Python regression.

3.8 fail, build 162:

os.uname: posix.uname_result(sysname='FreeBSD', nodename='130-CURRENT-amd64', 
release='13.0-CURRENT', version='FreeBSD 13.0-CURRENT #1 r358865: Wed Mar 11 
21:35:42 UTC 2020 
root@130-CURRENT-amd64:/usr/obj/usr/src/amd64.amd64/sys/GENERIC', 
machine='amd64')

3.8 ok, build 153 (12 days ago):

os.uname: posix.uname_result(sysname='FreeBSD', nodename='130-CURRENT-amd64', 
release='13.0-CURRENT', version='FreeBSD 13.0-CURRENT #7 r356645: Sun Jan 12 
14:57:12 AEDT 2020 
root@130-CURRENT-amd64:/usr/obj/usr/src/amd64.amd64/sys/GENERIC-NODEBUG', 
machine='amd64')

The kernel changed.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

> This code has introduced a regression in AIX in Python 3.7.7

Also this is a rather bold statement since probably no one has ever
run _decimal on AIX with MAX_PREC.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> Thanks for the lecture. This is an esoteric case between bugfix and
feature that only occurs with very large context precisions.

Nobody is lecturing anyone. I am just asking why this was backported.

> If Bloomberg isn't happy with _decimal, they can stop using it.
I'm not paid by them.

Stefan, nobody has mentioned Bloomberg in this issue so please, stop.


> Also this is a rather bold statement since probably no one has ever
run _decimal on AIX with MAX_PREC.

Well, I just did and I can confirm that reverting the 3.7 backport fixes the 
problem.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

> Well, I just did and I can confirm that reverting the 3.7 backport fixes the 
> problem.

If you are fortunate enough to have access to an AIX system, I guess
you have to find out why POWER6 AIX 3.8 and PPC64 AIX 3.8 apparently
work on https://buildbot.python.org/ but your 3.7 does not.

It seems rather strange to me. Are you compiling --with-system-libmpdec?

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

Hi Michael, in case you have built 3.7.7 on AIX, have you observed
any problems with test_decimal?

--
nosy: +Michael.Felt

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> If you are fortunate enough to have access to an AIX system, I guess
you have to find out why POWER6 AIX 3.8 and PPC64 AIX 3.8 apparently
work on https://buildbot.python.org/ but your 3.7 does not.

I am working on trying to debug where the problem comes from, but meanwhile, I 
wanted to report here that this introduced a difference between Python 3.7.6 
and Python 3.7.7

I still did not test Python 3.8 but I suppose that it has the same problem.

> Are you compiling --with-system-libmpdec?

No, I am compiling with:

CFLAGS+= -qmaxmem=-1
OBJECT_MODE=64
CONFIGURE_ARGS=--enable-shared --with-system-ffi --without-computed-gotos 
ac_cv_rshift_extends_sign=no

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

These flags worked for xlc when snakebite was still up:

./configure CC=xlc_r AR="ar -X64" CFLAGS="-q64 -qmaxmem=7" LDFLAGS="-q64"

-qmaxmem was always finicky, I remember segfaults too (AIX problem,
not libmpdec problem).

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Btw, this is AIX 7.1.0.0 with xlc in case that is relevant.

--

___
Python tracker 

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



[issue39576] Surprising MemoryError in `decimal` with MAX_PREC

2020-03-16 Thread Stefan Krah


Stefan Krah  added the comment:

BTW, if you are compiling with xlc and there"s no xlc buildbot,
perhaps a company-that-shall-not-be-named should provide one.

I mean, it's not okay to complain about a regression and then
mention xlc about 10 mails later.

--

___
Python tracker 

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



  1   2   >