[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-22 Thread Leonardo Mörlein

Change by Leonardo Mörlein :


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



[issue36069] asyncio: create_connection cannot handle IPv6 link-local addresses anymore (linux)

2019-02-22 Thread Leonardo Mörlein

Leonardo Mörlein  added the comment:

Oh, you are correct. So this can be closed.

--

___
Python tracker 

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



[issue34981] Unable to install Python from web-based installer and executable installer

2019-02-22 Thread Inada Naoki


Change by Inada Naoki :


--
resolution:  -> out of date
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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Okay the PR is ready.

If you all are mostly comfortable with it, it would great to get this in for 
the second alpha so that people have a chance to work with it.

--
nosy: +davin

___
Python tracker 

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



[issue35810] Object Initialization does not incref Heap-allocated Types

2019-02-22 Thread Christian Tismer


Christian Tismer  added the comment:

Neil, that is the absolute super-move!

When all types are heap types, then I have no longer the problem
that I cannot get at slots from builtin types, with all are static.

I am very much for that change, because then I can make my stable
ABI implementation of PySide much cleaner.

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Kevin Mai-Hsuan Chia


New submission from Kevin Mai-Hsuan Chia :

It seems the result of `asyncio.Server.sockets` after `asyncio.Server.close()` 
is performed becomes `[]` instead of `None` since python 3.7. However, in the 
[document 3.7 and 
3.8](https://docs.python.org/3.8/library/asyncio-eventloop.html#asyncio.Server.sockets),
 it states
```
List of socket.socket objects the server is listening on, or None if the server 
is closed.

Changed in version 3.7: Prior to Python 3.7 Server.sockets used to return an 
internal list of server sockets directly. In 3.7 a copy of that list is 
returned.
```
For me, I think the comment `Changed in version 3.7: ...` only emphasizes the 
"copied list" is returned. IMO it will be more clear if the change from `None` 
to `[]` is mentioned in the comment as well. Sorry if this issue is not 
appropriate. Thanks!

--
assignee: docs@python
components: Documentation
messages: 336287
nosy: docs@python, mhchia
priority: normal
severity: normal
status: open
title: Result of `asyncio.Server.sockets` after `Server.close()` is not clear
type: enhancement
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



[issue31162] urllib.request.urlopen CERTIFICATE_VERIFY_FAILED error

2019-02-22 Thread Martin Panter


Change by Martin Panter :


--
resolution:  -> not a bug
status: open -> pending
title: urllib.request.urlopen error -> urllib.request.urlopen 
CERTIFICATE_VERIFY_FAILED error

___
Python tracker 

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



[issue36075] python 2to3 conversion tool is generating file with extra line for every input line

2019-02-22 Thread Saba Kauser


New submission from Saba Kauser :

Hi,
I am building my python ibm_db driver on python 3.7 using the setup.py under 
https://github.com/SabaKauser/python-ibmdb/blob/master/IBM_DB/ibm_db/setup.py 
with 2to3 compatibility as:

python setup.py build
and installing as:
python setup.py install

I have a python script that after installing has new empty line added for every 
line.

e.g:
my source:
   if database is None:
raise InterfaceError("createdb expects a not None database name value")
if (not isinstance(database, basestring)) | \
   (not isinstance(codeset, basestring)) | \
   (not isinstance(mode, basestring)):
raise InterfaceError("Arguments sould be string or unicode")

The generated file under 
C:\Users\skauser\AppData\Local\Programs\Python\Python37\Lib\site-packages\ibm_db-2.0.9-py3.7-win-amd64.egg\ibm_db_dbi.py

   if database is None:

raise InterfaceError("createdb expects a not None database name value")

if (not isinstance(database, str)) | \

   (not isinstance(codeset, str)) | \

   (not isinstance(mode, str)):

raise InterfaceError("Arguments sould be string or unicode")

As you can see, there is this new line that is throwing runtime error.
  File 
"c:\users\skauser\appdata\local\programs\python\python37\lib\site-packages\ibm_db-2.0.9-py3.7-win-amd64.egg\ibm_db_dbi.py",
 line 846

^
SyntaxError: invalid syntax

Could you please let me know how can I get rid of this behavior?

When I install the package using pip, I don't see this behavior.

Thanks!
Saba.

--
components: 2to3 (2.x to 3.x conversion tool)
messages: 336288
nosy: sabakauser
priority: normal
severity: normal
status: open
title: python 2to3 conversion tool is generating file with extra line for every 
input line
type: compile error
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



[issue35810] Object Initialization does not incref Heap-allocated Types

2019-02-22 Thread Petr Viktorin


Petr Viktorin  added the comment:

Changing all types to heap types is definitely a gigantic task. First let's 
make heap types more usable and bug-free, and then it will be easier :)

(I do have an agenda here: improving heap types usable is also yak-shaving* for 
making modules play nice with subinterpreters, like in PEPs 489 & 573)

* https://en.wiktionary.org/wiki/yak_shaving

--

___
Python tracker 

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



[issue36064] docs: urllib.request.Request not accepting iterables data type

2019-02-22 Thread Martin Panter

Martin Panter  added the comment:

I agree the documentation is insufficient. It should have said if “data” is 
iterated, it must yield bytes-like objects.

I agree it is unwise to yet more special cases for the uploaded data types. 
When Lye passed the dictionary of three keys and values, I suspect they weren’t 
expecting it to upload just the key names using one HTTP chunk for each key. 
See Issue 23740 about the mess of data types currently supported.

--

___
Python tracker 

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



[issue35889] sqlite3.Row doesn't have useful repr

2019-02-22 Thread Vlad Shcherbina


Vlad Shcherbina  added the comment:

There is no need to add explicit knowledge of reprlib to the Row object or vice 
versa.

Those who use reprlib to limit output size will have no problem. Reprlib 
already truncates arbitrary reprs at the string level: 
https://github.com/python/cpython/blob/22bfe637ca7728e9f74d4dc8bb7a15ee2a913815/Lib/reprlib.py#L144

Those who use builtin repr() have to be prepared for the possibility of 
unbounded repr anyway, because all collection-like objects in Python have 
unbounded __repr__.

It would be annoying if some collection-like objects decided to be clever and 
omit parts of their regular __repr__ because they feel it's too much for the 
user to handle.

--

___
Python tracker 

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



[issue36076] ssl.get_server_certificate should use SNI

2019-02-22 Thread Maciej Grela


New submission from Maciej Grela :

The ssl.get_server_certificate function doesn't send SNI information causing an 
wrong certificate to be sent back by the server (or connection close in some 
cases). This can be seen when trying to use get_server_certificate against a 
site behind cloudflare. An example is provided below:

$ python3 -V
Python 3.7.2
$ python3 -c "import ssl; 
print(ssl.get_server_certificate(('www.mx.com',443)))" | openssl x509 -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
89:2a:bc:df:8a:f3:d6:f6:ae:c5:18:5a:78:ec:39:6e
Signature Algorithm: ecdsa-with-SHA256
Issuer: C=GB, ST=Greater Manchester, L=Salford, O=COMODO CA Limited, 
CN=COMODO ECC Domain Validation Secure Server CA 2
Validity
Not Before: Dec 19 00:00:00 2018 GMT
Not After : Jun 27 23:59:59 2019 GMT
Subject: OU=Domain Control Validated, OU=PositiveSSL Multi-Domain, 
CN=ssl803013.cloudflaressl.com
Subject Public Key Info:
Public Key Algorithm: id-ecPublicKey
Public-Key: (256 bit)
pub: 
04:ff:c1:c3:f1:c0:8a:08:84:ad:e4:25:f6:c3:03:
1f:26:0a:b4:85:e0:65:0e:f5:8b:13:1e:21:b2:54:
94:8c:f3:ce:98:eb:cf:ff:ff:1d:3a:03:22:b1:7c:
5f:13:e5:09:1f:77:b0:e8:ac:bf:e6:6c:ea:cb:57:
df:e1:c8:14:da
ASN1 OID: prime256v1
NIST CURVE: P-256
X509v3 extensions:
X509v3 Authority Key Identifier: 

keyid:40:09:61:67:F0:BC:83:71:4F:DE:12:08:2C:6F:D4:D4:2B:76:3D:96

X509v3 Subject Key Identifier: 
4B:F4:77:CD:FB:04:DC:0D:B2:A5:99:B8:6F:17:CC:80:DF:AE:59:DF
X509v3 Key Usage: critical
Digital Signature
X509v3 Basic Constraints: critical
CA:FALSE
X509v3 Extended Key Usage: 
TLS Web Server Authentication, TLS Web Client Authentication
X509v3 Certificate Policies: 
Policy: 1.3.6.1.4.1.6449.1.2.2.7
  CPS: https://secure.comodo.com/CPS
Policy: 2.23.140.1.2.1

X509v3 CRL Distribution Points: 

Full Name:
  
URI:http://crl.comodoca4.com/COMODOECCDomainValidationSecureServerCA2.crl

Authority Information Access: 
CA Issuers - 
URI:http://crt.comodoca4.com/COMODOECCDomainValidationSecureServerCA2.crt
OCSP - URI:http://ocsp.comodoca4.com

X509v3 Subject Alternative Name: 
DNS:ssl803013.cloudflaressl.com, DNS:*.hscoscdn00.net, 
DNS:hscoscdn00.net
1.3.6.1.4.1.11129.2.4.2: 
..u...q...#...{G8W.
.Rd6...g..P..F0D. ...0J|..2I..}%.Q.P...Zg.. 
..ej...Y^.Ti^..].w.t~..1.3..!..%OBp...^B 
..75y..{.V...g..Pv.H0F.!..1#I..\.#2...$...X
..!...].{o..ud..6OV
Q.x...J_([!.
Signature Algorithm: ecdsa-with-SHA256
 30:45:02:20:0c:8c:b6:ea:68:e4:d6:d6:18:95:50:8f:77:41:
 63:51:81:59:3b:1b:e6:38:47:88:f3:47:d5:b0:0b:03:c5:ba:
 02:21:00:d2:19:3f:71:e2:64:36:79:d1:4c:c9:98:fd:74:d7:
 32:53:f6:b4:de:09:65:d8:a0:60:85:eb:f1:1f:75:35:75
-BEGIN CERTIFICATE-
MIIFBzCCBK2gAwIBAgIRAIkqvN+K89b2rsUYWnjsOW4wCgYIKoZIzj0EAwIwgZIx
CzAJBgNVBAYTAkdCMRswGQYDVQQIExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNV
BAcTB1NhbGZvcmQxGjAYBgNVBAoTEUNPTU9ETyBDQSBMaW1pdGVkMTgwNgYDVQQD
Ey9DT01PRE8gRUNDIERvbWFpbiBWYWxpZGF0aW9uIFNlY3VyZSBTZXJ2ZXIgQ0Eg
MjAeFw0xODEyMTkwMDAwMDBaFw0xOTA2MjcyMzU5NTlaMGwxITAfBgNVBAsTGERv
bWFpbiBDb250cm9sIFZhbGlkYXRlZDEhMB8GA1UECxMYUG9zaXRpdmVTU0wgTXVs
dGktRG9tYWluMSQwIgYDVQQDExtzc2w4MDMwMTMuY2xvdWRmbGFyZXNzbC5jb20w
WTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAT/wcPxwIoIhK3kJfbDAx8mCrSF4GUO
9YsTHiGyVJSM886Y68///x06AyKxfF8T5Qkfd7DorL/mbOrLV9/hyBTao4IDBzCC
AwMwHwYDVR0jBBgwFoAUQAlhZ/C8g3FP3hIILG/U1Ct2PZYwHQYDVR0OBBYEFEv0
d837BNwNsqWZuG8XzIDfrlnfMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAA
MB0GA1UdJQQWMBQGCCsGAQUFBwMBBggrBgEFBQcDAjBPBgNVHSAESDBGMDoGCysG
AQQBsjEBAgIHMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vc2VjdXJlLmNvbW9kby5j
b20vQ1BTMAgGBmeBDAECATBWBgNVHR8ETzBNMEugSaBHhkVodHRwOi8vY3JsLmNv
bW9kb2NhNC5jb20vQ09NT0RPRUNDRG9tYWluVmFsaWRhdGlvblNlY3VyZVNlcnZl
ckNBMi5jcmwwgYgGCCsGAQUFBwEBBHwwejBRBggrBgEFBQcwAoZFaHR0cDovL2Ny
dC5jb21vZG9jYTQuY29tL0NPTU9ET0VDQ0RvbWFpblZhbGlkYXRpb25TZWN1cmVT
ZXJ2ZXJDQTIuY3J0MCUGCCsGAQUFBzABhhlodHRwOi8vb2NzcC5jb21vZG9jYTQu
Y29tMEgGA1UdEQRBMD+CG3NzbDgwMzAxMy5jbG91ZGZsYXJlc3NsLmNvbYIQKi5o
c2Nvc2NkbjAwLm5ldIIOaHNjb3NjZG4wMC5uZXQwggEEBgorBgEEAdZ5AgQCBIH1
BIHyAPAAdQC72d+8H4pxtZOUI5eqkntHOFeVCqtS6BqQlmQ2jh7RhQAAAWfEHVAd
AAAEAwBGMEQCIB73izCk6hPeSnyYAjJJD959JRpRHFD2EwNa3Bzo3mcUAiASBZfK
xLxlg5H302r4gOVZXrFUaV6Ylpy57rzdrvb4XQB3AHR+2oMxrTMQkSGcziVPQnDC
v/1eQiAIxjc1eeYQe8xWAAABZ8QdUHYAAAQDAEgwRgIhAMMxI0kXulz+sMgA7iMy
LrjbJLcZ6ViL4e71CpHc99etAiEAzKFdBXtvvJR1ZAj4Nk9WClGbeBmO7EpfKP+4
nMFbIQ4wCgYIKoZIzj0EAwIDS

[issue35859] Capture behavior depends on the order of an alternation

2019-02-22 Thread Ma Lin


Ma Lin  added the comment:

A bug harvest, see PR11756, maybe sre has more bugs.
Those bug exist since Python 2.

Any ideas from regular expression experts?

--

___
Python tracker 

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



[issue35307] Command line help example is missing "--prompt" option

2019-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12009

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-22 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

Code looks much better now. I'm still not convinced "SharedMemory(name=None, 
create=False, size=0)" is the best API. How are you supposed to "create or 
attach" atomically? You can do that with O_EXCL but as it stands this is not 
togglable via the API.

Also, could you address my comment about size?
https://bugs.python.org/issue35813#msg335731

--

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Thanks Raymond.

Apologies for commenting here instead of at the PR.

While I've been fighting with more intermittedly broken than usual 
internet access, Github has stopped supporting my browser. I can't 
upgrade the browser without upgrading the OS, and I can't upgrade the OS 
without new hardware, and that will take money I don't have at the moment.

So the bottom line is that while I can read *part* of the diffs on 
Github, that's about all I can do. I can't comment there, I can't fork, 
I can't make push requests, half the pages don't load for me and the 
other half don't work properly when they do load. I can't even do a git 
clone.

So right now, the only thing I can do is comment on your extensive 
documentation in statistics.rst. That's very nicely done.

The only thing that strikes me as problematic is the default value for 
sigma, namely 0.0. The PDF for normal curve divides by sigma, so if 
that's zero, things are undefined. So I think that sigma ought to be 
strictly positive.

I also think it would be nice to default to the standard normal curve, 
with mu=0.0 and sigma=1.0. That will make it easy to work with Z scores.

Thanks again for this class, and my apologies for my inability to 
follow the preferred workflow.

--

___
Python tracker 

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



[issue35307] Command line help example is missing "--prompt" option

2019-02-22 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Thank you @daftwullie for the report and for the PR!  And thank you, @xtreak 
for triaging and for the reminder.  :-)

--
nosy: +cheryl.sabella
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Кирилл Чуркин

New submission from Кирилл Чуркин :

I found a problem when use inherit dataclasses.
When I define parent dataclass with field(s) with default (or default_factory) 
properties, and inherit child dataclass from parent, i define non-default field 
in it and got `TypeError('non-default argument {f.name!r} follows default 
argument')` in dataclasses.py(466)._init_fn. It happens because dataclass 
constructor defines all parent class fields as arguments in __init__ class and 
then all child class fields.
Maybe it need to define all non-default fields in init before all default.

--
messages: 336297
nosy: Кирилл Чуркин
priority: normal
severity: normal
status: open
title: Inheritance dataclasses fields and default init statement
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread SilentGhost


Change by SilentGhost :


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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Yes, that is a problem (in principle) of the docs. But I think that would be 
appropriate return None if is closed.

--
nosy: +eamanu

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-22 Thread Giampaolo Rodola'


Giampaolo Rodola'  added the comment:

Also, there is no way to delete/unwrap memory without using an existing 
SharedMemory instance, which is something we may not have on startup. Perhaps 
we should have a "shared_memory.unlink(name)" function similar to os.unlink() 
which simply calls C shm_unlink().

--

___
Python tracker 

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



[issue35512] patch.dict resolves in_dict eagerly (should be late resolved)

2019-02-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

If I understand the issue correctly it's as below is a simple reproducer where 
target is resolved with {'a': 1} during the construction of the decorator [0] 
though it's redefined later in the program as target = dict(a=2). Also here due 
to this since target is reassigned the decorator just stores a reference to 
{'a': 1} and updates it with {'b': 2} leaving the reference to dict object 
{'a': 2} unpatched in test_with_decorator. Meanwhile in case of the context 
manager (test_with_context_manager) it's created and resolved at the time it's 
executed hence updating the object {'a': 2} correctly. A possible fix would be 
to store the reference to the string path of the patch '__main__.target' and 
try it again with importer function. I will take a further look into this. It 
would be helpful if you can confirm this reproducer is good enough and 
resembles the original report.


from unittest import mock

target = dict(a=1)

@mock.patch.dict('__main__.target', dict(b=2))
def test_with_decorator():
print(f"target inside decorator : {target}")

def test_with_context_manager():
with mock.patch.dict('__main__.target', dict(b=2)):
print(f"target inside context : {target}")

target = dict(a=2)
test_with_decorator()
test_with_context_manager()

$ python3 test_foo.py
target inside decorator : {'a': 2}
target inside context : {'a': 2, 'b': 2}

[0] 
https://github.com/python/cpython/blob/3208880f1c72800bacf94a2045fcb0436702c7a1/Lib/unittest/mock.py#L1624

--
nosy: +xtreak
type:  -> behavior
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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

hmm looking in depth when the server is closed, currently return None.

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Maybe would be great mention that the None is still return for closed server

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
keywords: +patch
pull_requests: +12010
stage:  -> patch review

___
Python tracker 

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



[issue31162] urllib.request.urlopen CERTIFICATE_VERIFY_FAILED error

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

hmmm I think that is not a bug. I think that this is a certification problem, 
literally.

--
nosy: +eamanu
status: pending -> open

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Excuse me, I tried 3.7.2 and 3.8.0a1+ with the following code and still failed. 
Could you help me to try this? or can you give me a pointer to the code 
returning `None`? Sorry for the inconvenience and thanks a lot.
```
import asyncio
import platform


async def close_server():
def handler(reader, writer):
pass
s = await asyncio.start_server(handler, host='127.0.0.1', port=34567)
s.close()
await s.wait_closed()
assert s.sockets is None


print("version: ", platform.python_version())
asyncio.get_event_loop().run_until_complete(close_server())
```

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

@mhchia yes! sorry! I was testing the .close() return. yes you are right is 
confused. I will modified the PR.

Thanks

--

___
Python tracker 

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



[issue36035] pathlib.Path().rglob() breaks with broken symlinks

2019-02-22 Thread Jörg Stucke

Change by Jörg Stucke :


--
pull_requests: +12011

___
Python tracker 

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



[issue36035] pathlib.Path().rglob() breaks with broken symlinks

2019-02-22 Thread Jörg Stucke

Jörg Stucke  added the comment:

I tried to add a test file in https://github.com/python/cpython/pull/11988 
To fix all now broken tests I had to add a try except block to the 
_WildcardSelector as well (analogous to the _RecursiveWildcardSelector).

I could only check on Linux and I have no idea how it behaves on any other OS.

--

___
Python tracker 

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



[issue35512] patch.dict resolves in_dict eagerly (should be late resolved)

2019-02-22 Thread Jason R. Coombs

Jason R. Coombs  added the comment:

I agree that’s a good reproducer. Thanks for looking into this!

--

___
Python tracker 

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



[issue36019] test_urllib fail in s390x buildbots: http://www.example.com/

2019-02-22 Thread miss-islington


Change by miss-islington :


--
pull_requests: +12012

___
Python tracker 

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



[issue36019] test_urllib fail in s390x buildbots: http://www.example.com/

2019-02-22 Thread STINNER Victor

STINNER Victor  added the comment:


New changeset a40681dd5db8deaf05a635eecb91498dac882aa4 by Victor Stinner 
(Stéphane Wirtel) in branch 'master':
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
https://github.com/python/cpython/commit/a40681dd5db8deaf05a635eecb91498dac882aa4


--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue22239] asyncio: nested event loop

