[issue35815] Able to instantiate a subclass with abstract methods from __init_subclass__ of the ABC

2019-01-23 Thread Jazeps Basko


New submission from Jazeps Basko :

I am creating and registering singleton instances of subclasses of ABC in the 
ABC's __init_subclass__ and I just noticed that I am able to instantiate even 
the classes which have abstract methods.



import abc


class Base(abc.ABC):
def __init_subclass__(cls, **kwargs):
instance = cls()
print(f"Created instance of {cls} easily: {instance}")


@abc.abstractmethod
def do_something(self):
pass


class Derived(Base):
pass


Actual Output:

Created instance of  easily: <__main__.Derived object 
at 0x10a6dd6a0>

Expected Output:

TypeError: Can't instantiate abstract class Derived with abstract methods 
do_something

--
messages: 334284
nosy: jbasko
priority: normal
severity: normal
status: open
title: Able to instantiate a subclass with abstract methods from 
__init_subclass__ of the ABC
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-23 Thread Eryk Sun


Eryk Sun  added the comment:

It's worth noting the consequences of changing the application directory (i.e. 
the "%__APPDIR__%" dynamic variable from GetEnvironmentVariableW).
This is the first directory checked in most cases when Windows searches for a 
file, including the CreateProcess[AsUser]W EXE search path, the default 
LoadLibrary[Ex]W DLL search path, and the default SearchPathW generic search 
path. In NT 6.2+, these search paths respectively come from the runtime library 
functions RtlGetExePath, LdrGetDllPath, and RtlGetSearchPath. The search itself 
is implemented by RtlDosSearchPath_Ustr, except LoadLibraryExW uses it only 
when loading a DLL as a data file. (Loading as a module is implemented by 
LdrLoadDll, which uses a private search function, LdrpSearchPath; resolves 
API-set names; and reserves known system DLLs.) This search supports file 
redirection [1], but it's unlikely that Python scripts are creating their own 
activation contexts.

In practice maybe no scripts will be affected by this change. I'm just noting 
potential problems.

Changing the application directory will break scripts that depend on the 
environment's "Scripts" directory being in one of the above search paths. It 
will also break scripts that depend on it being the first directory searched in 
order to shadow system files that aren't otherwise reserved.

We can lessen the impact of this change by prepending the "Scripts" directory 
to PATH. However, some directories will unavoidably have precedence over it 
now. Specifically, for the CreateProcessW EXE search, it's any of the following 
directories:

* "%__APPDIR__%"
This is now the installed location of python.exe.
* "%__CD__%"
The current directory is searched if a name has a 
backslash in it, and also if the environment variable
NoDefaultCurrentDirectoryInExePath is not defined.
* "%SystemRoot%\System32" (GetSystemDirectory)
* "%SystemRoot%\System"
* "%SystemRoot%" (GetWindowsDirectory)

Also, applications that call SetDefaultDllDirectories get a secure DLL search 
path that can only reference "%__APPDIR__%", "%SystemRoot%\System32", and 
directories added via AddDllDirectory or SetDllDirectory. They no longer use 
"%__CD__%", "%SystemRoot%\System", "%SystemRoot%", or PATH. An affected script 
will have to manually add the "Scripts" directory to the DLL search path via 
AddDllDirectory or SetDllDirectory. 

Scripts that wish to restrict searches to PATH should use shutil.which(). It 
also works more predictably for relative filenames. In particular, a relative 
filename that has a path separator in it (e.g. r"eggs\spam.txt") is only 
searched relative to the process current directory. In contrast, searches based 
on RtlDosSearchPath_Ustr handle all relative filenames, whether or not they 
contain a path separator, by trying every directory in the search path (e.g. it 
will look for r"%__APPDIR__%\eggs\spam.txt", and so on).


