[issue26680] Incorporating float.is_integer into Decimal

2021-03-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
components:  -2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, Extension Modules, 
asyncio, ctypes
nosy:  -Alex.Willmer, asvetlov, dstufft, eric.araujo, larry, yselivanov
type: compile error -> enhancement

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into Decimal

2021-03-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


Removed file: https://bugs.python.org/file49898/Mobile_Signup.vcf

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-21 Thread Sergey B Kirpichev


Sergey B Kirpichev  added the comment:

On Mon, Mar 22, 2021 at 04:34:32AM +, Tim Peters wrote:
> For example, setting up a module global `_gcd` name for `math.gcd`

Looking on the stdlib, I would just import gcd.

> default `_gcd=math.gcd` arguments to the methods? Then it's
> even faster (& uglier, of course).

... and less readable.

Not sure if speedup will be noticeable.  But more important is
that I see no such micro-optimizations across the stdlib.  Probably,
this will be the reason for rejection.

> Or wrt changing properties to private attributes, that speeds some
> things but slows others - and, unless I missed it, nobody who wrote
> that code to begin with said a word about why it was done that way.

Yes, I'll dig into the history.  Commen^WDocstring doesn't explain
this (for me).

> Opening a BPO report is a trivial effort.

Sure, but such report will require patch to be
discussed, anyway.

--

___
Python tracker 

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



[issue43420] Optimize rational arithmetics

2021-03-21 Thread Tim Peters


Tim Peters  added the comment:

If experience is any guide, nothing about anything here will go smoothly ;-)

For example, setting up a module global `_gcd` name for `math.gcd` is a very 
standard, widespread kind of micro-optimization. But - if that's thought to be 
valuable (who knows? maybe someone will complain) - why not go on instead to 
add not-intended-to-be-passed trailing default `_gcd=math.gcd` arguments to the 
methods? Then it's even faster (& uglier, of course).

Or wrt changing properties to private attributes, that speeds some things but 
slows others - and, unless I missed it, nobody who wrote that code to begin 
with said a word about why it was done that way.

I'm not going to "pre-bless" shortcuts in an area where everything so far has 
been more contentious than it "should have been" (to my eyes). Opening a BPO 
report is a trivial effort. Skipping NEWS, or not, depends on how it goes.

--

___
Python tracker 

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



[issue43586] sys.path is weird in Windows 10.

2021-03-21 Thread Shin Ryu


New submission from Shin Ryu :

import sys
print(sys.path)

only on windows, they print sys.path[0] is python38.zip not "".