2019-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue29871] Enable optimized locks on Windows

2019-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue36019] test_urllib fail in s390x buildbots: http://www.example.com/

2019-02-22 Thread STINNER Victor

STINNER Victor  added the comment:

> New changeset a40681dd5db8deaf05a635eecb91498dac882aa4 by Victor Stinner 
> (Stéphane Wirtel) in branch 'master':
> bpo-36019: Use pythontest.net instead of example.com in network tests 
> (GH-11941)

I'm not sure that this change will fix https://bugs.python.org/issue36019 but I 
prefer that your CI doesn't flood public servers like google.com or 
example.com. I prefer that we control the external resources used by our tests.

--

___
Python tracker 

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



[issue35662] Windows #define _PY_EMULATED_WIN_CV 0 bug

2019-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue35826] Typo in example for async with statement with condition

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

This issue could be closed, right?

--
nosy: +eamanu

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Sure thing. Should it be discussed more detailed before the PR? If the document 
or the returned value is controversial, I would like to contribute if needed. 
Thanks :)

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

> Sure thing. Should it be discussed more detailed before the PR? If the 
> document or the returned value is controversial, I would like to contribute 
> if needed. Thanks :)

Please, make the comments on the PR. This way, other reviewer can see your 
comments.

--

___
Python tracker 

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



