[issue43785] bz2 performance issue.

2021-04-08 Thread Inada Naoki


Change by Inada Naoki :


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

___
Python tracker 

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



[issue43785] bz2 performance issue.

2021-04-08 Thread Inada Naoki


Change by Inada Naoki :


--
type:  -> performance
Added file: https://bugs.python.org/file49949/create.py

___
Python tracker 

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



[issue43785] bz2 performance issue.

2021-04-08 Thread Inada Naoki


New submission from Inada Naoki :

The original issue is reported here.
https://discuss.python.org/t/non-optimal-bz2-reading-speed/6869

1. Only BZ2File uses RLock()

lzma and gzip don't use RLock(). It adds significant performance overhead.
When I removed `with self._lock:`, decompression speed improved from about 148k 
line/sec to 200k line/sec.


2. The default __iter__ calls `readline()` for each iteration.

BZ2File.readline() is implemented in C so it is slightly slow than C 
implementation.

If I add this `__iter__()` to BZ2File, decompression speed improved from about 
148k lines/sec (or 200k lines/sec) to 500k lines/sec.

def __iter__(self):
self._check_can_read()
return iter(self._buffer)

If this __iter__ method is safe, it can be added to gzip and lzma too.

--
components: Library (Lib)
files: dec.py
messages: 390588
nosy: methane
priority: normal
severity: normal
status: open
title: bz2 performance issue.
versions: Python 3.10
Added file: https://bugs.python.org/file49948/dec.py

___
Python tracker 

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



[issue43784] [Windows] interpreter hangs indefinitely on subprocess.communicate during __del__ at script exit

2021-04-08 Thread Kevin M


New submission from Kevin M :

I've noticed an issue (or user error) in which Python a call that otherwise 
usually works in the __del__ step of a class will freeze when the Python 
interpreter is exiting.

I've attached sample code that I've ran against Python 3.9.1 on Windows 10.

The code below runs a process and communicates via the pipe.

class SubprocTest(object):
def run(self):
print("run")
proc_args = ["cmd.exe"]
self._process = subprocess.Popen(proc_args, 
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

def __del__(self):
print("__del__")
if self._process is not None:
self.terminate()

def terminate(self):
print("terminate")
self._process.communicate(input=b"exit\n", timeout=1)
print("kill")
self._process.kill()
self._process = None

if __name__ == "__main__":
s = SubprocTest()
s.run()
del s
print("s done")

t = SubprocTest()
t.run()
print("t done")


Current output:
run
__del__
terminate
kill
s done
run
t done
__del__
terminate
<< hangs indefinitely here, even though timeout=1

Expected output:
run
__del__
terminate
kill
s done
run
t done
__del__
terminate
kill


In normal circumstances, when you del the object and force a run of __del__(), 
the process ends properly and the terminate() method completes.

When the Python interpreter exits, Python calls the __del__() method of the 
class.  In this case, the terminate() never completes and the script freezes 
indefinitely on the communicate()

--
components: Library (Lib), Windows
files: win_subprocess_hang.py
messages: 390587
nosy: paul.moore, steve.dower, sylikc, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] interpreter hangs indefinitely on subprocess.communicate 
during __del__ at script exit
versions: Python 3.9
Added file: https://bugs.python.org/file49947/win_subprocess_hang.py

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24030
pull_request: https://github.com/python/cpython/pull/25294

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-08 Thread Inada Naoki


Change by Inada Naoki :


--
nosy: +methane

___
Python tracker 

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



[issue38974] using tkinter.filedialog.askopenfilename() freezes python 3.8

2021-04-08 Thread Colin Caprani


Colin Caprani  added the comment:

In case it helps, I have the same problem. Running python 3.8.8 on Windows 10, 
and any MWE doesn't work, e.g.:

from tkinter import filedialog
from tkinter import *

