[issue36759] astimezone() fails on Windows for pre-epoch times

2020-03-23 Thread Jonathan Hsu


Jonathan Hsu  added the comment:

This exception is raised because astimezone() ends up calling time.localtime() 
to determine the appropriate time zone. If the datetime object has a pre-epoch 
value, it passes a negative timestamp to time.localtime(). On Windows, 
time.localtime() does not accept values greater than 0 (more discussion in 
issue #35796).

This is the minimal code required to reproduce the error:

from datetime import datetime
datetime(1969, 1, 1).astimezone()

Without the ability to ascertain the time zone with localtime(), I'm not sure 
if the time zone can be accurately determined. It's not clear what the proper 
behavior is. Maybe raise a ValueError?

PEP 615 proposes to include the IANA tz database, which would negate the need 
for a system call. Should we wait for this PEP before fixing this issue? 
Thoughts?

--

___
Python tracker 

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



[issue40051] Dead link in help(lib2to3)

2020-03-23 Thread wyz23x2


New submission from wyz23x2 :

When typing this in shell:
>>> import lib2to3
>>> help(lib2to3)

The output contains this link:
--snip--
MODULE REFERENCE
https://docs.python.org/3.8/library/lib2to3 <--

The following documentation is automatically generated from the Python
--snip--

But when you access it, 404!
This works:
https://docs.python.org/3.8/library/2to3.html#module-lib2to3

Please change it. Thanks!

--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Documentation, Library (Lib)
messages: 364917
nosy: docs@python, wyz23x2
priority: normal
severity: normal
status: open
title: Dead link in help(lib2to3)
type: performance
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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread hai shi


Change by hai shi :


--
nosy: +shihai1991

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

Actually, we already have some third party libs to support cgroup. But most of 
them get these questions

1. They are not std lib

2. They are just support cgroup1

But if we want to add a new std lib. Should we create a PEP?

--

___
Python tracker 

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



[issue40017] Please support CLOCK_TAI in the time module.

2020-03-23 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 687fe979705dc588a46a35da884cc0198c67 by Russell Owen in 
branch 'master':
closes bpo-40017: Add CLOCK_TAI constant to the time module. (GH-19096)
https://github.com/python/cpython/commit/687fe979705dc588a46a35da884cc0198c67


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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Before commit 8334f30a74abcf7e469b901afc307887aa85a888, at the first 
_imp.create_builtin() calls, it calls _PyImport_FixupExtensionObject() which 
stores the created module in an internal "extensions" dictionary. 
PyInit__weakref() returns a module object. Next calls to 
_imp.create_builtin("_weakref") simply returned the cached _weakref module.

At commit 8334f30a74abcf7e469b901afc307887aa85a888, _imp.create_builtin() 
doesn't store it in the internal "extensions" dictionary, but calls 
PyModule_FromDefAndSpec() instead. PyInit__weakref() returns a module 
definition (PyModuleDef_Type: "moduledef"). Each 
_imp.create_builtin("_weakref") creates a new module.

--

___
Python tracker 

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



[issue38972] [venv] Link to instructions to change PowerShell execution policy for venv activation

2020-03-23 Thread Derek Keeler


Change by Derek Keeler :


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

___
Python tracker 

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



[issue40034] cgi.parse() does not work with multipart POST requests.

2020-03-23 Thread San


Change by San :


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

___
Python tracker 

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



[issue40041] Typo in argparse ja-document wrong:'append', correct:'extend'

2020-03-23 Thread Yasunobu Imamura


Yasunobu Imamura  added the comment:

moved to https://github.com/python-doc-ja/python-doc-ja/issues/825

--
resolution:  -> rejected
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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

Still searching the issue and created a first draft PR. With it, tesT_ssl and 
test_imaplib pass now, urllib2_localnet still has issues.

--

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread Charalampos Stratakis


Change by Charalampos Stratakis :


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

___
Python tracker 

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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

I can reproduce the leak with the following test, stored as 
Lib/test/test_leak.py:
---
from test import support
import unittest

class Tests(unittest.TestCase):
def test_import_fresh(self):
support.import_fresh_module('importlib.machinery',
fresh=('importlib',),
blocked=('_frozen_importlib', '_frozen_importlib_external'))
---

Extract of "./python -m test -R 3:3 test_leak" output:
---
test_leak leaked [6303, 6299, 6303] references, sum=18905
test_leak leaked [2022, 2020, 2022] memory blocks, sum=6064
---

--

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


STINNER Victor  added the comment:


New changeset 188078c39dec24aa5b3f2073bdc9a68ebaae42de by Victor Stinner in 
branch 'master':
Revert "bpo-1635741: Port _weakref extension module to multiphase 
initialization (PEP 489) (GH-19084)" (#19128)
https://github.com/python/cpython/commit/188078c39dec24aa5b3f2073bdc9a68ebaae42de


--

___
Python tracker 

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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 188078c39dec24aa5b3f2073bdc9a68ebaae42de by Victor Stinner in 
branch 'master':
Revert "bpo-1635741: Port _weakref extension module to multiphase 
initialization (PEP 489) (GH-19084)" (#19128)
https://github.com/python/cpython/commit/188078c39dec24aa5b3f2073bdc9a68ebaae42de


--

___
Python tracker 

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



[issue36759] astimezone() fails on Windows for pre-epoch times

2020-03-23 Thread Jonathan Hsu


Jonathan Hsu  added the comment:

I'd like to take on this issue if no one else is working on it.

--

___
Python tracker 

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



[issue38972] [venv] Link to instructions to change PowerShell execution policy for venv activation

2020-03-23 Thread Brett Cannon


Brett Cannon  added the comment:

All sound reasonable, Derek.

--

___
Python tracker 

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



[issue36759] astimezone() fails on Windows for pre-epoch times

2020-03-23 Thread Jonathan Hsu


Change by Jonathan Hsu :


--
nosy: +Jonathan Hsu

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


Change by STINNER Victor :


--
pull_requests: +18489
pull_request: https://github.com/python/cpython/pull/19128

___
Python tracker 

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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


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

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


STINNER Victor  added the comment:

> The last merged pull request, GH-GH-19084, causes refleaks in importlib 
> tests. Stable buildbots are failing, I can reproduce on macOS Catalina.

I expect that the bug is non-trivial, so I prefer to open a separated issue: 
bpo-40050 "test_importlib leaked [6303, 6299, 6303] references".

--

___
Python tracker 

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



[issue40050] test_importlib leaked [6303, 6299, 6303] references

2020-03-23 Thread STINNER Victor


New submission from STINNER Victor :

https://buildbot.python.org/all/#/builders/206/builds/119

test_importlib leaked [6303, 6299, 6303] references, sum=18905
test_importlib leaked [2022, 2020, 2022] memory blocks, sum=6064

Issue reported at: https://bugs.python.org/issue1635741#msg364845

It seems like the regression was introduced by the following change:

commit 8334f30a74abcf7e469b901afc307887aa85a888 (HEAD)
Author: Hai Shi 
Date:   Fri Mar 20 16:16:45 2020 +0800

bpo-1635741: Port _weakref extension module to multiphase initialization 
(PEP 489) (GH-19084)

--
components: Tests
messages: 364905
nosy: vstinner
priority: normal
severity: normal
status: open
title: test_importlib leaked [6303, 6299, 6303] references
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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Moreover, on Linux, getgrouplist() can also fail with -1 if the group list is 
> too small. In that case, ngroups is updated to the number of groups and so 
> can be used to enlarge the list!

I tested by manually initializing ngroups to a value way lower than MAX_GROUPS 
(65536 on my Fedora 31): os.getgrouplist() raises OSError() with a random 
errno, getgrouplist() doesn't set errno on failure.

I wrote PR 19126 to fix the issue on all platforms. The glibc implementation is 
detected and used: use updated ngroups value (only if it's larger).

--

___
Python tracker 

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



[issue36144] Dictionary union. (PEP 584)

2020-03-23 Thread Curtis Bucher


Change by Curtis Bucher :


--
pull_requests: +18488
pull_request: https://github.com/python/cpython/pull/19127

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue38948] os.path.ismount() returns False for current working drive

2020-03-23 Thread Jonathan Hsu


Change by Jonathan Hsu :


--
nosy: +Jonathan Hsu

___
Python tracker 

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



[issue19462] Add remove_argument() method to argparse.ArgumentParser

2020-03-23 Thread paul j3


paul j3  added the comment:

I think it can be closed.

--

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Christian Heimes


Christian Heimes  added the comment:

I suggest that your provide a low solution that returns general information 
from cgroup v1 and unified cgroup v2 rather than a solution that focuses on CPU 
only. Then you can provide a high level interface that returns effective CPU 
cores.

cgroup v2 (unified hierarchy) has been around for 6 years and slowly gains 
traction as container platforms start to support them.

--

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Keir Lawson


Change by Keir Lawson :


--
nosy:  -keirlawson

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

I'm not sure that it's a good idea to change os.cpucount(). I suggest to add a 
new function instead.

os.cpu_count() iss documented as:
"Return the number of CPUs in the system."
https://docs.python.org/dev/library/os.html#os.cpu_count

By the way, the documentation adds:

"This number is not equivalent to the number of CPUs the current process can 
use. The number of usable CPUs can be obtained with 
len(os.sched_getaffinity(0))"

--

___
Python tracker 

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



[issue36144] Dictionary union. (PEP 584)

2020-03-23 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset 25e580a73c163f472fdeb5489bebef85da21655c by Curtis Bucher in 
branch 'master':
bpo-36144: Add union operators to WeakKeyDictionary (#19106)
https://github.com/python/cpython/commit/25e580a73c163f472fdeb5489bebef85da21655c


--

___
Python tracker 

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



[issue32592] Drop support of Windows Vista and 7 in Python 3.9

2020-03-23 Thread C.A.M. Gerlach


C.A.M. Gerlach  added the comment:

Thanks, will do as requested. I was planning on knocking it out yesterday, but 
some unexpected things came up so I might have to push it all the way to next 
weekend, but I'll get it done.

--

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

I will make a PR in this week

--

___
Python tracker 

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



[issue40036] Deleting duplicates in itertoolsmodule.c

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the patch.  I've applied it to the 3.9.   Don't see any need to 
backport this because it is just a minor code cleanup.

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

___
Python tracker 

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



[issue40036] Deleting duplicates in itertoolsmodule.c

2020-03-23 Thread Raymond Hettinger


New submission from Raymond Hettinger :


New changeset 8dd1792c680caaf94a00cead82b238238f419172 by AlphaHot in branch 
'master':
bpo-40036: Deleting duplicates in itertoolsmodule.c (GH-18958)
https://github.com/python/cpython/commit/8dd1792c680caaf94a00cead82b238238f419172


--
nosy: +rhettinger

___
Python tracker 

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



[issue19462] Add remove_argument() method to argparse.ArgumentParser

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> In order to migrate from optparse to argparse we need to have 
> an ability to substitute anguments, e.g. remove and then create.

It seems to me that the original use case is obsolete.

Paul, do you think this issue should be closed?

--
nosy: +rhettinger

___
Python tracker 

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



[issue36054] On Linux, os.count() should read cgroup cpu.shares and cpu.cfs (CPU count inside docker container)

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

Hello Mike, thanks for your code. 

I think it's a good way 

I think if  cpu.quota and cpu.shares are -1, just return the original value in 
os.cpu_count() is OK

--
nosy: +vstinner

___
Python tracker 

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



[issue40045] Make "dunder" method documentation easier to locate

2020-03-23 Thread Kyle Stanley


Kyle Stanley  added the comment:

> I vote for #2.   It improves findability while also recognizing that "dunder" 
> isn't a formal term and lies somewhere between slang and jargon.

Yeah, I suppose it is a bit more of a slang or jargon term rather than 
something with a formal definition, so (2) is fine with me. Thanks for the 
feedback. 

I'll leave the issue open for a new contributor as it would be an easy PR to 
work on. But, if it doesn't receive any attention within a few months or so, 
I'll likely just add it myself since it would be useful to me for easily 
locating the section in the future.

--

___
Python tracker 

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



[issue19462] Add remove_argument() method to argparse.ArgumentParser

2020-03-23 Thread Alexander Hirner


Alexander Hirner  added the comment:

@paul j3
FWIW, popping optionals from a cache that is maintained in addition to 
self._actions, makes special conflict handling unnecessary.

i.e.:
for option_string in a.option_strings:
parser._option_string_actions.pop(option_string)

--
nosy: +cybertreiber

___
Python tracker 

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



[issue40047] itertools.tee does not release resources during iteration?

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've just reviewed the code.  The observed behavior is an intrinsic part of the 
design and was an expected behavior (noted in the comments).  I don't see a 
non-invasive way of making the memory releases more aggressive.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.7

___
Python tracker 

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



[issue39533] Use `statx(2)` system call on Linux for extended `os.stat` information

2020-03-23 Thread ntninja


Change by ntninja :


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

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

Hello Victor

I have tried on both MacOS and Ubuntu 18.04 from 3.8.2 to the newest code in 
master, and can't reproduce this problem

macOS-10.15.4-x86_64-i386-64bit
Python 3.9.0a4+ (heads/master:9a81ab107a, Mar 24 2020, 02:06:30)
[Clang 11.0.3 (clang-1103.0.32.26)]

Linux-4.15.0-1060-aws-x86_64-with-glibc2.27
Python 3.8.2 (default, Mar 23 2020, 19:21:16)
[GCC 8.3.0]

Linux-4.15.0-1060-aws-x86_64-with-glibc2.27
Python 3.9.0a4 (default, Mar 23 2020, 19:25:43)
[GCC 8.3.0]

I think it may be caused by the kernel version and the glibc version, I don't 
have enough evidence to prove it.

I will try the Python 3.7.6 to the newest version in Ubuntu 19.10 with Kernel 
5.3.0-29 and GCC 8.3.0

--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread miss-islington


miss-islington  added the comment:


New changeset 1cdc61c7673f71f2cef57715e482c84efda6d9e0 by Miss Islington (bot) 
in branch '3.7':
bpo-40014: Fix os.getgrouplist() on macOS (GH-19118)
https://github.com/python/cpython/commit/1cdc61c7673f71f2cef57715e482c84efda6d9e0


--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread miss-islington


miss-islington  added the comment:


New changeset 21bee0bd71e1ad270274499f9f58194ebb52e236 by Miss Islington (bot) 
in branch '3.8':
bpo-40014: Fix os.getgrouplist() on macOS (GH-19118)
https://github.com/python/cpython/commit/21bee0bd71e1ad270274499f9f58194ebb52e236


--

___
Python tracker 

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



[issue36144] Dictionary union. (PEP 584)

2020-03-23 Thread Guido van Rossum


Guido van Rossum  added the comment:


New changeset f393b2c588559162dc2e77f8079a42e48558870a by Curtis Bucher in 
branch 'master':
bpo-36144: Add PEP 584 operators to collections.ChainMap (#18832)
https://github.com/python/cpython/commit/f393b2c588559162dc2e77f8079a42e48558870a


--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 6.0 -> 7.0
pull_requests: +18484
pull_request: https://github.com/python/cpython/pull/19123

___
Python tracker 

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



[issue40047] itertools.tee does not release resources during iteration?

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Whats going on is that the implementation tracks blocks of 56 references at a 
time, freeing entire blocks at time.   So the memory release does occur 
periodically, but not as aggressively as it could. This code shows what is 
going on:

# Show the timing of when objects are decreffed

from itertools import tee

class Notify:
def __init__(self, x):
self.x = x
def __del__(self):
print('' % self.x)
def __repr__(self):
return 'Notify(%r)' % self.x

it = map(Notify, range(100))
p, q = tee(it)
for i in range(100):
next(p)
next(q)
print(i)
print('Deleting it')
del it
print('Deleting p')
del p
print('Deleting q')
del q

I'll look to see if the objects can be freed sooner without doing major brain 
surgery to the existing code.

--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 8ec7370c89aa522602eb9604086ce9f09770953d by Victor Stinner in 
branch 'master':
bpo-40014: Fix os.getgrouplist() on macOS (GH-19118)
https://github.com/python/cpython/commit/8ec7370c89aa522602eb9604086ce9f09770953d


--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

test.pythoninfo of the macOS job on the PR:

os.getgrouplist: 20, 0, 12, 61, 79, 80, 81, 98, 264, 399, 701, 33, 100, 204, 
250, 395, 398, 400
os.getgroups: 20, 0, 12, 61, 79, 80, 81, 98, 264, 399, 701, 33, 100, 204, 250, 
395, 398, 400

So yeah, there are 18 groups ;-)

--

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


STINNER Victor  added the comment:


New changeset bd409bb5b78e7ccac5fcda9ab4cec770552f3090 by Paulo Henrique Silva 
in branch 'master':
bpo-1635741: Port time module to multiphase initialization (PEP 489) (GH-19107)
https://github.com/python/cpython/commit/bd409bb5b78e7ccac5fcda9ab4cec770552f3090


--

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Try to get the gdb traceback (C call stack).

You may also try: python3 -X faulthandler urllib_segfault.py.

But I expect a crash in Python finalization, where there is no Python frame and 
so empty traceback.

--

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.7.3 is outdated. Can you please try on newer Python version?


I failed to reproduce the crash on Fedora 31. I tested:

vstinner@apu$ python3.7 -VV
Python 3.7.6 (default, Jan 30 2020, 09:44:41) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

vstinner@apu$ python3.8 -VV
Python 3.8.2 (default, Feb 26 2020, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

vstinner@apu$ python3.9 -VV
Python 3.9.0a4 (default, Feb 27 2020, 00:00:00) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

vstinner@apu$ python3-debug -VV
Python 3.7.6 (default, Jan 30 2020, 09:04:19) 
[GCC 9.2.1 20190827 (Red Hat 9.2.1-1)]

--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Most likely this hasn't been an issue before is that 10.15 creates more 
> groups for system services than the earlier versions did.

Aha, interesting. I updated my PR to remove mentions of the macOS version 
number. I just wrote "on macOS". Yeah, I wouldn't be surprised that the 
function always failed.

--

I'm not sure that the Linux implementation is correct. It rely on errno, 
whereas Linux manual page of getgrouplist() doesn't say anything about errno 
being set on error.

Moreover, on Linux, getgrouplist() can also fail with -1 if the group list is 
too small. In that case, ngroups is updated to the number of groups and so can 
be used to enlarge the list!

--

___
Python tracker 

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



[issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed.

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

> (This issue previously had "release blocker" priority before it was closed.  
> Now that it is re-opened does it still need that? I'm assuming not.)

Techicanilly, it's a 3.9 regression but I don't think that it should be hold 
3.9 release. So no, it's not a blocker issue.

--

___
Python tracker 

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



[issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed.

2020-03-23 Thread Ned Deily


Ned Deily  added the comment:

(This issue previously had "release blocker" priority before it was closed.  
Now that it is re-opened does it still need that? I'm assuming not.)

--
nosy: +ned.deily
priority: release blocker -> high
versions: +Python 3.9 -Python 3.4

___
Python tracker 

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



[issue40045] Make "dunder" method documentation easier to locate

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I vote for #2.   It improves findability while also recognizing that "dunder" 
isn't a formal term and lies somewhere between slang and jargon.

--
nosy: +rhettinger

___
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-23 Thread Paulo Henrique Silva


Change by Paulo Henrique Silva :


--
pull_requests: +18483
pull_request: https://github.com/python/cpython/pull/19122

___
Python tracker 

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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

use the same GCC 8.3.0 to recompile the Python 3.7.3 still no fault

maybe we need the core dump to figure it out.

--

___
Python tracker 

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



[issue39148] DatagramProtocol + IPv6 does not work with ProactorEventLoop

2020-03-23 Thread Kjell Braden


Change by Kjell Braden :


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

___
Python tracker 

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



[issue37319] Deprecate using random.randrange() with non-integers

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Marking this as rejected.  Nothing good would come from obfuscating the docs to 
note a minor implementation detail.

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

___
Python tracker 

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



[issue40033] Just defined class missing from scope

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I assumed that Level1A should already be in scope while defining 
> the insides of Level1B. But it isn't.

That analysis is correct.  Class namespaces don't nest like functions do.  The 
"enclosing" namespace is globals, not the surrounding class.

This isn't a bug, but it is understandable why you might assume otherwise.

--
nosy: +rhettinger
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



[issue39853] Segmentation fault with urllib.request.urlopen and threads

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

I have tried it on Python 3.7.3 Ubuntu 18.04 

Linux-4.15.0-1060-aws-x86_64-with-debian-buster-sid
Python 3.7.3 (default, Mar 23 2020, 18:15:26)
[GCC 7.5.0]

there is no segmentation fault 

would you mind sharing the core dump to help us find more detail about the 
crash?

--
nosy: +Manjusaka

___
Python tracker 

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



[issue37319] Deprecate using random.randrange() with non-integers

2020-03-23 Thread Tim Peters


Tim Peters  added the comment:

It's neither "bug" nor "feature" - it's an inherited quirk CPython maintains to 
avoid annoying users for no good reason.

If you absolutely have to "do something", how about adding a mere footnote?  
The docs already imply the args have the same restrictions as for `range()`.  A 
footnote could add that, to preserve historical compatibility, CPython also 
accepts arguments `x` for which `int(x) == x`, and uses `int(x)` in such cases 
- but portable code shouldn't rely on that.

But nobody cares, so putting that in the main part of the docs would also annoy 
99.99% of users for no good reason ;-)

--

___
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-23 Thread hai shi

hai shi  added the comment:

> The last merged pull request, GH-GH-19084, causes refleaks in importlib 
> tests. Stable buildbots are failing, I can reproduce on macOS Catalina.

thanks, Łukasz.
I catched this problem in my vm of centos too. I don't the broken reason 
temporarily.

--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS if the user has more than 17 groups

2020-03-23 Thread Ned Deily


Ned Deily  added the comment:

Thanks for the PR, Victor, it does address the problem.  I went back and 
explicitly tested on macOS 10.14 and 10.13 by creating some more groups and 
adding the user to them and the same failure occurred there so this is not just 
a 10.15 issue.  Most likely this hasn't been an issue before is that 10.15 
creates more groups for system services than the earlier versions did.  So the 
PR should be updated to remove the 10.15 (and 10.5!) references.

--
title: os.getgrouplist() fails on macOS 10.15 (Catalina) if the user has more 
than 17 groups -> os.getgrouplist() can fail on macOS if the user has more than 
17 groups

___
Python tracker 

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



[issue34591] smtplib mixes RFC821 and RFC822 addresses

2020-03-23 Thread Manjusaka


Manjusaka  added the comment:

> This is a problem because not all RFC822 addresses are valid RFC821 addresses.

Do you mean that we would add a verification before we send the command?

--
nosy: +Manjusaka

___
Python tracker 

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



[issue40012] Avoid Python 2 documentation to appear in Web search results

2020-03-23 Thread Terry Davis


Terry Davis  added the comment:

It seems like using "noindex" to tell search engines not to look at Python 2 
docs at all would have the side-effect of breaking Python 2 documentation 
searches.
I have gotten into the habit of searching for "python 3" explicitly, which I 
think is a reasonable work-around. Especially since python 2 and 3 could be 
considered different languages.

--
nosy: +Terry Davis

___
Python tracker 

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



[issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed.

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue40039] [CVE-2020-10796] Python multiprocessing Remote Code Execution vulnerability

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Lib/multiprocessing/connection.py uses a challenge to authenticate the client. 
How do you connect to the server?

Yes, it's known that pickle is not safe, there is a big red warning at the top 
of the doc:
https://docs.python.org/dev/library/pickle.html

But please elaborate your attack scenario. How do you execute arbitrary code on 
a server? How do you inject code?

--

___
Python tracker 

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



[issue36759] astimezone() fails on Windows for pre-epoch times

2020-03-23 Thread SilentGhost

SilentGhost  added the comment:

Yes, I was also able to verify this issue on 3.8.2 on win10. Argument to 
astimezone is not required, and this happens for both naïve and aware objects.

--
nosy: +belopolsky, p-ganssle
resolution: duplicate -> 
stage: resolved -> test needed
status: closed -> open
superseder: [Windows] datetime.fromtimestamp(t) when 0 <= t <= 86399 fails on 
Python 3.6 -> 
title: datetime: astimezone() results in OSError: [Errno 22] Invalid argument 
-> astimezone() fails on Windows for pre-epoch times
versions: +Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue40048] _PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Note: I found this issue with Pablo Galindo Galgado while investigating 
bpo-20526.

--
nosy: +inada.naoki, pablogsal

___
Python tracker 

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



[issue40014] os.getgrouplist() fails on macOS 10.15 (Catalina) if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Python 3.7 and 3.8 are also affected on macOS 10.15 (Catalina).

--
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue40024] Add _PyModule_AddType private helper function

2020-03-23 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue38972] [venv] Link to instructions to change PowerShell execution policy for venv activation

2020-03-23 Thread Derek Keeler


Derek Keeler  added the comment:

Where would we like to put this information?

My proposal would be to add this in a combination of places:

1. Add a further note near the symlinks on Windows comment in this document: 
`Doc\using\venv-create.inc`

2. Add a blurb in the Activate.ps1 script itself, so that any user can see it 
very near where the problem might occur. `Lib\venv\scripts\common\Activate.ps1`

I'd probably put something like the following in there:
---

.. note::
   On Microsoft Windows, it may be required to enable the ``Activate.ps1``
   script by setting the execution policy for the user. You can do this by
   issuing the following Powershell command from a Powershell command window:

   PS C:\Users\user> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope 
CurrentUser

   See `About Execution Policies 
   
`_
   for more information.

---

(This would exist as a ".Notes" section in the Activate.ps1 script)


What do folks think?

--
nosy: +d3r3kk

___
Python tracker 

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



[issue40014] os.getgrouplist() fails on macOS 10.15 (Catalina) if the user has more than 17 groups

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


--
title: os.getgrouplist() can fail on macOS -> os.getgrouplist() fails on macOS 
10.15 (Catalina) if the user has more than 17 groups

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

tl; dr os.getgrouplist() is limited to 17 groups and fails with a random 
OSError if the request user has more groups. PR 19118 fix the issue.

--

On macOS-10.15.1-x86_64-i386-64bit (python -m platform), os.getgrouplist() 
fails with my user name and group identifier:

>>> os.getgrouplist('haypo', 20)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 0] Error

Full example:

macbook:master haypo$ ./python.exe 
Python 3.9.0a4+ (heads/master:da2914d, Mar 20 2020, 09:45:36) 
[Clang 11.0.0 (clang-1100.0.33.8)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, pwd
>>> entry=pwd.getpwuid(os.getuid())

>>> os.getgrouplist(entry.pw_name, entry.pw_gid)
Traceback (most recent call last):
  File "", line 1, in 
InterruptedError: [Errno 4] Interrupted system call

>>> os.getgrouplist(entry.pw_name, entry.pw_gid)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 0] Error

>>> entry
pwd.struct_passwd(pw_name='haypo', pw_passwd='', pw_uid=502, pw_gid=20, 
pw_gecos='Victor Stinner', pw_dir='/Users/haypo', pw_shell='/bin/bash')


My user has the following groups:

macbook:master haypo$ id
uid=502(haypo) gid=20(staff) 
groups=20(staff),702(com.apple.sharepoint.group.2),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),701(com.apple.sharepoint.group.1),33(_appstore),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh),400(com.apple.access_remote_ae),703(com.apple.sharepoint.group.3)