[1] If enabled by the call flags, searching for a relative filename
can be redirected by an activation context or (in the absence 
of a manifest) an ".local" directory in the application 
directory, via RtlDosApplyFileIsolationRedirection_Ustr. 
CreateProcessW does not enable redirection. SearchPathW enables 
it for the default search path. LoadLibraryExW / LdrLoadDll needs 
to redirect even fully-qualified filenames, so it directly calls
RtlDosApplyFileIsolationRedirection_Ustr.

--

___
Python tracker 

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



[issue33397] IDLE help viewer: let users control font size

2019-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The configdialog font tab sample could also use font resizing.  #24776.

--
versions:  -Python 3.6

___
Python tracker 

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



[issue24776] IDLE: Improve config dialog font change user interface

2019-01-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
versions: +Python 3.8 -Python 3.6

___
Python tracker 

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



[issue24776] IDLE: Improve config dialog font change user interface

2019-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I now think that the proper widget for font resizing might be a ttk.Spinbox 
(but see below).  #33962 discusses issues around using this widget. 

#33397 is about adding local font resizing with hot key or mousewheel to text 
and help viewers via a new FontSizer class. Font Sizer should be usable with 
the sample Text instance.  Size changes in the sample should propagate to the 
size widget.  When done, it might suffice to use a simple entry box for font 
size.  We already use them for counts on the General tab.

Since we do not want to encourage indent changes, I think the indent widget 
should be an entry box with bounds check.

--

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +gvanrossum, levkivskyi

___
Python tracker 

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



[issue35814] Syntax quirk with variable annotations

2019-01-23 Thread Raymond Hettinger


New submission from Raymond Hettinger :

Am not sure how much we care about this, but parenthesis around tuples stops 
being optional when there is a variable annotation. 

>>> from typing import Tuple
>>> t = 10, 'hello' # Parens not normally required
>>> t: Tuple[int, str] = (10, 'hello')  # Annotated allows parens
>>> t: Tuple[int, str] = 10, 'hello'# Annotated w/o parens fails
SyntaxError: invalid syntax

--
components: Interpreter Core
messages: 334280
nosy: rhettinger
priority: low
severity: normal
status: open
title: Syntax quirk with variable annotations
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue25522] IDLE: warn if save-as name matches stdlib name

2019-01-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Beginners import stdlib files such as random.  And they save scripts with such 
name, and accidentally import the script when not desired.

Beginners should learn how to test a script by running a test file provided by 
an instructor or written themselves.  In either case, they *will* have to 
import the script.

--

___
Python tracker 

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



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

2019-01-23 Thread Davin Potts


Change by Davin Potts :


--
keywords: +patch, patch
pull_requests: +11470, 11471
stage:  -> patch review

___
Python tracker 

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



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

2019-01-23 Thread Davin Potts


Change by Davin Potts :


--
keywords: +patch, patch, patch
pull_requests: +11470, 11471, 11472
stage:  -> patch review

___
Python tracker 

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



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

2019-01-23 Thread Davin Potts


Change by Davin Potts :


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

___
Python tracker 

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



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

2019-01-23 Thread Davin Potts


New submission from Davin Potts :

A facility for using shared memory would permit direct, zero-copy access to 
data across distinct processes (especially when created via multiprocessing) 
without the need for serialization, thus eliminating the primary performance 
bottleneck in the most common use cases for multiprocessing.

Currently, multiprocessing communicates data from one process to another by 
first serializing it (by default via pickle) on the sender's end then 
de-serializing it on the receiver's end.  Because distinct processes possess 
their own process memory space, no data in memory is common across processes 
and thus any information to be shared must be communicated over a 
socket/pipe/other mechanism.  Serialization via tools like pickle is convenient 
especially when supporting processes on physically distinct hardware with 
potentially different architectures (which multiprocessing does also support).  
Such serialization is wasteful and potentially unnecessary when multiple 
multiprocessing.Process instances are running on the same machine.  The cost of 
this serialization is believed to be a non-trivial drag on performance when 
using multiprocessing on multi-core and/or SMP machines.