(docs.python.org says "As initialized upon program startup, the first item of 
this list, path[0], is the directory containing the script that was used to 
invoke the Python interpreter. If the script directory is not available (e.g. 
if the interpreter is invoked interactively or if the script is read from 
standard input), path[0] is the empty string, which directs Python to search 
modules in the current directory first. Notice that the script directory is 
inserted before the entries inserted as a result of PYTHONPATH.")

--
components: Windows
messages: 389275
nosy: RyuSh1n, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: sys.path is weird in Windows 10.
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



[issue43420] Optimize rational arithmetics

2021-03-21 Thread Sergey B Kirpichev


Sergey B Kirpichev  added the comment:

On Mon, Mar 22, 2021 at 02:35:59AM +, Tim Peters wrote:
> Thanks, all! This has been merged now. If someone wants to
> continue pursuing things left hanging, I'd suggest opening
> a different BPO report.

Tim, if you are about micro-optimizations for small components
(properties->attributes and so on, I think this not worth
BPO report of the news entry, isn't?

Thanks for all reviewers and commenters.

--

___
Python tracker 

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



[issue38428] Can't gracefully ctrl+C multiprocessing pool on Python3 & Windows

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

In bpo-29971 it was suggested to split the PyThread lock API in Windows into an 
"interruptible lock" API that's based on emulated condition variables and a 
"fast lock" API that's based on native condition variables and SRW locks. Maybe 
the only API change that's needed in that regard is to add 
PyThread_allocate_lock_ex(int interruptible), and otherwise dispatch on the 
lock type that's set in the PNRMUTEX.

--
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue26680] Incorporating float.is_integer into Decimal

2021-03-21 Thread Max Prokop


Change by Max Prokop :


--
components: +2to3 (2.x to 3.x conversion tool), Argument Clinic, Build, C API, 
Cross-Build, Demos and Tools, Distutils, Documentation, asyncio, ctypes
nosy: +Alex.Willmer, asvetlov, dstufft, eric.araujo, larry, yselivanov
type: enhancement -> compile error
Added file: https://bugs.python.org/file49898/Mobile_Signup.vcf

___
Python tracker 

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



[issue34747] SSLSocket.context cannot be changed on non-connected sockets

2021-03-21 Thread Vincent Pelletier


Vincent Pelletier  added the comment:

Added: affects Python 3.9

This bug is still preventing (...or shall I say "discourages", as the setter is 
effective but raises) server-side SSL certificate reloading on long-running 
services.
This codepath on listening sockets is necessary for seamless certificate 
renewal, so the new certificate is used on any accepted connection past the 
setter call.

Is there anything that needs to be changed to the fix I proposed ?
Should I open a merge/pull request somewhere ?

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



[issue43420] Optimize rational arithmetics

2021-03-21 Thread Tim Peters


Tim Peters  added the comment:

Thanks, all! This has been merged now. If someone wants to continue pursuing 
things left hanging, I'd suggest opening a different BPO report.

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



[issue43420] Optimize rational arithmetics

2021-03-21 Thread Tim Peters


Tim Peters  added the comment:


New changeset 690aca781152a498f5117682524d2cd9aa4d7657 by Sergey B Kirpichev in 
branch 'master':
bpo-43420: Simple optimizations for Fraction's arithmetics (GH-24779)
https://github.com/python/cpython/commit/690aca781152a498f5117682524d2cd9aa4d7657


--

___
Python tracker 

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



[issue37860] Add deploy preview for docs

2021-03-21 Thread Ashwin Ramaswami


Change by Ashwin Ramaswami :


--
nosy: +EWDurbin

___
Python tracker 

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



[issue37860] Add deploy preview for docs

2021-03-21 Thread Ashwin Ramaswami


Ashwin Ramaswami  added the comment:

I realized there's another alternative which is probably simpler. We can use 
Netlify to host the deploy previews, but we can use GitHub Actions to build the 
documentation. This way, we won't run into the build time limits for Netlify, 
and we can still use Netlify to host deploy previews.

We can use this GitHub Actions action: 
https://github.com/marketplace/actions/netlify-actions, and just add it as an 
additional step to our existing doc GitHub Actions workflow 
(https://github.com/python/cpython/blob/master/.github/workflows/doc.yml).

What do you think about this approach?

--

___
Python tracker 

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



[issue36860] Inconsistent/Undocumented behavior with pathlib resolve and absolute on Windows

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

The issue with non-strict resolution of relative paths that do not exist is 
being addressed in bpo-38671. The proposal to support and document the 
absolute() method is addressed in bpo-29688.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pathlib.Path.resolve(strict=False) returns relative path on 
Windows if the entry does not exist

___
Python tracker 

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



[issue39920] os.stat() and os.lstat() fail with Windows device paths

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

3.7.8, released on 2020-06-27, was the last bugfix release of Python 3.7, so 
I'm closing this issue as a duplicate of bpo-33898, which is about supporting 
device paths correctly in pathlib.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> pathlib issues with Windows device paths

___
Python tracker 

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



[issue38188] Incorrect Argument Order for Calls to _winapi.DuplicateHandle() in multiprocessing.reduction.DupHandle

2021-03-21 Thread Eryk Sun


Change by Eryk Sun :


--
components: +Library (Lib)
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.10, Python 3.8, 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



[issue35754] [Windows] I/O on a broken pipe may raise an EINVAL OSError instead of BrokenPipeError

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

It's still the case that we have to guess that a generic EINVAL (22) is 
actually EPIPE. Low-level wrapper functions in Python/fileutils.c, such as 
_Py_read() and _Py_write_impl(), should try to get a better error code by 
calling Python's custom winerror_to_errno() mapping function on the CRT's 
_doserrno value. For example:

_Py_read:

#ifdef MS_WINDOWS
n = read(fd, buf, (int)count);
if (n < 0 && errno == EINVAL) {
errno = winerror_to_errno(_doserrno);
}

_Py_write_impl:

#ifdef MS_WINDOWS
n = write(fd, buf, (int)count);
if (n < 0 && errno == EINVAL) {
errno = winerror_to_errno(_doserrno);
}

This maps ERROR_NO_DATA to EPIPE.

--
title: When writing/closing a closed Popen.stdin, I get OSError vs. 
BrokenPipeError randomly or depending on bufsize -> [Windows] I/O on a broken 
pipe may raise an EINVAL OSError instead of BrokenPipeError
versions: +Python 3.10, 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



[issue27823] Change bare AttributeError messages to be more informative

2021-03-21 Thread Irit Katriel


Irit Katriel  added the comment:

-1

As Anilyka wrote: "it (AttributeError) doesn't even mean the attribute doesn't 
exist, as it may".

So it's not safe to fill in a missing message based on the assumption that we 
know what it should be.

--
nosy: +iritkatriel

___
Python tracker 

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2021-03-21 Thread pmp-p


Change by pmp-p :


--
nosy: +pmpp

___
Python tracker 

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



[issue17792] Unhelpful UnboundLocalError due to del'ing of exception target

2021-03-21 Thread Irit Katriel


Irit Katriel  added the comment:

I think the issue is that the error message for UnboundLocalError is wrong, see 
this example:

>>> def g():
...x = 42
...del x
...print(x)
...
>>> g()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in g
UnboundLocalError: local variable 'x' referenced before assignment
>>>


How about we change it to "local variable 'x' referenced before assignment or 
after deletion"?

--
components: +Interpreter Core
nosy: +iritkatriel
versions: +Python 3.10 -Python 3.4

___
Python tracker 

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



[issue15286] normpath does not work with local literal paths

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

This old issue still needs to be fixed. The check for special_prefixes in 
ntpath.normpath() must be removed in order to be consistent with WinAPI 
GetFullPathNameW(). In Windows, one can just call ntpath.abspath() to ensure 
that nt._getfullpathname() is called. But "Lib/ntpath.py" is cross-platform.

--
assignee: brian.curtin -> 
components: +Library (Lib)
nosy: +paul.moore, steve.dower, zach.ware
stage: patch review -> needs patch
versions: +Python 3.10, 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



[issue15286] normpath does not work with local literal paths

2021-03-21 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue43585] perf_counter() returns computers uptime

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

For Windows, starting with Python 3.10, the value of time.perf_counter[_ns]() 
is system wide instead of relative to the first time it's accessed in the 
current process. This allows comparing the counter value across processes. See 
bpo-37205.

--
nosy: +eryksun

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

The callback from context.alpn_callback would fire when OpenSSL handles the 
ALPN extension. Since the callback is triggered in the ClientHello phase of the 
handshake, you'll be able to replace the socket's context with another context.

The OpenSSL codes work a bit like this:

TLSEXT_INDEX = [
...,
TLSEXT_IDX_server_name,
...,
TLSEXT_IDX_application_layer_protocol_negotiation,
]

for extid in TLSEXT_INDEX:
if client.has_extension(extid):
ext = do_stuff(client, extid)
ext.callback(client)

Any of the callbacks is able to replace the context.

The process for contributing to Python is explained in the devguide:
https://devguide.python.org/. Please start by signing a contributor agreement. 
Then you can file a PR on Github.

--

___
Python tracker 

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



[issue37205] time.perf_counter() is not system-wide on Windows, in disagreement with documentation

2021-03-21 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue37205] time.perf_counter() is not system-wide on Windows, in disagreement with documentation