[issue36019] test_urllib fail in s390x buildbots: http://www.example.com/

2019-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset 6163210089148ad31c270695f7273fc3561a211a by Miss Islington (bot) 
in branch '3.7':
bpo-36019: Use pythontest.net instead of example.com in network tests (GH-11941)
https://github.com/python/cpython/commit/6163210089148ad31c270695f7273fc3561a211a


--
nosy: +miss-islington

___
Python tracker 

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



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

2019-02-22 Thread Axel


New submission from Axel :

Example source:
from argparse import ArgumentParser, SUPPRESS
==
parser = ArgumentParser()
parser.add_argument('i', nargs='?', type=int, default=SUPPRESS)
args = parser.parse_args([])
==
results in:
error: argument integer: invalid int value: '==SUPPRESS=='

Expected: args = Namespace()


In Lib/argparse.py:
line 2399 in _get_value: result = type_func(arg_string)
with arg_string = SUPPRESS = '==SUPPRESS=='

called by ... line 1836 in take_action: argument_values = 
self._get_values(action, argument_strings)
which is done before checking for SUPPRESS in line 1851:
if argument_values is not SUPPRESS:
   action(...)

--
components: Library (Lib)
messages: 336314
nosy: n8falke
priority: normal
severity: normal
status: open
title: argparse: positional with type=int, default=SUPPRESS raise ValueError
type: behavior
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



