[issue40860] Exception in multiprocessing/context.py under load

2020-06-03 Thread Arkady M


New submission from Arkady M :

I am running an HTTP server (socketserver.ThreadingMixIn, 
http.server.HTTPServer) in a Docker container (FROM ubuntu:19.10)

Occasionally I get an exception:

Exception happened during processing of request from ('172.17.0.1', 35756)
Traceback (most recent call last):
  File "/usr/lib/python3.7/socketserver.py", line 650, in process_request_thread
self.finish_request(request, client_address)
  File "/usr/lib/python3.7/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
  File "service.py", line 221, in __init__
super(UrlExtractorServer, self).__init__(*args, **kwargs)
  File "/usr/lib/python3.7/socketserver.py", line 720, in __init__
self.handle()
  File "/usr/lib/python3.7/http/server.py", line 426, in handle
self.handle_one_request()
  File "/usr/lib/python3.7/http/server.py", line 414, in handle_one_request
method()
  File "service.py", line 488, in do_POST
self._post_extract(url)
  File "service.py", line 459, in _post_extract
extracted_links, err_msg = self._extract_links(transaction_id, 
attachment_id, zip_password, data)
  File "service.py", line 403, in _extract_links
error, results = call_timeout(process_deadline, 
extractor.extract_links_binary_multiprocess, args=data)
  File "service.py", line 175, in call_timeout
manager = multiprocessing.Manager()
  File "/usr/lib/python3.7/multiprocessing/context.py", line 56, in Manager
m.start()
  File "/usr/lib/python3.7/multiprocessing/managers.py", line 563, in start
self._process.start()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 111, in start
_cleanup()
  File "/usr/lib/python3.7/multiprocessing/process.py", line 56, in _cleanup
if p._popen.poll() is not None:
AttributeError: 'NoneType' object has no attribute 'poll'


I am in the process of preparingof of a reasonably simple piece of code 
demonstrating the problem.

Meanwhile the following can be important. In the code below I ma getting the 
elapse < timeout (20 times from 70K). In all case psutil.Process() returned 
psutil.NoSuchProcess

time_start = time.time()
job = multiprocessing.Process(target=func, args=(args, results), 
kwargs=kwargs)
job.start()
job.join(timeout)
elapsed = time.time()-time_start
if job.is_alive():
try:
process = psutil.Process(job.pid)
process_error = f"pid {job.pid} status {process.status} {process}"
except Exception as e:
process_error = f"psutil.Process() failed {e}"
if elapsed < timeout:
print("elapsed < timeout")

--
messages: 370695
nosy: Arkady M
priority: normal
severity: normal
status: open
title: Exception in multiprocessing/context.py under load
type: crash
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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread David Bolen


David Bolen  added the comment:

It appears the recent commit is causing a CRT exception dialog in 
test_close_stdin (test_repl.TestInteractiveInterpreter).  The dialog can't get 
answered, which is what leads to the eventual timeout.

The assertion is "_osfile(fh) & FOPEN" from osfinfo.cpp on line 258.  It 
actually appears twice (if the first is ignored).  If both are ignored the test 
passes.

I was somewhat surprised to see the dialog, as I believe CRT exception dialogs 
are disabled during test runs (others are present in test logs).  Perhaps the 
child interpreter used by test_repl doesn't inherit that behavior.  If so, this 
was probably always a risk, there just weren't any assertions occurring before 
this in the child interpreter.

--

___
Python tracker 

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



[issue40859] Update Windows build to use xz-5.2.5

2020-06-03 Thread Ma Lin


Change by Ma Lin :


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

___
Python tracker 

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



[issue40859] Update Windows build to use xz-5.2.5

2020-06-03 Thread Ma Lin


New submission from Ma Lin :

The Windows build is using xz-5.2.2, it was released on 2015-09-29.
xz-5.2.5 was released recently, maybe we can update this library.

When preparing cpython-source-deps, don't forget to copy 
`xz-5.2.5\windows\vs2019\config.h` to `xz-5.2.5\windows\` folder.

`\vs2019\config.h` and `\vs2017\config.h` are the same, except for the comment 
on the first line.

I tested xz-5.2.5 on my local machine, it passed test_lzma.py.

XZ Utils Release Notes:
https://git.tukaani.org/?p=xz.git;a=blob;f=NEWS;hb=HEAD

--
components: Windows
messages: 370693
nosy: Ma Lin, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Update Windows build to use xz-5.2.5
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread David Bolen


David Bolen  added the comment:

I haven't had a chance to look too deeply, but the final set of commits 
(starting with fa7ab6aa) appear to be the common thread with all branches now 
failing with timeout exceptions in test_repl on the Windows 10 buildbot.

The first instance was in the 3.x branch 
(https://buildbot.python.org/all/#/builders/129/builds/1191) but they all seem 
similar.

-- David

--
nosy: +db3l

___
Python tracker 

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



[issue40840] lzma.h file not found building on macOS

2020-06-03 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

In [this latest 
routine](https://github.com/jaraco/jaraco.develop/blob/6469c7a61e7349b93f191df38eed6cd020dd79be/jaraco/develop/macos-build-python.py),
 on my macOS workstation with Homebrew installed locally, Python builds 
successfully with just a few outliers:

```
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_gdbm ossaudiodev   spwd   
To find the necessary bits, look in setup.py in detect_modules() for the 
module's name.