My user has 18 groups.

MAX_GROUPS=16, Python uses 1 + MAX_GROUPS.

getgrouplist() manual page says:

RETURN VALUES
 The getgrouplist() function returns 0 on success.  If the size of the 
group list is too small to hold
 all the user's groups, getgrouplist() returns -1 to indicate failure.  In 
this case, the group array
 will be filled with as many groups as will fit.


In short, getgrouplist() doesn't set errno on failure.

--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +18479
pull_request: https://github.com/python/cpython/pull/19118

___
Python tracker 

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



[issue39148] DatagramProtocol + IPv6 does not work with ProactorEventLoop

2020-03-23 Thread Steve Dower


Steve Dower  added the comment:

Main thing we need is a PR (straightforward) and confirming that the relevant 
tests all run. We can use the buildbot fleet to make sure that all supported 
platforms have the necessary APIs, but it wouldn't surprise me if there's some 
weird edge cases here.

--

___
Python tracker 

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



[issue40014] os.getgrouplist() can fail on macOS

2020-03-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +18478
pull_request: https://github.com/python/cpython/pull/19117

___
Python tracker 

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



[issue40049] tarfile cannot extract from stdin

2020-03-23 Thread Danijel


New submission from Danijel :

Hi,

I have the following code:

```
import tarfile
import sys

tar = tarfile.open(fileobj=sys.stdin.buffer, mode='r|*')
tar.extractall("tarout")
tar.close()
```