[issue35392] Create asyncio/sockutils.py

2019-02-22 Thread Emmanuel Arias


Change by Emmanuel Arias :


--
nosy: +eamanu

___
Python tracker 

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



[issue36035] pathlib.Path().rglob() breaks with broken symlinks

2019-02-22 Thread Jörg Stucke

Jörg Stucke  added the comment:

As expected the Windows CI build failed.
All test fails were caused by:
OSError: [WinError 1921] The name of the file cannot be resolved by the system: 
'C:\\projects\\cpython\\build\\test_python_936\\@test_936_tmp\\brokenLinkLoop'

Therefore, I added WinError 1921 to _IGNORED_WINERRORS as suggested by Eryk Sun.

--

___
Python tracker 

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



[issue36079] pdb on setuptools "ValueError: underlying buffer has been detached"

2019-02-22 Thread Gerrit Holl


New submission from Gerrit Holl :

I am unable to use `pdb` to debug a problem I have with the `python-hdf4` 
installer.  The exception in the program to be debugged is printed twice, 
followed by an exception in pdb itself, ending with `ValueError: underlying 
buffer has been detached`.  See below, in particular the lower part:

$ python -mpdb setup.py install

python -mpdb setup.py install   
 
> /panfs/e/vol0/gholl/checkouts/python-hdf4/setup.py(11)()  
>  
-> """  
 
(Pdb) cont  
 
running install 
 
running bdist_egg   
 
running egg_info
 
running build_src   
 
build_src   
 
building extension "pyhdf._hdfext" sources  
 
build_src: building npy-pkg config files
   
writing python_hdf4.egg-info/PKG-INFO   
 
writing dependency_links to python_hdf4.egg-info/dependency_links.txt   

writing top-level names to python_hdf4.egg-info/top_level.txt   

reading manifest file 'python_hdf4.egg-info/SOURCES.txt'
 
writing manifest file 'python_hdf4.egg-info/SOURCES.txt'
   
installing library code to build/bdist.linux-x86_64/egg
running install_lib 

running build_py   
running build_ext   
 
customize UnixCCompiler 
  
customize UnixCCompiler using build_ext 

  
building 'pyhdf._hdfext' extension  
  
compiling C sources  
C compiler: gcc -pthread -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes -fPIC

  
compile options: 
'-I/panfs/e/vol0/gholl/venv/py36/lib/python3.6/site-packages/numpy/core/include 
-I/panfs/e/vol0/gholl/venv/py36/include 
-I/hpc/rhome/software/python/3.6.5/include/python3.6m -c'
extra options: '-DNOSZIP'   

Traceback (most recent call last):  
  
  File "/hpc/rhome/software/python/3.6.5/lib/python3.6/pdb.py", line 1667, in 
main
pdb._runscript(mainpyfile)  

  File "/hpc/rhome/software/python/3.6.5/lib/python3.6/pdb.py", line 1548, in 
_runscript 
self.run(statement) 
   
  File "/hpc/rhome/software/python/3.6.5/lib/python3.6/bdb.py", line 434, in 
run  
exec(cmd, globals, locals)  
  
  File "", line 1, in   
 
  File "/panfs/e/vol0/gholl/checkouts/python-hdf4/setup.py", line 11, in 

""" 
   
  File 
"/panfs/e/vol0/gholl/venv/py36/lib/python3.6/site-packages/numpy/distutils/core.py",
 line 171, in setup
return old_setup(**new_attr)
  
  File 
"/panfs/e/vol0/gholl/venv/py36/lib/python3.6/site-packages/setuptools/__init__.py",
 line

[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Can you please add a simple reproducer to understand the issue in little more 
detail? I could see some tests along with different cases producing the error 
message at 
https://github.com/python/cpython/blob/a40681dd5db8deaf05a635eecb91498dac882aa4/Lib/test/test_dataclasses.py#L55
 and a simple script would be helpful in understanding the behavior of the 
report.

--
components: +Library (Lib)
nosy: +xtreak

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Eric V. Smith


Change by Eric V. Smith :


--
assignee:  -> eric.smith

___
Python tracker 

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



[issue35826] Typo in example for async with statement with condition

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

Cool! Thanks for the reminder.

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



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

2019-02-22 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +paul.j3

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

I've made both suggested changes, "examples"->"samples" and set the defaults to 
the standard normal distribution.

To bypass Github, I've attached a diff to this tracker issue.  Let me know what 
you think :-)

--
Added file: https://bugs.python.org/file48161/normdist_22feb2019.diff

___
Python tracker 

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



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

2019-02-22 Thread Axel


Axel  added the comment:

Some more details:
The problem is not the order of assignment in take_action:
Defaults have been set by:
def parse_known_args(self, args=None, namespace=None):
...
# add any action defaults that aren't present
for action in self._actions:
if action.dest is not SUPPRESS:
if not hasattr(namespace, action.dest):
if action.default is not SUPPRESS:
setattr(namespace, action.dest, action.default)

Assignment without argument should not happen, like the example shows:
==
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('i', action="count", default=42)
args = parser.parse_args([])
print(repr(args))
==
Namespace(i=43)
==

--
nosy:  -paul.j3

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Julien Palard


Julien Palard  added the comment:

Behavior changed in commit c9070d03f5169ad6e171e641b7fa8feab18bf229 (Jan 2018) 
but has been documented as returning None since 
8ebeb03740dad4d9edd65de88f82840a05070941 (Jul 2014).

--
nosy: +mdk, vstinner, yselivanov

___
Python tracker 

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



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

2019-02-22 Thread Axel


Change by Axel :


--
nosy: +paul.j3

___
Python tracker 

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



[issue36080] Ensurepip fails to install pip into a nested virtual environment (on Windows)

2019-02-22 Thread Sammy Gillespie


New submission from Sammy Gillespie :

Running Windows 10 Enterprise. Create a virtual environment:

> python -m venv .venv

Activate that virtual environment and attempt to create another virtual 
environment using the same command.

This new environment will not contain pip (or anything other than just Python).

Investigating this further. Running:

> python -Im ensurepip --upgrade --default-pip

from within the second virtual environment results in:

> Requirement already up-to-date: pip in 

--

I want to create a python tool that will build a virtual env, but this 
restricts me from being able to install that tool into a virtual env (e.g. 
using pipx).

--
messages: 336322
nosy: Sammy Gillespie
priority: normal
severity: normal
status: open
title: Ensurepip fails to install pip into a nested virtual environment (on 
Windows)
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue36064] docs: urllib.request.Request not accepting iterables data type

2019-02-22 Thread Julien Palard


Change by Julien Palard :


--
pull_requests: +12013

___
Python tracker 

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



[issue36080] Ensurepip fails to install pip into a nested virtual environment (on Windows)

2019-02-22 Thread Sammy Gillespie


Sammy Gillespie  added the comment:

To expand on this. Using:

> python -m pip

in the second virtual environment (which does not have pip) gives the following 
usage example:

> Usage:
> C:\venv_test\\Scripts\python.exe -m pip  [options]

Yet the python running this command is not in venv_1, it is in venv_2.

So the issue appears to lie with how pip determines its python location. So 
this issue may be more suited there.

--

___
Python tracker 

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



[issue36080] Ensurepip fails to install pip into a nested virtual environment (on Windows)

2019-02-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Is this similar to issue35872? Can you please specify the full version of 
Python as in 3.7.0 or later?

--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, xtreak, zach.ware

___
Python tracker 

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



[issue28453] SSLObject.selected_alpn_protocol() not documented

2019-02-22 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12014
stage: needs patch -> patch review

___
Python tracker 

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



[issue36080] Ensurepip fails to install pip into a nested virtual environment (on Windows)

2019-02-22 Thread Sammy Gillespie


Sammy Gillespie  added the comment:

This is identical to https://bugs.python.org/issue35872

I am running 3.7.2

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


Added file: https://bugs.python.org/file48162/normdist_22feb2019.diff

___
Python tracker 

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



[issue22239] asyncio: nested event loop

2019-02-22 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


Removed file: https://bugs.python.org/file48161/normdist_22feb2019.diff

___
Python tracker 

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



[issue36081] Cannot set LDFLAGS containing $

2019-02-22 Thread Rolf Eike Beer


New submission from Rolf Eike Beer :

My use case is: LDFLAGS=-Wl,-rpath,'$ORIGIN/../lib'

This works fine for everything build directly by the Makefile, but for 
everything that is build through the python distutils this breaks. This is not 
an issue of the python side, it happens because the Makefile passes the 
information to python using LDSHARED='$(BLDSHARED)'. At this point the variable 
is expanded and the $ORIGIN is expanded by the shell (or so) before passing it 
to python, so python actually received "-Wl,-rpath,/../lib" from the 
environment variable.

I have worked around locally by doing something like $(subst 
$$,~dollar~,$(BLDSHARED)) and replacing that inside python with \\$ or so. 
Really hacky, but works for my current setup.

--
components: Build
messages: 336326
nosy: Dakon
priority: normal
severity: normal
status: open
title: Cannot set LDFLAGS containing $
type: compile error
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Kevin Mai-Hsuan Chia


Kevin Mai-Hsuan Chia  added the comment:

@mdk That's interesting. May I ask which one is the preferred behavior, `None` 
or `[]`? IMO both make sense, but `None` is more consistent with the behavior 
in previous versions. If it is the case, may I work on fixing this(`None` to 
`[]`) as a practice to contribute? Otherwise, the PR from @eamanu should be 
enough to fix the document. Thanks a lot for the review and the pointer!

--

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

> @mdk That's interesting. May I ask which one is the preferred behavior, 
> `None` or `[]`?

IMO changing  the returned of the sockets could represent a big change, and I 
think that this need to be discuss

--

___
Python tracker 

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



[issue36080] Ensurepip fails to install pip into a nested virtual environment (on Windows)

2019-02-22 Thread Sammy Gillespie


Change by Sammy Gillespie :


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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


Added file: https://bugs.python.org/file48163/normdist_22feb2019.diff

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Raymond Hettinger


Change by Raymond Hettinger :


Removed file: https://bugs.python.org/file48162/normdist_22feb2019.diff

___
Python tracker 

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



[issue36082] The built-in round() function giving a wrong output

2019-02-22 Thread Juho Pesonen


New submission from Juho Pesonen :

As the title says I have got some wrong outputs with the round() built-in 
function.
The bug occurs only with certain numbers though. (I've had problems only with 
the number 2.5, but I assume that there is more than one number that gives 
wrong output.)
Here are some outputs with the round built-in function:

>>>round(2.5)
2
>>>round(2.51)
3
>>>round(3.5)
4
>>>round(1.5)
2

As you can see the number 2.5 gives 2 instead of 3.

--
messages: 336329
nosy: Goodester
priority: normal
severity: normal
status: open
title: The built-in round() function giving a wrong output
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue36082] The built-in round() function giving a wrong output

2019-02-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

https://docs.python.org/3/whatsnew/3.0.html

> The round() function rounding strategy and return type have changed. Exact 
> halfway cases are now rounded to the nearest even result instead of away from 
> zero. (For example, round(2.5) now returns 2 rather than 3.) round(x[, n]) 
> now delegates to x.__round__([n]) instead of always returning a float. It 
> generally returns an integer when called with a single argument and a value 
> of the same type as x when called with two arguments.

--
nosy: +xtreak

___
Python tracker 

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



[issue36082] The built-in round() function giving a wrong output

2019-02-22 Thread SilentGhost


SilentGhost  added the comment:

This is the documented behaviour. It might seem counter-intuitive, but it's is 
not likely to change.

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-22 Thread Francis MB


Francis MB  added the comment:

Good options itemization!

>> This would give us a clean, fast API with no flags:
>>   mode(Iterable) -> scalar
>>   multimode(Iterable) -> list
[...]
>> For any of those options, we should still add a separate multimode()
>> function.
[..]
>> * Add a Deprecation warning to the current behavior of mode() when it
>> finds multimodal data.  Then change the behavior in Python 3.9.  This
>> is uncomfortable for one release, but does get us to the cleanest API
>> and best performance.

LGTM upto 3.9, shouldn't be "mode" at some point be replaced by
"multimode" ?

--

___
Python tracker 

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



[issue36082] The built-in round() function giving a wrong output

2019-02-22 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This is called banker rounding and is done on purpose to limit the accumulation 
of errors when summing a list of rounded integers. You can read 
https://en.m.wikipedia.org/wiki/Rounding#Round_half_to_even and look at IEEE 
754 for more information.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue35943] PyImport_GetModule() can return partially-initialized module

2019-02-22 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +vstinner

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread miss-islington


miss-islington  added the comment:


New changeset df5cdc11123a35065bbf1636251447d0bfe789a5 by Miss Islington (bot) 
(Emmanuel Arias) in branch 'master':
bpo-36074: Result of  `asyncio.Server.sockets` after `Server.close()` after  is 
not clear (GH-11987)
https://github.com/python/cpython/commit/df5cdc11123a35065bbf1636251447d0bfe789a5


--
nosy: +miss-islington

___
Python tracker 

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



[issue36074] Result of `asyncio.Server.sockets` after `Server.close()` is not clear

2019-02-22 Thread Julien Palard