2021-03-21 Thread Eryk Sun


Change by Eryk Sun :


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

___
Python tracker 

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



[issue39484] [time] document that integer nanoseconds may be more precise than float

2021-03-21 Thread Eryk Sun


Change by Eryk Sun :


--
assignee:  -> docs@python
components: +Documentation, Extension Modules -Library (Lib)
nosy: +docs@python
title: time_ns() and time() cannot be compared on windows -> [time] document 
that integer nanoseconds may be more precise than float
type: behavior -> enhancement
versions: +Python 3.10, 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



[issue43567] regen.vcxproj cannot regenerate some necessary files

2021-03-21 Thread Zachary Ware


Change by Zachary Ware :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware
stage:  -> needs patch

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Andrew Dailey


Andrew Dailey  added the comment:

Yea, I noticed that through some of my digging. The ALPN callback is used to 
implement SSLContext.set_alpn_protocols() but full control of the callback 
isn't exposed. Aside from adjusting how the ALPN callback used, do you know of 
any other way to swap contexts once the selected ALPN proto is known but not 
before it's too late? As I said before, I'm not super familiar with Python / 
OpenSSL internals but maybe overriding SSLSocket.do_handshake() would suffice? 
I don't want this issue to get too far off track.

I'm still doing research on how I'd go about drafting and submitting a formal 
patch here on the issue tracker. I'm new to this process but definitely want to 
help out as much as I can.

Here's my current idea for how to adjust the documentation given the current 
behavior / capabilities.

CURRENT:
Due to the early negotiation phase of the TLS connection, only limited methods 
and attributes are usable like SSLSocket.selected_alpn_protocol() and 
SSLSocket.context. SSLSocket.getpeercert(), SSLSocket.getpeercert(), 
SSLSocket.cipher() and SSLSocket.compress() methods require that the TLS 
connection has progressed beyond the TLS Client Hello and therefore will not 
contain return meaningful values nor can they be called safely.

REVISED:
Based on the value of `sni_name`, a new SSLContext can be created and attached 
to the current SSLSocket. Due to the early negotiation phase of the TLS 
connection, only the Client Hello will have occurred by the time this callback 
is called. Methods and attributes such as SSLSocket.selected_alpn_protocol(), 
SSLSocket.getpeercert(), SSLSocket.cipher(), and SSLSocket.compress() require 
that the TLS connection has progressed beyond the TLS Client Hello and 
therefore will not contain return meaningful values nor can they be called 
safely.

--

___
Python tracker 

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



[issue37891] Exceptions tutorial page does not mention raise from

2021-03-21 Thread Irit Katriel


Change by Irit Katriel :


--
keywords: +easy
versions: +Python 3.10 -Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 
3.9

___
Python tracker 

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



[issue14189] C API documentation must document if returned object is a borrowed reference or strong reference

2021-03-21 Thread Irit Katriel


Irit Katriel  added the comment:

This was fixed for all the functions listed by the OP, except a few that no 
longer exist AFAICT:

Doc/c-api/import.rst:  _PyImport_FindExtension
Doc/c-api/import.rst:  _PyImport_FixupExtension
Doc/c-api/init.rst:  PyEval_GetCallStats
Doc/c-api/int.rst:  PyInt_FromSize_t

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Assuming Antoine is correct (a likely story), I'm closing and will only re-open 
if a subsequent failure is confirmed to have run and failed after the 
submission. Sorry for the noise.

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

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Okay, I think you may be right. I saw your name on the build and assumed that 
meant the merge triggered that build. I'll trigger a build now.

--

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I don't think that build includes your change.
Here are the builds that have been triggered (the list seems incomplete for 
now):
https://buildbot.python.org/all/#/changes/3355