then doing the following on a debian 10 system:

```
$ python -m tarfile -c git.tar /usr/share/doc/git
$ python -V
Python 3.8.1
$ cat git.tar | python foo.py
$ cat git.tar | python foo.py
Traceback (most recent call last):
  File "foo.py", line 5, in 
tar.extractall("tarout")
  File "/home/danielt/miniconda3/lib/python3.8/tarfile.py", line 2026, in 
extractall
self.extract(tarinfo, path, set_attrs=not tarinfo.isdir(),
  File "/home/danielt/miniconda3/lib/python3.8/tarfile.py", line 2067, in 
extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name),
  File "/home/danielt/miniconda3/lib/python3.8/tarfile.py", line 2139, in 
_extract_member
self.makefile(tarinfo, targetpath)
  File "/home/danielt/miniconda3/lib/python3.8/tarfile.py", line 2178, in 
makefile
source.seek(tarinfo.offset_data)
  File "/home/danielt/miniconda3/lib/python3.8/tarfile.py", line 513, in seek
raise StreamError("seeking backwards is not allowed")
tarfile.StreamError: seeking backwards is not allowed
```

The second extraction trys to seek, although the mode is 'r|*'.


For reference if I remove ".buffer" from the code above, I can run
it with python2 without problems:

```
$ cat foo2.py
import tarfile
import sys

tar = tarfile.open(fileobj=sys.stdin, mode='r|*')
tar.extractall("tarout")
tar.close()

$ cat git.tar | python2 foo2.py
$ cat git.tar | python2 foo2.py
$ cat git.tar | python2 foo2.py
$ cat git.tar | python2 foo2.py
$ cat git.tar | python2 foo2.py
```

