[issue42819] readline 8.1 bracketed paste

2021-01-18 Thread Dustin Rodrigues


Dustin Rodrigues  added the comment:

The linked PR disables bracketed paste regardless of if the user has it as a 
configuration option or if Python was configured with a version of readline 
which defaults to on for bracketed paste. Is this a viable approach?

--

___
Python tracker 

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



[issue42964] Draft PEP blob etc

2021-01-18 Thread Larry Hastings


Larry Hastings  added the comment:

(Oops, meant to send that as a private email.  Sorry for the noise, I'll try to 
be more careful in the future.)

--

___
Python tracker 

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



[issue42964] Draft PEP blob etc

2021-01-18 Thread Larry Hastings

New submission from Larry Hastings :

You interested in me doing an editing pass / critique of your PEP?  I 
just poked around on Github, and I don't think I can do one of those 
inline code review things until it's a PR.

Also, I'm a PEP editor, I can get it assigned a PEP number when you're 
ready for that.

Cheers,

//arry/

--
messages: 385243
nosy: larry
priority: normal
severity: normal
status: open
title: Draft PEP blob etc

___
Python tracker 

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



[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-18 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

I think the crash is fixed by this PR. I try other arguments. No crash is 
reported. Thank you!

--

___
Python tracker 

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



[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-18 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

No crash is reported anymore. The result is like following:
-
... 
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
  File 
"/home/xxm/Downloads/cpython-a4afb55fb226e1debcdaaf80890b790198ba14cc/Lib/socket.py",
 line 953, in getaddrinfo
  File 
"/home/xxm/Downloads/cpython-a4afb55fb226e1debcdaaf80890b790198ba14cc/Lib/socket.py",
 line 953, in getaddrinfo
OSError: [Errno 24] Too many open files
  File 
"/home/xxm/Downloads/cpython-a4afb55fb226e1debcdaaf80890b790198ba14cc/Lib/socket.py",
 line 953, in getaddrinfo
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
OSError: [Errno 24] Too many open files
---

--

___
Python tracker 

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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-01-18 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



[issue42963] [multiprocessing] Calling pool.terminate() from an error_callback causes deadlock

2021-01-18 Thread Sammy Jelin


Change by Sammy Jelin :


--
type:  -> behavior

___
Python tracker 

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



[issue42963] [multiprocessing] Calling pool.terminate() from an error_callback causes deadlock

2021-01-18 Thread Sammy Jelin


New submission from Sammy Jelin :

As the title says, calling `pool.terminate()` inside an `error_callback` 
handler causes a deadlock.  The deadlock always happens, so it's not a race 
condition or thread-safety issue.

Simple repro:

```
from multiprocessing import Pool
p = Pool()

def error_callback(x):
print(f'error: {x!r}')
p.terminate()
print('this message is never seen, because p.termiante() deadlocks')

p.apply_async(lambda: None, error_callback=error_callback)

# The following lines are technically aren't threadsafe,
# but I manually verified that that wasn't the problem.
p.close()
p.join()
print('this is also never seen, because the task handler is stuck in the 
deadlock')
```

This will print the following line and then hang:
```
error: PicklingError("Can't pickle  at 0x112c55e18>: 
attribute lookup  on __main__ failed")
```

The hanging happens inside `_help_stuff_finish`, when we call 
`inqueue._rlock.acquire()`.  As far as I can tell, `_handle_tasks` is already 
holding the lock when it calls the error_callback, so when `_terminate_pool` 
calls `_help_stuff_finish` a deadlock occurs.

Calling `p.terminate()` from a success callback doesn't appear to be an issue, 
likely because success callbacks are called via `_handle_results` instead of 
via `_handle_tasks`.

If calling `p.terminate()` from an error_callback isn't supported, that should 
be one of those big red warnings in the documentation.

I verified that this bug happens on 3.6 and 3.7, a skimmed the code on the 
github project to verify that it was likely still an issue.

--
components: Library (Lib)
messages: 385240
nosy: sjelin
priority: normal
severity: normal
status: open
title: [multiprocessing] Calling pool.terminate() from an error_callback causes 
deadlock
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2021-01-18 Thread Bar Harel


Change by Bar Harel :


--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread William Schwartz


William Schwartz  added the comment:

> In Windows, os.kill() is a rather confused function.

I know how it feels.

To be honest, I don't have an opinion about whether the steps I laid out ought 
to work. I just reported it because the SystemError indicates that a C-API 
function was returning non-NULL even after PyErr_Occurred() returns true. I 
think that's what you're referring to here...

> it doesn't clear the error that was set as a result of the 
> GenerateConsoleCtrlEvent() call, which causes SystemError to be raised.

...but I lost you on where that's happening and why. Frankly, Windows IPC is 
not in my wheelhouse.

>>  Oddly, `echo %errorlevel%` will print `0` rather than `-1073741510` 
>
> There's nothing odd about that.

Here's why I thought it was odd. The following session is from the Windows 
Command shell inside *Command Prompt* (not Windows Terminal):

 C:\Users\wksch>python --version
 Python 3.9.1
 C:\Users\wksch>python -c"import os, signal, time; os.kill(os.getpid(), 
signal.CTRL_C_EVENT); time.sleep(1)"
 Traceback (most recent call last):
   File "", line 1, in 
 KeyboardInterrupt
 ^C
 C:\Users\wksch>echo %errorlevel%
 -1073741510

In the Windows Command shell inside *Windows Terminal* (not Command Prompt):

 C:\Users\wksch>python -c"import os, signal, time; os.kill(os.getpid(), 
signal.CTRL_C_EVENT); time.sleep(1)"

 C:\Users\wksch>echo %errorlevel%
 0

 C:\Users\wksch>python -c"raise KeyboardInterrupt"
 Traceback (most recent call last):
   File "", line 1, in 
 KeyboardInterrupt
 ^C
 C:\Users\wksch>echo %errorlevel%
 -1073741510