--

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Unfortunately, it seems the patch didn't have the intended effect. The [build 
is still failing](https://buildbot.python.org/all/#/builders/14/builds/810). So 
I'm left without a way to test without committing code to the main branch.

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

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

SSLContext.set_alpn_protocols() is a high level interface on top of 
SSL_CTX_set_alpn_select_cb(). Python doesn't directly expose the ALPN selector 
callback. The ssl module only provides a way to set a hard-coded callback that 
wraps SSL_select_next_proto().

https://github.com/python/cpython/blob/9a50ef43e42ee32450a81ce13ed5a0729d3b84e8/Modules/_ssl.c#L3487-L3535

https://github.com/python/cpython/blob/9a50ef43e42ee32450a81ce13ed5a0729d3b84e8/Modules/_ssl.c#L3393-L3415

To solve your problem Python would have to support something like:

def alpn_cb(sslsocket, client_alpn_protocols, negotiated):
return negotiated

context.alpn_cb = alpn_cb

--

___
Python tracker 

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



[issue43060] Convert _decimal C API from pointer array to struct

2021-03-21 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

Closing, as the C API was removed in GH-24960.

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 9a50ef43e42ee32450a81ce13ed5a0729d3b84e8 by Jason R. Coombs in 
branch 'master':
bpo-43569: Add test/test_importlib/namespacedata01 to TESTSUBDIRS (GH-24952)
https://github.com/python/cpython/commit/9a50ef43e42ee32450a81ce13ed5a0729d3b84e8


--

___
Python tracker 

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



[issue43569] test_importlib failed on installed Python

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

You can find your submitted change here by looking here:
https://buildbot.python.org/all/#/changes

For some reason, though, it seems that no build was triggered:
https://buildbot.python.org/all/#/changes/3344

In any case, the fix is a no-brainer.

--
nosy: +pitrou

___
Python tracker 

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



[issue41701] Buildbot web page: connection lost after 1 minute, then display "Connection restored" popup

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
nosy: +pitrou

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Andrew Dailey


Andrew Dailey  added the comment:

Yea, I'm still on the hunt for a better way to solve my primary problem: detect 
an acme-tls/1 ALPN protocol request during the TLS handshake so that I can swap 
out the context to one with the cert chain that Let's Encrypt is expecting to 
see.

It seems like OpenSSL provides three primary hooks into the handshake: 
ClientHello, servername, and ALPN. The servername callback is the only one that 
can be "officially" customized by Python's SSL API. The ALPN callback seems to 
be used under the hood to implement SSLContext.set_alpn_protocols() but there 
isn't a way to specify complete control of the callback.

My current "hack" is to use the SSLContext._msg_callback to check for the 
acme-tls/1 protocol explicitly:

def msg_callback(conn, direction, version, content_type, msg_type, data):
if direction == 'read' and b'acme-tls/1' in data:
print('got an acme-tls/1 request')
print('set a flag for sni_callback to check, etc etc')

I know this probably isn't a good or safe way to solve the problem. The current 
docs make it sound like sni_callback would be my one-stop shop but that ended 
up not being the case. Maybe I could subclass SSLSocket, override 
do_handshake(), and then swap out the context before or after 
super().do_handshake()? I'm quite new to Python/OpenSSL internals so I'm not 
sure if that is even possible. Can a context be swapped out so late in the 
handshake process?

The SSL_client_hello_get0_ext() function you mentioned could be a contender. 
The _msg_callback I'm currently using _does_ do the trick but maybe shouldn't 
be documented and made official? Regardless of how best to solve my current 
acme-tls/1 ALPN detection issue, the sni_callback won't ever be the full answer 
unless some internal mechanics are added to watch ClientHello and preemptively 
peek at the requested ALPN protocol(s).

--

___
Python tracker 

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



[issue43585] perf_counter() returns computers uptime

2021-03-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Can you explain why you think this is the wrong behavior, and what operating 
system and version of Python you're using?


from https://docs.python.org/3/library/time.html#time.perf_counter

Return the value (in fractional seconds) of a performance counter, i.e. a clock 
with the highest available resolution to measure a short duration. It does 
include time elapsed during sleep and is system-wide. The reference point of 
the returned value is undefined, so that only the difference between the 
results of two calls is valid.


Returning the uptime seems like acceptable behavior to me, since "the reference 
point ... is undefined".

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue41369] Update to libmpdec-2.5.1

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23719
pull_request: https://github.com/python/cpython/pull/24962

___
Python tracker 

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



[issue43585] perf_counter() returns computers uptime

2021-03-21 Thread Tobi


New submission from Tobi :

perf_counter() does not behave as expected

--
messages: 389248
nosy: txhx38
priority: normal
severity: normal
status: open
versions: Python 3.10

___
Python tracker 

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



[issue43422] Revert _decimal C API changes

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue43422] Revert _decimal C API changes

2021-03-21 Thread miss-islington


miss-islington  added the comment:


New changeset cdddc2b742750e3f289305cf276433a8170c32c1 by Antoine Pitrou in 
branch 'master':
bpo-43422: Revert _decimal C API addition (GH-24960)
https://github.com/python/cpython/commit/cdddc2b742750e3f289305cf276433a8170c32c1


--
nosy: +miss-islington

___
Python tracker 

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



[issue43575] map() instantiation time reducing by using PEP 590 vectorcall

2021-03-21 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +rhettinger

___
Python tracker 

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



[issue43584] Doc description of str.title() upper case vs. title case.

2021-03-21 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

There was recent change to str.capitalize. I am not sure if Serhiy was 
referring to this doc change in https://bugs.python.org/issue36549#msg339570

--
nosy: +serhiy.storchaka, xtreak

___
Python tracker 

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



[issue43581] array assignment error

2021-03-21 Thread John Cena


John Cena  added the comment:

You are actually creating 4 references to the same list(See the ending *4). 
This is how python behaves. See the below link as well

https://stackoverflow.com/questions/240178/list-of-lists-changes-reflected-across-sublists-unexpectedly

--
nosy: +crazyguyx4

___
Python tracker 

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



[issue43581] array assignment error

2021-03-21 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue41324] Add a minimal decimal capsule API

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

For the record, this is going to be reverted at Stefan's request in issue43422.

--

___
Python tracker 

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



[issue43581] array assignment error

2021-03-21 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

By using * 4 in the end you are making four lists having same reference. Hence 
change in one causes change in other 4 lists.