--
components: Library (Lib)
messages: 364860
nosy: dtamuc
priority: normal
severity: normal
status: open
title: tarfile cannot extract from stdin
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



[issue40046] Increase test coverage of the random module

2020-03-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is wrong with adding more tests?

--

___
Python tracker 

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



[issue40033] Just defined class missing from scope

2020-03-23 Thread Damian Yurzola


Change by Damian Yurzola :


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



[issue40046] Increase test coverage of the random module

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I'm against this doc change.  While factually true, it is irrelevant and 
distracting to most users.  We do not need to test and document every 
implementation detail, nor should we.

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

___
Python tracker 

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



[issue37319] Deprecate using random.randrange() with non-integers

2020-03-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

How about we just leave it alone.  AFAICT nothing is broken -- no user is 
having any issues.  We really don't need to go through every tool in the 
standard library that uses int() and document that it accepts any type that 
defines __int__, nor do we need to test those cases.  I understand that you are 
bugged by this but it isn't a real problem.

--

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread Kubilay Kocak


Kubilay Kocak  added the comment:

Confirming on FreeBSD CURRENT buildbot worker which had its openssl updated to 
1.1.1e a number of days ago. I reverted back to 1.1.1d

Full log of the failing build/tests with 1.1.1e attached

--
nosy: +koobs
Added file: 
https://bugs.python.org/file48997/amd64.freebsd.shared.3.x.build.450.test.stdio.txt