Julien Palard  added the comment:

Thanks Emmanuel for the PR (yes those PRs do not need NEWS).
Thanks Kevin for the proposition to try fixing it the other way around, that's 
appreciated, don't hesitate to filter on easy issues there's some others :)

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



[issue33927] Allow json.tool to have identical infile and outfile

2019-02-22 Thread hervé

Change by hervé :


--
pull_requests: +12015

___
Python tracker 

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



[issue35813] shared memory construct to avoid need for serialization between processes

2019-02-22 Thread Davin Potts


Davin Potts  added the comment:

> Code looks much better now. I'm still not convinced 
> "SharedMemory(name=None, create=False, size=0)" is the best API.
> How are you supposed to "create or attach" atomically?

We are consciously choosing to not support an atomic "create or attach".  This 
significantly simplifies the API and avoids the valid concerns raised around 
user confusion relating to that behavior (including the use of different 
specified 'size' values in a race) but does not preclude our potentially 
introducing this as a feature in the future.

This simpler API still supports a "try: create; except: attach" which is not 
atomic but effectively covers the primary use cases for "create or attach".  
Combined with a SyncManager.Lock, users can already achieve an atomic "create 
or attach" using this simpler API.


> Also, could you address my comment about size?
> https://bugs.python.org/issue35813#msg335731
>> Let me rephrase: are we forced to specify a value (aka call
>> ftruncate()) on create ? If we are as I think, could size have a
>> reasonable default value instead of 0? Basically I'm wondering if we
>> can relieve the common user from thinking about what size to use,
>> mostly because it's sort of a low level detail. Could it perhaps
>> default to mmap.PAGESIZE?

Apologies for not responding to your question already, Giampaolo.

For the same reasons that (in C) malloc does not provide a default size, I do 
not think we should attempt to provide a default here.  Not all platforms 
allocate shared memory blocks in chunks of mmap.PAGESIZE, thus on some 
platforms we would unnecessarily over-allocate no matter what default size we 
might choose.  I do not think we should expect users to know what mmap.PAGESIZE 
is on their system.  I think it is important that if a user requests a new 
allocation of memory, that they first consider how much memory will be needed.  
When attaching to an existing shared memory block, its size is already defined.

I think this even fits with CPython's over-allocation strategies behind things 
like list, where an empty list triggers no malloc at all.  We will not allocate 
memory until the user tells us how much to allocate.


> Also, there is no way to delete/unwrap memory without using an
> existing SharedMemory instance, which is something we may not have
> on startup. Perhaps we should have a "shared_memory.unlink(name)"
> function similar to os.unlink() which simply calls C shm_unlink().

It is not really possible to offer this on non-POSIX platforms so I think we 
should not attempt to offer a public "shared_memory.unlink(name)".  It is 
possible to invoke "shm_unlink" with the name of a shared memory block (for 
those who really need it) on platforms with POSIX Shared Memory support via:
shared_memory._posixshmem.shm_unlink('name')

--

___
Python tracker 

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



[issue36018] Add a Normal Distribution class to the statistics module

2019-02-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

@steven.daprano Bit off topic but you can also append .patch in the PR URL to 
generate patch file with all the commits made in the PR up to latest commit and 
.diff provides the current diff against master. They are plain text and can be 
downloaded through wget and viewed with an editor in case if it helps.

https://github.com/python/cpython/pull/11973.patch
https://github.com/python/cpython/pull/11973.diff

--
nosy: +xtreak

___
Python tracker 

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



[issue35892] Fix awkwardness of statistics.mode() for multimodal datasets

2019-02-22 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> shouldn't be "mode" at some point be replaced by "multimode" ?

No.  The signature is completely incompatible with the existing mode() function.

Like MS Excel which has two functions, MODE.SGNL and MODE.MULT, we should also 
have two functions, each with a clean signature and with running speed that is 
optimal for the desired result:

   mode(data: Iterable) -> object
   Returns a single value
   If multiple modes found, return first encountered
   Raises StatisticsError for an empty input
   Fast O(n), single pass, doesn't keep all data in memory

   multimode(data: Iterable) -> List[object]
   Always returns a list
   If multiple modes found, all are returned
   Returns an empty list for an empty input
   Slow O(n log n), loads all data in memory, full sort

For the first one, I recommend skipping deprecation and just changing the 
behavior that usually raises an exception for multiple modes.  In its current 
form, it likely to create bugs due to uncaught exceptions, and it doesn't 
provide any work-around if you do want only one of the modes.

By analogy, consider what would happen if we had a max() function that raised 
an exception when there were duplicate maximum values.  It would be almost 
usable.  So, what the real max() actually does is return the first encountered 
maximum value:

>>> max(3, 1, 3.0)
3
>>> max(3.0, 1, 3)
3.0

--

___
Python tracker 

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



[issue36067] subprocess terminate() "invalid handle" error when process is gone

2019-02-22 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

> Interesting. Because both errors/conditions are mapped to 
> ERROR_INVALID_HANDLE we need the creation time. I can work on a patch for 
> that.

I don't understand why any patch for CPython is needed at all. Using invalid 
handles is a serious programming bug (it's similar to using freed memory), so 
CPython doesn't really have to attempt to detect the programmer's error, at 
least not if this attempt significantly complicates  the existing code.

In my opinion, the CI failure linked in the first comment simply indicates a 
bug in psutil and is unrelated to CPython at all.

--
nosy: +izbyshev

___
Python tracker 

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



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

2019-02-22 Thread paul j3


paul j3  added the comment:

Defaults are handled into two stages.

At the start of parsing defaults are added to the Namespace.

At the end of parsing intact defaults are evaluated with 'type'.

But a nargs='?' positional gets special handling.  It matches an empty string, 
so it is always 'seen'.  If its default is not None, that default is put in the 
Namespace instead of the matching empty list.

It's this special default handling that lets us use a ?-positional in a 
mutually exclusive group.

I suspect the error arises from this special default handling, but I'll have to 
look at the code to verify the details.

--

___
Python tracker 

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



[issue36066] Add `empty` block to `for` and `while` loops.

2019-02-22 Thread WloHu


WloHu  added the comment:

Sorry for beeing ignorant about python-ideas. The linked proposal is almost 
exatly what I've requested here, the differences are that it discusses other 
keyword alternatives and mine suggests an alternative for making empty 
generators false.

If lack of follow-up in the linked proposal can be considered as "won't do" 
then this issue can be closed. Should I repost any part of this to python-ideas 
or whole case is closed?

--

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I think this is what is referring Кирилл Чуркин to:


Python 3.7.2 (default, Jan 13 2019, 12:50:01)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dataclasses import dataclass
>>> @dataclass
... class Parent:
... x: int = 1
...
>>> Parent()
Parent(x=1)
>>> @dataclass
... class Child(Parent):
... y: int
...
Traceback (most recent call last):
  File "", line 2, in 
  File 
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
 line 991, in dataclass
return wrap(_cls)
  File 
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
 line 983, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
  File 
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
 line 904, in _process_class
else 'self',
  File 
"/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/dataclasses.py",
 line 490, in _init_fn
raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'y' follows default argument



@eric.smith, do you think Child's argument should be merged nicely with 
Parent's ones in this case? If so, can I propose a PR?

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue36083] Misformated manpage: --check-hash-based-pycs ´default´|´always´|´never´

2019-02-22 Thread Miro Hrončok

New submission from Miro Hrončok :