The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
_abc  atexitpwd
time   
```

The output is the same as on the system with Homebrew system-installed, except 
for `_gdbm`, which seems only to work on system-installed Homebrew.

That's much cleaner and addresses the reported issue. I guess I should have 
been more careful to execute exactly what the dev docs said rather than my 
routine which must have accumulated some cruft as you recognized.

Thanks for the help.

If you have any other hints as to how to ensure _gdbm builds, I'm open to 
suggestions. Thanks.

--

___
Python tracker 

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



[issue40858] ntpath.realpath fails for broken symlinks with rooted target paths

2020-06-03 Thread Eryk Sun


New submission from Eryk Sun :

ntpath.realpath fails to resolve the non-strict path of a broken relative 
symlink if the target is a rooted path. For example:

>>> os.readlink('symlink')
'\\broken\\link'
>>> os.path.realpath('symlink')
'\\broken\\link'

>>> os.path.abspath('symlink')
'C:\\Temp\\symlink'

The problem is that relative paths have to be specially handled by 
ntpath._readlink_deep, but ntpath.isabs incorrectly classifies r"\broken\link" 
as an absolute path. It's actually relative to the current device or drive in 
the access context. Other path libraries get this right, such as 
pathlib.Path.is_absolute and C++ path::is_absolute [1]. The documented behavior 
of ntpath.isabs (i.e. "begins with a (back)slash after chopping off a potential 
drive letter") isn't something that we can change. So ntpath._readlink_deep 
needs a private implementation of isabs. For example:

def _isabs(s):
s = os.fspath(s)
seps = _get_bothseps(s)
s = s[1:2] if (s and s[0] in seps) else splitdrive(s)[1]
return bool(s) and s[0] in seps

This classifies UNC paths as absolute; rooted paths without a drive as 
relative; and otherwise depends on splitdrive() to get the root path, if any.

[1]: 
https://docs.microsoft.com/en-us/cpp/standard-library/path-class?view=vs-2019#is_absolute


Background

The target of a relative symlink gets evaluated against the hard path that's 
used to access the link. A hard path contains directories and mountpoints, but 
no symlinks. In particular, a rooted symlink target such as r"\spam\eggs" is 
relative to the root device of the hard path that's used to access the link. 
This may or may not be the device on which the link resides. It depends on how 
it's accessed. For example, if the volume that contains the r"\spam\eggs" link 
is accessed via its DOS device name "V:", then it resolves to r"V:\spam\eggs". 
Similarly, if the r"\spam\eggs" link is accessed via r"C:\Mount\VolumeSymlink", 
where "VolumeSymlink" is a directory symlink to "V:\\", then it also resolves 
to r"V:\spam\eggs". On the other hand, if the r"\spam\eggs" link is accessed 
via the mountpoint r"C:\Mount\VolumeMountpoint", then it resolves to 
r"C:\spam\eggs".

--
components: Library (Lib), Windows
messages: 370690
nosy: eryksun, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: needs patch
status: open
title: ntpath.realpath fails for broken symlinks with rooted target paths
type: behavior
versions: Python 3.10, 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



[issue40857] tempfile.TemporaryDirectory() context manager can fail to propagate exceptions generated within its context

2020-06-03 Thread Tim Reid


New submission from Tim Reid :

When an exception occurs within a tempfile.TemporaryDirectory() context
and the directory cleanup fails, the _cleanup exception_ is propagated,
not the original one. This effectively 'masks' the original exception,
and makes it impossible to catch using a simple 'try'/'except' construct.


Code like this:

  import tempfile
  import os
  import sys

  try:
  with tempfile.TemporaryDirectory() as tempdir:
  print(tempdir)
  # some code happens here

  except ArithmeticError as exc:
  print('An arithmetic error occurred: {}'.format(exc))

  print('Continuing...')

is effective at catching any ArithmeticError which occurs in the
code fragment but is not otherwise handled. However if, in addition,
an error occues in cleaning up the temporary directory, the exception
which occurred in the code is replaced by the cleanup exception, and is
not be propagated to be caught by the 'except' clause.

For example:

  import tempfile
  import os
  import sys

  try:
  with tempfile.TemporaryDirectory() as tempdir:
  print(tempdir)
  n = 1 / 0

  except ArithmeticError as exc:
  print('An arithmetic error occurred: {}'.format(exc))

  print('Continuing...')

produces this:

  /tmp/tmp_r2sxqgb
  An arithmetic error occurred: division by zero
  Continuing...

but this:

  import tempfile
  import os
  import sys

  try:
  with tempfile.TemporaryDirectory() as tempdir:
  print(tempdir)
  os.rmdir(tempdir)  # this new line is the only difference
  n = 1 / 0

  except ArithmeticError as exc:
  print('An arithmetic error occurred: {}'.format(exc))

  print('Continuing...')

produces this:

  /tmp/tmp_yz6zyfs
  Traceback (most recent call last):
File "tempfilebug.py", line 9, in 
  n = 1 / 0
  ZeroDivisionError: division by zero

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
File "tempfilebug.py", line 9, in 
  n = 1 / 0
File "/usr/lib/python3.6/tempfile.py", line 948, in __exit__
  self.cleanup()
File "/usr/lib/python3.6/tempfile.py", line 952, in cleanup
  _rmtree(self.name)
File "/usr/lib/python3.6/shutil.py", line 477, in rmtree
  onerror(os.lstat, path, sys.exc_info())
File "/usr/lib/python3.6/shutil.py", line 475, in rmtree
  orig_st = os.lstat(path)
  FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp_yz6zyfs'

and the program exits with the top-level code having no chance to catch
the ZeroDivisionError and continue execution. (To catch this exception,
the top-level code would need to know to catch FileNotFoundError.)

My view is that if an exception happens within a TemporaryDirectory
context, *and* there is an exception generated as a result of the cleanup
process, the original exception is likely to be more significant, and
should be the exception which is propagated, not the one generated by
the cleanup.


System info:

$ python3 --version
Python 3.6.9

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:Ubuntu 18.04.4 LTS
Release:18.04
Codename:   bionic

--
components: Extension Modules
messages: 370689
nosy: granchester
priority: normal
severity: normal
status: open
title: tempfile.TemporaryDirectory() context manager can fail to propagate 
exceptions generated within its context
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue40856] IDLE line numbering should be light gray

2020-06-03 Thread Tal Einat


Tal Einat  added the comment:

I agree that the line numbers should be less prominent.

Terry, why not change the the default? ISTM we should strive to have good 
default colors, they are what most users use and see.

I also think we should improve the dark theme, but that's a separate issue.

--

___
Python tracker 

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



[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Thanks Raymond, that is the intended effect, and your analysis seems 
plausible.

--

___
Python tracker 

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



[issue40856] IDLE line numbering should be light gray

2020-06-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The line number sidebar colors are already user configurable.  We expected 
preferences for this to be as diverse as for anything else.  I changed them on 
my custom dark theme to dark blue on light blue, but I don't expect anyone else 
to like that.

Notepad++ black on white uses a slightly lighter gray on a very light gray (RBG 
about 233 versus 255 for white).  I think a background different from the text 
is a good idea.  In retrospect,  I might have suggested a default something 
more like N++,  but I am not currently willing to change the existing default.

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



[issue39457] Add an autocommit property to sqlite3.Connection with a PEP 249 compliant manual commit mode and migrate

2020-06-03 Thread Erlend Egeberg Aasland


Change by Erlend Egeberg Aasland :


--
nosy: +erlendaasland

___
Python tracker 

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



[issue37483] Add PyObject_CallOneArg()

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

Oh, PyObject_CallOneArg() is missing in the What's New in Python 3.9:
https://docs.python.org/dev/whatsnew/3.9.html#id1

Can someone please propose a PR to add it? I reopen the issue.

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

___
Python tracker 

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



[issue25377] Mention octal format of mode argument of os.chmod

2020-06-03 Thread Ama Aje My Fren


Change by Ama Aje My Fren :


--
keywords: +patch
nosy: +amaajemyfren
nosy_count: 4.0 -> 5.0
pull_requests: +19846
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20621

___
Python tracker 

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



[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

Perhaps this would work:

diff --git a/Lib/statistics.py b/Lib/statistics.py
index c76a6ca519..93a4633464 100644
--- a/Lib/statistics.py
+++ b/Lib/statistics.py
@@ -682,8 +682,10 @@ def _ss(data, c=None):
 calculated from ``c`` as given. Use the second case with care, as it can
 lead to garbage results.
 """
-if c is None:
-c = mean(data)
+if c is not None:
+T, total, count = _sum((x-c)**2 for x in data)
+return (T, total)
+c = mean(data)
 T, total, count = _sum((x-c)**2 for x in data)
 # The following sum should mathematically equal zero, but due to rounding
 # error may not.


Matti, where do you get 0.5 as the expected outcome for the third example?   
The actual mean is 1.5, so I would expect the third case to give sqrt(2)/2 or 
0.707.

--
components: +Library (Lib)
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.6

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

Ok, I fixed bugs in the REPL on Linux and Windows in 3.8, 3.9 and master 
branches.

I also modified PyOS_InterruptOccurred() to fail with a fatal error and a nice 
error message, rather than crashing with a core dump, if it's called with the 
GIL released. I changed in 3.9 and master branches.

Thanks Jelle Zijlstra for the bug report! I'm now closing the issue.

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6d62dc1ea4e191b8486e80a85ca0694215375424 by Victor Stinner in 
branch '3.9':
[3.9] bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) (GH-20618)
https://github.com/python/cpython/commit/6d62dc1ea4e191b8486e80a85ca0694215375424


--

___
Python tracker 

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



[issue40856] IDLE line numbering should be light gray

2020-06-03 Thread Raymond Hettinger


New submission from Raymond Hettinger :

In live code demos, the visual weight of the line numbers is heavier than the 
code next to it.  Instead, is should be light gray, just dark enough to easily 
locate a line of interest, and light enough to tune out while reading the line 
and surrounding code.   The current weight impairs readability.

--
assignee: terry.reedy
components: IDLE
messages: 370681
nosy: rhettinger, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE line numbering should be light gray
type: behavior
versions: Python 3.10, Python 3.9

___
Python tracker 

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



[issue40686] Compiler warnings in _zoneinfo.c on Windows build in 64-bit

2020-06-03 Thread Dong-hee Na


Change by Dong-hee Na :


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

___
Python tracker 

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



[issue40850] Programming FAQ - variables local to the lambdas

2020-06-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


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



[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

The relevant code is in the _ss() helper function:

# The following sum should mathematically equal zero, but due to rounding
# error may not.
U, total2, count2 = _sum((x-c) for x in data)
assert T == U and count == count2
total -=  total2**2/len(data)

The intent was to correct for small rounding errors, but the effect is to undo 
any xbar value that differs from the true mean.

>From a user point-of-view the xbar parameter should have two effects, saving 
>the computation time for the mean and also giving the ability to recenter the 
>stdev/variance around a different point.   It does save a call to mean; 
>however, that effort is mostly throw-away by the rounding adjustment code 
>which does even more work than computing the mean.

Likely, the fix for this is skip the rounding adjustment code if the user 
supplies an xbar value.

--
assignee:  -> steven.daprano
nosy: +steven.daprano

___
Python tracker 

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



[issue33608] Add a cross-interpreter-safe mechanism to indicate that an object may be destroyed.

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

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



[issue14073] allow per-thread atexit()

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

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



[issue36476] Runtime finalization assumes all other threads have exited.

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

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



[issue31517] MainThread association logic is fragile

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

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



[issue36724] Clear _PyRuntime at exit

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
components: +Subinterpreters

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19844
pull_request: https://github.com/python/cpython/pull/20618

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8 by Victor Stinner in 
branch '3.8':
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613) (GH-20616)
https://github.com/python/cpython/commit/6f7346bb3983cd7a6aa97eeeafffb3cecd5292b8


--

___
Python tracker 

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



[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +rhettinger

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Rob Taft


Rob Taft  added the comment:

I updated the test with 2 cases and the traceback is different for each when I 
expected them to be the same if this was purely a mock issue, the line throwing 
the error is the same.  I can post this over with flask and see what they think.

from unittest.mock import patch

import flask

def some_function():
flask.g.somevariable = True
return flask.g.somevariable

@patch('flask.g')
def test_patch(mock_flask_global):
assert some_function()

def test_no_patch():
assert some_function()


$ pytest -vv temp_test.py 

 test session starts 
=
platform linux -- Python 3.8.3, pytest-5.4.3, py-1.8.1, pluggy-0.13.1 -- 
collected 2 items   

 

temp_test.py::test_patch FAILED 

   [ 50%]
temp_test.py::test_no_patch FAILED  

   [100%]

==
 FAILURES 
==
_
 test_patch 
_

args = (), keywargs = {}

@wraps(func)
def patched(*args, **keywargs):
>   with self.decoration_helper(patched,
args,
keywargs) as (newargs, newkeywargs):

../../../.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py:1322: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
../../../.pyenv/versions/3.8.3/lib/python3.8/contextlib.py:113: in __enter__
return next(self.gen)
../../../.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py:1304: in 
decoration_helper
arg = exit_stack.enter_context(patching)
../../../.pyenv/versions/3.8.3/lib/python3.8/contextlib.py:425: in enter_context
result = _cm_type.__enter__(cm)
../../../.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py:1416: in __enter__
if spec is None and _is_async_obj(original):
../../../.pyenv/versions/3.8.3/lib/python3.8/unittest/mock.py:51: in 
_is_async_obj
if hasattr(obj, '__func__'):
pyvenv/lib/python3.8/site-packages/werkzeug/local.py:347: in __getattr__
return getattr(self._get_current_object(), name)
pyvenv/lib/python3.8/site-packages/werkzeug/local.py:306: in _get_current_object
return self.__local()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

name = 'g'

def _lookup_app_object(name):
top = _app_ctx_stack.top
if top is None:
>   raise RuntimeError(_app_ctx_err_msg)
E   RuntimeError: Working outside of application context.
E   
E   This typically means that you attempted to use functionality that 
needed
E   to interface with the current application object in some way. To 
solve
E   this, set up an application context with app.app_context().  See the
E   documentation for more information.

pyvenv/lib/python3.8/site-packages/flask/globals.py:45: RuntimeError
___
 test_no_patch 


def test_no_patch():
>   assert some_function()

temp_test.py:14: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
temp_test.py:6: in some_function
flask.g.somevariable = True
pyvenv/lib/python3.8/site-packages/werkzeug/local.py:364: in 
 

[issue37746] Provide Windows predefined access type constants

2020-06-03 Thread Zackery Spytz


Change by Zackery Spytz :


--
keywords: +patch
nosy: +ZackerySpytz
nosy_count: 5.0 -> 6.0
pull_requests: +19843
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/20617

___
Python tracker 

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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> is it possible to make dict give consistent result?

That is unlikely (there isn't much need, it would introduce a cross-type 
dependency, it would be awkward dicts which use keys in many more ways than 
sets do).

For the time being, a user should explicitly convert to a frozenset:

frozenset(s) in d

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19842
pull_request: https://github.com/python/cpython/pull/20616

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 5d2396c8cf68fba0a949c6ce474a505e3aba9c1f by Victor Stinner in 
branch '3.9':
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)
https://github.com/python/cpython/commit/5d2396c8cf68fba0a949c6ce474a505e3aba9c1f


--

___
Python tracker 

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



[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19841
pull_request: https://github.com/python/cpython/pull/20615

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Chris, I see no evidence in the *incomplete* traceback not posted here that 
there is a bug in mock.  Mock calls "hasattr(obj, '__func__') and apparently 
flask, called via werkzeug, answers 'RuntimeError'.  The overt bug is that 
calling werkzeug.local.(type(obj)?).__getattr__ fails by doing something other 
than "return the (computed) attribute value or raise an AttributeError 
exception".
https://docs.python.org/3/reference/datamodel.html#object.__getattr__

--

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19840
pull_request: https://github.com/python/cpython/pull/20613

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Rob Taft


Change by Rob Taft :


--
versions: +Python 3.9 -Python 3.6

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-06-03 Thread Joannah Nanjekye


Change by Joannah Nanjekye :


--
pull_requests: +19839
pull_request: https://github.com/python/cpython/pull/20611

___
Python tracker 

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



[issue40692] Adjust test_concurrent_futures to run more of its tests if multiprocessing.synchronize is missing

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

> Automated testing: In order to prevent regressions, I'm interested in hosting 
> a buildbot for at least one year, hopefully in perpetuity, on which we call 
> ./configure with ac_cv_posix_semaphores_enabled=no.

Can't you tune an unit test to prevent multiprocessing.synchronize to be 
imported? For example, sys.modules['multiprocessing.synchronize'] = None 
ensures that "import multiprocessing.synchronize" fails, even if the module 
exists and works.

$ python3
Python 3.8.3 (default, May 15 2020, 00:00:00) 
>>> import sys
>>> sys.modules['multiprocessing.synchronize'] = None
>>> import multiprocessing.synchronize
Traceback (most recent call last):
  File "", line 1, in 
ModuleNotFoundError: import of multiprocessing.synchronize halted; None in 
sys.modules

A whole buildbot sounds like an overkill solution to this problem.

On the other hand, multiprocessing tests are already ones of the slowest tests 
of the test suite *because* they try to test all possible combinations.

--
nosy: +vstinner

___
Python tracker 

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



[issue39314] (readline) Autofill the closing parenthesis during auto-completion for functions which accept no arguments at all

2020-06-03 Thread Senthil Kumaran


Change by Senthil Kumaran :


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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Rob Taft


Rob Taft  added the comment:

I have confirmed that using unittest.mock instead of the 3rd party mock library 
in python 3.8.3 and 3.9-dev fails to patch flask.g.  3.7.7 works correctly.

--

___
Python tracker 

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



[issue40471] Grammar typo in issubclass docstring

2020-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset df773f8c5454acebe08c31e7308597fa5a8bf5df by Alex Povel in branch 
'master':
bpo-40471: Fix grammar typo in 'issubclass' docstring (GH-19847)
https://github.com/python/cpython/commit/df773f8c5454acebe08c31e7308597fa5a8bf5df


--
nosy: +miss-islington

___
Python tracker 

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



[issue40471] Grammar typo in issubclass docstring

2020-06-03 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
versions: +Python 3.10, Python 3.7, Python 3.8

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

I proposed PR 20610 to enhance the documentation explaining how to port 
existing to code to Py_SET_SIZE() & cie.

--

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
assignee:  -> orsenthil
nosy: +orsenthil
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -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



[issue40837] email.utils.encode_rfc2231(string, None, None) returns broken value

2020-06-03 Thread Senthil Kumaran


Senthil Kumaran  added the comment:

This will be a breaking change to the clients relying on current broken 
behavior, setting the fix version to 3.10 (current active).

--
nosy: +orsenthil

___
Python tracker 

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



[issue40837] email.utils.encode_rfc2231(string, None, None) returns broken value

2020-06-03 Thread Senthil Kumaran


Change by Senthil Kumaran :


--
versions: +Python 3.10 -Python 3.5, 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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset 911c35d5d334b8c148202f2a7a32b511958032fc by Miss Islington (bot) 
in branch '3.7':
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
https://github.com/python/cpython/commit/911c35d5d334b8c148202f2a7a32b511958032fc


--

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset 74a1fceeb61212a24608eab8266f64c6b22679a6 by Miss Islington (bot) 
in branch '3.9':
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
https://github.com/python/cpython/commit/74a1fceeb61212a24608eab8266f64c6b22679a6


--

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset 5b8787ef191864cd2313015959bcc3e10711aaff by Miss Islington (bot) 
in branch '3.8':
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
https://github.com/python/cpython/commit/5b8787ef191864cd2313015959bcc3e10711aaff


--

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19838
pull_request: https://github.com/python/cpython/pull/20610

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

numpy fix defines Py_SET_TYPE() and Py_SET_SIZE() on old Python versions:

* https://github.com/numpy/numpy/commit/a96b18e3d4d11be31a321999cda4b795ea9eccaa
* https://github.com/numpy/numpy/pull/16417

In the whole numpy code base, only 5 lines have to be modified!

--

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

Similar macro for Py_SET_TYPE:

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_TYPE(obj, size) do { Py_TYPE(obj) = (size); } while (0)
#endif

--

___
Python tracker 

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



[issue40679] show class name in method invocation TypeError

2020-06-03 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Thanks a lot, Victor.

--

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19837
pull_request: https://github.com/python/cpython/pull/20609

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19835
pull_request: https://github.com/python/cpython/pull/20607

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


Change by miss-islington :


--
pull_requests: +19836
pull_request: https://github.com/python/cpython/pull/20608

___
Python tracker 

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



[issue39573] [C API] Make PyObject an opaque structure in the limited C API

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

To port code to Python 3.10, the following macro can be copied/pasted in your 
code. It defines Py_SET_SIZE() if it's not defined.

#if PY_VERSION_HEX < 0x030900A4
#  define Py_SET_SIZE(obj, size) do { Py_SIZE(obj) = (size); } while (0)
#endif

--

___
Python tracker 

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



[issue40767] Allow pure Wayland to get default XDG webbrowser

2020-06-03 Thread miss-islington


miss-islington  added the comment:


New changeset c822efeda9a0afe87cf3429724732fc8e19a01fb by Jeremy Attali in 
branch 'master':
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
https://github.com/python/cpython/commit/c822efeda9a0afe87cf3429724732fc8e19a01fb


--
nosy: +miss-islington

___
Python tracker 

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



[issue40826] PyOS_InterruptOccurred() now requires to hold the GIL: PyOS_Readline() crash

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset fa7ab6aa0f9a4f695e5525db5a113cd21fa93787 by Victor Stinner in 
branch 'master':
bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599)
https://github.com/python/cpython/commit/fa7ab6aa0f9a4f695e5525db5a113cd21fa93787


--

___
Python tracker 

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



[issue32604] [subinterpreters] PEP 554 implementation: add interpreters module

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:


New changeset 18a90248fdd92b27098cc4db773686a2d10a4d24 by Victor Stinner in 
branch 'master':
bpo-32604: Fix reference leak in select module (GH-20600)
https://github.com/python/cpython/commit/18a90248fdd92b27098cc4db773686a2d10a4d24


--

___
Python tracker 

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



[issue40855] statistics.stdev ignore xbar argument

2020-06-03 Thread Matti


New submission from Matti :

statistics.variance also has the same problem. 

>>> import statistics
>>> statistics.stdev([1,2])
0.7071067811865476
>>> statistics.stdev([1,2], 3)
0.7071067811865476
>>> statistics.stdev([1,2], 1.5)
0.7071067811865476

should be 
0.7071067811865476
2.23606797749979
0.5

--
messages: 370659
nosy: Folket
priority: normal
severity: normal
status: open
title: statistics.stdev ignore xbar argument
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor


Change by STINNER Victor :


--
pull_requests: +19834
stage: resolved -> patch review
pull_request: https://github.com/python/cpython/pull/20606

___
Python tracker 

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



[issue40679] show class name in method invocation TypeError

2020-06-03 Thread STINNER Victor


STINNER Victor  added the comment:

> bpo-40679: Use the function's qualname in certain TypeErrors (GH-20236)

This change introduced a regression. See this bug in Cython:
https://github.com/cython/cython/issues/3641#issuecomment-638102096

I wrote a PR to use co->co_name if qualname is NULL (ex: when 
PyEval_EvalCodeEx() is called). I will post the PR once I finish to run the 
test suite locally ;-)

--
nosy: +vstinner
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread yesheng


yesheng  added the comment:

thanks, it sounds reasonable.
is it possible to make dict give consistent result?
{1,2} in {frozenset({1,2}):3} 
# to return True

--

___
Python tracker 

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



[issue38905] venv python reports wrong sys.executable in a subprocess on Windows

2020-06-03 Thread Jurko Gospodnetić

Jurko Gospodnetić  added the comment:

encountered what I believe is the same problem, so here are some more details I 
noticed, after checking what exactly that process name lookup does using 
ProcessMonitor:

- when running my external process in a `venv` generated virtual environment, 
POpen() started subprocess executables are first looked up in the base Python 
executable's folder (the one used to create our virtual environment) as opposed 
to the one running the external Python process, if POpen() is called with 
`shell=False`

- when doing the same and passing `shell=True` to the POpen() call, there is no 
such initial folder in the lookup

- when doing the same on a `virtualenv` generated virtual environment, the file 
lookup is done in the correct folder first - the one containing the current 
Python executable and not in the base one

--
nosy: +Jurko.Gospodnetić

___
Python tracker 

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



[issue40854] [Patch] Allow overriding sys.platlibdir

2020-06-03 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 1.0 -> 2.0
pull_requests: +19832
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20605

___
Python tracker 

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



[issue40854] [Patch] Allow overriding sys.platlibdir

2020-06-03 Thread Sandro Mani


New submission from Sandro Mani :

You can currently point the python interpreter to a different install say via

export PYTHONHOME=
export PYTHONPATH=/lib/python3.9
python3

With the newly added platlibdir [1], if python was configured with 
platlibdir=lib64, this will break because i.e. the site-packages dir as 
returned by `sysconfig.get_paths()` will use lib64 and not lib as the other 
install may be using.

This PR adds the possibility to override the platlibdir via environment 
variable.

Full rationale: [2].

[1] https://github.com/python/cpython/pull/8068
[2] https://src.fedoraproject.org/rpms/python3.9/pull-request/10

--
components: Interpreter Core
messages: 370655
nosy: smani
priority: normal
severity: normal
status: open
title: [Patch] Allow overriding sys.platlibdir
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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

This is documented in 
https://docs.python.org/3.8/library/stdtypes.html#set-types-set-frozenset:


Instances of set are compared to instances of frozenset based on their members. 
For example, set('abc') == frozenset('abc') returns True and so does set('abc') 
in set([frozenset('abc')]).

--

___
Python tracker 

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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread Rémi Lapeyre

Change by Rémi Lapeyre :


--
components: +Interpreter Core
nosy: +rhettinger
versions: +Python 3.10, Python 3.9

___
Python tracker 

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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread Rémi Lapeyre

Rémi Lapeyre  added the comment:

The set is converted to a frozenset before the comparison so 

>>> {1,2} in {frozenset({1,2}), 3}

is equivalent to 

>>> frozenset({1,2}) in {frozenset({1,2}), 3}


This was introduced on purpose 17 years ago in 19c2d778 so it's unlikely to 
change.

--
nosy: +remi.lapeyre

___
Python tracker 

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



[issue40853] "set() in set()" should raise TypeError: unhashable type: 'set'

2020-06-03 Thread yesheng


New submission from yesheng :

>>> set() in set()
False  # should raise TypeError

>>> dict() in set()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'dict'

>>> set() in dict()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'set'

>>> dict() in dict()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: unhashable type: 'dict'

>>> frozenset({1,2}) in {frozenset({1,2}), 3}
True

>>> {1,2} in {frozenset({1,2}), 3}
True  # should raise TypeError

--
messages: 370652
nosy: yesheng
priority: normal
severity: normal
status: open
title: "set() in set()" should raise TypeError: unhashable type: 'set'
type: behavior
versions: Python 3.8

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers


Chris Withers  added the comment:

Rob, you're welcome to dump `mock` and use `unittest.mock`, and that might be 
best for now, but this will then likely come back to bite you when you end up 
on the version of Python, probably 3.9, where it is present ;-)

--

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers


Change by Chris Withers :


--
status: closed -> open

___
Python tracker 

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



[issue40805] Can no longer patch flask.g

2020-06-03 Thread Chris Withers


Chris Withers  added the comment:

Terry, mock is now a rolling backport of unittest.mock with all development 
taking place in cpython's repo. If issues are reported there, they need to be 
triaged here first, as it's most likely a bug in unittest.mock that needs 
fixing here.

Rob, please can you see if this is reproducible on Python 3.8 or 3.9, replacing 
`from mock import` with `from unittest.mock` import?

--
nosy: +cjw296

___
Python tracker 

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



[issue40403] pdb does not drop into debugger upon SyntaxError caused by ast.literal_eval

2020-06-03 Thread Xavier de Gaye


Xavier de Gaye  added the comment:

> Perhaps we should should test whether the exception happened there and not 
> drop in the debugger in that case?

The same kind of problem occurs for any post-mortem debugging raised by an 
uncaught exception in the user code: the backtrace displayed by the 'bt' 
command shows frames that are owned by the pdb and bdb modules; and worse, the 
'up' command allows to move to these frames. See for example below what happens 
when debugging foo.py that contains only the line "1/0". IMO this problem 
should be handled in another issue and in that case, in your example, 'bt' 
output would be empty.


$ python -m pdb foo.py
> /tmp/foo.py(1)()
-> 1/0
(Pdb) c
Traceback (most recent call last):
  File "/usr/lib/python3.8/pdb.py", line 1703, in main
pdb._runscript(mainpyfile)
  File "/usr/lib/python3.8/pdb.py", line 1572, in _runscript
self.run(statement)
  File "/usr/lib/python3.8/bdb.py", line 580, in run
exec(cmd, globals, locals)
  File "", line 1, in 
  File "/tmp/foo.py", line 1, in 
1/0
ZeroDivisionError: division by zero
Uncaught exception. Entering post mortem debugging
Running 'cont' or 'step' will restart the program
> /tmp/foo.py(1)()
-> 1/0
(Pdb) bt
  /usr/lib/python3.8/pdb.py(1703)main()
-> pdb._runscript(mainpyfile)
  /usr/lib/python3.8/pdb.py(1572)_runscript()
-> self.run(statement)
  /usr/lib/python3.8/bdb.py(580)run()
-> exec(cmd, globals, locals)
  (1)()
> /tmp/foo.py(1)()
-> 1/0
(Pdb)

--

___
Python tracker 

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



[issue40836] logging.fatal() and logging.Logger.fatal() should raise a DeprecationWarning

2020-06-03 Thread Vinay Sajip


Vinay Sajip  added the comment:

Yes, they could have a docstring indicating that it is better to use 
critical(). Feel free to update the PR along that line.

--

___
Python tracker 

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



[issue31861] add aiter() and anext() functions to operator module

2020-06-03 Thread Eric Wieser


Change by Eric Wieser :


--
nosy: +Eric Wieser

___
Python tracker 

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



[issue40852] Dictionary created with dict.fromkeys have issues (all explained in the file)

2020-06-03 Thread Jim Fasarakis-Hilliard


New submission from Jim Fasarakis-Hilliard :

This isn't an issue, `value` (that is, `{}` here) is shared among all keys. 
Since you've added a mutable value, when you mutate it this change is seen for 
all keys holding the value. 

This is documented in dict.fromkeys 
https://docs.python.org/3/library/stdtypes.html#dict.fromkeys

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue40846] Misleading line in documentation

2020-06-03 Thread J Arun Mani


J Arun Mani  added the comment:

Hi. Thanks for your follow-up. I created a PR, since I signed CLA today, the PR 
has some labels indicating it. :p
Thanks

--
nosy:  -python-dev

___
Python tracker 

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



[issue40846] Misleading line in documentation

2020-06-03 Thread Roundup Robot


Change by Roundup Robot :


--
pull_requests: +19831
pull_request: https://github.com/python/cpython/pull/20603

___
Python tracker 

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



[issue40852] Dictionary created with dict.fromkeys have issues (all explained in the file)

2020-06-03 Thread Christian Heimes


Christian Heimes  added the comment:

Yes, this is intended behavior.

Thanks Jim!

--
nosy: +christian.heimes
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



[issue40222] "Zero cost" exception handling

2020-06-03 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

The only observable changes will be changes in the code object: new attributes 
and constructor parameters, changed .pyc format, dis output, etc.

--

___
Python tracker 

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



[issue40846] Misleading line in documentation

2020-06-03 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 4.0 -> 5.0
pull_requests: +19830
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20602

___
Python tracker 

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



[issue40852] Dictionary created with dict.fromkeys have issues (all explained in the file)

2020-06-03 Thread hung son luong


Change by hung son luong :


--
components: ctypes
files: issue_of_python_dict.py
nosy: hung son luong
priority: normal
severity: normal
status: open
title: Dictionary created with dict.fromkeys have issues (all explained in the 
file)
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file49214/issue_of_python_dict.py

___
Python tracker 

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



[issue40847] New parser considers empty line following a backslash to be a syntax error, old parser didn't

2020-06-03 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +gvanrossum, lys.nikolaou

___
Python tracker 

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



[issue40848] compile() can compile a bare starred expression with `PyCF_ONLY_AST` flag with the old parser, but not the new one

2020-06-03 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Yeah, this is not a bug as Serhiy points out. Regarding the error message, we 
are currently working on trying to unify the error messages in the the parser 
as much as we can but there is also no promise that they will match 100%.

Many grammar checks currently are done outside the parser (we mention it on  
PEP617) so I am not surprised that the old parser is ok with some invalid 
expressions and PyCF_ONLY_AST. This is one of the things we are trying to 
change with the new parser precisely.

I will close for now as "not a bug". Feel free to reopen if you think we missed 
something or if something was left to discuss.

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



[issue40222] "Zero cost" exception handling

2020-06-03 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

To clarify, would there be any observable difference in behavior aside from 
speed? And would there be any limitations in when the speedup can be applied?

--
nosy: +chris.jerdonek

___
Python tracker 

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