Relevant FAQ : 
https://docs.python.org/3/faq/programming.html#how-do-i-create-a-multidimensional-list

--
nosy: +xtreak

___
Python tracker 

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



[issue43584] Doc description of str.title() upper case vs. title case.

2021-03-21 Thread Grant Edwards


New submission from Grant Edwards :

The documentation for str.title() states that the first character in each world 
is converted to upper case. That is not correct for recent versions of Python. 
The first character in each word is converted to title case. Title and upper 
may be the same for English/ASCII, but other languages have characters for 
which upper and title case are different.

--
assignee: docs@python
components: Documentation
messages: 389242
nosy: docs@python, grant.b.edwards
priority: normal
severity: normal
status: open
title: Doc description of str.title() upper case vs. title case.
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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-21 Thread Christian Heimes

Christian Heimes  added the comment:

I'm also -1 and would prefer something like Grégory's proposal instead.

--
nosy: +christian.heimes

___
Python tracker 

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



[issue43422] Revert _decimal C API changes

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +23718
pull_request: https://github.com/python/cpython/pull/24960

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

The fix will be available in next 3.9 and 3.8 release.

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

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

I don't see any way to fix the issue with our current API. OpenSSL 1.1.1 
provides a new API SSL_client_hello_get0_ext() to access raw extension during 
early stage of ClientHello phase. 
https://www.openssl.org/docs/man1.1.1/man3/SSL_client_hello_get1_extensions_present.html

--

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread miss-islington


miss-islington  added the comment:


New changeset c145c03281af850130dd7f75abc19c6ea49626e6 by Miss Islington (bot) 
in branch '3.9':
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback 
(GH-24957)
https://github.com/python/cpython/commit/c145c03281af850130dd7f75abc19c6ea49626e6


--

___
Python tracker 

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



[issue43583] make test failures, 2 tests failed: test_embed test_tabnanny

2021-03-21 Thread Pattesvador

New submission from Pattesvador :

I'm trying to install python 3.9.2 on a 18.04.5 ubuntu. I downloaded the 
Python-3.9.2.tar.xz and followed the readme.txt installation instructions. When 
executing the "make test" command I get this error : 

== Tests result: FAILURE then FAILURE ==

397 tests OK.

2 tests failed:
test_embed test_tabnanny

26 tests skipped:
test_bz2 test_dbm_gnu test_dbm_ndbm test_devpoll test_idle
test_ioctl test_kqueue test_lzma test_msilib test_ossaudiodev
test_readline test_smtpnet test_sqlite test_ssl test_startfile
test_tcl test_tix test_tk test_ttk_guionly test_ttk_textonly
test_turtle test_winconsoleio test_winreg test_winsound
test_zipfile64 test_zoneinfo

2 re-run tests:
test_embed test_tabnanny

Total duration: 9 min 26 sec
Tests result: FAILURE then FAILURE
Récolte du processus fils perdant 0x55e48cc2b400 PID 15880 
Makefile:1199: recipe for target 'test' failed
make: *** [test] Error 2
Retrait du processus fils 0x55e48cc2b400 PID 15880 de la chaîne.

I don't know what to do. I've read one issue on the topic but I have to admit 
that I didn't understand a thing. Here's the issue 
https://bugs.python.org/issue43001

Thank you for your answers.

--
messages: 389237
nosy: Pattesvador
priority: normal
severity: normal
status: open
title: make test failures, 2 tests failed: test_embed test_tabnanny
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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

I analysed the issue in comment https://bugs.python.org/issue43577#msg389222

--
nosy: +alex, dstufft, janssen, njs
versions: +Python 3.10

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

No, there is no check for that. This kind of deadlock should never occur. The 
problem was an implementation bug in low-level C code that had bad interaction 
with the global interpreter lock. Python releases the GIL around OpenSSL calls. 
Callbacks have to re-acquire the GIL correctly and release it again at the end 
of a callback.

By the way the _msg_cb attribute is deliberately undocumented and marked as an 
internal property. I implemented the callback to debug some issues with TLS 1.3 
and OpenSSL 1.1.1. It's neither well tested nor stable.

--

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread miss-islington


miss-islington  added the comment:


New changeset 93b0da7527ae1b7d705052cf352ef9da81e608ec by Miss Islington (bot) 
in branch '3.8':
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback 
(GH-24957)
https://github.com/python/cpython/commit/93b0da7527ae1b7d705052cf352ef9da81e608ec


--

___
Python tracker 

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



[issue43581] array assignment error

2021-03-21 Thread Vedran Čačić

Vedran Čačić  added the comment:

All three words in the title are wrong. :-D

--
nosy: +veky

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23717
pull_request: https://github.com/python/cpython/pull/24959

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:


New changeset 77cde5042a2f1eae489c11a67540afaf43cd5cdf by Christian Heimes in 
branch 'master':
bpo-43577: Fix deadlock with SSLContext._msg_callback and sni_callback 
(GH-24957)
https://github.com/python/cpython/commit/77cde5042a2f1eae489c11a67540afaf43cd5cdf


--

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 2.0 -> 3.0
pull_requests: +23716
pull_request: https://github.com/python/cpython/pull/24958

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Andrew Dailey


Change by Andrew Dailey :


--
nosy: +christian.heimes

___
Python tracker 

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



[issue43582] SSLContext.sni_callback docs inaccurately describe available handshake info

2021-03-21 Thread Andrew Dailey


New submission from Andrew Dailey :

Hello,

The documentation for SSLContext.sni_callback [0] seems to incorrectly describe 
the information available at that stage of the TLS handshake.