--

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23076
pull_request: https://github.com/python/cpython/pull/24238

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23075
pull_request: https://github.com/python/cpython/pull/24254

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23074
pull_request: https://github.com/python/cpython/pull/24254

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread Eryk Sun


Eryk Sun  added the comment:

> 4. In console A, type the PID from console B and execute the command.

In Windows, os.kill() is a rather confused function. In particular, it confuses 
a process ID (pid) with a process group ID (pgid). If the signal is 
CTRL_C_EVENT or CTRL_BREAK_EVENT, it first tries WinAPI 
GenerateConsoleCtrlEvent(). This function takes a pgid for a process group in 
the console session. Passing it a pid of a process in the console session 
that's not a pgid has undefined behavior (usually it acts like passing 0 as the 
pgid, but it's complicated; I have an open issue on Microsoft's GitHub repo for 
this that's been languishing for a couple years). Passing it a pid of a process 
that's not in the console session will fail as an invalid parameter. 

In the latter case, os.kill() sets an error but still tries the regular pid 
(not pgid) path of OpenProcess() and TerminateProcess(). If the latter 
succeeds, it returns success. However, it doesn't clear the error that was set 
as a result of the GenerateConsoleCtrlEvent() call, which causes SystemError to 
be raised.

>  Oddly, `echo %errorlevel%` will print `0` rather than `-1073741510` 

There's nothing odd about that. The value of CTRL_C_EVENT is 0. 
GenerateConsoleCtrlEvent() does not work across different console sessions. So 
os.kill() has simply opened a handle to the process and called 
TerminateProcess(handle, 0).

--
nosy: +eryksun

___
Python tracker 

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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-01-18 Thread Eryk Sun


Eryk Sun  added the comment:

FYI, Windows is not a POSIX operating system and does not implement Unix 
signals in the kernel. That said, the C language serves as a base level of 
cross-platform support for language runtimes across most operating systems, and 
there's significant coupling between C and Unix. Standard C requires six Unix 
signals to be supported in some fashion: SIGABRT, SIGTERM, SIGFPE, SIGILL, 
SIGSEGV, and SIGINT. 

The C runtime in Windows implements SIGABRT and SIGTERM only within the 
process, e.g. with C raise() and abort(). There's no mechanism to send these 
signals to another process. It implements SIGFPE, SIGILL, SIGSEGV using an OS 
structured exception handler, but these can't and shouldn't be handled in 
Python. 

That leaves SIGINT, which is implemented for console applications using a 
console control handler for the cancel event (CTRL_C_EVENT). The same handler 
also implements non-standard SIGBREAK for the other console control events: 
break, close, logoff, and shutdown. 

There's limited support to send the cancel and break events (CTRL_C_EVENT and 
CTRL_BREAK_EVENT) to other processes via WinAPI 
GenerateConsoleCtrlEvent(ctrlEvent, processGroupId). The event can be sent to a 
process group in the current console session or to all processes (group 0) in 
the console session. The process group ID (pgid) of a process cannot be 
directly queried. The only way to know a pgid is to create a process as the 
leader of a new group with the creation flag CREATE_NEW_PROCESS_GROUP, in which 
case the pgid is the pid. A new process group initially has the cancel event 
ignored, until a process manually enables it. So in practice you can only rely 
on sending the break event. This is implemented in Python via os.kill(pgid, 
event) and subprocess.Popen.send_signal(event). But remember the target pgid 
must be either 0 or a known pgid. Using a pid that's not a pgid has undefined 
behavior.

--
nosy: +eryksun

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread Petr Viktorin


Change by Petr Viktorin :


--
nosy:  -petr.viktorin

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

FYI I created 
https://python-security.readthedocs.io/vuln/ctypes-buffer-overflow-pycarg_repr.html
 to track fixes of this issue.

--

___
Python tracker 

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



[issue42962] Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)

2021-01-18 Thread William Schwartz


New submission from William Schwartz :

I don't have an automated test at this time, but here's how to get os.kill to 
raise SystemError. I did this on Windows 10 version 20H2 (build 19042.746) with 
Pythons 3.7.7, 3.8.5, and 3.9.1. os_kill_impl at Modules/posixmodule.c:7833 
does not appear to have been modified recently (but I haven't checked its 
transitive callees), so I imagine you can get the same behavior from os.kill on 
Python 3.10.

1. Open two consoles, A and B. (I'm using tabs in Windows Terminal, if that 
matters.)
2. In console A, type but DO NOT EXECUTE the following command:

python -c"import os, signal; os.kill(, signal.CTRL_C_EVENT)"

Move your cursor back before the comma.

3. In console B, create a process that does nothing but print its process 
identifier and wait long enough for you to type it in console A:

python -c"import os, time; print(os.getpid()); time.sleep(60); print('exiting 
cleanly')"

Copy or remember the printed PID. Hurry to step 4 before your 60 seconds 
expires!

4. In console A, type the PID from console B and execute the command.
5. In console B, confirm that the Python exited without printing "exiting 
cleanly". Oddly, `echo %errorlevel%` will print `0` rather than `-1073741510` 
(which is `2**32 - 0xc13a`, the CTRL_C_EVENT exit code), which is what it 
prints after `python -c"raise KeyboardInturrupt"`.
6. In console A, you should see the following traceback.