man python3.7 or man python3.8 says this in synopsis:

   python [ -B ] [ -b ] [ -d ] [ -E ] [ -h ] [ -i ] [ -I ]
  [ -m module-name ] [ -q ] [ -O ] [ -OO ] [ -s ] [ -S ] [ -u ]
  [ -v ] [ -V ] [ -W argument ] [ -x ] [ [ -X option ] -?  ]
  [ --check-hash-based-pycs ´default´|´always´|´never´ ]
  [ -c command | script | - ] [ arguments ]

Some words are bold, some are underlined. However the 
´default´|´always´|´never´ bit after --check-hash-based-pycs is misformated. 
The backticks should not be there, they should be underline instead.

The source literally has:

   [
.B \--check-hash-based-pycs
\'default\'|\'always\'|\'never\'
]

since the original implementation of PEP 552 in 
42aa93b8ff2f7879282b06efc73a31ec7785e602

I think it should be replaced with:

   [
.B \--check-hash-based-pycs
.I default|always|never
]

Shall I send a PR?

--
assignee: docs@python
components: Documentation
messages: 336342
nosy: docs@python, hroncok
priority: normal
severity: normal
status: open
title: Misformated manpage: --check-hash-based-pycs ´default´|´always´|´never´
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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Eric V. Smith


Eric V. Smith  added the comment:

I'm not keen on re-ordering parameters. Maybe it could be done if specified 
with a parameter to @dataclass.

--

___
Python tracker 

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



[issue36077] Inheritance dataclasses fields and default init statement

2019-02-22 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

I see your point.

On the other hand, a new parameter would also increase the complexity for the 
user.

Maybe it should not be seen as re-ordering but just a "zipping" them correctly:


@dataclass
class Parent:
i: int
j: int = 0


@dataclass
class Child(Parent):
k: int
l: int = 1


The "naive" to define Child's __index__ is:

__index__(self, i: int, j: int = 0, k: int, l: int = 1):

but wouldn't this make sense (given that it is previsible and deterministic)?


__index__(self, i: int, k: int, j: int = 0, l: int = 1):

--

___
Python tracker 

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



[issue36046] support dropping privileges when running subprocesses

2019-02-22 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue36046] support dropping privileges when running subprocesses

2019-02-22 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Patrick, could you provide more background that would explain your choice of 
setreuid/setregid functions and the desired handling of supplementary groups? 
I'm not a security expert, so I may not have sufficient expertise to judge on 
that, but maybe my questions could be helpful for others:

1) setreuid/setregid, as used in your PR, will set the real, effective and 
saved ids to the specified value [1]. So this precludes the use-case where a 
user wants to temporarily switch the effective id to the real id ("drop 
privileges") and then switch it back to the old effective (saved) id in the 
child. This use case is supported for non-root processes by 
POSIX_SPAWN_RESETIDS flag used with posix_spawn() (the flag is implemented by 
simply calling setuid(getuid()) in the child). Is it okay that the proposed API 
doesn't support this?

2) While setreuid/setregid on Linux permit setting the real id to either the 
effective or the real id, POSIX leaves it unspecified [2]. Are we okay with 
potential portability problems?

3) setgroups() always requires privileges on Linux [3]. So, if we always call 
setgroups() if subprocess.Popen(groups=...) is used, we preclude the use case 
where a non-privileged process wants to switch its gid but doesn't want to 
touch its supplementary groups. Is this a valid use case we want to care about?

The current workaround for the above is to call setgroups() only if geteuid() 
== 0, but I'm not sure it's a good one:
(a) ISTM we're basically guessing the intent here: what if a process really 
wants to change its supplementary groups, but a user run it without appropriate 
privileges by mistake? I think such process would like to get an exception 
instead of silently ignored call to setgroups().
(b) geteuid() == 0 test is not precise. The Linux man page documents that the 
caller needs the CAP_SETGID capability, which doesn't necessarily imply that 
the effective id is zero.

Another solution would be to split groups into two arguments: gid and 
supplementary groups. This way users can explicitly tell us whether they want 
to switch supplementary groups or not.

Overall, I'd really like to have security experts review this PR if possible.

[1] http://man7.org/linux/man-pages/man2/setreuid.2.html
[2] http://pubs.opengroup.org/onlinepubs/9699919799/functions/setreuid.html
[3] http://man7.org/linux/man-pages/man2/setgroups.2.html

--
assignee: gregory.p.smith -> 

___
Python tracker 

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



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

2019-02-22 Thread paul j3


paul j3  added the comment:

By defining a custom 'type' function:

def foo(astr):
if astr is argparse.SUPPRESS:
raise KeyError
return astr

I get the full traceback

   1831 def take_action(action, argument_strings, option_string=None):
   1832 seen_actions.add(action)
-> 1833 argument_values = self._get_values(action, argument_strings)

and in '_get_values' the error is produced when it calls '_get_value' (which 
runs the 'type' function):

# optional argument produces a default when not present
if not arg_strings and action.nargs == OPTIONAL:
if action.option_strings:
value = action.const
else:
value = action.default
if isinstance(value, str):
 -->value = self._get_value(action, value)
self._check_value(action, value)
  
It identifies this as an OPTIONAL action that has received an empty argument 
list, and assigns it the action.default.

ZERO_OR_MORE * also gets the action.default, but without a _get_value() call.  
That default can be SUPPRESSed by the test at the end of take_action.

A couple of fixes come to mind: 

- add a SUPPRESS test at the start of take_action
- add a SUPPRESS test to _get_values block I quote above, maybe bypassing the 
`_get_value` call

There is a unittest case of a suppressed optional positional; it just doesn't 
also test for a failed type.

class TestDefaultSuppress(ParserTestCase):
"""Test actions with suppressed defaults"""

argument_signatures = [
Sig('foo', nargs='?', default=argparse.SUPPRESS)

I'm inclined go with the second choice, but the alternatives need to be 
throughly tested.

In the mean time, an 'int' type could be replaced with one that is SUPPRESS 
knowledgeable:

def bar(astr):
if astr is argparse.SUPPRESS:
return astr
else:
return int(astr)

Note that this use of action.default is different from the normal default 
handling at the start of parse_known_args (and the end of _parse_known_args).  
It's specifically for positionals that will always be 'seen' (because an empty 
argument strings list satisfies their nargs).

--

___
Python tracker 

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



[issue36084] Threading: add builtin TID attribute to Thread objects

2019-02-22 Thread Jake Tesler


New submission from Jake Tesler :

This functionality adds a native Thread ID to threading.Thread objects. This ID 
(TID), similar to the PID of a process, is assigned by the OS (kernel) and is 
generally used for externally monitoring resources consumed by the running 
thread (or process).
This does not replace the `ident` attribute within Thread objects, which is 
assigned by the Python interpreter and is guaranteed as unique for the lifetime 
of the Python instance.

--
messages: 336348
nosy: Jake Tesler
priority: normal
severity: normal
status: open
title: Threading: add builtin TID attribute to Thread objects
type: enhancement
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



[issue36084] Threading: add builtin TID attribute to Thread objects

2019-02-22 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
pull_requests: +12016
stage:  -> patch review

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-02-22 Thread Steve Dower


New submission from Steve Dower :

So the fundamental problem is that the default DLL search path on Windows 
changes in various contexts, and the only consistent approach is the most 
difficult to support with current packaging tools. The result is .pyd files 
that need to resolve .dll dependencies from directories *other* than where the 
.pyd file is located.