According to the docs:
Due to the early negotiation phase of the TLS connection, only limited methods 
and attributes are usable like SSLSocket.selected_alpn_protocol() and 
SSLSocket.context. SSLSocket.getpeercert(), SSLSocket.getpeercert(), 
SSLSocket.cipher() and SSLSocket.compress() methods require that the TLS 
connection has progressed beyond the TLS Client Hello and therefore will not 
contain return meaningful values nor can they be called safely.

This paragraph claims that SSLSocket.selected_alpn_protocol() should be usable 
within sni_callback but I think this is inaccurate. Based on the OpenSSL docs 
[1] and my own testing, the servername callback occurs after ClientHello but 
_before_ the ALPN callback. This prevents accurate ALPN information from being 
available until later. I believe that any call to 
SSLSocket.selected_alpn_protocol() within an SSLContext.sni_callback will 
simply return None.

Excerpt from the OpenSSL docs:
Several callbacks are executed during ClientHello processing, including the 
ClientHello, ALPN, and servername callbacks. The ClientHello callback is 
executed first, then the servername callback, followed by the ALPN callback.

I think it'd be better to explain that the only "useful" thing you can do 
within sni_callback is to see what sni_name is desired an optionally swap out 
the context for one with a more appropriate cert chain. Any information about 
the selected ALPN protocol has to wait until later in the handshake.

[0] https://docs.python.org/3/library/ssl.html#ssl.SSLContext.sni_callback
[1] 
https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_tlsext_servername_callback.html

--
assignee: docs@python
components: Documentation, SSL
messages: 389231
nosy: docs@python, theandrew168
priority: normal
severity: normal
status: open
title: SSLContext.sni_callback docs inaccurately describe available handshake 
info
type: enhancement
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



[issue43581] array assignment error

2021-03-21 Thread Wen Hao


New submission from Wen Hao :

>>>mat = [[0]*4]*4
>>> mat
[[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]
>>> mat[1][2]=1
>>> mat
[[0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0], [0, 0, 1, 0]]

--
components: Build
messages: 389230
nosy: haowenqi.zz
priority: normal
severity: normal
status: open
title: array assignment error
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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Andrew Dailey


Andrew Dailey  added the comment:

I'm glad that the info I provided was helpful! I'll go ahead and create another 
issue for the misleading docs surrounding SSLContext.sni_callback. Thanks for 
looking into this and coming up with a fix so quickly.

I do have one more question: does python provide a "safe" way to test for 
deadlocks like this? I noticed that you added a test case to verify that this 
lockup doesn't happen but what would happen if someone ran that test on an 
earlier version? Would the test runner also freeze or are there facilities 
in-place to catch such behavior? Maybe something nutty like:

with should_deadlock():
my_buggy_test()

--

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-21 Thread Grégory Starck

Grégory Starck  added the comment:

FWIW -1 from me too.

That should be solved by creating a new function IMO : 

def joinstr(sep, *seq):
return sep.join(str(i) for i in seq)

--
nosy: +g.sta...@gmail.com

___
Python tracker 

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



[issue19124] os.execv executes in background on Windows

2021-03-21 Thread Eryk Sun


Eryk Sun  added the comment:

> On Windows, the new process is executed in the background but 
> can send output to a console if the original process was 
> started in a console.

C execv[e]() is a mess for console applications. The child process is competing 
for console input with an ancestor process in the console session, which is 
typically a CLI shell such as CMD or PowerShell. This is dysfunctional. It's 
worth either fixing or deprecating. It's not worth documenting since it's way 
off spec compared to exec() in POSIX systems. exec() is supposed to overlay the 
current process with a new image, not terminate the current process. That 
cannot be implemented in Windows, but we could do our best to emulate it. 

The implementation could leave the current Python process running in much the 
same way as a launcher functions, i.e. wait for the child process to exit and 
proxy its exit status, and set the child process in a kill-on-close job object.

It would be better at this point to use subprocess.Popen() to implement 
os.exec*, considering it can work concurrently with itself, without race 
conditions involving inheritable handles. nt.spawnv[e](), nt.waitpid(), and 
nt.system() could also be implemented with subprocess.

--
assignee: docs@python -> 
components: +Extension Modules, Library (Lib) -Documentation
versions: +Python 3.10 -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



[issue33140] shutil.chown should not be defined in Windows

2021-03-21 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue43535] Make str.join auto-convert inputs to strings.

2021-03-21 Thread Kamil Turek


Change by Kamil Turek :


--
nosy: +kamilturek

___
Python tracker 

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



[issue40521] [subinterpreters] Make free lists and unicode caches per-interpreter

2021-03-21 Thread Mark Dickinson


Mark Dickinson  added the comment:

Hi Victor,

I just noticed the change to dtoa.c in GH-24821. Please could you explain what 
the benefit of this change was?

In general, we need to be very conservative with changes to dtoa.c: it's a 
complex, fragile, performance-critical piece of code, and ideally we'd like it 
not to diverge from the upstream code any more than it already has, in case we 
need to integrate bugfixes from upstream.

It's feeling as though the normal Python development process is being bypassed 
here. As I understand it, this and similar changes are in aid of 
per-subinterpreter GILs. Has there been agreement from the core devs or 
steering council that this is a desirable goal? Should there be a PEP before 
more changes like this are made? (Or maybe there's already a PEP, that I 
missed? I know about PEP 554, but that PEP is explicit that GIL sharing is out 
of scope.)

--

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

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