root = Tk()
root.filename =  filedialog.askopenfilename(initialdir = "/",title = "Select 
file",filetypes = (("jpeg files","*.jpg"),("all files","*.*")))
print (root.filename)

I just get the spinning circle and unresponsive dialog. I have quite a few 
shell integrations so uninstalling them is not ideal.

--
nosy: +colin.caprani

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-08 Thread Inada Naoki


Inada Naoki  added the comment:

You are misreading the error message. 

> RuntimeError: PyPI's XMLRPC API is currently disabled due to unmanageable 
> load and will be deprecated in the near future. See 
> https://status.python.org/ for more information.

This error message says "PyPI's XMLRPC API" is disabled and will be deprecated. 
It doesn't say `pip search` command is disabled and will be deprecated.

Removing or reimplement `pip search` is discussed in this issue:
https://github.com/pypa/pip/issues/5216

Anyway, I am +1 to remove it from the tutorial.

--
nosy: +methane

___
Python tracker 

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



[issue43783] Make ParamSpec.args/kwargs more useful objects

2021-04-08 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


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

___
Python tracker 

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Zachary Ware


Zachary Ware  added the comment:

The error message certainly looks more like a compiler bug than a Python bug.  
FTR, we also have several builders on buildbot.python.org [1] running Fedora or 
RHEL on PPC64LE, none of which appear to have a problem.

[1] https://buildbot.python.org/all/#/builders?tags=%2B3.9 (search ppc64le)

--
nosy: +zach.ware

___
Python tracker 

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



[issue43783] Make ParamSpec.args/kwargs more useful objects

2021-04-08 Thread Jelle Zijlstra


Change by Jelle Zijlstra :


--
assignee:  -> Jelle Zijlstra

___
Python tracker 

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



[issue43783] Make ParamSpec.args/kwargs more useful objects

2021-04-08 Thread Jelle Zijlstra


New submission from Jelle Zijlstra :

Currently, typing.ParamSpec.args and ParamSpec.kwargs are just object() 
instances, which makes them useless for runtime inspection of __annotations__. 
This type was introduced by PEP 612.

Instead, I propose to make them return some special helper object with 
__origin__ set to the underlying ParamSpec object. I'll work on a PR soon.

--
components: Library (Lib)
messages: 390583
nosy: Jelle Zijlstra, gvanrossum, levkivskyi
priority: normal
severity: normal
status: open
title: Make ParamSpec.args/kwargs more useful objects
versions: Python 3.10

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for adding this.

--
nosy: +rhettinger

___
Python tracker 

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Ruairidh MacLeod


Change by Ruairidh MacLeod :


--
nosy: +rkm

___
Python tracker 

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Anthony Sottile


Anthony Sottile  added the comment:

hmmm strange, the only changes in 3.9.4 are a revert -- perhaps this is a 
flakey bug in gcc and not actionable

I've clicked rebuild on my build, maybe it'll magically fix it

plus xenial is almost end of lifed so I doubt anyone cares about this strange 
architecture on an old platform anyway

--

___
Python tracker 

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Ethan Smith


Change by Ethan Smith :


--
nosy: +ethan smith

___
Python tracker 

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



[issue43782] Failure to build from source on ppc64le on ubuntu xenial

2021-04-08 Thread Anthony Sottile


New submission from Anthony Sottile :

I realize this is unlikely to be a helpful report, but something that changed 
between 3.9.3 and 3.9.4 has caused the build to break on (admittedly a strange 
platform) ppc64le


I attached the build log (zipped because otherwise it's too big ?)

The live URL is here: 
https://launchpadlibrarian.net/532585040/buildlog_ubuntu-xenial-ppc64el.python3.9_3.9.4-1+xenial1_BUILDING.txt.gz

Probably the most relevant part of the bug report is this bit, though I'm 
guessing so I don't really know what is useful and what is not.

```
Preprocessed source stored into /tmp/ccIkITd0.out file, please attach this to 
your bugreport.
=== BEGIN GCC DUMP ===
// Target: powerpc64le-linux-gnu
// Configured with: ../src/configure -v --with-pkgversion='Ubuntu/IBM 
5.4.0-6ubuntu1~16.04.12' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs 
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr 
--program-suffix=-5 --enable-shared --enable-linker-build-id 
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix 
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-libstdcxx-time=yes 
--with-default-libstdcxx-abi=new --enable-gnu-unique-object 
--disable-libquadmath --enable-plugin --with-system-zlib 
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo 
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el/jre --enable-java-home 
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-ppc64el 
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-ppc64el 
--with-arch-directory=ppc64le --with-ecj-jar=/usr/share/java/eclipse-ecj.jar 
--enable-objc-gc --enable-secureplt --with-cpu=power8 --ena
 ble-targets=powerpcle-linux --disable-multilib --enable-multiarch 
--disable-werror --with-long-double-128 --enable-checking=release 
--build=powerpc64le-linux-gnu --host=powerpc64le-linux-gnu 
--target=powerpc64le-linux-gnu
// Thread model: posix
// gcc version 5.4.0 20160609 (Ubuntu/IBM 5.4.0-6ubuntu1~16.04.12) 
// 
// ../Python/ceval.c: In function 'is_tstate_valid':
// ../Python/ceval.c:5694:1: internal compiler error: Segmentation fault
//  }
//  ^
// Please submit a full bug report,
// with preprocessed source if appropriate.
// See  for instructions.
```

--
components: Build
files: buildlog.tgz
messages: 390580
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: Failure to build from source on ppc64le on ubuntu xenial
versions: Python 3.9
Added file: https://bugs.python.org/file49946/buildlog.tgz

___
Python tracker 

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



[issue43776] Popen with shell=True yield mangled repr output

2021-04-08 Thread William Pickard


William Pickard  added the comment:

Actually, the problem is independent of the value of "shell", the __repr__ 
function from the initial PR that introduced it expects "args" to be a sequence 
and converts it to a list.

--
nosy: +WildCard65

___
Python tracker 

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



[issue43781] SIGSEGV when replacing _multiprocessing.SemLock at runtime

2021-04-08 Thread Sam Stern


Sam Stern  added the comment:

This does not arise on 3.8.9

--

___
Python tracker 

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



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

2021-04-08 Thread Dong-hee Na


Change by Dong-hee Na :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue43781] SIGSEGV when replacing _multiprocessing.SemLock at runtime

2021-04-08 Thread Sam Stern


New submission from Sam Stern :

When patching `_multiprocessing.SemLock` at runtime and then instantiating an 
instance of `multiprocessing.Pool`, the interpreter throws a SIGSEGV when 
trying to access a field of `_multiprocessing.SemLock` on pre-3.9 pythons

--
components: Interpreter Core
files: this-segfaults.py
messages: 390577
nosy: sternj
priority: normal
severity: normal
status: open
title: SIGSEGV when replacing _multiprocessing.SemLock at runtime
type: crash
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file49945/this-segfaults.py

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 25296 to reuse Doc/requirements.txt in the Docs PR job of Azure 
Pipelines. It installs Sphinx 3.2.1 as expected, and with this version, no 
warning is emitted.

--

___
Python tracker 

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



[issue43780] Sync importlib_metadata enhancements through 3.10.

2021-04-08 Thread Jason R. Coombs


Change by Jason R. Coombs :


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

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24027
pull_request: https://github.com/python/cpython/pull/25296

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 54366953633dbe5d9585dbae0c633d4e92df2d04 by Victor Stinner in 
branch 'master':
bpo-43774: Enhance configure documentation (GH-25293)
https://github.com/python/cpython/commit/54366953633dbe5d9585dbae0c633d4e92df2d04


--

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

> The following syntax fails on the Docs PR job of the Azure Pipelines:

It uses Sphinx 2.2.0. Do we still support Spinx 2.2.0?

Collecting sphinx==2.2.0
...
Successfully installed Jinja2-2.11.3 MarkupSafe-1.1.1 Pygments-2.8.1 
alabaster-0.7.12 babel-2.9.0 blurb-1.0.8 certifi-2020.12.5 chardet-4.0.0 
docutils-0.17 idna-2.10 imagesize-1.2.0 packaging-20.9 pyparsing-2.4.7 
python-docs-theme-2020.12 pytz-2021.1 requests-2.25.1 snowballstemmer-2.1.0 
sphinx-2.2.0 sphinxcontrib-applehelp-1.0.2 sphinxcontrib-devhelp-1.0.2 
sphinxcontrib-htmlhelp-1.0.3 sphinxcontrib-jsmath-1.0.1 
sphinxcontrib-qthelp-1.0.3 sphinxcontrib-serializinghtml-1.1.4 urllib3-1.26.4

--

___
Python tracker 

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



[issue43751] await anext() returns None when default is given

2021-04-08 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
priority: normal -> release blocker

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

The following syntax fails on the Docs PR job of the Azure Pipelines:
--
.. cmdoption:: --with-cxx-main
.. cmdoption:: --with-cxx-main=COMPILER

   Compile the Python ``main()`` function and link Python executable with C++
   compiler: ``$CXX``, or *COMPILER* if specified.
--

Error:
--
Warning, treated as error:
/home/vsts/work/1/s/Doc/using/configure.rst:47:Duplicate explicit target name: 
"cmdoption--with-cxx-main".
Makefile:49: recipe for target 'build' failed
--

--

___
Python tracker 

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



[issue43780] Sync importlib_metadata enhancements through 3.10.

2021-04-08 Thread Jason R. Coombs


New submission from Jason R. Coombs :

Incorporate importlib_metadata changes from 3.8 through 3.10: 
https://importlib-metadata.readthedocs.io/en/latest/history.html#v3-10-0

Two main changes:

- Add mtime-based caching during distribution discovery.
- Flagged use of dict result from ``entry_points`` as deprecated.

--
components: Library (Lib)
messages: 390572
nosy: jaraco
priority: normal
severity: normal
status: open
title: Sync importlib_metadata enhancements through 3.10.
versions: Python 3.10

___
Python tracker 

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



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa by Markus Gerstel in 
branch '3.8':
bpo-39674: Fix collections ABC deprecation notice (GH-25281)
https://github.com/python/cpython/commit/20d56bd41b56023ce9fa3739c0c9aa8be8d48bfa


--

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +24026
pull_request: https://github.com/python/cpython/pull/25293

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2021-04-08 Thread miss-islington


miss-islington  added the comment:


New changeset a9228d02d16fe90f2f13e7e9ec478f7b4f8607a2 by Miss Islington (bot) 
in branch '3.9':
[3.9] bpo-39702: Remove dotted_name from decorator documentation (GH-25234) 
(GH-25290)
https://github.com/python/cpython/commit/a9228d02d16fe90f2f13e7e9ec478f7b4f8607a2


--

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2021-04-08 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 4.0 -> 5.0
pull_requests: +24025
pull_request: https://github.com/python/cpython/pull/25290

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

+1

--

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

We could also adjust Parser/asdl_c.py to decref right after a failed 
_PyArena_AddPyObject() call, instead of goto failure and Py_XDECREF. I'm not 
sure it's worth it though.

--
Added file: https://bugs.python.org/file49944/parser.diff

___
Python tracker 

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



[issue39702] PEP 614: Relaxing Grammar Restrictions On Decorators

2021-04-08 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset 1e051a21b7106a93c30b74aad7e1f40d6c0c477b by Saiyang Gou in branch 
'master':
bpo-39702: Remove dotted_name from decorator documentation (GH-25234)
https://github.com/python/cpython/commit/1e051a21b7106a93c30b74aad7e1f40d6c0c477b


--

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

> We could also adjust Parser/asdl_c.py to decref right after a failed 
> _PyArena_AddPyObject() call, instead of goto failure and Py_XDECREF. I'm not 
> sure it's worth it though.

I normally recommend having the least amount of exist paths possible, makes 
reasoning easily normally at the cost of some extra NULL checks for the XDECREF 
in failure scenarios

--

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
pull_requests: +24024
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25289

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Yes, I'll do that.

--

___
Python tracker 

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



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

> Is there any hope of a backport to 3.7? Or has that ship sailed?

Python 3.7 doesn't accept bugfixes anymore, nor new features, nor new platofrm 
support (macOS 11).

The 3.7 branch now only accept security fixes:
https://devguide.python.org/#status-of-python-branches

--
nosy: +vstinner

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Ah, I see that the Parser/asdl_c.py case is handled by the callers. So that 
leaves only Parser/pegen.c.

--

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Thanks Erlend. Mind creating a PR from the patch?

--

___
Python tracker 

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



[issue41100] Support macOS 11 and Apple Silicon Macs

2021-04-08 Thread Benoit Hudson


Benoit Hudson  added the comment:

Is there any hope of a backport to 3.7? Or has that ship sailed?

--
nosy: +benoithudson

___
Python tracker 

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



[issue43779] Fix possible parser/AST ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
title: Fix possible _PyArena_AddPyObject ref leaks -> Fix possible parser/AST 
ref leaks

___
Python tracker 

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



[issue43778] [Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.9 is not affected, this Sphinx extension is new in Python 3.10. By the 
way, I like this feature!

The new " Glossary: borrowed reference " block in:

https://docs.python.org/3.10/search.html?q=borrowed+reference

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



[issue43779] Fix possible _PyArena_AddPyObject ref leaks

2021-04-08 Thread Erlend Egeberg Aasland


New submission from Erlend Egeberg Aasland :

_PyArena_AddPyObject() only steals the object reference if successful.

- In Parser/pegen.c, _PyPegen_fill_token(), the return value is not checked at 
all.
- In Parser/asdl_c.py, none of the (two) calls to _PyArena_AddPyObject() decref 
on failure
- Ditto for Python/Python-ast.c


Attached patch fixes all callers. I'll put up a PR if it looks ok.

Alternatively, one could make _PyArena_AddPyObject() _not_ steal the reference, 
but since it's an exposed API, that's probably not an option.

--
files: patch.diff
keywords: patch
messages: 390559
nosy: erlendaasland, pablogsal
priority: normal
severity: normal
status: open
title: Fix possible _PyArena_AddPyObject ref leaks
type: behavior
versions: Python 3.10
Added file: https://bugs.python.org/file49943/patch.diff

___
Python tracker 

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



[issue43778] [Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f32d0221477f18993666bb66cc79c61c4e145d42 by Victor Stinner in 
branch 'master':
bpo-43778: Fix Sphinx glossary_search extension (GH-25286)
https://github.com/python/cpython/commit/f32d0221477f18993666bb66cc79c61c4e145d42


--

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

With Sphinx 2, there is an error on the Docs PR job of Azure Pipelines:

Warning, treated as error:
/home/vsts/work/1/s/Doc/using/configure.rst:416:unknown option: 
--enable-universalsdk

--

___
Python tracker 

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



[issue43540] importlib: Document how to replace load_module() in What's New in Python 3.10

2021-04-08 Thread Brett Cannon

Brett Cannon  added the comment:

Much like the question about load_module(), replacing find_module() with 
find_spec() can be helped with things like 
importlib.util.spec_from_file_location() and .spec_from_loader() 
(https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location
 and 
https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_loader),
 but there isn't a 1:1 swap, so it will take some thought.

And the docs in importlib for things like find_module() say to implement 
find_spec() which then mentions spec_from_loader() may be useful.

As for replicating the subprocess docs approach, that's a little different 
since those alternatives in the stdlib are not going anywhere while the stuff 
in importlib is going to be gone in 3.12 so it will only last for two years.

And BTW I took care of six for you knowing you were going to ask about it if I 
didn't. 

--

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-08 Thread Bob Kline


Bob Kline  added the comment:

PR submitted: https://github.com/python/cpython/pull/25287

--

___
Python tracker 

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-08 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 2.0 -> 3.0
pull_requests: +24023
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25287

___
Python tracker 

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



[issue42134] Raise ImportWarning when falling back to find_module()

2021-04-08 Thread Brett Cannon


Brett Cannon  added the comment:

> would you accept a PR that changes the changelog entry to contain the 
> ".find_spec() not found; falling back to find_module()" message, for better 
> search-ability?

Sure!

> Also, could you please explain how to migrate to find_spec() in 
> https://docs.python.org/3.10/whatsnew/3.10.html#porting-to-python-3-10 ? I'd 
> do that, but I don't know yet what is the proper way.

The problem is it will possibly vary from class to class. You can probably get 
pretty far with 
https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_file_location
 or 
https://docs.python.org/3/library/importlib.html#importlib.util.spec_from_loader
 depending.

--

___
Python tracker 

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



[issue43778] [Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist

2021-04-08 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset a41782cc84bcd813209a03e6e11c60e77dbc7718 by Victor Stinner in 
branch 'master':
bpo-43774: Document configure options (GH-25283)
https://github.com/python/cpython/commit/a41782cc84bcd813209a03e6e11c60e77dbc7718


--

___
Python tracker 

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



[issue43778] [Doc] Doc/tools/extensions/glossary_search.py fails with FileNotFoundError if the _static/ directory doesn't exist

2021-04-08 Thread STINNER Victor


New submission from STINNER Victor :

Doc/tools/extensions/glossary_search.py failed multiple times on my doc PR:
https://github.com/python/cpython/pull/25283

The fail is not deterministic (random error, timing issue?), it depends if the 
directory was already created by something else or not.

Error on the Docs PR job of the Azure Pipeline:
--
2021-04-08T17:55:57.7774293Z writing output... [ 98%] whatsnew/3.5
2021-04-08T17:55:58.0531588Z writing output... [ 98%] whatsnew/3.6
2021-04-08T17:55:58.3085384Z writing output... [ 99%] whatsnew/3.7
2021-04-08T17:55:58.5638166Z writing output... [ 99%] whatsnew/3.8
2021-04-08T17:55:59.3385073Z writing output... [ 99%] whatsnew/3.9
2021-04-08T17:55:59.5205350Z writing output... [ 99%] whatsnew/changelog
2021-04-08T17:56:02.4282200Z writing output... [100%] whatsnew/index
2021-04-08T17:56:03.1454692Z 
2021-04-08T17:56:03.1463636Z Writing glossary.json
2021-04-08T17:56:03.1466614Z 
2021-04-08T17:56:03.1467473Z Exception occurred:
2021-04-08T17:56:03.3286028Z   File 
"/home/vsts/work/1/s/Doc/tools/extensions/glossary_search.py", line 49, in 
on_build_finish
2021-04-08T17:56:03.3287379Z with open(path.join(app.outdir, '_static', 
'glossary.json'), 'w') as f:
2021-04-08T17:56:03.3288351Z FileNotFoundError: [Errno 2] No such file or 
directory: '/home/vsts/work/1/s/Doc/build/html/_static/glossary.json'
2021-04-08T17:56:03.3294489Z The full traceback has been saved in 
/tmp/sphinx-err-1c8jemiu.log, if you want to report the issue to the developers.
2021-04-08T17:56:03.3295501Z Please also report this if it was a user error, so 
that a better error message can be provided next time.
2021-04-08T17:56:03.3296536Z A bug report can be filed in the tracker at 
. Thanks!
--
https://dev.azure.com/Python/cpython/_build/results?buildId=78035=results

Error on Travis CI:
--
PATH=./venv/bin:$PATH sphinx-build -b html -d build/doctrees  -q -W -j4 -W . 
build/html 

Extension error:

Handler  for event 'build-finished' 
threw an exception (exception: [Errno 2] No such file or directory: 
'/home/travis/build/python/cpython/Doc/build/html/_static/glossary.json')

Makefile:49: recipe for target 'build' failed
--
https://travis-ci.com/github/python/cpython/jobs/497108477


Attached PR fix the extension: create the directory if it doesn't exists.

--
assignee: docs@python
components: Documentation
messages: 390552
nosy: docs@python, vstinner
priority: normal
severity: normal
status: open
title: [Doc] Doc/tools/extensions/glossary_search.py fails with 
FileNotFoundError if the _static/ directory doesn't exist
versions: Python 3.10

___
Python tracker 

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



[issue43773] macOS official installer builds not respecting DYLD_LIBRARY_PATH environment variable.

2021-04-08 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the report. However, I think you've drawn the wrong conclusion form 
what you've observed. The reason you are unable to do what you are trying to do 
is that the _sqlite3 module included with the python.org macOS Pythons is 
statically linked with its own copy of an sqlite3 library, not dynamically 
linked. This has been true for a long time (10+ years); I believe the original 
reason was to avoid linking with the Apple-supplied system copy of the sqlite3 
library.  You can see this by using otool:

- with the python.org 3.9.4:

$ /usr/local/bin/python3.9 -c 'import sys;print(sys.version)'
3.9.4 (v3.9.4:1f2e3088f3, Apr  4 2021, 12:19:19)
[Clang 12.0.0 (clang-1200.0.32.29)]
$ /usr/local/bin/python3.9 -c 'import _sqlite3;print(_sqlite3.__file__)'
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_sqlite3.cpython-39-darwin.so
$ otool -L $(/usr/local/bin/python3.9 -c 'import 
_sqlite3;print(_sqlite3.__file__)')
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_sqlite3.cpython-39-darwin.so:
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1292.60.1)

- with a MacPorts python3.9.4:

$ /opt/macports/bin/python3.9 -c 'import _sqlite3;print(_sqlite3.__file__)'
/opt/macports/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_sqlite3.cpython-39-darwin.so
$ otool -L $(/opt/macports/bin/python3.9 -c 'import 
_sqlite3;print(_sqlite3.__file__)')
/opt/macports/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/lib-dynload/_sqlite3.cpython-39-darwin.so:
/opt/macports/lib/libsqlite3.0.dylib (compatibility version 9.0.0, 
current version 9.6.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current 
version 1292.60.1)

If you want to replace the sqlite3 library, you would need to rebuild the 
_sqlite3 module. That's not something we would encourage or support.

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



[issue43777] Remove description of "pip search" command from tutorial

2021-04-08 Thread Bob Kline


New submission from Bob Kline :

The official tutorial instructs users to find third-party packages by using the 
"pip search" command, which no longer works (and will be deprecated -- and 
presumably subsequently removed -- according to the error message). See 
https://docs.python.org/3.10/tutorial/venv.html#managing-packages-with-pip

That passage should be removed from the tutorial.

--
assignee: docs@python
components: Documentation
messages: 390550
nosy: bkline, docs@python
priority: normal
severity: normal
status: open
title: Remove description of "pip search" command from tutorial
versions: Python 3.10

___
Python tracker 

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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Can you put together an example we can run? Either from a single file, or 
multiple modules in the current directory? The "..." import makes it 
complicated to reproduce.

--

___
Python tracker 

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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread Eric V. Smith


Change by Eric V. Smith :


--
Removed message: https://bugs.python.org/msg390548

___
Python tracker 

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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Can you put together an example we can actually run?

--
nosy: +eric.smith

___
Python tracker 

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



[issue43775] JSON Parsing Alarm: Requests + Json = JSONDecodeError

2021-04-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> Two days ago everything worked completely fine, 
> and now this disaster happens.

It's unlikely that Python itself changed over those two days. It's more likely 
that the data source has changed.

Try this in your notebook:

import requests
r = requests.get('https://api.github.com/users/gvanrossum')
print(r.status_code)
print(r.headers['Content-Type'])
print(r.json())

If that works, try it with your url.  If the content-type is not 
'application/json; charset=utf-8', then you've identified a problem with the 
data source rather than with the tooling.

--
nosy: +rhettinger

___
Python tracker 

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



[issue43764] Turning off generation of __match_args__ for dataclasses

2021-04-08 Thread Brandt Bucher


Brandt Bucher  added the comment:


New changeset d92c59f48680122ce0e4d1ccf69d92b983e8db01 by Brandt Bucher in 
branch 'master':
bpo-43764: Fix `__match_args__` generation logic for dataclasses (GH-25284)
https://github.com/python/cpython/commit/d92c59f48680122ce0e4d1ccf69d92b983e8db01


--

___
Python tracker 

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



[issue38659] enum classes cause slow startup time

2021-04-08 Thread Ethan Furman


Change by Ethan Furman :


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

___
Python tracker 

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I agree with Steven that minor fact should not be given more weight.  It has a 
specification in the Reference and it own FAQ entry.

IMO it doesn't belong in tutorial because having a negative modulus is rare and 
because burying the use in details makes the tutorial harder to read.  The 
intent of the tutorial is to have a structured, example driven, overview of the 
language.  It necessarily omits uncommon cases and detailed specifications.

Thanks for the suggestion, but I am going to close this one as Steven suggested.

--
resolution:  -> not a bug
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



[issue43775] JSON Parsing Alarm: Requests + Json = JSONDecodeError

2021-04-08 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

JSON is not HTML. If response.text contains HTML, it is expected that 
json.loads() cannot parse it.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue43751] await anext() returns None when default is given

2021-04-08 Thread Joshua Bronson


Change by Joshua Bronson :


--
nosy: +jab

___
Python tracker 

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



[issue43739] Fixing the example code in Doc/extending/extending.rst to declare and initialize the pmodule variable to be of the right type.

2021-04-08 Thread Shreyan Avigyan


Shreyan Avigyan  added the comment:

Please have a review.

--
type: compile error -> 

___
Python tracker 

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



[issue43776] Popen with shell=True yield mangled repr output

2021-04-08 Thread mkocher


New submission from mkocher :

When using Popen with shell=True, the output of the repr is not particularly 
user friendly. 

When using the form `p = Popen('python --version'.split())`, the output is 
reasonably output in a user friendly form of ``. 

However, when running with `shell=True`, the output is mangled.

For example, trying to run `python --help` via `p = Popen('python --version', 
shell=True)` yields the following output.

``

The original change appears to be motivated by 
https://bugs.python.org/issue38724 

and the PR here:

https://github.com/python/cpython/pull/17151/files

--
components: Library (Lib)
messages: 390542
nosy: mkocher
priority: normal
severity: normal
status: open
title: Popen with shell=True yield mangled repr output
type: behavior
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



[issue43540] importlib: Document how to replace load_module() in What's New in Python 3.10

2021-04-08 Thread Sviatoslav Sydorenko

Sviatoslav Sydorenko  added the comment:

@vstinner: I think I figure out the solution — 
https://github.com/pypa/setuptools/pull/2633

--
nosy: +webknjaz

___
Python tracker 

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



[issue40066] Enum: modify __repr__, __str__; update docs

2021-04-08 Thread Ethan Furman


Change by Ethan Furman :


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



[issue43772] Minor repr error in typing.TypeVar.__ror__()

2021-04-08 Thread Guido van Rossum


Guido van Rossum  added the comment:

Yes.--
--Guido (mobile)

--

___
Python tracker 

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



[issue43775] JSON Parsing Alarm: Requests + Json = JSONDecodeError

2021-04-08 Thread Maria Kazakova

New submission from Maria Kazakova :

I tried to use the usual code:
response = requests.get (url)
response.json () OR json.loads (response.text)
BUT
it returns JSONDecodeError Expecting value: line 1 column 1 (char 0) — no 
matter, which website I am trying to parse, with headers or without them. 
However, response.status_code = 200 and response.text returns the whole 
html-content. Two days ago everything worked completely fine, and now this 
disaster happens. I asked a couple of friends to try the same — and everyone 
failed to succeed, everyone gets this error — using Jupyter Notebook 
(+Anaconda, Python 3.7), PyCharm (+Python 3.9) and Google Colab.
Please help :(

--
components: Windows
messages: 390539
nosy: marikasakowa, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: JSON Parsing Alarm: Requests + Json = JSONDecodeError
type: crash
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



[issue43764] Turning off generation of __match_args__ for dataclasses

2021-04-08 Thread Brandt Bucher


Change by Brandt Bucher :


--
pull_requests: +24020
pull_request: https://github.com/python/cpython/pull/25284

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue43745] ssl.OPENSSL_VERSION still reporting 1.1.1i on windows 3.8.9/3.9.4

2021-04-08 Thread Steve Dower


Steve Dower  added the comment:

I just purged the CDN again and it seems to be fine now.

--

___
Python tracker 

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



[issue43766] Implement PEP 647 (User-Defined Type Guards) in typing.py

2021-04-08 Thread Ken Jin


Ken Jin  added the comment:

> I assume that this will be pretty simple, right?

Yep! The PR speaks for itself ;). typing.py has pretty nice internal constructs 
to make these types of additions a breeze. I'm really grateful to whoever 
wrote/refactored the _SpecialForm decorator to what it is today.

--

___
Python tracker 

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



[issue43766] Implement PEP 647 (User-Defined Type Guards) in typing.py

2021-04-08 Thread Ken Jin


Change by Ken Jin :


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

___
Python tracker 

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



[issue43774] [Doc] Document configure options in the Python documentation

2021-04-08 Thread STINNER Victor


New submission from STINNER Victor :

Attached PR documents configure, compiler and linker options to build Python.

--
assignee: docs@python
components: Documentation
messages: 390536
nosy: docs@python, vstinner
priority: normal
severity: normal
status: open
title: [Doc] Document configure options in the Python documentation
versions: Python 3.10

___
Python tracker 

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



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +24017
pull_request: https://github.com/python/cpython/pull/25281

___
Python tracker 

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



[issue39674] Keep deprecated features in Python 3.9 to ease migration from Python 2.7, but remove in Python 3.10

2021-04-08 Thread Roundup Robot


Change by Roundup Robot :


--
nosy: +python-dev
nosy_count: 5.0 -> 6.0
pull_requests: +24016
pull_request: https://github.com/python/cpython/pull/25280

___
Python tracker 

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



[issue42998] pathlib.Path: add `username` argument to `home()`

2021-04-08 Thread Eryk Sun


Eryk Sun  added the comment:

> 3. Worth fixing in `ntpath.expanduser()` 

To expand on the suggestion in msg390507, here's a demo that implements getting 
the profile path of a local user account, with support for the special profile 
directories "Default", "Public", and "ProgramData" (i.e. ALLUSERSPROFILE).

ERROR_NONE_MAPPED = 1332

def get_profile_path(name):
if not isinstance(name, str):
raise TypeError(f'name must be str, not {type(name).__name__}')
profile_list = r'Software\Microsoft\Windows 
NT\CurrentVersion\ProfileList'
if name.lower() in ('default', 'public', 'programdata'):
subkey = profile_list
value = name
else:
try:
sid = lookup_account_name(name)[0]
except OSError as e:
if e.winerror != ERROR_NONE_MAPPED:
raise
raise KeyError(f'name not found: {name}')
subkey = f'{profile_list}\\{sid}'
value = 'ProfileImagePath'
try:
with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, subkey) as hkey:
path, dtype = winreg.QueryValueEx(hkey, value)
except FileNotFoundError:
raise KeyError(f'name not found: {name}')
if dtype == winreg.REG_SZ:
return path
if dtype == winreg.REG_EXPAND_SZ:
return winreg.ExpandEnvironmentStrings(path)
raise TypeError('profile path value must be a string type (1 or 2), '
 f'not {dtype}')

For example:

>>> print(get_profile_path('administrator'))
C:\Users\Administrator

>>> print(get_profile_path('default'))
C:\Users\Default

>>> print(get_profile_path('public'))
C:\Users\Public

>>> print(get_profile_path('programdata'))
C:\ProgramData

>>> print(get_profile_path('system'))
C:\Windows\system32\config\systemprofile

>>> print(get_profile_path('localservice'))
C:\Windows\ServiceProfiles\LocalService

>>> print(get_profile_path('networkservice'))
C:\Windows\ServiceProfiles\NetworkService

For lookup_account_name(), _winapi.LookupAccountName(system_name, account_name) 
has to be implemented. It should convert the SID result to string form via 
ConvertSidToStringSidW() and return the tuple (sid_string, domain_name, 
account_type). Here's a ctypes prototype implementation of 
lookup_account_name():

import ctypes

lsalookup = ctypes.WinDLL(
'api-ms-win-security-lsalookup-l2-1-0', use_last_error=True)
sddl = ctypes.WinDLL('api-ms-win-security-sddl-l1-1-0', use_last_error=True)
heap = ctypes.WinDLL('api-ms-win-core-heap-l2-1-0', use_last_error=True)

ERROR_INSUFFICIENT_BUFFER = 122

def lookup_account_name(name):
sid = (ctypes.c_char * 1)()
cb = ctypes.c_ulong()
cch = ctypes.c_ulong()
name_use = ctypes.c_ulong()
lsalookup.LookupAccountNameW(None, name, sid, ctypes.byref(cb),
None, ctypes.byref(cch), ctypes.byref(name_use))
error = ctypes.get_last_error()
if error != ERROR_INSUFFICIENT_BUFFER:
raise ctypes.WinError(error)

sid = (ctypes.c_char * cb.value)()
domain_name = (ctypes.c_wchar * cch.value)()
success = lsalookup.LookupAccountNameW(None, name, sid,
ctypes.byref(cb), domain_name, ctypes.byref(cch),
ctypes.byref(name_use))
if not success:
raise ctypes.WinError(ctypes.get_last_error())

ssid = ctypes.c_wchar_p()
if not sddl.ConvertSidToStringSidW(sid, ctypes.byref(ssid)):
raise ctypes.WinError(ctypes.get_last_error())
string_sid = ssid.value
heap.LocalFree(ssid)

return string_sid, domain_name.value, name_use.value

--
nosy: +eryksun

___
Python tracker 

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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread conchylicultor


conchylicultor  added the comment:

The above example is a real world example I have currently have. Basically I 
have some dataclass based configuration like:

in losses.py:
```
class LossesParams:
  ...
```
in dataset.py:
```
class DatasetParams:
  ...
```
in config.py:
```
@dataclasses.dataclass
class Params:
  losses: losses.LossesParams = dataclasses.field()
  dataset: dataset.DatasetParams = dataclasses.field()
```
I want to use params as:
```
param = Params()
param.datasets.batch_size = 123
```
However the above code fail at `dataset: dataset.DatasetParams = 
dataclasses.field()` due to the closure issue.

The example is simplified but this is a very concrete problem I encountered.

--

___
Python tracker 

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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread Larry Hastings


Larry Hastings  added the comment:

By "use case", I mean, what problem are you solving in a useful program by 
doing this?  So far it seems like a pointless exercise in seeing what funny 
behavior you can try with annotations.

--

___
Python tracker 

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



[issue43747] Can't create new interpreter in multi thread

2021-04-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

You might have more luck asking on the capi-sig mailing list: 
https://mail.python.org/mailman3/lists/capi-sig.python.org/

I'm going to close this, because it looks like a usage question and not a bug. 
If it turns out to be a bug, please re-open this issue.

--
nosy: +eric.smith
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



[issue43746] Weird typing annotation closure behavior

2021-04-08 Thread conchylicultor


conchylicultor  added the comment:

> Do you have an actual use case for self-referential annotations?

I'm not sure I understand the question. My use case is the following:

```
from ... import losses

class A:
  losses: losses.Losses = losses.Losses()
```

Currently this is failing be cause this get resolved as:

```
class A:
  name: .Losses().Losses = .Losses()
```
Instead of what I want/expected:
```
class A:
  name: .Losses = .Losses()
```

I would expect that both "losses.Losses" on the left and right of the `=` refer 
to the outer module (`name: .Losses`), while currently it is 
resolved as `name: name.Losses`

--

___
Python tracker 

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



[issue43772] Minor repr error in typing.TypeVar.__ror__()

2021-04-08 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python

___
Python tracker 

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
type:  -> enhancement

___
Python tracker 

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



[issue43715] curses inch() and scrbkgd() documentation ommissions

2021-04-08 Thread Mariatta


Mariatta  added the comment:

Thanks for the patch, but I find it difficult to read in plain text. Can you 
create a pull request with the your suggested changes?

--
nosy: +Mariatta

___
Python tracker 

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



[issue43773] macOS official installer builds not respecting DYLD_LIBRARY_PATH environment variable.

2021-04-08 Thread Carlton Gibson

New submission from Carlton Gibson :

Hi. 

On MacOS 11.3 "Big Sur", with the latest 3.9.4 installed with the official 
installer downloaded from python.org, the DYLD_LIBRARY_PATH environment 
variable is not being respected. 

This looks very similar to Issue40198
https://bugs.python.org/issue40198

To begin everything looks correct as per 40198:

~ $ python3 --version
Python 3.9.4
~ $ which python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
~ $ codesign --display --entitlements=:- 
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
Executable=/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9

http://www.apple.com/DTDs/PropertyList-1.0.dtd;>


com.apple.security.cs.allow-dyld-environment-variables

com.apple.security.cs.disable-library-validation

com.apple.security.cs.disable-executable-page-protection

com.apple.security.automation.apple-events





The active python is that from the official installer, and it looks to have the 
correct entitlements, as per the resolution to 40198. 

However, it's not working in practice. 

I create a script test: 

~ $ cat ~/bin/sqlite_config.py 
import os
import sqlite3

print("DYLD_LIBRARY_PATH:" )
print(os.getenv('DYLD_LIBRARY_PATH'))

print("SQLite Version:")
print(sqlite3.sqlite_version)

Together with a compiled SQLite version: 

~ $ ls /Users/carlton/lib/sqlite/3.35.4
libsqlite3.dylib

Trying to use this, the dylib is not picked up: 

~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" python3 
~/bin/sqlite_config.py 
DYLD_LIBRARY_PATH:
/Users/carlton/lib/sqlite/3.35.4
SQLite Version:
3.34.0

Contrast the same when run with a pyenv installed python: 

~ $ pyenv which python3.8
/Users/carlton/.pyenv/versions/3.8.3/bin/python3.8
~ $ DYLD_LIBRARY_PATH="/Users/carlton/lib/sqlite/3.35.4" 
/Users/carlton/.pyenv/versions/3.8.3/bin/python3.8 ~/bin/sqlite_config.py 
DYLD_LIBRARY_PATH:
/Users/carlton/lib/sqlite/3.35.4
SQLite Version:
3.35.4

The expected result, in both cases, is that the last lines should read: 

SQLite Version:
3.35.4



I don't know if this is the result of a tightening in macOS' SIP in Big Sur (or 
something else entirely...) — I thought to test it by installing the official 
build in a different location (so not in the SIP protected `/Library/` space 
but somewhere in `~` but the installer doesn't look like it allows that (no 
doubt for good reasons). 

Next step for me with be building from source to see if I can dig deeper, but I 
thought I'd report it, as it does look like a change in behaviour from the 
*success* reported in 40198. 

Thanks very much!

--
components: macOS
messages: 390529
nosy: carltongibson, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: macOS official installer builds not respecting DYLD_LIBRARY_PATH 
environment variable.
type: behavior
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



[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2021-04-08 Thread Barney Gale


Barney Gale  added the comment:

Good spot Eryk - I've put in another PR to address it.

--

___
Python tracker 

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



[issue42998] pathlib.Path: add `username` argument to `home()`

2021-04-08 Thread Barney Gale


Barney Gale  added the comment:

Thanks for the feedback.

1. We can check the return value, like we do in `Path.expanduser()`
2. Seems like expected behaviour?
3. Worth fixing in `ntpath.expanduser()` I think. See Eryk Sun's comment here: 
https://bugs.python.org/issue39899#msg390507

--

___
Python tracker 

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



[issue43737] Documentation of modulo operator should document behaviour clearly when second operator is negative

2021-04-08 Thread Anthony Flury


Change by Anthony Flury :


--
pull_requests: +24015
pull_request: https://github.com/python/cpython/pull/25279

___
Python tracker 

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



[issue39899] `pathlib.Path.expanduser()` does not call `os.path.expanduser()`

2021-04-08 Thread Barney Gale


Change by Barney Gale :


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

___
Python tracker 

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



[issue43540] importlib: Document how to replace load_module() in What's New in Python 3.10

2021-04-08 Thread Florian Bruhin


Change by Florian Bruhin :


--
nosy: +The Compiler

___
Python tracker 

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



[issue43753] [C API] Add Py_Is(x, y) and Py_IsNone(x) functions

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

Mark:
> `is` is not well defined except for a small set of values, so the docs for 
> `Py_Is` would have to so vague as to be worthless, IMO.

I don't propose to change the "is" operator semantic: Py_Is(x, y) is C would 
behave *exaclty* as "x is y" in Python.

Check my implementation: the IS_OP bytecode uses directly Py_Is().

--

___
Python tracker 

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



[issue43682] Make static methods created by @staticmethod callable

2021-04-08 Thread STINNER Victor


STINNER Victor  added the comment:

There is a nice side effect of PR 25268 + PR 25117: pydoc provides better self 
documentation for the following code:

class X:
@staticmethod
def sm(x, y):
'''A static method'''
...

pydoc on X.sm:
---
sm(x, y)
A static method
---

instead of:
---

---

--

___
Python tracker 

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



[issue43760] The DISPATCH() macro is not as efficient as it could be.

2021-04-08 Thread Mark Shannon


Change by Mark Shannon :


--
pull_requests: +24013
pull_request: https://github.com/python/cpython/pull/25276

___
Python tracker 

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



[issue43772] Minor repr error in typing.TypeVar.__ror__()

2021-04-08 Thread Larry Hastings


New submission from Larry Hastings :

The implementation of the | operator for TypeVar objects is as follows:

def __or__(self, right):
return Union[self, right]

def __ror__(self, right):
return Union[self, right]

I think the implementation of __ror__ is ever-so-slightly inaccurate.  
Shouldn't it be this?

def __ror__(self, left):
return Union[left, self]

I assume this wouldn't affect runtime behavior, as unions are sets and are 
presumably unordered.  The only observable difference should be in the repr() 
(and only then if both are non-None), as this reverses the elements.  The repr 
for Union does preserve the order of the elements it contains, so it's visible 
to the user there.

--
components: Library (Lib)
messages: 390524
nosy: larry
priority: low
severity: normal
stage: test needed
status: open
title: Minor repr error in typing.TypeVar.__ror__()
type: behavior
versions: Python 3.10

___
Python tracker 

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



[issue43661] api-ms-win-core-path-l1-1.0.dll, redux of 40740 (which has since been closed)

2021-04-08 Thread Eric V. Smith


Eric V. Smith  added the comment:

Closing as a duplicate. Any discussion should be on the original issue.

--
nosy: +eric.smith
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Missing api-ms-win-core-path-l1-1.0.dll for 
python-3.9.0b1-amd64.exe Under Win7
type:  -> behavior

___
Python tracker 

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



  1   2   >