Here's a generic scenario:
* my_package.subpackage1.my_module is implemented as 
my_package/subpackage1/my_module.pyd
* my_package.subpackage2.my_module is implemented as 
my_package/subpackage2/my_module.pyd
* my_module.pyd in both cases depends on HelperLib.dll
* both modules must end up with the same instance of HelperLib.dll

While there are various ways for my_modules.pyd to locate HelperLib.dll, the 
only totally reliable way is to put HelperLib.dll alongside my_module.pyd. 
However, because it is needed twice, this means two copies of the DLL, which is 
unacceptable.

With Python 3.8, we are *nearly* dropping support for Windows 7, and I believe 
we can justify dropping support for Windows 7 without KB2533625 [1], which will 
have been released over eight years by the time 3.8 releases. This means the 
DLL search path enhancements are available.


Proposal #1: CPython calls SetDefaultDllDirectories() [2] on startup and 
exposes AddDllDirectory() [3] via the sys or os module.

This would ensure consistency in DLL search order regardless of security 
settings, and modules that have their own ".libs" directory have a supported 
API for adding it to the search path.

Past experience of forcing a consistent search path like this is that it has 
broken many users who expect features like %PATH% to locate DLL dependencies to 
work. For security reasons, this feature is already deprecated and often 
disabled (see [4]), so it can't be relied upon, but it makes it impossible for 
a single package to modify this setting or use the supported method for adding 
more DLL search directories.


Proposal #2: Resolve extension modules by full name

Without this proposal, the directory structure looks like:

my_package\
-subpackage1\
--__init__.py
--my_module.pyd
--HelperLib.dll
-subpackage2\
--__init__.py
--my_module.pyd
--HelperLib.dll

After this proposal, it could look like:

my_package\
-subpackage1
--__init__.py
-subpackage2\
--__init__.py
-my_package.subpackage1.my_module.pyd
-my_package.subpackage2.my_module.pyd
-HelperLib.dll

Essentially, when searching for modules, allow going up the package hierarchy 
and locating a fully-qualified name at any level of the import tree.

Note that since "import my_package.subpackage1.my_module" implies both "import 
my_package" and "import my_package.subpackage1", those have to succeed, but 
then the final part of the import would use subpackage1.__path__ to look for 
"my_module.pyd" and my_package.__path__ to look for 
"my_package.subpackage1.my_module.pyd".

This allows all extension modules to be co-located in the one (importable) 
directory, along with a single copy of any shared dependencies.

[1]: https://go.microsoft.com/fwlink/p/?linkid=217865
[2]: 
https://docs.microsoft.com/windows/desktop/api/libloaderapi/nf-libloaderapi-setdefaultdlldirectories
[3]: 
https://docs.microsoft.com/windows/desktop/api/libloaderapi/nf-libloaderapi-adddlldirectory
[4]: 
https://docs.microsoft.com/windows/desktop/Dlls/dynamic-link-library-search-order

--
assignee: steve.dower
components: Windows
messages: 336349
nosy: brett.cannon, eric.snow, ncoghlan, paul.moore, steve.dower, tim.golden, 
zach.ware
priority: normal
severity: normal
status: open
title: Enable better DLL resolution
type: enhancement
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



[issue36085] Enable better DLL resolution

2019-02-22 Thread Steve Dower


Steve Dower  added the comment:

I nosied both Windows and import experts, and I'm about to go ping relevant 
numpy/scipy people on https://github.com/numpy/numpy/pull/13019

Personally, I would prefer option #1, despite the pain it would cause. It is 
the better long-term supported option, and Anaconda has already adopted a patch 
that does this. However, I think it's most appropriate to be a change in 
CPython at a major release boundary so that we can provide proper porting 
information for users.

Option #2 is kind of neat, and honestly I thought this already worked when the 
fully-qualified .pyd was in a folder on sys.path. However, it's going to mess 
big time with all of our existing build tools. So I'm not thrilled about 
passing on that kind of pain - then again, most people don't need this, and 
those who do can do their own hacks to make it work (on the theory that they're 
already applying their own hacks anyway).

I'm totally open to other suggestions on how to make these situations workable, 
though I will (continue to) push back hard against ideas that simply bring back 
the security concerns that led us to this point :)

--

___
Python tracker 

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



[issue33944] Deprecate and remove pth files

2019-02-22 Thread Steve Dower


Steve Dower  added the comment:

I took a look at the docs PR, and honestly I don't even get what the "intended" 
uses of executable code are supposed to be.

The examples are "load 3rd-party import hooks, adjust PATH variable", but the 
only cases I can think of where you'd need to do these in a .pth file is where 
your module is a single file. As soon as you have a package with __init__.py, 
you have a file that can do exactly the same modifications before the module 
that needs it is imported.

I'd be inclined to limit the doc change to not provide any "valid" uses for 
this, and just discourage doing anything that takes a long time (most of the 
text in the PR is fine, IMHO).

And yeah, I'd like to see the arbitrary code execution "feature" removed too.

As for .pth files in general, I'm interested in the scenarios that caused Barry 
to have to do difficult debugging where "python -m site" wasn't able to help. 
If they all involved arbitrary code execution, then let's take out the right 
tumor. But if they somehow manipulated sys.path in a way that looking at 
sys.path doesn't reveal, then I'd like to know how.

--

___
Python tracker 

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



[issue36085] Enable better DLL resolution

2019-02-22 Thread Jeremy Kloth


Change by Jeremy Kloth :


--
nosy: +jkloth

___
Python tracker 

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



[issue36086] Split IDLE into separate feature in Windows installer

2019-02-22 Thread Jacob Bundgaard


New submission from Jacob Bundgaard :

I don't use IDLE to edit Python files, but do use tcl/tk for Python projects on 
Windows. Therefore, it would be useful for me to be able to install tcl/tk 
without also installing IDLE. However, in the Windows installer, tcl/tk and 
IDLE are bundled together into one feature.

Splitting them into two features (the IDLE feature requiring the tcl/tk one) 
would reduce installation time, storage use, Explorer context menu cluttering, 
etc. for users like me.

--
components: Installation
messages: 336352
nosy: kimsey0
priority: normal
severity: normal
status: open
title: Split IDLE into separate feature in Windows installer
type: enhancement
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



[issue36085] Enable better DLL resolution

2019-02-22 Thread Eryk Sun


Eryk Sun  added the comment:

> Proposal #1: CPython calls SetDefaultDllDirectories() [2] on startup 

SetDefaultDllDirectories() affects the entire process, so it would needlessly 
break the world -- especially for embedding applications and ctypes users that 
have relied on adding directories to PATH. When loading an extension module, we 
can simply replace LOAD_WITH_ALTERED_SEARCH_PATH in the LoadLibraryExW flags 
with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR and LOAD_LIBRARY_SEARCH_DEFAULT_DIRS 
(application directory, System32 directory, and directories added via 
SetDllDirectoryW and AddDllDirectory). Writers of extension modules are 
constrained by our API. We'll simply mandate that PATH is no longer searched.

It's cumbersome to require packages to have to manually call AddDllDirectory 
before being able to import an extension module with dependencies. We could 
create a protocol to store relative paths as an embedded resource in the 
extension module, which would be similar to the RPATH/RUNPATH $ORIGIN field in 
POSIX. We'd first map the extension module as a data file via 
LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE. Load and resolve the 
relative paths, add them via AddDllDirectory. Call LoadLibraryExW with the 
above-mentioned flags. Then remove the directories via RemoveDllDirectory.

--
nosy: +eryksun

___
Python tracker 

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



  1   2   >