As a data point, my Windows development VM uses Windows 7.  It would be a major 
annoyance for me to reinstall a new development VM from scratch (going through 
the usual hurdles to have a usable development environment would probably be a 
full day of work, perhaps more).

--
nosy: +pitrou

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Thank you!

--

___
Python tracker 

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



[issue43572] "Too many open files" on macOS buildbot

2021-03-21 Thread Antoine Pitrou


Change by Antoine Pitrou :


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



[issue31863] Inconsistent exitcode for terminated child processes on Windows

2021-03-21 Thread Eryk Sun

Eryk Sun  added the comment:

> I'm not actually sure what the proposal here is. Are we suggesting 
> that all Python's means of terminating a process should use the 
> same exit code?

That's how I read it, but I don't agree if it means always pretending that a 
process was killed by a SIGTERM POSIX signal. That's fighting an uphill battle 
against the platform and its conventions.

I singled out the case where multiprocessing tries to pretend that Windows has 
Unix signals. It documents that `exitcode` will be negative if terminated by a 
signal. It doesn't qualify that this is only in Unix.

exitcode
The child’s exit code. This will be None if the process has not
yet terminated. A negative value -N indicates that the child
was terminated by signal N.

A negative exit code in Windows (i.e. 0x8000_ and above) has many possible 
meanings. Generally it indicates an abnormal error of some sort that terminated 
the process, and generally the code is an NTSTATUS or HRESULT value, such as 
STATUS_CONTROL_C_EXIT or E_FAIL (0x8000_4005). However, there isn't a 
convention to use an NTSTATUS or HRESULT error code when manually terminating a 
process. Instead, the convention is to use EXIT_FAILURE (1).

multiprocessing pretends that terminate() is implemented with a SIGTERM signal. 
To do so, it terminates with an exit code that's just above the system 16-bit 
range:

TERMINATE = 0x1

def terminate(self):
if self.returncode is None:
try:
_winapi.TerminateProcess(int(self._handle), TERMINATE)
except OSError:
if self.wait(timeout=1.0) is None:
raise

and maps this code to -signal.SIGTERM:

def wait(self, timeout=None):
if self.returncode is None:
if timeout is None:
msecs = _winapi.INFINITE
else:
msecs = max(0, int(timeout * 1000 + 0.5))

res = _winapi.WaitForSingleObject(int(self._handle), msecs)
if res == _winapi.WAIT_OBJECT_0:
code = _winapi.GetExitCodeProcess(self._handle)
if code == TERMINATE:
code = -signal.SIGTERM
self.returncode = code

return self.returncode

I don't know why it doesn't simply use -SIGTERM instead of involving the 
intermediate error code. 

It's apparently trying to close a loop for scripts that call terminate() and 
look for this case, or for logging, but the platform convention in Windows 
doesn't allow distinguishing when a process was forcibly terminated. We don't 
know whether an exit status of 1 means the process failed internally or was 
forcibly terminated by another tool. So we can't rely on the exit code in 
Windows in the same way that it can be relied on in POSIX. All we know is that 
the process failed. Terminating with an exit code of 15 or -15 in some cases 
does nothing to solve the problem in general.

--
title: Inconsistent returncode/exitcode for terminated child processes on 
Windows -> Inconsistent exitcode for terminated child processes on Windows
versions: +Python 3.10 -Python 3.7

___
Python tracker 

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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Christian Heimes


Christian Heimes  added the comment:

Thanks for the excellent bug report and reproducer! I have identified the issue 
and submitted a fix for review. OpenSSL copies the internal msg_callback to SSL 
struct, but SSL_set_SSL_CTX() does not update the msg_callback with value from 
new context.

Could you please open a new bug regarding the issue with SNI and ALPN order? 
This is unrelated. It looks like OpenSSL processes the ALPN extension after the 
SNI extension, 
https://github.com/openssl/openssl/blob/abded2ced44b94d96f08ea5cf01df6519b80f5d3/ssl/ssl_local.h#L740-L769
 . I can see that the state machines fires "final_server_name" first (which 
triggers the SNI callback), then "tls_handle_alpn". This makes sense. This 
allows the new context to select ALPNs.


#0  final_server_name (s=0x8a4080, context=128, sent=1) at 
ssl/statem/extensions.c:925
#1  0x7fffea3ec146 in tls_parse_all_extensions (x=, 
chainidx=, fin=, exts=, 
context=, 
s=) at ssl/statem/extensions.c:762
#2  tls_parse_all_extensions (s=0x8a4080, context=128, exts=, 
x=, chainidx=, fin=1) at 
ssl/statem/extensions.c:737
#3  0x7fffea417db6 in tls_early_post_process_client_hello (s=0x8a4080) at 
ssl/statem/statem_srvr.c:1906
#4  tls_post_process_client_hello (wst=, s=0x8a4080) at 
ssl/statem/statem_srvr.c:2249
#5  ossl_statem_server_post_process_message (s=s@entry=0x8a4080, wst=) at ssl/statem/statem_srvr.c:1243
#6  0x7fffea3fe34c in read_state_machine (s=0x8a4080) at 
ssl/statem/statem.c:664
#7  state_machine (s=0x8a4080, server=) at 
ssl/statem/statem.c:434
#8  0x7fffea48a9df in _ssl__SSLSocket_do_handshake_impl 
(self=0x7fffe9fe3ed0) at /home/heimes/dev/python/cpython/Modules/_ssl.c:1084
#9  _ssl__SSLSocket_do_handshake (self=0x7fffe9fe3ed0, 
_unused_ignored=) at 
/home/heimes/dev/python/cpython/Modules/clinic/_ssl.c.h:19