___
Python tracker 

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



[issue38243] [security][CVE-2019-16935] A reflected XSS in python/Lib/DocXMLRPCServer.py

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Charalampos Strataris's advice: If you backport the security fix and 
test_docxmlrpc starts to hang randomly, you should also backport bpo-27614 fix. 
For example, it's the commit 3911d8333c5b6f9374fa11ab7c912f1471580f0f for 
Python 2.7. We had the issue on RHEL 7.

--

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

I closed bpo-39787 "test_ssl and test_urllib2_localnet failing with new 
OpenSSL" as a duplicate of this issue. Copy of the message:

"""
test_ssl and test_urllib2_localnet are failing when Python is built against 
top-of-tree OpenSSL. I'm attaching the output of: `regrtest.py test_ssl 
test_urllib2_localnet -W`

The output is from a powerpc64le machine with Python 3.8.2+ (1bbb81b251bc) and 
OpenSSL master (db943f43a60d1b).

A git bisect showed the problems started with the following OpenSSL commit:

commit db943f43a60d1b5b1277e4b5317e8f288e7a0a3a
Author: Matt Caswell 
Date:   Fri Jan 17 17:39:19 2020 +

Detect EOF while reading in libssl

If we hit an EOF while reading in libssl then we will report an error
back to the application (SSL_ERROR_SYSCALL) but errno will be 0. We add
an error to the stack (which means we instead return SSL_ERROR_SSL) and
therefore give a hint as to what went wrong.

Contains a partial fix for #10880

Reviewed-by: Tomas Mraz 
Reviewed-by: Dmitry Belyavskiy 
(Merged from https://github.com/openssl/openssl/pull/10882)

This also looks similar to: https://bugs.python.org/issue28689
"""