While not a new concept (System V Shared Memory has been around for quite some 
time), the proliferation of support for shared memory segments on modern 
operating systems (Windows, Linux, *BSDs, and more) provides a means for 
exposing a consistent interface and api to a shared memory construct usable 
across platforms despite technical differences in the underlying implementation 
details of POSIX shared memory versus Native Shared Memory (Windows).

For further reading/reference:  Tools such as the posix_ipc module have 
provided fairly mature apis around POSIX shared memory and seen use in other 
projects.  The "shared-array", "shared_ndarray", and "sharedmem-numpy" packages 
all have interesting implementations for exposing NumPy arrays via shared 
memory segments.  PostgreSQL has a consistent internal API for offering shared 
memory across Windows/Unix platforms based on System V, enabling use on 
NetBSD/OpenBSD before those platforms supported POSIX shared memory.

At least initially, objects which support the buffer protocol can be most 
readily shared across processes via shared memory.  From a design standpoint, 
the use of a Manager instance is likely recommended to enforce access rules in 
different processes via proxy objects as well as cleanup of shared memory 
segments once an object is no longer referenced.  The documentation around 
multiprocessing's existing sharedctypes submodule (which uses a single  memory 
segment through the heap submodule with its own memory management 
implementation to "malloc" space for allowed ctypes and then "free" that space 
when no longer used, recycling it for use again from the shared memory segment) 
will need to be updated to avoid confusion over concepts.

Ultimately, the primary motivation is to provide a path for better parallel 
execution performance by eliminating the need to transmit data between distinct 
processes on a single system (not for use in distributed memory architectures). 
 Secondary use cases have been suggested including a means for sharing data 
across concurrent Python interactive shells, potential use with 
subinterpreters, and other traditional uses for shared memory since the first 
introduction of System V Shared Memory onwards.

--
assignee: davin
components: Library (Lib)
messages: 334278
nosy: davin, eric.snow, lukasz.langa, ned.deily, rhettinger, yselivanov
priority: normal
severity: normal
status: open
title: shared memory construct to avoid need for serialization between processes
type: enhancement
versions: Python 3.8

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-23 Thread Steve Dower


Steve Dower  added the comment:

FWIW, a symlink should be able to launch the Store Python - the problem with 
the old approach was it never tried to launch the original Python, but only 
load it's DLLs which won't work (maybe there's a way to enable the app context, 
but that would still require a new redirector and so wasn't any simpler than a 
direct launch).

Otherwise, I agree with this analysis and proposal. Just needs a patch!

--

___
Python tracker 

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



[issue35812] Don't log an exception from the main coroutine in asyncio.run()

2019-01-23 Thread Andrew Svetlov


New submission from Andrew Svetlov :

We use `asyncio.run()` (well, a backported to python3.6 private copy) in our 
application.

The problem is: when `asyncio.run(main_coro(args))` raises an exception it is 
both raised to a caller and passed to `loop.call_exception_handler()` by 
`_cancel_all_tasks()` as *unhandled exception*.

I believe that the logging of unhandled exceptions is a very useful feature but 
the logging should be skipped for the main coroutine passed to `asyncio.run()` 
because it is handled by outer code anyway.

The fix is trivial, the attached file shows how to do it.
But the fix needs tests also.

If somebody wishes to pick up the issue and make it done -- it would be 
awesome. I will help with review and commit, sure.

Another question is should the changing land into 3.7?
I think yes but feedback from Yuri Selivanov is very welcome.

--
components: asyncio
files: utils.py
keywords: easy
messages: 334276
nosy: asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: Don't log an exception from the main coroutine in asyncio.run()
versions: Python 3.8
Added file: https://bugs.python.org/file48074/utils.py

___
Python tracker 

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



[issue35811] py.exe should unset the __PYVENV_LAUNCHER__ environment variable

2019-01-23 Thread Eryk Sun


New submission from Eryk Sun :