OSError: [WinError 87] The parameter is incorrect

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "", line 1, in 
SystemError:  returned a result with an error set

--
components: Extension Modules, Windows
messages: 385235
nosy: William.Schwartz, ncoghlan, paul.moore, petr.viktorin, steve.dower, 
tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Windows: SystemError during os.kill(..., signal.CTRL_C_EVENT)
type: behavior
versions: Python 3.10, 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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Ned Deily


Change by Ned Deily :


--
keywords: +security_issue
priority: normal -> high
versions: +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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset c347cbe694743cee120457aa6626712f7799a932 by Miss Islington (bot) 
in branch '3.9':
closes bpo-42938: Replace snprintf with Python unicode formatting in ctypes 
param reprs. (GH-24247)
https://github.com/python/cpython/commit/c347cbe694743cee120457aa6626712f7799a932


--

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f by Miss Islington (bot) 
in branch '3.8':
closes bpo-42938: Replace snprintf with Python unicode formatting in ctypes 
param reprs. (GH-24248)
https://github.com/python/cpython/commit/ece5dfd403dac211f8d3c72701fe7ba7b7aa5b5f


--

___
Python tracker 

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



[issue42957] os.readlink produces wrong result on windows

2021-01-18 Thread Eryk Sun


Eryk Sun  added the comment:

Symlinks and mountpoints (aka junctions) contain two forms of the target path. 
There's a path that's intended for display in the shell, and there's the actual 
substitute path to which the link resolves. os.readlink() was changed to return 
the substitute path because the display form is not mandated by filesystem 
protocols (it's sometimes missing, especially for junctions) and not reliable 
(e.g. the display path may be a long path or contain reserved names such that 
it's not valid without the \\?\ prefix). It was decided to keep the C 
implementation of os.readlink() simple. Whether to retain the \\?\ prefix was 
shifted to high-level functions that consume the result of os.readlink(), such 
as os.path.realpath().

There was a previous issue related to this, in that the shutil module copies 
symlinks via os.readlink() and os.symlink(), which thus copies only the 
substitute path now. The issue was closed as not a bug, but had it been 
resolved with new functionality, I would have preferred to do so with a 
low-level function to copy a reparse point, not by reverting the behavior of 
os.readlink(). I also see no reason against adding an option to readlink() to 
return the display path instead of the substitute path, or to just remove the 
prefix. But I'd vote against making it the default behavior.

--
components: +Library (Lib)
nosy: +eryksun
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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset d9b8f138b7df3b455b54653ca59f491b4840d6fa by Benjamin Peterson in 
branch '3.7':
[3.7] closes bpo-42938: Replace snprintf with Python unicode formatting in 
ctypes param reprs. (GH-24249)
https://github.com/python/cpython/commit/d9b8f138b7df3b455b54653ca59f491b4840d6fa


--

___
Python tracker 

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



[issue42961] Use-after-free (of a heap type) during finalization

2021-01-18 Thread Yannick Jadoul


Change by Yannick Jadoul :


--
nosy: +YannickJadoul

___
Python tracker 

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



[issue42961] Use-after-free (of a heap type) during finalization

2021-01-18 Thread Boris Staletic


[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 34df10a9a16b38d54421eeeaf73ec89828563be7 by Benjamin Peterson in 
branch '3.6':
[3.6] closes bpo-42938: Replace snprintf with Python unicode formatting in 
ctypes param reprs. (GH-24250)
https://github.com/python/cpython/commit/34df10a9a16b38d54421eeeaf73ec89828563be7


--

___
Python tracker 

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



[issue42960] resources module, FreeBSD update adding RLIMIT_KQUEUES constant

2021-01-18 Thread David CARLIER


Change by David CARLIER :


--
components: FreeBSD
nosy: devnexen, koobs
priority: normal
pull_requests: 23073
severity: normal
status: open
title: resources module, FreeBSD update adding RLIMIT_KQUEUES constant
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



[issue36143] Auto-generate Lib/keyword.py

2021-01-18 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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-01-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

As the docs explain, SIGHUP is not available on Windows. This is as designed.

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +23072
pull_request: https://github.com/python/cpython/pull/24250

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
pull_requests: +23071
pull_request: https://github.com/python/cpython/pull/24249

___
Python tracker 

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



[issue42959] AttributeError: module 'signal' has no attribute 'SIGHUP'

2021-01-18 Thread Joel Ewaldo


New submission from Joel Ewaldo :

I have already tried uninstalling and reinstalling python 3.7.9 via the 64-bit 
installer on the official python website. Also, I am on the latest version of 
windows. I have also made sure that signal.py was not a file in my directory 
and when I import _signal followed with print(dir(_signal)), it returns 
['CTRL_BREAK_EVENT', 'CTRL_C_EVENT', 'NSIG', 'SIGABRT', 'SIGBREAK', 'SIGFPE', 
'SIGILL', 'SIGINT', 'SIGSEGV', 'SIGTERM', 'SIG_DFL', 'SIG_IGN', '__doc__', 
'__loader__', '__name__', '__package__', 
'__spec__', 'default_int_handler', 'getsignal', 'set_wakeup_fd', 'signal'].

--
components: Windows
files: unknown (2).png
messages: 385227
nosy: ametatheton2, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: AttributeError: module 'signal' has no attribute 'SIGHUP'
type: compile error
versions: Python 3.9
Added file: https://bugs.python.org/file49748/unknown (2).png

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread miss-islington


Change by miss-islington :


--
pull_requests: +23070
pull_request: https://github.com/python/cpython/pull/24248

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread miss-islington


Change by miss-islington :


--
nosy: +miss-islington
nosy_count: 3.0 -> 4.0
pull_requests: +23069
pull_request: https://github.com/python/cpython/pull/24247

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Benjamin Peterson  added the comment:


New changeset 916610ef90a0d0761f08747f7b0905541f0977c7 by Benjamin Peterson in 
branch 'master':
closes bpo-42938: Replace snprintf with Python unicode formatting in ctypes 
param reprs. (24239)
https://github.com/python/cpython/commit/916610ef90a0d0761f08747f7b0905541f0977c7


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



[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-01-18 Thread Alexander Vandenbulcke


Change by Alexander Vandenbulcke :


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

___
Python tracker 

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



[issue42958] filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs

2021-01-18 Thread Alexander Vandenbulcke


New submission from Alexander Vandenbulcke :

Consider the case where 2 files are shallow compared where only the mtime 
differs (i.e. the mode and size is identical).

With filecmp.cmp(f1, f2, shallow=True) a deep compare would be performed behind 
the scenes since the guard clauses fell through. This discrepancy is either a 
problem in the docstring or a problem in the comparison itself.

Two options remain:
- the documentation is altered and describes that, in case only the mtime 
differs (i.e. mode and size are equal) a deep compare is performed
- the behaviour is restricted in that effectively only a shallow compare is 
performed
- a shallow compare becomes more restrictive (do not consider the mtime during 
the compare)

My preference is to adjust the function to safeguard the meaning of 'shallow' 
in this context.

--
components: Library (Lib)
messages: 385225
nosy: AlexVndnblcke
priority: normal
severity: normal
status: open
title: filecmp.cmp(shallow=True) isn't actually shallow when only mtime differs
type: behavior

___
Python tracker 

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



[issue36143] Auto-generate Lib/keyword.py

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6a809fa01f59bb00f4029d35d132cd87553554c3 by Victor Stinner in 
branch 'master':
bpo-36143: make regen-all now also runs regen-keyword (GH-24245)
https://github.com/python/cpython/commit/6a809fa01f59bb00f4029d35d132cd87553554c3


--

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

I'm not keen on prohibiting nonlocal variable reference in annotations,
since I can imagine uses for this (e.g. in tests). I'm not too worried
about keeping the cell alive "forever", since with Larry's PEP 649 their
lifetime would end when the object containing the annotation ends.

Someone should look into how Batuhan's super()-in-annotation example would
behave under Larry's PEP 649. (Using super() in the magical function Larry
proposes to generate might not work anyway, since super()'s own magical
powers don't work in a nested function.)

Re: issue42737, not sure what to do for that, since neither PEP 563 nor PEP
649 gives a way to access those annotations. Then again, that's also true
for annotations on local variables. So maybe we can treat them the same?
Type checkers won't care, and runtime uses of annotations (whether as type
hints or otherwise) won't have access..

--

___
Python tracker 

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



[issue36143] Auto-generate Lib/keyword.py

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23066
pull_request: https://github.com/python/cpython/pull/24245

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

I created https://bugs.python.org/issue42955 to add sys.modules_names tuple: 
names of stdlib modules. Once it will be merged, I will updated this PR to 
filter the list of modules (ignore stdlib modules).

--

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 250035d134ad482e724f73ce654682254b513ee0 by Victor Stinner in 
branch 'master':
bpo-42923: Dump extension modules on fatal error (GH-24207)
https://github.com/python/cpython/commit/250035d134ad482e724f73ce654682254b513ee0


--

___
Python tracker 

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



[issue42956] Easy conversion between range and slice

2021-01-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Perhaps the indices() method will suffice:

>>> slice(None, 10, 2).indices(8)
(0, 8, 2)

>>> range(8)[:10:2]
range(0, 8, 2)

--
nosy: +rhettinger

___
Python tracker 

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



[issue42953] After the subclass of enum.Enum is imported in some diffenent ways, the same enumeration value is judged as False

2021-01-18 Thread Ethan Furman


Ethan Furman  added the comment:

This issue is not unique to Enum, and is not an Enum problem.

What is happening is that "test.py" has the `__name__` of `__main__` because it 
is being directly executed from the command line, but when `test2.py` imports 
it, it is being re-executed and everything inside is re-created -- so you end 
up with two copies of everything in that module.

You can also see this issue if you manage to import a module under two 
different names (usually by messing with `sys.path`).

To see it yourself, add a custom __str__ to A:

def __str__(self):
return "%s.%s.%s" % (
__name__,
self.__class__.
   __qualname__, self._name_,
   _)

Then your print() will show:

__main__.A.a test.A.a

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



[issue42957] os.readlink produces wrong result on windows

2021-01-18 Thread simon mackenzie


New submission from simon mackenzie :

os.readlink gives wrong result on python 3.8 onwards for windows

os.readlink("c:/users/simon/v1")
'?\\d:\\v1'

Should read d:\\v1

--
components: Windows
messages: 385218
nosy: paul.moore, simon mackenzie, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: os.readlink produces wrong result on windows
type: behavior
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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-18 Thread Batuhan Taskaya


Batuhan Taskaya  added the comment:

> The use of nonlocal variables in an annotation will be a syntax error in 
> Python 3.10

What is the reasoning for forbidding nonlocal variables 
(https://bugs.python.org/msg383659), can't we just treat them like regular 
variables and leave the value to whom needed to deal with resolving the scope? 

Also, you should preferably clarify other cases regarding the symbol table 
interaction of annotations. For example this case:

Here is one;
class T:
def foo(self):
a: super().bar() = x
print(T.foo.__closure__)

And if we are on the road to writing a PEP, maybe we should somehow squeeze 
issue 42737 somewhere, since the annotations for complex targets are still 
evaluated and this makes everything a bit problematic and inconsistent. If you 
need collaboration on the PEP, just let me know (isidenti...@gmail.com) (I have 
a patch ready to go for the symbol table to both make annotations ineffective 
and forbid this stuff but was waiting for issue 42737)

--

___
Python tracker 

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



[issue42944] random.Random.sample bug when counts is not None

2021-01-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Thanks for the report and the PR.

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



[issue42944] random.Random.sample bug when counts is not None

2021-01-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset a90539f5723a4c34430761be8cba97daa8474abf by Miss Islington (bot) 
in branch '3.9':
bpo-42944 Fix Random.sample when counts is not None (GH-24235) (GH-24243)
https://github.com/python/cpython/commit/a90539f5723a4c34430761be8cba97daa8474abf


--

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2021-01-18 Thread Bar Harel


Bar Harel  added the comment:

I've taken a shot making this in pure Python, and took into account a few more 
factors such as starvation and reentrancy.

As Nick said, one of the only ways it can truly work is if it's completely 
global, in which case we don't need to use the internal lock and relying on the 
GIL would work.

It's not very efficient atm, as the overhead of the Lock() and 
resulting python code probably offsets the benefit of disabling the GC, but it 
can be fine for some uses I guess.
 
https://github.com/bharel/disable_gc

I'll release it to pypi sometime soon and we can take a look at the 
not-so-accurate usage metric to see if such a thing is needed in the standard 
library.

--
nosy:  -Dennis Sweeney

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2021-01-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

https://bugs.python.org/issue41545 is a duplicate of this.

In that report, there's an example of something that can go wrong with the 
save-a-boolean-per-context-manager approach even when threads are not used, but 
when concurrent generators are used, like

def gen():
with gc_disabled():
yield 1
yield 2
yield 3

a = gen()
b = gen()
next(a) # disable gc
next(b) 
list(a) # this re-enableds the gc
next(b) # gc is enabled but shouldn't be.

A counter for "number of times disabled" may be a better approach.

--
nosy: +Dennis Sweeney

___
Python tracker 

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



[issue41545] gc API requiring matching number of gc.disable - gc.enable calls

2021-01-18 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It looks like this was a duplicate of https://bugs.python.org/issue31356

--

___
Python tracker 

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



[issue42913] asyncio.ProactorEventLoop mishandles signal wakeup file descriptor

2021-01-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

No pressure. If there's an API change needed you will have until 3.10 beta 1. 
Without API changes this can be fixed any time.

--

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-18 Thread Guido van Rossum


Guido van Rossum  added the comment:

It'll probably be quicker if you leave me out of the loop (feel free to quote 
me though). I am currently quite overwhelmed with PEP-sized discussions. I 
expect that the SC can rule on this quickly (just use their tracker to send 
them the PEP).

--

___
Python tracker 

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



[issue42944] random.Random.sample bug when counts is not None

2021-01-18 Thread miss-islington


Change by miss-islington :


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

___
Python tracker 

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



[issue42944] random.Random.sample bug when counts is not None

2021-01-18 Thread Raymond Hettinger


Raymond Hettinger  added the comment:


New changeset f7b5bacd7a0b2084ce699eda6f6f4b1adfa16590 by jonanifranco in 
branch 'master':
bpo-42944 Fix Random.sample when counts is not None (GH-24235)
https://github.com/python/cpython/commit/f7b5bacd7a0b2084ce699eda6f6f4b1adfa16590


--

___
Python tracker 

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



[issue31356] Add context manager to temporarily disable GC

2021-01-18 Thread Bar Harel


Change by Bar Harel :


--
nosy: +bar.harel

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

Note for myself: regen-keyword should be included in "make regen-all".

--

___
Python tracker 

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



[issue42953] After the subclass of enum.Enum is imported in some diffenent ways, the same enumeration value is judged as False

2021-01-18 Thread Guido van Rossum


Change by Guido van Rossum :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 314b8787e0c50985ba708034b84ff5b37a1d47de by Victor Stinner in 
branch 'master':
bpo-42923: Py_FatalError() avoids fprintf() (GH-24242)
https://github.com/python/cpython/commit/314b8787e0c50985ba708034b84ff5b37a1d47de


--

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset e232025025c8bd07c1d1b12a583a80c4a673f077 by Victor Stinner in 
branch 'master':
bpo-42923: Add Py_FatalError() test in test_capi (GH-24240)
https://github.com/python/cpython/commit/e232025025c8bd07c1d1b12a583a80c4a673f077


--

___
Python tracker 

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



[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-18 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

I've made a PR to remove most calls to pthread_exit().

@xxm: could you test it in your environment?

--

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23064
pull_request: https://github.com/python/cpython/pull/24242

___
Python tracker 

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



[issue42888] Not installed “libgcc_s.so.1” causes exit crash.

2021-01-18 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue42923] Py_FatalError(): dump the list of extension modules

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +23062
pull_request: https://github.com/python/cpython/pull/24240

___
Python tracker 

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



[issue42951] Random and infinite loop in dealing with recursion error for "try-except "

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Funny. But the output is not random. You can generate the sequence of letters 
by the following simple loop:

s = ''
for i in range(n):
s = f'a{s}b{s}'

The length of this sequence is 2*(2**n-1). Finally, your code will raise a 
non-silenced RecursiveError, but it will just take some time (for printing 
around 2**1000 letters).

--

___
Python tracker 

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



[issue42725] PEP 563: Should the behavior change for yield/yield from's

2021-01-18 Thread Mark Shannon


Mark Shannon  added the comment:

Draft PEP here
https://github.com/markshannon/peps/blob/annotation-syntax-errors/pep-.rst

Guido, would you like to be co-author as it was your idea to make these things 
a syntax error?

--

___
Python tracker 

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



[issue42952] Incorrect handling of EC_KEY_new_by_curve_name() in the _ssl module

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Okay. And I have doubts that someone would backport this change to 3.6.

I do not see harm in merging PR 24237, although there is no use of it too. In 
any case thank you for finding this suspicious code Zackery.

--

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread Benjamin Peterson


Change by Benjamin Peterson :


--
keywords: +patch
nosy: +benjamin.peterson
nosy_count: 2.0 -> 3.0
pull_requests: +23061
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/24239

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

Another way to gather the list of Python modules: pydoc help("modules") uses 
pkgutil.walk_packages().

pydoc uses ModuleScanner which uses sys.builtin_module_names and 
pkgutil.walk_packages().

pkgutil.walk_packages() calls pkgutil.iter_modules() which iterates on 
sys.meta_path and sys.path, and calls iter_modules() on each importer.

For FileImporter, it iterates on os.listdir() on the importer path.

For zipimporter, it iterates on 
zipimport._zip_directory_cache[importer.archive].

--

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

(...) This API uses objects.inv from the online Python documentation.

By the way, there is also this documentation page listing Python stdlib modules:
https://docs.python.org/dev/py-modindex.html

--

___
Python tracker 

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



[issue42938] [security] ctypes double representation BoF

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy: +vstinner
title: ctypes double representation BoF -> [security] ctypes double 
representation BoF

___
Python tracker 

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



[issue39950] Add pathlib.Path.hardlink_to()

2021-01-18 Thread Jay Chu


Jay Chu  added the comment:

Maybe we could have the correct `Path.hardlink` implemented before removing or 
even deprecating the confusing `Path.link_to`? It will only help even if we 
don't remove the latter in a hurry.

--
nosy: +tothesong

___
Python tracker 

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



[issue42913] asyncio.ProactorEventLoop mishandles signal wakeup file descriptor

2021-01-18 Thread Michel Hidalgo


Michel Hidalgo  added the comment:

Sorry for taking so long to reply. 

Sure, I would be happy to contribute. We should probably take care of Unix 
event loops -- since I opened this ticket I found out those tend to not 
cooperate with other signal wakeup file descriptor users either. I am a bit 
short on time right now though, so it will take some time.

--

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

Use cases for sys.module_names:

* When computing dependencies of a project, ignore modules which are part of 
the stdlib: https://github.com/jackmaney/pypt/issues/3

* Trace the execution of third party code, but ignore stdlib, use 
--ignore-module option of trace: 
https://stackoverflow.com/questions/6463918/how-can-i-get-a-list-of-all-the-python-standard-library-modules

* When reformatting a Python source file, group imports of stdlib modules. The 
isort module contains the list of stdlib modules, one list py Python version: 
https://github.com/PyCQA/isort/tree/develop/isort/stdlibs which is generated 
from the online Python documentation.

---

The isort uses the following script to generate the list of stdlib modules:
https://github.com/PyCQA/isort/blob/develop/scripts/mkstdlibs.py

The script uses sphinx.ext.intersphinx.fetch_inventory(...)["py:module"]. This 
API uses objects.inv from the online Python documentation. Example of Python 
3.9:

   https://docs.python.org/3.9/objects.inv

On the "dev" version, mkstdlibs.py lists 211 modules.

--

___
Python tracker 

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



[issue42952] Incorrect handling of EC_KEY_new_by_curve_name() in the _ssl module

2021-01-18 Thread Christian Heimes


Christian Heimes  added the comment:

It really doesn't matter. The code is dead and will never trigger. Python 3.7 
and newer all require OpenSSL 1.0.2, which always has defines 
SSL_CTX_set_ecdh_auto. In more recent versions SSL_CTX_set_ecdh_auto() is a 
no-op. I'll remove the code entirely when I can drop support for 1.0.2, too.

--

___
Python tracker 

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



[issue42952] Incorrect handling of EC_KEY_new_by_curve_name() in the _ssl module

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Will it be removed in master only or in all maintained version too?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

I wrote PR 24238 which implements an hardcoded list of stdlib module names. The 
PR uses the CI to ensure that the list always remain up to date. If tomorrow a 
new module is added, a CI job fails ("file not up to date").

> What if set __author__ = 'PSF' in every stdib module? Or other attributes 
> which would allow to group modules by origin. Perhaps other authors would use 
> that feature too.

Hum, that would go against my bpo-42923 use case.

Also for bpo-42923, I would prefer a tuple of strings ;-)

--

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue42862] Use functools.lru_cache iso. _sqlite.Cache in sqlite3 module

2021-01-18 Thread Erlend Egeberg Aasland


Erlend Egeberg Aasland  added the comment:

I need some help debugging the Windows issues. There are a handful of tests 
that fail because the sqlite3 is clinging on to objects or file descriptors. 
AFAICT, a GC bug. For example, test_open_uri fails with:

PermissionError: [WinError 32] The process cannot access the file because it is 
being used by another process: [...]

I've tried the following, with no success:
- Remove GC from the Connection type
- Remove the clear method, and modify traverse to only visit Py_TYPE(self) 
(https://bugs.python.org/issue42866#msg384675)
- Add heap type GC (visit type, GC tracking) to all pysqlite types

Maybe it's best to reopen GH-24135 and continue the work with multi-phase init? 
That is finalise bpo-40956, add heap type GC 
(https://bugs.python.org/issue42866#msg384675), establish module state, 
implement multi-phase init, and then revisit this issue.

--

___
Python tracker 

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



[issue42951] Random and infinite loop in dealing with recursion error for "try-except "

2021-01-18 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42950] Incorrect exception behavior in handling recursive call.

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Maybe stdout.flush() or stdout.buffer.flush() raise a RecursionError?

When run the interpreter with option -u the second error is gone.

--

___
Python tracker 

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



[issue42717] The python interpreter crashed with "_enter_buffered_busy"

2021-01-18 Thread Mark Shannon


Mark Shannon  added the comment:

Please leave the issue open. This is a real bug.

It may not be fixed right now, but that doesn't mean it won't ever be fixed.

--
nosy: +Mark.Shannon

___
Python tracker 

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



[issue42950] Incorrect exception behavior in handling recursive call.

2021-01-18 Thread Mark Shannon


Mark Shannon  added the comment:

If you make calls in an exception handler that is handling a RecursionError, 
without unwinding first, then it is likely that another RecursionError may 
occur.

What is strange is that the second RecursionError is raised after 
`print(str(e))` has printed the exception, which is weird and needs further 
investigation.

The following code, using `list.append` shows what happens without the 
additional RecursionError from print.
`list.append` is safe to use as it never raises a RecursionError.

import sys
sys.setrecursionlimit(100)
events = []

def foo(c):
try:
c = c + 1
events.append("ss"+str(c))
foo(c)
except Exception as e:
events.append(e)
events.append("kk")
events.append(c)

c = 0
foo(c)
for ev in events:
print(ev)


ss1
ss2

ss97
maximum recursion depth exceeded while getting the str of an object
kk
97
95
..
3
2
1

--

___
Python tracker 

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



[issue42956] Easy conversion between range and slice

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

> s.start or 0

Why 0? start=None is not the same as start=0 in slice. For example:

>>> 'abcdefgh'[slice(None, 3, -1)]
'hgfe'
>>> 'abcdefgh'[slice(0, 3, -1)]
''

Slices and range objects are very different in many ways. It depends on your 
application how do you convert a slice to a range object, and in general case 
it does not make sense. Just use the way that is appropriate in your 
application.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42956] Easy conversion between range and slice

2021-01-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

All versions older than 3.10 are in feature freeze and cannot get new features 
or enhancements, only bugfixes.

Slices are far more general than range objects. How do you propose to deal with 
slice objects such as this?

slice('item', (23, {'key': 'value'}, 4.5), ('a', 2))

Even for plain integer arguments, the meanings are not the same. Consider the 
slice:

slice(10, -2)  # Start at the 10th item, end at the second-last.

versus the range:

range(10, -2)  # Empty range.

--
nosy: +steven.daprano
versions:  -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



[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

Yes, there is an overhead of using the trashcan mechanism. This is why it is 
only used in data collections, because it is expected that your data can 
contain arbitrary long chains of links. There is many ways to create arbitrary 
long chains with other objects, but it does not happen in common code. For 
methods the cost would be especially high, because method objects are usually 
short-lived and the performance of creating/destroying is critical.

AFAIK the same issue (maybe not with __sizeof__, but with other method of the 
basic object class, like __reduce__) was already reported earlier. I propose to 
close  this issue as "won't fix".

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

There is no technical difference between stdlib modules and other modules. 
Stdlib modules are only special in context of copyright and responsibility.
What if set __author__ = 'PSF' in every stdib module? Or other attributes which 
would allow to group modules by origin. Perhaps other authors would use that 
feature too.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue42956] Easy conversion between range and slice

2021-01-18 Thread Dávid Nemeskey

Dávid Nemeskey  added the comment:

s/to different/two different/

--

___
Python tracker 

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



[issue42956] Easy conversion between range and slice

2021-01-18 Thread Dávid Nemeskey

New submission from Dávid Nemeskey :

It would be nice if there was an easy way to convert a range to a slice and 
vice versa. At least superficially the two are almost the same(*), yet if one 
wants to convert a slice to a range, he has to go through hoops to avoid 
potential errors, ending up with code such as:

s = slice(1, 10, 2)
r = range(s.start or 0, s.stop, s.step or 1)

It would be much nicer if the range and slice functions had a signature that 
accepts the other, which would simplify the above to just r(s).

(*) I don't know the implementation details, but is it even important to have 
to different objects for effectively the same concept? Cannot these two just be 
merged?

--
messages: 385184
nosy: nemeskeyd
priority: normal
severity: normal
status: open
title: Easy conversion between range and slice
type: enhancement
versions: Python 3.10, 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



[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

I'm not having a good day :-(

> the process to get new syntax added to the library

The process to get new syntax added to the **language**.

--

___
Python tracker 

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



[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Oops sorry I got the operator precedence wrong:

if (profile := users.get(uid, None)) is not None:

The walrus operator was added in Python 3.8. Using the "as" key word was 
considered and rejected. See the PEP:

https://www.python.org/dev/peps/pep-0572/

https://docs.python.org/3/reference/expressions.html#assignment-expressions


I don't want to discourage you, but the process to get new syntax added to the 
library is:

* discuss it on Python-Ideas mailing list, to see if there is community support 
for it;

* if there is community support, as for a core developer to sponsor the idea;

* if you get a sponsor, write a PEP

* hopefully the Steering Council will accept it;

* and somebody (perhaps you, perhaps somebody else) will make the changes to 
the language.


https://mail.python.org/archives/list/python-id...@python.org/

https://www.python.org/dev/peps/

--

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

On Fedora 33, the stdlib lives in two main directories:

* /usr/lib64/python3.9: Python modules
* /usr/lib64/python3.9/lib-dynload: C extension modules

Example:

>>> import os.path
>>> os.path.dirname(os.__file__) # Python
'/usr/lib64/python3.9'
>>> os.path.dirname(_asyncio.__file__)
'/usr/lib64/python3.9/lib-dynload'

The Python stdlib path can be retrieved with:

>>> import sysconfig; sysconfig.get_paths()['stdlib']
'/usr/lib64/python3.9'

But I'm not sure how to retrieve /usr/lib64/python3.9/lib-dynload path. 
"platstdlib" is not what I expect:

>>> import sysconfig; sysconfig.get_paths()['platstdlib']
'/usr/lib64/python3.9'

I found DESTDIR in Makefile:

>>> sysconfig.get_config_var('DESTSHARED')
'/usr/lib64/python3.9/lib-dynload'

--

___
Python tracker 

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



[issue42955] Add sys.module_names: list of stdlib module names (Python and extension modules)

2021-01-18 Thread STINNER Victor


New submission from STINNER Victor :

Some use cases require to know if a module comes from the stdlib or not. For 
example, I would like to only dump extension modules which don't come from the 
stdlib in bpo-42923: "Py_FatalError(): dump the list of extension modules".

Stdlib modules are special. For example, the maintenance and updates are 
connected to the Python lifecycle. Stdlib modules cannot be updated with "pip 
install --upgrade". They are shipped with the system ("system" Python). They 
are usually "read only": on Unix, only the root user can write into /usr 
directory where the stdlib is installed, whereas modules installed with "pip 
install --user" can be modified by the current user.

There is a third party project on PyPI which contains the list of stdlib 
modules:
https://pypi.org/project/stdlib-list/

There is already sys.builtin_module_names:
"A tuple of strings giving the names of all modules that are compiled into this 
Python interpreter."
https://docs.python.org/dev/library/sys.html#sys.builtin_module_names

I propose to add a similar sys.module_names tuple of strings (module names).

There are different constraints:

* If we add a public sys attribute, users will likely expect the list to be (1) 
exhaustive (2) correct
* Some extensions are not built if there are missing dependencies. Dependencies 
are checked after Python "core" (the sys module) is built.
* Some extensions are not available on some platforms.
* This list should be maintained.

Should we only list top level packages, or also submodules? For example, only 
list "asyncio", or list the 31 submodules (asyncio.base_events, 
asyncio.futures, ...)? Maybe it can be decided on a case by case basis. For 
example, I consider that "os.path" is a stdlib module, even it's just an alias 
to "posixpath" or "ntpath" depending on the platform.

I propose to include all extensions in the list, even if they are not 
built/available on some platforms. For example, "winsound" would also be listed 
on Linux, even if the extension is specific to Windows.

I also propose to include stdlib module names even if they are overridden at 
runtime using PYTHONPATH with a different implementation. For example, 
"asyncio" would be in the list, even if an user creates "asyncio.py" file. The 
list would not depend on sys.path.

--

Another option is to add an attribute to modules to mark them as coming from 
the stdlib. The API would be an attribute: module.__stdlib__ (bool).

The attribute could be set directly in the module code. For example, add 
"__stdlib__ = True" in Python modules. Similar idea for C extension modules.

Or the attribute could be set after importing the module, in the import site. 
But we don't control how stdlib modules are imported.

--

For the specific case of bpo-42923, another option is to use a list of stdlib 
paths, and check module.__file__ to check if a module is a stdlib module, and 
also use sys.builtin_module_names. And so don't add any API.

--
components: Library (Lib)
messages: 385180
nosy: vstinner
priority: normal
severity: normal
status: open
title: Add sys.module_names: list of stdlib module names (Python and extension 
modules)
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



[issue42954] new "if-as" syntax

2021-01-18 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Use the walrus operator:

if profile := users.get(uid, None) is not None:
print(f"user: {profile['name']}")

--
nosy: +steven.daprano
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue42954] new "if-as" syntax

2021-01-18 Thread Евгений Jen

New submission from Евгений Jen :

# use
if users.get(uid, None) as profile != None:
...

# instead
profile = users.get(uid, None)
if profile != None:
...


# full-sample:

>>> users = {1: {"name": "Jen"}}
... uid = 1
... 
... # current syntax:
... profile = users.get(uid, None)
... if profile != None:
... print(f"user: {profile['name']}")
... #
... 
... # new:
... if users.get(uid, None) as profile != None:
... print(f"user: {profile['name']}")
... #
...

--
components: Interpreter Core
messages: 385178
nosy: jen.soft.master
priority: normal
severity: normal
status: open
title: new "if-as" syntax
type: enhancement
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



[issue35212] Expressions with format specifiers in f-strings give wrong code position in AST

2021-01-18 Thread daniel hahler


Change by daniel hahler :


--
nosy: +blueyed

___
Python tracker 

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



[issue42887] 100000 assignments of .__sizeof__ cause a segfault on del

2021-01-18 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

Note that there is a way to avoid this crash using the trashcan API (see the 
use of Py_TRASHCAN_BEGIN in various implementation).  This API is generally 
only used for recursive data structures and because it has a performance cost 
(based on what I've read in other issues).

--

___
Python tracker 

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



[issue40170] [C API] Make PyTypeObject structure an opaque structure in the public C API

2021-01-18 Thread STINNER Victor


STINNER Victor  added the comment:

See also bpo-41618: [C API] How many slots of static types should be exposed in 
PyType_GetSlot().

--

___
Python tracker 

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



[issue7946] Convoy effect with I/O bound threads and New GIL

2021-01-18 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



  1   2   >