There is a file attached which contains test failures like these ones:

test_ciphers (test.test_ssl.SimpleBackgroundTests) ...  server:  new connection 
from ('127.0.0.1', 39550)
 server: connection cipher is now ('TLS_AES_256_GCM_SHA384', 'TLSv1.3', 256)
 server: selected protocol is now None
Test server failure:
Traceback (most recent call last):
   File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/test/test_ssl.py",
 line 2388, in run
msg = self.read()
   File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/test/test_ssl.py",
 line 2365, in read
return self.sslconn.read()
   File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1101, in read
return self._sslobj.read(len)
 OSError: [Errno 0] Error
ERROR

==
ERROR: test_connect_capath (test.test_ssl.SimpleBackgroundTests)
--
Traceback (most recent call last):
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/test/test_ssl.py",
 line 2038, in test_connect_capath
s.connect(self.server_addr)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1342, in connect
self._real_connect(addr, False)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1333, in _real_connect
self.do_handshake()
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1309, in do_handshake
self._sslobj.do_handshake()
ConnectionResetError: [Errno 104] Connection reset by peer



==
ERROR: test_https (test.test_urllib2_localnet.TestUrlopen)
--
Traceback (most recent call last):
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/test/test_urllib2_localnet.py",
 line 560, in test_https
data = self.urlopen("https://localhost:%s/bizarre; % handler.port, 
context=context)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/test/test_urllib2_localnet.py",
 line 464, in urlopen