In 3.7.2 on Windows, venv now uses a redirecting launcher 'script' for 
python[w].exe. This replaces (on Windows only) the setup requirement to copy or 
symlink the interpreter binaries (i.e. python[w].exe, python37.dll, and 
vcruntime140.dll). Apparently this is required to be able to install Python as 
a Windows Store app. I haven't experimented with it yet, so I'll just accept 
that as a given. I'm curious to find out whether using symlinks would still 
work, and even if it doesn't work for the app installation, whether we could 
still support that option for desktop installations. I've used `--symlinks` for 
a while now, since I grant the required privilege to the authenticated users 
group and thus don't have to elevate to create symlinks. (I know it's not so 
easy for many Windows users.)

The new launcher reads pyvenv.cfg to locate and execute the real python.exe. 
Since the process image is no longer in the virtual environment's "Scripts" 
directory (which has various consequences), we need a way to communicate the 
launcher's path to make Python use the virtual environment. A -X command-line 
option could work, but then all packages and tools that spawn worker processes, 
such as multiprocessing, would need to be updated to look for this option in 
sys._xoptions and propagate it. Instead the launcher sets a special 
"__PYVENV_LAUNCHER__" environment variable. This is reasonable because 
processes are usually created with a copy of the parent's environment. Some 
environment variables may be added or modified, but it's rare for a child 
process to get a completely new environment. (One example of the latter would 
be creating a process that runs as a different user.)

An oversight in the current ecosystem is that py.exe and the distlib 
entry-point launchers do not unset "__PYVENV_LAUNCHER__". Thus, when executing 
a script from a virtual environment (e.g. either directly via py.exe or via the 
.py file association), it will mistakenly be pinned into the virtual 
environment if it runs in Python 3.7. Similarly, pip.exe for an installed 
Python 3.7 will mistakenly install into the virtual environment. However, the 
latter is out of scope here since the entry-point launchers are in distlib. 

It's also a problem if we run the fully-qualified path for an installed Python 
3.7, e.g. from shutil.which('python'). We can't automatically address this 
since it's exactly the reason "__PYVENV_LAUNCHER__" exists. We have to know to 
manually unset "__PYVENV_LAUNCHER__" in the environment that's passed to the 
child. This should be documented somewhere -- maybe in the venv docs.

It's not a problem if a script runs unqualified "python.exe" since the final 
result is usually the same, but for different reasons. With the launcher, it's 
locked down by inheriting "__PYVENV_LAUNCHER__". With the previous design, the 
application directory was the virtual environment's "Scripts" directory. 
Unqualified "python.exe" was thus pinned for CreateProcessW, which checks the 
application directory first. It's also not a problem if we run sys.executable, 
since previously that was the virtual environment's executable. (In 3.7.2, 
sys.executable gets set to the virtual environment's launcher, but that breaks 
multiprocessing. See issue 35797.)

--
components: Windows
messages: 334275
nosy: eryksun, paul.moore, steve.dower, tim.golden, vinay.sajip, zach.ware
priority: normal
severity: normal
stage: test needed
status: open
title: py.exe should unset the __PYVENV_LAUNCHER__ environment variable
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33166] os.cpu_count() returns wrong number of processors on specific systems

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
versions:  -Python 3.6

___
Python tracker 

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



[issue33166] os.cpu_count() returns wrong number of processors on specific systems

2019-01-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Added #32592 as a dependency since that is removing the Vista code mentioned 
here.  Once that change is merged, then this would be a simpler change to make.

--
dependencies: +Drop support of Windows Vista in Python 3.7
nosy: +cheryl.sabella

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -11469

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests:  -11468

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +11467, 11468, 11469
stage: needs patch -> patch review

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +11467, 11468
stage: needs patch -> patch review

___
Python tracker 

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



[issue18610] wsgiref.validate expects wsgi.input read to give exactly one arg

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
pull_requests: +11467
stage: needs patch -> patch review

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2019-01-23 Thread Cheryl Sabella