#0  tls_handle_alpn (s=0x8a4080) at ssl/statem/statem_srvr.c:2167
#1  0x7fffea3ec146 in tls_parse_all_extensions (x=, 
chainidx=, fin=, exts=, 
context=, 
s=) at ssl/statem/extensions.c:762
#2  tls_parse_all_extensions (s=0x8a4080, context=128, exts=, 
x=, chainidx=, fin=1) at 
ssl/statem/extensions.c:737
#3  0x7fffea417db6 in tls_early_post_process_client_hello (s=0x8a4080) at 
ssl/statem/statem_srvr.c:1906
#4  tls_post_process_client_hello (wst=, s=0x8a4080) at 
ssl/statem/statem_srvr.c:2249
#5  ossl_statem_server_post_process_message (s=s@entry=0x8a4080, wst=) at ssl/statem/statem_srvr.c:1243
#6  0x7fffea3fe34c in read_state_machine (s=0x8a4080) at 
ssl/statem/statem.c:664
#7  state_machine (s=0x8a4080, server=) at 
ssl/statem/statem.c:434
#8  0x7fffea48a9df in _ssl__SSLSocket_do_handshake_impl 
(self=0x7fffe9fe3ed0) at /home/heimes/dev/python/cpython/Modules/_ssl.c:1084

--

___
Python tracker 

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



[issue43580] A Question about List Slice

2021-03-21 Thread Mark Dickinson


Change by Mark Dickinson :


--
components:  -Regular Expressions

___
Python tracker 

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



[issue43580] A Question about List Slice

2021-03-21 Thread Mark Dickinson


Mark Dickinson  added the comment:

It's behaving as designed and documented; see the docs here: 
https://docs.python.org/3/library/stdtypes.html#sequence-types-list-tuple-range 
(and particularly note 3).

In your first example, the first `-1` in `x[1:-1:-1]` is interpreted relative 
to the end of the list, so `x[1:-1:-1]` is equivalent to `x[1:9:-1]`.

`x[1::-1]` may give you what you want for the first case.

--
nosy: +mark.dickinson
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



[issue43577] Deadlock when using SSLContext._msg_callback and SSLContext.sni_callback

2021-03-21 Thread Christian Heimes


Change by Christian Heimes :


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

___
Python tracker 

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



[issue43580] A Question about List Slice

2021-03-21 Thread LittleGuy


New submission from LittleGuy <674980...@qq.com>:

# There is a question when I use list.
# If I run this following code:

x = list(range(10))
a = x[1 : -1 : -1]
print(a)

# the answer will be:
[]

# the right answer should be: [1, 0]
# But in some cases, it works well, like:

a = x[4 : 2 : -1]
print(a)

# the answer will be:
[4, 3]

# so, there may be some problems.

--
components: Regular Expressions
messages: 389220
nosy: YangS007, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: A Question about List Slice
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



[issue43579] Leak in asyncio.selector_events._SelectorSocketTransport

2021-03-21 Thread begnac

New submission from begnac :

Hello,

Even after close()ing, asyncio.selector_events._SelectorSocketTransport keeps a 
reference to itself via self._read_ready_cb.

should probably add

def close(self):
super().close()
self._read_ready_cb = None

Cheers !
Itaï.

--
components: asyncio
messages: 389219
nosy: asvetlov, begnac, yselivanov
priority: normal
severity: normal
status: open
title: Leak in asyncio.selector_events._SelectorSocketTransport
type: performance
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue43578] With asyncio subprocess, send_signal() and the child process watcher will both call waitpid()

2021-03-21 Thread lincheney


New submission from lincheney :

Under unix, when creating a asyncio subprocess, the child process watcher will 
call waitpid() to reap the child, but if you call send_signal() (or terminate() 
or kill() ) on the asyncio subprocess, this will also call waitpid(), causing 
exactly one of these to fail, as you cannot call waitpid() on a PID more than 
once.

If the send_signal() fails, this doesn't seem much of an issue.
If the child process watcher fails however, it sets the returncode to 255 and 
also returns 255 when running wait() and also emits a warning.

I've seen this behaviour with the ThreadedChildWatcher, but possibly other Unix 
child watchers that use waitpid() suffer from the same problem.

The behaviour is racey (it depends on which one completes the waitpid() first), 
but if you try it enough it will appear:
```
import asyncio
import signal

async def main():
while True:
proc = await asyncio.create_subprocess_exec('sleep', '0.1')
await asyncio.sleep(0.1)
try:
proc.send_signal(signal.SIGUSR1)
except ProcessLookupError:
pass
assert (await proc.wait() != 255)

asyncio.run(main())

```

The output looks like:
```
Unknown child process pid 1394331, will report returncode 255
Traceback (most recent call last):
  File "/tmp/bob.py", line 14, in 
asyncio.run(main())
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
  File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in 
run_until_complete
return future.result()
  File "/tmp/bob.py", line 12, in main
assert (await proc.wait() != 255)
AssertionError
```

This would be expected behaviour if I were explicitly calling waitpid() myself 
(ie I'm shooting my own foot, so I'd deserve the bad behaviour), but that's not 
the case here nor any other exotic code.

--
components: asyncio
messages: 389218
nosy: asvetlov, lincheney, yselivanov
priority: normal
severity: normal
status: open
title: With asyncio subprocess, send_signal() and the child process watcher 
will both call waitpid()
type: behavior
versions: Python 3.9

___
Python tracker 

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