l.extend(f.readlines(200))
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/http/client.py",
 line 655, in readline
result = self.fp.readline(limit)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/socket.py", 
line 669, in readinto
return self._sock.recv_into(b)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1241, in recv_into
return self.read(nbytes, buffer)
  File 
"/home/mscastanho/AT/next/opt/at-next-14.0-0-alpha/lib64/python3.8/ssl.py", 
line 1099, in read
return self._sslobj.read(len, buffer)
ssl.SSLError: [SSL: KRB5_S_TKT_NYV] unexpected eof while reading (_ssl.c:2607)

--

___
Python tracker 

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



[issue39787] test_ssl and test_urllib2_localnet failing with new OpenSSL

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Duplicate of bpo-40018.

--
nosy: +vstinner
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> test_ssl fails with OpenSSL 1.1.1e

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread Matheus Castanho


Matheus Castanho  added the comment:

Hi, I believe this is the exact same problem as reported by 
https://bugs.python.org/issue39787

Both issues could be closed by the same fix =)

--
nosy: +mscastanho

___
Python tracker 

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



[issue20526] python: Modules/gcmodule.c:379: visit_decref: Assertion `((gc)->gc.gc_refs >> (1)) != 0' failed.

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

Right now, threading_shutdown_interrupted.py does crash on the master branch 
(commit 05e4a296ecc127641160a04f39cc02c0f66a8c27). I reintroduced the bug with:

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.

I investigated this bug with Pablo Galindo Salgado. When the bug triggers, 
there are 2 strong references to a Frame object:

* Traceback object
* Generator object

The bug occurs in "except ValueError as exc:" of EvilThread.coroutine().

The exception contains a traceback object which has a strong reference to the 
frame.

The frame object contains "exc" variable (the exception) which contains a 
reference to the tracecback (exc.__traceback__) which contains a refererence to 
the frame (tb.tb_frame): there is a reference cycle. (It's not really an issue 
by itself).

There are 2 strong references to the Frame object.

Py_FinalizeEx() calls _PyThreadState_DeleteExcept() which doesn't clear the 
reference cycle. But PyThreadState_Clear() calls Py_CLEAR(tstate->frame) which 
reduces the Frame reference counter from 2 to 1, even if there are still 2 
strong references to it (traceback and generator).

tstate->frame is only set at 3 places:

* new_threadstate(): when a Python thread state is created (it's initialized to 
NULL)
* _PyEval_EvalFrameDefault() entry: set to frame
* _PyEval_EvalFrameDefault() exit: set to frame->f_back (which can be NULL

By the way, _PyEval_EvalFrameDefault() has a bug: tstate->frame is not reset if 
_PyCode_InitOpcache() fails: bpo-40048.

Py_FinalizeEx() calls _PyRuntimeState_SetFinalizing(runtime, tstate) and so 
threads which tries to take the GIL must exit immediately. Extract of 
take_gil():
---
static inline int
tstate_must_exit(PyThreadState *tstate)
{
PyThreadState *finalizing = _PyRuntimeState_GetFinalizing(&_PyRuntime);
return (finalizing != NULL && finalizing != tstate);
}

static void
take_gil(PyThreadState *tstate)
{
...

if (tstate_must_exit(tstate)) {
PyThread_exit_thread();
}
...
}
---

The thread is exited in the middle of _PyEval_EvalFrameDefault() by take_gil() 
which calls PyThread_exit_thread() because the thread must exit (because the 
main thread destroyed its Python thread state and so accessing it would crash 
the thread).

_PyThreadState_DeleteExcept() calls PyThreadState_Clear() which calls 
Py_CLEAR(tstate->frame): this case only occurs because the thread exited in the 
middle of _PyEval_EvalFrameDefault(). In the normal case, 
_PyEval_EvalFrameDefault() always resets tstate->frame to its previous value.

Py_CLEAR(tstate->frame) is wrong: it's a *borrowed* reference.

Pablo and me agree with PyThreadState_Clear() must not call 
Py_CLEAR(tstate->frame): it's borrowed reference, not a strong reference.

I'm working on a PR to fix the issue.

--
resolution: wont fix -> 
status: closed -> open

___
Python tracker 

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



[issue40048] _PyEval_EvalFrameDefault() doesn't reset tstate->frame if _PyCode_InitOpcache() fails

2020-03-23 Thread STINNER Victor


New submission from STINNER Victor :

tstate->frame is a borrowed references to the current frame object. It's set tp 
the frame at _PyEval_EvalFrameDefault() and resets to frame->f_back at 
_PyEval_EvalFrameDefault() exit.

Problem: when _PyCode_InitOpcache() fails, tstate->frame is not reset to 
frame->f_back.

--
components: Interpreter Core
messages: 364850
nosy: vstinner
priority: normal
severity: normal
status: open
title: _PyEval_EvalFrameDefault() doesn't reset tstate->frame if 
_PyCode_InitOpcache() fails
versions: Python 3.8, Python 3.9

___
Python tracker 

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



[issue40047] itertools.tee does not release resources during iteration?

2020-03-23 Thread Peter Würtz

New submission from Peter Würtz :

Itertools `tee` does not seem to de-reference yielded items, even after 
consumption of all items from all tee-iterators.

According to the documentation (to my understanding), there shouldn't be any 
extra memory requirement as long as the tee-iterators are consumed in a 
balanced way. I.e. after an item was pulled from all iterators there shouldn't 
be any residual reference to it.

This is true for the example-implementation mentioned in the documentation, but 
`itertools.tee` doesn't de-reference items until the tee-iterator itself is 
deleted:

https://pastebin.com/r3JUkH41

Is this a bug or am I missing something?

--
components: Library (Lib)
messages: 364849
nosy: pwuertz
priority: normal
severity: normal
status: open
title: itertools.tee does not release resources during iteration?
type: resource usage
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



[issue39830] zipfile.Path is not included in __all__

2020-03-23 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue39830] zipfile.Path is not included in __all__

2020-03-23 Thread Jason R. Coombs


Jason R. Coombs  added the comment:


New changeset 9a81ab107a54b8ca320fb703f7c68e14ccd9d016 by Zackery Spytz in 
branch 'master':
bpo-39830: Add zipfile.Path to __all__ (GH-19115)
https://github.com/python/cpython/commit/9a81ab107a54b8ca320fb703f7c68e14ccd9d016


--

___
Python tracker 

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



[issue40041] Typo in argparse ja-document wrong:'append', correct:'extend'

2020-03-23 Thread Tomohiko Kinebuchi


Tomohiko Kinebuchi  added the comment:

Japanese translation issues are tracked in the repository below for historical 
reasons.
So, please create a report about this issue in English or Japanese.

https://github.com/python-doc-ja/python-doc-ja/issues

--
nosy: +cocoatomo
versions: +Python 3.8 -Python 3.9

___
Python tracker 

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



[issue40018] test_ssl fails with OpenSSL 1.1.1e

2020-03-23 Thread STINNER Victor


STINNER Victor  added the comment:

bpo-40044 was marked as a duplicate of this issue. Copy of Charalampos's 
message:
"""
The fedora rawhide buildbots started failing due to the latest update of 
openssl to version 1.1.1e.

e.g. https://buildbot.python.org/all/#/builders/607/builds/137

Changelog: https://www.openssl.org/news/cl111.txt

The relevant info which seems to make the tests fail:

Properly detect EOF while reading in libssl. Previously if we hit an EOF while 
reading in libssl then we would report an error back to the application 
(SSL_ERROR_SYSCALL) but errno would be 0. We now add an error to the stack 
(which means we instead return SSL_ERROR_SSL) and therefore give a hint as to 
what went wrong.

Upstream PR: https://github.com/openssl/openssl/pull/10882

urllib3 issue: https://github.com/urllib3/urllib3/issues/1825
"""

--
nosy: +vstinner

___
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-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

The last merged pull request, GH-GH-19084, causes refleaks in importlib tests. 
Stable buildbots are failing, I can reproduce on macOS Catalina.

You can test yourself by running:
$ ./python.exe -E -Wd -m test -uall,-gui -l -L -R: test_importlib

Master at 2de7ac9798 does not fail while the next commit, 8334f30a74, 
introduces the failure.

--
nosy: +lukasz.langa

___
Python tracker 

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



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-03-23 Thread Łukasz Langa

Łukasz Langa  added the comment:

> Reverting GH-18627 fixes the issue.

Sorry, this is false. I just checked out to the last commit to importlib before 
GH-18627 and it did not refleak. But when I actually reverted just GH-18627, 
the issue persisted.

By bisecting, I found out that it's GH-19084 which causes the refleak and it 
only just so happens that this refleak appears in importlib tests.

--

___
Python tracker 

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



[issue39830] zipfile.Path is not included in __all__

2020-03-23 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 3.0 -> 4.0
pull_requests: +18476
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/19115

___
Python tracker 

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



[issue38691] importlib: PYTHONCASEOK should be ignored when using python3 -E

2020-03-23 Thread Łukasz Langa

Change by Łukasz Langa :


--
stage: resolved -> commit review

___
Python tracker 

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



  1   2   >