Change by Cheryl Sabella :


--
components: +Documentation -Library (Lib)
keywords: +easy
stage:  -> needs patch
versions: +Python 3.8 -Python 2.6

___
Python tracker 

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



[issue33342] urllib IPv6 parsing fails with special characters in passwords

2019-01-23 Thread Terrence Brannon


Terrence Brannon  added the comment:

I would like to add to this bug - the password field on the URL cannot contain 
a pound sign or question mark or the parser incorrectly parses the URL, as this 
gist demonstrates - 
https://gist.github.com/metaperl/fc6f43bf6b9a9f874b8f27e29695e68c

--
nosy: +metaperl

___
Python tracker 

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



[issue35767] unittest loader doesn't work with partial test functions

2019-01-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11464, 11465, 11466

___
Python tracker 

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



[issue35767] unittest loader doesn't work with partial test functions

2019-01-23 Thread Łukasz Langa

Łukasz Langa  added the comment:


New changeset fd628cf5adaeee73eab579393cdff71c8f70cdf2 by Łukasz Langa (Jason 
Fried) in branch 'master':
bpo-35767: Fix unittest.loader to allow partials as test_functions (#11600)
https://github.com/python/cpython/commit/fd628cf5adaeee73eab579393cdff71c8f70cdf2


--

___
Python tracker 

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



[issue35767] unittest loader doesn't work with partial test functions

2019-01-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11464

___
Python tracker 

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



[issue35767] unittest loader doesn't work with partial test functions

2019-01-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11464, 11465

___
Python tracker 

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



[issue35810] Object Initialization Bug with Heap-allocated Types

2019-01-23 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
keywords: +patch, patch, patch
pull_requests: +11461, 11462, 11463
stage:  -> patch review

___
Python tracker 

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



[issue35810] Object Initialization Bug with Heap-allocated Types

2019-01-23 Thread Eddie Elizondo


Change by Eddie Elizondo :


--
keywords: +patch, patch
pull_requests: +11461, 11462
stage:  -> patch review

___
Python tracker 

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



[issue35810] Object Initialization Bug with Heap-allocated Types

2019-01-23 Thread Eddie Elizondo


Change by Eddie Elizondo :


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

___
Python tracker 

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



[issue35810] Object Initialization Bug with Heap-allocated Types

2019-01-23 Thread Eddie Elizondo


New submission from Eddie Elizondo :

Heap-allocated Types initializing instances through `PyObject_{,GC}_New{Var}` 
will *NOT* not have their refcnt increased. This was totally fine under the 
assumption that static types are immortal. However, heap-allocated types MUST 
participate in refcounting. Furthermore, their deallocation routine should also 
make sure to decrease their refcnt to provide the incref/decref pair.

--
components: Library (Lib)
messages: 334271
nosy: eelizondo
priority: normal
severity: normal
status: open
title: Object Initialization Bug with Heap-allocated Types
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



[issue20911] urllib 'headers' is not a well defined data type

2019-01-23 Thread R. David Murray


R. David Murray  added the comment:

There has been considerable rewriting of the header handling code since I filed 
this.  I would not be surprised if the issue is no longer valid.  If you want 
to double check, look for the places that the headers attribute is created in 
the various handlers.  Otherwise you can just close this as out of date.

--

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-23 Thread Alexey Izbyshev


Alexey Izbyshev  added the comment:

Another problem with posix_spawn() on glibc: it doesn't report errors to the 
parent process when run under QEMU user-space emulation and Windows Subsystem 
for Linux. This is because starting with commit [1] (glibc 2.25) posix_spawn()  
relies on address space sharing semantics of clone(CLONE_VM) to report errors, 
but it's not implemented in QEMU and WSL, so clone(CLONE_VM) and vfork() behave 
like fork(). See also [2], [3].

This can be easily demonstrated:
$ cat test.c
#include 

int main(int argc, char *argv[], char *envp[]) {
return posix_spawn(0, "non-existing", 0, 0, argv, envp);
}

$ gcc test.c
$ ./a.out
$ echo $?
2
$ aarch64-linux-gnu-gcc -static test.c
$ qemu-aarch64 ./a.out
$ echo $?
0

There is no problem with musl (it doesn't rely on address space sharing).

[1] 
https://sourceware.org/git/?p=glibc.git;a=commit;h=4b4d4056bb154603f36c6f8845757c1012758158
[2] https://bugs.launchpad.net/qemu/+bug/1673976
[3] https://lists.gnu.org/archive/html/qemu-devel/2017-11/msg04890.html

--

___
Python tracker 

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



[issue23903] Generate PC/python3.def by scraping headers

2019-01-23 Thread Neil Schemenauer


Change by Neil Schemenauer :


--
nosy: +nascheme

___
Python tracker 

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



[issue35537] use os.posix_spawn in subprocess

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset f6243ac1e4828299fe5a8e943d7bd41cab1f34cd by Victor Stinner in 
branch 'master':
bpo-35537: subprocess can use posix_spawn with pipes (GH-11575)
https://github.com/python/cpython/commit/f6243ac1e4828299fe5a8e943d7bd41cab1f34cd


--

___
Python tracker 

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



[issue34656] [CVE-2018-20406] memory exhaustion in Modules/_pickle.c:1393

2019-01-23 Thread Matej Cepl


Matej Cepl  added the comment:

Python 3.4 doesn't allow C99 constructs, so I had to update the patch to 
reorder iterator declarations. Just if any future colleague Python Linux distro 
maintainer needs it.

--
Added file: 
https://bugs.python.org/file48073/CVE-2018-20406-pickle_LONG_BINPUT.patch

___
Python tracker 

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2019-01-23 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Patch probably doesn't apply anymore.

--
stage: patch review -> needs patch
versions: +Python 3.8 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue35711] Print information about an unexpectedly pending error before crashing

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:

> A failure (crash) from such asserts provides no information on its own about 
> the unhandled exception itself to help the developer track down the C API use 
> error that led to this state.

Maybe someone should try to modify faulthandler to display the current 
exception?

--

___
Python tracker 

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



[issue27035] Cannot set exit code in atexit callback

2019-01-23 Thread George King


George King  added the comment:

I agree that regardless of the underlying issue, the docs should match the 
behavior. Additionally, I hope the docs will note the exact release at which 
the behavior changed.

@serhiy-storchaka do you have any opinion on this? I took a brief look at your 
commit cited above, and it appears that you were trying to suppress an unwanted 
stack trace display. Did you intend for the exit status behavior to also change?

I stand by my original assessment, as a somewhat dissatisfied user of the 
`atexit` feature. However I also acknowledge that at this point, CPython 
already has a subtle backwards-compatibility issue and further change might not 
be so welcome. I'm happy to discuss this further if people are interested, but 
I'm not going to lobby hard :)

--

___
Python tracker 

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



[issue27035] Cannot set exit code in atexit callback

2019-01-23 Thread Kumar Akshay


Kumar Akshay  added the comment:

Sure, I would love to!

--

___
Python tracker 

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



[issue35779] Print friendly version message in REPL

2019-01-23 Thread Eric Snow


Eric Snow  added the comment:

Thanks for clarifying, Ma Lin.  At this point there just isn't enough strong 
justification for making any change here.  So I'm closing the issue.

Also, making a PR for this likely wouldn't be the best use of your time.  
However, if you're interested in contributing to Python there are plenty of 
interesting problems to solve in open tracker issues.  I'd be glad to help you 
get started if you're interested. :)

--
components: +Interpreter Core
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



[issue35680] [2.7] Coverity scan: Passing freed pointer "name" as an argument to "Py_BuildValue" in _bsddb module.

2019-01-23 Thread Charalampos Stratakis


Charalampos Stratakis  added the comment:

Closing this as it's not really a bug in the code, and I don't think spending 
too much time on python2 is worth it.

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



[issue10112] Use -Wl, --dynamic-list=x.list, not -Xlinker -export-dynamic

2019-01-23 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



[issue18078] threading.Condition to allow notify on a specific waiter

2019-01-23 Thread João Bernardo

João Bernardo  added the comment:

Don't keep your hopes up. People here don't like implementing features they 
don't understand about even if they could verify elsewhere it works well.

My solution at the time was to create a decent "Condition" class based on the 
original one (subclassing this one is not safe). Feel free to use my patch 
above.

--

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:

"""
> Fatal Python error: _PySys_BeginInit: can't initialize sys module

I have no idea why you get this error. You should try to run this function in a 
debugger like gdb and run the code step by step to see what happens.
"""

I pushed 3 changes to get working exceptions and working sys.stderr earlier 
during Python initialization. It should help to display the current exceptions 
when Py_FatalError() is called during early stage of the Python initialization.

--

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset ab67281e95de1a88c4379a75a547f19a8ba5ec30 by Victor Stinner in 
branch 'master':
bpo-35713: Reorganize sys module initialization (GH-11658)
https://github.com/python/cpython/commit/ab67281e95de1a88c4379a75a547f19a8ba5ec30


--

___
Python tracker 

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



[issue33686] test_concurrent_futures: test_pending_calls_race() failed on x86 Windows7 3.6

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:

Should be fixed by bpo-33716.

--

___
Python tracker 

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



[issue35809] test_concurrent_futures.ProcessPoolForkExecutorDeadlockTest fails intermittently on Travis and passes in verbose mode

2019-01-23 Thread STINNER Victor


STINNER Victor  added the comment:

> Sample crash : https://travis-ci.org/python/cpython/jobs/483394585#L2781

Some info from pythoninfo, not sure if they are relevant:

CC.version: clang version 5.0.0 (tags/RELEASE_500/final)
platform.libc_ver: glibc 2.19
platform.platform: Linux-4.4.0-104-generic-x86_64-with-glibc2.17
sys.thread_info: sys.thread_info(name='pthread', lock='semaphore', 
version='NPTL 2.19')
sys.version: 3.8.0a0 (heads/master-2-g5b3e8e9:5b3e8e9, Jan 23 2019, 13:18:30)  
[Clang 5.0.0 (tags/RELEASE_500/final)]

--

___
Python tracker 

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



[issue28890] logging.handlers: Document that QueueListener is a daemon thread

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +vinay.sajip, xtreak
versions: +Python 3.7, Python 3.8 -Python 3.5

___
Python tracker 

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



[issue35809] test_concurrent_futures.ProcessPoolForkExecutorDeadlockTest fails intermittently on Travis and passes in verbose mode

2019-01-23 Thread Karthikeyan Singaravelan


New submission from Karthikeyan Singaravelan :

I can see this test failing intermittently many times on Travis during the 
first run and to pass later during a verbose run hence the failure is not 
visible. I don't know the exact cause and haven't checked the buildbots. Search 
also didn't bring up anything so I thought to file a new issue for this.

Stack trace : 

==
FAIL: test_crash 
(test.test_concurrent_futures.ProcessPoolForkExecutorDeadlockTest) [crash at 
task unpickle]
--
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 958, in test_crash
res.result(timeout=self.TIMEOUT)
  File "/home/travis/build/python/cpython/Lib/concurrent/futures/_base.py", 
line 438, in result
raise TimeoutError()
concurrent.futures._base.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 962, in test_crash
self._fail_on_deadlock(executor)
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 910, in _fail_on_deadlock
self.fail(f"Executor deadlock:\n\n{tb}")
AssertionError: Executor deadlock:
Thread 0x2b5105ca3700 (most recent call first):
  File "/home/travis/build/python/cpython/Lib/threading.py", line 296 in wait
  File "/home/travis/build/python/cpython/Lib/multiprocessing/queues.py", line 
227 in _feed
  File "/home/travis/build/python/cpython/Lib/threading.py", line 865 in run
  File "/home/travis/build/python/cpython/Lib/threading.py", line 917 in 
_bootstrap_inner
  File "/home/travis/build/python/cpython/Lib/threading.py", line 885 in 
_bootstrap
Thread 0x2b510584c700 (most recent call first):
  File "/home/travis/build/python/cpython/Lib/selectors.py", line 415 in select
  File "/home/travis/build/python/cpython/Lib/multiprocessing/connection.py", 
line 930 in wait
  File "/home/travis/build/python/cpython/Lib/concurrent/futures/process.py", 
line 354 in _queue_management_worker
  File "/home/travis/build/python/cpython/Lib/threading.py", line 865 in run
  File "/home/travis/build/python/cpython/Lib/threading.py", line 917 in 
_bootstrap_inner
  File "/home/travis/build/python/cpython/Lib/threading.py", line 885 in 
_bootstrap
Current thread 0x2b50fe39c9c0 (most recent call first):
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 901 in _fail_on_deadlock
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 962 in test_crash
  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 642 in run
  File "/home/travis/build/python/cpython/Lib/unittest/case.py", line 702 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 122 in 
run
  File "/home/travis/build/python/cpython/Lib/unittest/suite.py", line 84 in 
__call__
  File "/home/travis/build/python/cpython/Lib/unittest/runner.py", line 176 in 
run
  File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 
1935 in _run_suite
  File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 
2031 in run_unittest
  File "/home/travis/build/python/cpython/Lib/test/test_concurrent_futures.py", 
line 1241 in test_main
  File "/home/travis/build/python/cpython/Lib/test/support/__init__.py", line 
2163 in decorator
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", 
line 182 in runtest_inner
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest.py", 
line 127 in runtest
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/runtest_mp.py", 
line 68 in run_tests_worker
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
600 in _main
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
586 in main
  File "/home/travis/build/python/cpython/Lib/test/libregrtest/main.py", line 
640 in main
  File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 46 in 
_main
  File "/home/travis/build/python/cpython/Lib/test/regrtest.py", line 50 in 

  File "/home/travis/build/python/cpython/Lib/runpy.py", line 85 in _run_code
  File "/home/travis/build/python/cpython/Lib/runpy.py", line 192 in 
_run_module_as_main


Sample crash : https://travis-ci.org/python/cpython/jobs/483394585#L2781

--
components: Tests
messages: 334255
nosy: bquinlan, pablogsal, pitrou, vstinner, xtreak

[issue35726] QueueHandler formatting affects other handlers

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +11457, 11458, 11459, 11460

___
Python tracker 

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



[issue35726] QueueHandler formatting affects other handlers

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +11457, 11458, 11459

___
Python tracker 

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



[issue35726] QueueHandler formatting affects other handlers

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +11457

___
Python tracker 

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



[issue35726] QueueHandler formatting affects other handlers

2019-01-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
pull_requests: +11457, 11458

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11454, 11455, 11456

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11454

___
Python tracker 

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



[issue35713] Fatal Python error: _PySys_BeginInit: can't initialize sys module

2019-01-23 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +11454, 11455

___
Python tracker 

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



[issue20911] urllib 'headers' is not a well defined data type

2019-01-23 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue18078] threading.Condition to allow notify on a specific waiter

2019-01-23 Thread Richard Whitehead


Richard Whitehead  added the comment:

Condition.wait_for_any is still a desirable feature, e.g. to wait on multiple 
command queues, or a work queue and a command queue.
Is there any chance of pulling this into the latest version?

--
nosy: +richardnwhitehead

___
Python tracker 

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



[issue10915] Make the PyGILState API compatible with multiple interpreters

2019-01-23 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