[issue33944] Deprecate and remove pth files

2019-01-21 Thread Ionel Cristian Mărieș

Ionel Cristian Mărieș  added the comment:

FYI I have 3 projects that use pth files to activate various features (an env 
var is usually the trigger):

https://pypi.org/project/pytest-cov - enables coverage measurement in any 
subprocess
https://pypi.org/project/manhole - installs a debug service
https://pypi.org/project/hunter - installs a tracer

I wouldn't like them being rendered almost or completely useless by such a 
hasty change. 

Running stuff during startup can be problematic and tricky, for example I have 
painfully found out that on python 2.7 you can completely hose up your codecs 
registry if you try to decode things during startup (before the registry is 
fully built) but I think it's a fair price for such a powerful feature.

--
nosy: +ionelmc

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-21 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> I am not sure about an addition _PyDict_GetItem_KnownHash().

It is a necessary check.  The user call is allowed to update the cache so we no 
longer know without checking whether the new key/result pair has already been 
added.  That is in fact the main bug that is being fixed.

> Every of dict operations can cause executing an arbitrary code 
> and re-entering the execution of bounded_lru_cache_wrapper().

FWIW, the new _PyDict_GetItem_KnownHash() call is made at the top of the post 
user call code path, before any modifications of the cache have occurred.  This 
is the safest possible time to allow reentry.  There's really nothing this call 
can do that couldn't have happened in the user function call.

Also, only the normal case (where the key is not present) proceeds to modify 
the cache state.  The other two paths exit immediately.

> Could not the API that atomically checks and updates the dict
> (like getdefault()/setdefault()) be useful here?

That seems tempting but our goal is a "contains" test.  We're not storing a new 
entry at this point.  Instead, we're just checking to see if any further work 
is necessary.

At some point in the future (not in this bug fix), we could further sync the C 
code and pure python code to use the rotating root entry.   That means that in 
the "self->full" path, we never need to extract, append, or prepend links.  
Only the value fields and root pointer need to be updated.  That does less work 
and always leaves the structure in a consistent state.

> Currently the C implementation memoizes only one result, and 
> f(1.0) returns 1. With the Python implementation and with
> the proposed changes it will return 1.0.

When keyword argument sorting was dropped, we gained a speed improvement but 
came to treat f(a=1, b=2) and f(b=2, a=1) as distinct calls.  Here we cut 
memory overhead in half for common cases but will treat f(1) and f(1.0) as 
distinct calls.  I'm fine with that. It's also nice that the C and pure Python 
versions now match.

--

___
Python tracker 

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



[issue35766] Merge typed_ast back into CPython

2019-01-21 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch, patch, patch
pull_requests: +11427, 11428, 11429
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



[issue35766] Merge typed_ast back into CPython

2019-01-21 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch, patch
pull_requests: +11427, 11428
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



[issue35766] Merge typed_ast back into CPython

2019-01-21 Thread Guido van Rossum


Change by Guido van Rossum :


--
keywords: +patch
pull_requests: +11427
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



[issue20479] Efficiently support weight/frequency mappings in the statistics module

2019-01-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

Here is some further information on weights in statistics in general, 
and SAS and Stata specifically:

https://blogs.sas.com/content/iml/2017/10/02/weight-variables-in-statistics-sas.html

Quote:

use the FREQ statement to specify integer frequencies for 
repeated observations. Use the WEIGHT statement when you 
want to decrease the influence that certain observations 
have on the parameter estimates. 

http://support.sas.com/kb/22/600.html

https://www.stata.com/manuals13/u20.pdf#u20.23

Executive summary:

- Stata defines four different kinds of weights;

- SAS defines two, WEIGHT and FREQ (frequency);

- SAS truncates FREQ values to integers, with zero or 
  negative meaning that the data point is to be ignored;

- Using FREQ is equivalent to repeating the data points.
  In Python terms:

  mean([1, 2, 3, 4], freq=[1, 0, 3, 1])

  would be equivalent to mean([1, 3, 3, 3, 4]).

- Weights in SAS are implicitly normalised to sum to 1, 
  but some functions allow you to normalise to sum to the
  number of data points, because it sometimes makes a 
  difference.

- It isn't clear to me what the physical meaning of weights
  in SAS actually is. The documentation is unclear, it *could*
  as simple as the definition of weighted mean here:

https://en.wikipedia.org/wiki/Weighted_arithmetic_mean#Mathematical_definition

but how that extends to more complex SAS functions is unclear to me.

(And for what its worth, I don't think SAS's MEAN function supports 
weights at all. Any SAS users here that could comment?)

--

___
Python tracker 

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



[issue35132] python-gdb error: Python Exception Type does not have a target

2019-01-21 Thread Lisa Roach


Lisa Roach  added the comment:

I experienced this bug as well and have tried to dig into it a little. 

I experimented with a service I have that uses shared libraries. If I compile 
with high level of optimizations for the C++ code (-O3) I don't experience the 
issue, but compiling without any optimizations I do. 

I also tried with a script that does not use any shared libraries and I do not 
see the issue.


Digging into it a little, when running with the optimized version I found:

gdb.lookup_type('PyUnicodeObject')

returns a gdb.TYPE_CODE_TYPEDEF, which is the correct type. Running with the 
non-optimized version instead returns a gdb.TYPE_CODE_STRUCT.


The struct type errors because it has no target(), but I actually think 
target() might be superfluous here. 

Both versions if I only call `fields = 
gdb.lookup_type('PyUnicodeObject').fields()` returns a list of fields, one of 
which is named `data` for the purposes of the pep check, so target() doesn't 
seem vital.

--
nosy: +lisroach

___
Python tracker 

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



[issue35795] test_pkgutil test_zipapp fail in AMD64 Windows7 SP1 3.x and AMD64 Windows7 SP1 3.7 buildbots

2019-01-21 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

Also of note, a largish temporary directory (16K+ entries) seemed to be causing 
a slowdown in the cleanup of the tests, thus triggering the failures.  A quick 
purge later and the tests seem to run to completion.

Although the tests are currently passing, they are still broken from a Windows 
directory removal standpoint.  It is good to know that the failures can be 
recreated if needed by refilling the tempdir (at least on my buildbot).

This issue brings to light a few things:
1) tests MUST use the support.rmtree to prevent spurious failures
2) tests need to cleanup better; each run leaves ~10 entries in TEMP
3) a per-builder tempdir would mitigate the excessive tempdir issue

Note that addressing 2 wouldn't eliminate 3 as non-buildbot usage can still 
fill the tempdir, just not as fast as our buildbot seems to :)

I would really like to see #3 solved (maybe a `tmp` directory next to the 
`build` directory on the builders themselves?)  If it is in a fixed location, I 
would then be able to use a tmpfs-like solution for it, reducing test times 
20+% (in my hacked up local testing).

--

___
Python tracker 

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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2019-01-21 Thread Tom Wilson


Tom Wilson  added the comment:

In case this is a clue - the attached script "mp_hang2.py" adds a call to 
qsize() and uses only a single consumer. When I run it from the command line it 
does one of two things:


Option 1:

C:\TEMP\Py-3.7.2b-Venv\Scripts>.\python.exe 
"C:\Users\Tom.Wilson\Documents\Python-Bugs\mp_hang2.py"
Creating 1 consumers
Putting
Poisoning
Joining
Process Consumer-1:
Traceback (most recent call last):
  File 
"C:\Users\Tom.Wilson\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py",
 line 297, in _bootstrap
self.run()
  File "C:\Users\Tom.Wilson\Documents\Python-Bugs\mp_hang2.py", line 18, in run
print(f'Queue size: {self.task_queue.qsize()}')
  File 
"C:\Users\Tom.Wilson\AppData\Local\Programs\Python\Python37\lib\multiprocessing\queues.py",
 line 117, in qsize
return self._maxsize - self._sem._semlock._get_value()
PermissionError: [WinError 5] Access is denied


Option 2:

C:\TEMP\Py-3.7.2b-Venv\Scripts>.\python.exe 
"C:\Users\Tom.Wilson\Documents\Python-Bugs\mp_hang2.py"
Creating 1 consumers
Putting
Poisoning
Joining
Queue size: 2147483647
Getting task
 <<< Hangs here >>>


If I can provide anything else please let me know.

--
Added file: https://bugs.python.org/file48070/mp_hang2.py

___
Python tracker 

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



[issue35627] multiprocessing.queue in 3.7.2 doesn't behave as it was in 3.7.1

2019-01-21 Thread Tom Wilson


Tom Wilson  added the comment:

Hi there. I get this behavior as well, although only in a venv.

  Main   Virtual  
v3.7.1:260ec2c36a  CompletesCompletes
v3.7.2:9a3ffc0492  Completes  Hangs

Some other details of my setup:
 - Windows 10 Pro, Version 1803 (OS Build 17134.472)
 - Python platform is AMD64 on win32
 - Running from the command line (cmd.exe)
 - The virtual environment was created from the command line like this: 
 .\python -m venv c:\temp\Py-3.7.2b-Venv

--
nosy: +tom.wilson

___
Python tracker 

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



[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

2019-01-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> I'm off to write an ugly `next()` wrapper then.

Wouldn't it be simpler to re-design the generators to yield the final 
result instead of returning it? To process the final item differently 
from the rest, you just need something like this:

last = next(it)
for x in it:
process(last)
last = x
special_handling(last)

--

___
Python tracker 

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



[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

2019-01-21 Thread bryan.koch


bryan.koch  added the comment:

Thanks for testing that.  I'm off to write an ugly `next()` wrapper then.

--

___
Python tracker 

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



[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

2019-01-21 Thread Steven D'Aprano


Steven D'Aprano  added the comment:

> steven your generator example is exactly what I wanted to do; looks 
> like I'm upgrading to Python 3.8 for the new assignment syntax.
Sorry to have mislead you, but I don't think it will do what I thought. 
After giving it some more thought, I decided to test it (at least as 
much of it as possible). There's no local assignment here but you can 
see that the behaviour is not what I had assumed:

py> def inner():
... yield from (1, 2)
... return -1
...
py> def outer():
... for x in (yield from inner()):
... yield 100+x
...
py> for x in outer():
... print(x)
...
1
2
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in outer
TypeError: 'int' object is not iterable

In hindsight, this behaviour is logical. But I think it means that there 
is no way to do what you want using a for-loop.

> I was actually expecting the SyntaxError to be raised at runtime which 
> would be a pretty large behavior change

Not *entirely* unprecedented though, as you can get runtime SyntaxErrors 
from calling compile(), eval() or exec(). But I think some other class 
of exception would be better, since the problem isn't actually a syntax 
error.

--

___
Python tracker 

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



[issue35803] Test and document that `dir=...` in tempfile may be PathLike

2019-01-21 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch, patch
pull_requests: +11424, 11425
stage:  -> patch review

___
Python tracker 

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



[issue35803] Test and document that `dir=...` in tempfile may be PathLike

2019-01-21 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch, patch, patch
pull_requests: +11424, 11425, 11426
stage:  -> patch review

___
Python tracker 

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



[issue35803] Test and document that `dir=...` in tempfile may be PathLike

2019-01-21 Thread Anthony Sottile


Change by Anthony Sottile :


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

___
Python tracker 

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



[issue35800] remove smtpd.MailmanProxy

2019-01-21 Thread Barry A. Warsaw


Barry A. Warsaw  added the comment:

Yes, it should be deprecated and removed.  TBH, IMHO smtpd.py should be 
entirely deprecated.  aiosmtpd (3rd party) is a much more modern approach.

--

___
Python tracker 

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



[issue35803] Test and document that `dir=...` in tempfile may be PathLike

2019-01-21 Thread Anthony Sottile


New submission from Anthony Sottile :

This appears to be true in 3.6+ -- I'd like to add a test and documentation 
ensuring that going forward.

Related: https://github.com/python/typeshed/issues/2749

--
assignee: docs@python
components: Documentation, Tests
messages: 334188
nosy: Anthony Sottile, docs@python
priority: normal
severity: normal
status: open
title: Test and document that `dir=...` in tempfile may be PathLike
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



[issue35802] os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat')

2019-01-21 Thread Anthony Sottile


Change by Anthony Sottile :


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

___
Python tracker 

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



[issue35802] os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat')

2019-01-21 Thread Anthony Sottile


Change by Anthony Sottile :


--
keywords: +patch, patch
pull_requests: +11422, 11423
stage:  -> patch review

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

> I would prefer a -X command-line option, such as "VIRTUAL_ENV". 
> multiprocessing could propagate this option to worker processes.

Right, so would I, but it needs to be propagated basically everywhere (unless 
"everywhere" all defers through multiprocessing, which would be great). I chose 
to go with the same solution as used on macOS for the same problem, though it 
had to be implemented in a different part of the code. Plenty of other 
environment variables will cause problems if they propagate to a totally 
different python.exe, so perhaps we should document __PYVENV_LAUNCHER__ as one 
to clear in this case (along with PYTHONHOME and PYTHONPATH)?

For future enhancement, there's also the stalled PEP 582 that would "fix" 
venv's reliance on shell/environment variables by having a different way to 
enable a separate package directory (FWIW, it stalled because the PEP doesn't 
fix *all* packaging problems, but only some). 

But as it stands, people rely on there being something they can launch in their 
venv directory, and that thing has to know (at least for a given terminal 
session) how to propagate the correct search paths to child processes. The 
current solution is the simplest one that ensures the most compatibility for 
the least amount of risk, even though that was not zero risk, as we've seen. 
And it also has to remain for 3.7 now, since venvs are no longer automatically 
broken when updating to 3.7.3.

Changing sys.executable to the final executable and trusting/relying/hoping 
that everyone who invokes it also allows environment variables to propagate is 
probably the best solution (including whatever site.py fixes are required, if 
any).

--

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-21 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

@Steve, we are investigating and tracking this issue here:

https://bugs.python.org/issue35795

According to the buildbot owner "directory tree removal needs to go through 
support.rmtree, not any of the stdlib methods for doing so.  In a nutshell, the 
tests need to be changed to do this".

Not sure why this has happened now

--

___
Python tracker 

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



[issue35802] os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat')

2019-01-21 Thread Anthony Sottile


Anthony Sottile  added the comment:

looks true for os.chmod as well: 
https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L327-L328

--

___
Python tracker 

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



[issue14802] Python fails to compile with VC11 ARM configuration

2019-01-21 Thread Ned Deily

Ned Deily  added the comment:

Unless Steve thinks otherwise, I agree that this isn’t a candidate for 
backporting to 3.7 without all the work to fully support new platform 
configurations.

--

___
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-21 Thread Matej Cepl


Matej Cepl  added the comment:

> * Python 2.7 has no C accelerator _pickle (Modules/_pickle.c)

And Modules/cPickle.c is that drastically different?

--

___
Python tracker 

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



[issue35802] os.stat / os.lstat always present, but code checks hastattr(os, 'stat') / hasattr(os, 'lstat')

2019-01-21 Thread Anthony Sottile


New submission from Anthony Sottile :

Unless I'm reading incorrectly: 

https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L30-L31

https://github.com/python/cpython/blob/7a2368063f25746d4008a74aca0dc0b82f86ff7b/Modules/clinic/posixmodule.c.h#L68-L69

--
components: Library (Lib)
messages: 334182
nosy: Anthony Sottile
priority: normal
severity: normal
status: open
title: os.stat / os.lstat always present, but code checks hastattr(os, 'stat') 
/ hasattr(os, 'lstat')
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



[issue35756] Using `return value` in a generator function skips the returned value on for-loop iteration

2019-01-21 Thread bryan.koch


bryan.koch  added the comment:

steven your generator example is exactly what I wanted to do; looks like I'm 
upgrading to Python 3.8 for the new assignment syntax.

I was actually expecting the SyntaxError to be raised at runtime which would be 
a pretty large behavior change (definitely required to go through python-ideas) 
but I think my use case is covered by 3.8 and just upgrading is simpler to do.

Some details of the implementation that stirred this is that I'm streaming 
output from a hierarchy of generated modules and I get what is essentially 
(final value, EOF) as the last result so I need to yield the final value but 
for external reasons I need to perform the clean-up of native resources before 
yielding.

Let's consider this as closed since what I need is supported in 3.8.  Thank you 
for your help!

--

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks for the quickfix Pablo ;-)

--

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Kumar Akshay


Change by Kumar Akshay :


--
pull_requests: +11419, 11420, 11421

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Kumar Akshay


Change by Kumar Akshay :


--
pull_requests: +11419, 11420

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Kumar Akshay


Change by Kumar Akshay :


--
pull_requests: +11419

___
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-21 Thread STINNER Victor


STINNER Victor  added the comment:

Python 2.7 is not affected:

* Python 2.7 has no C accelerator _pickle (Modules/_pickle.c)
* Python 2.7 doesn't support protocol 4 (attached proof of concept)

I reopen the issue because the issue should be fixed in 3.4 and 3.5 as well, 
since it has been marked as a vulnerability (it got a CVE number).

--
nosy: +vstinner
resolution: fixed -> 
status: closed -> open
versions: +Python 3.4, 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



[issue35746] [ssl][CVE-2019-5010] TALOS-2018-0758 Denial of Service

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

Does someone work on backporting the fix to 3.4 and 3.5 branches?

Note: I added the vulnerability to:
https://python-security.readthedocs.io/vuln/ssl-crl-dps-dos.html

--

___
Python tracker 

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



[issue31506] Improve the error message logic for object_new & object_init

2019-01-21 Thread Sanyam Khurana


Change by Sanyam Khurana :


--
pull_requests: +11416, 11417, 11418
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



[issue31506] Improve the error message logic for object_new & object_init

2019-01-21 Thread Sanyam Khurana


Change by Sanyam Khurana :


--
pull_requests: +11416, 11417
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



[issue31506] Improve the error message logic for object_new & object_init

2019-01-21 Thread Sanyam Khurana


Change by Sanyam Khurana :


--
pull_requests: +11416
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



[issue14802] Python fails to compile with VC11 ARM configuration

2019-01-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Fixed in master branch.  Thank you, Minmin Gong!

I don't think this is a candidate for a 3.7 backport. If you think otherwise, 
though, please say so. You'll also need to check that the backport enables 
proper compilation on ARM.

--
nosy: +ned.deily, pitrou
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +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



[issue35758] Disable x87 control word for MSVC ARM compiler

2019-01-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 7a2368063f25746d4008a74aca0dc0b82f86ff7b by Antoine Pitrou 
(Minmin Gong) in branch 'master':
bpo-35758: Fix building on ARM + MSVC (gh-11531)
https://github.com/python/cpython/commit/7a2368063f25746d4008a74aca0dc0b82f86ff7b


--
nosy: +pitrou

___
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-21 Thread STINNER Victor


Change by STINNER Victor :


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

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

For the test you can use "nonlocal".

--

___
Python tracker 

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



[issue35661] Store the venv prompt in pyvenv.cfg

2019-01-21 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

I've made the changes suggested by Brett to store the raw value instead of the 
formatted prompt.  

I also have been looking into issues Steve raised about using the prompt value 
from `pyvenv.cfg` instead of having the prompt hard-coded into the activate 
scripts.  Since these scripts are .bat, bash, Powershell, etc scripts, I didn't 
know if there was anything special that needed to be taken into account (such 
as encoding) to use the values from the config file.  As Steve said, I could 
see this being opened as a bug in the future, so I don't mind working on it now 
in this issue or a separate one, whichever is the better option.  I just don't 
have much experience with those types of scripts, so I'm sure any changes I 
make will require some time and a lot of code review.  Plus, those changes add 
complexity to this change that Brett said he doesn't really need for his 
initial request.  Because of the possibility of changing those scripts soon, 
I've left the key name as `prompt` for now.  Fixing the activate scripts seems 
to be the right way to go instead of changing the name so it's no
 t misused.

One thing that I did find which may be a current bug is:
> PS N:\projects\cpython> python -m venv myvenv --prompt='this is my prompt'
> Running Release|Win32 interpreter...
> PS N:\projects\cpython> .\myvenv\Scripts\activate
> (this is my prompt) PS N:\projects\cpython> deactivate
> PS N:\projects\cpython> python -m venv myvenv --upgrade --prompt='new prompt'
> Running Release|Win32 interpreter...
> PS N:\projects\cpython> .\myvenv\Scripts\activate
> (this is my prompt) PS N:\projects\cpython>

--upgrade changes the prompt on `pyvenv.cfg`, but doesn't update activate 
scripts, so the prompt doesn't really change.

And for reference, there is another bug issue for storing the --prompt value in 
an environment variable (#35328).

--

___
Python tracker 

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



[issue35780] Recheck logic in the C version of the lru_cache()

2019-01-21 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It was the explanation of possible history, not the justification of bugs. Of 
course bugs should be fixed. Thank you for rechecking this code and for your 
fix.

As for the optimization in lru_cache_make_key(), consider the following example:

@lru_cache()
def f(x):
return x

print(f(1))
print(f(1.0))

Currently the C implementation memoizes only one result, and f(1.0) returns 1. 
With the Python implementation and with the proposed changes  it will return 
1.0. I do not say that any of answers is definitely wrong, but we should be 
aware of this, and it would be better if both implementation will be 
consistent. I am sure this example was already discussed, but I can not find it 
now.

I still did not analyze the new code for adding to the cache. The old code 
contains flaws, agree.

I am not sure about an addition _PyDict_GetItem_KnownHash(). Every of dict 
operations can cause executing an arbitrary code and re-entering the execution 
of bounded_lru_cache_wrapper(). Could not the API that atomically checks and 
updates the dict (like getdefault()/setdefault()) be useful here?

--
assignee: serhiy.storchaka -> 

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Eryk Sun


Eryk Sun  added the comment:

multiprocessing could be redesigned to make the child process responsible for 
duplicating all handles from its logical parent (by PID passed on the command 
line -- regardless of whatever its real parent is). That avoids the problem of 
the parent mistakenly duplicating handles to a launcher child process that has 
no idea that the parent has done this and certainly doesn't have the 
architecture in place to deal with it. 

That said, inserting the launcher process as a middle man for every worker 
process is wasteful. Creating processes without fork is expensive. Also, 
relying on the "__PYVENV_LAUNCHER__" environment variable for this is 
problematic. Environment variables are inherited by default, so it leaks to a 
completely unrelated python.exe process. For example, if we run 
subprocess.call(r'C:\Program Files\Python37\python.exe') from a virtual 
environment, currently we end up with an overridden sys.executable. I would 
prefer a -X command-line option, such as "VIRTUAL_ENV". multiprocessing could 
propagate this option to worker processes.

--

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

> So I think "breaking if environment variables are not inherited" is a less 
> severe failure mode than this issue is.

ISTR that having sys.executable point to a path outside of sys.prefix breaks 
the site module in some way, so that would move the fix over there. But again, 
going from memory - I'd have to try it (and doubtful that I'm getting to it 
today).

--

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Hmm, if multiprocessing exhibits the problem, I wouldn't be surprised if some 
third-party libraries also do.  I think `sys.executable` should really point to 
the proper executable.

> But changing sys.executable to _not_ be the venv one will break anyone who 
> doesn't correctly inherit environment variables (specifically, 
> __PYVENV_LAUNCHER__, but this is deliberately not documented ;) ). 

Well, it will also break if other environment variables are required, e.g. 
PYTHONPATH.  Usually you want to inherit environment variables (including such 
fundamental stuff such as HOME), because you don't know which ones are actually 
required for a given workload.

So I think "breaking if environment variables are not inherited" is a less 
severe failure mode than this issue is.

--

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Kumar Akshay


Kumar Akshay  added the comment:

can I work on this?

--
nosy: +kakshay

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11413, 11414, 11415

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11413

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-21 Thread miss-islington


Change by miss-islington :


--
pull_requests: +11413, 11414

___
Python tracker 

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



[issue35782] Missing whitespace after comma in randrange raise error

2019-01-21 Thread miss-islington


miss-islington  added the comment:


New changeset 2433a2ab705e93f9a44f01c260d351b205a73e9d by Miss Islington (bot) 
(Kumar Akshay) in branch 'master':
bpo-35782: Fix error message in randrange (GH-11620)
https://github.com/python/cpython/commit/2433a2ab705e93f9a44f01c260d351b205a73e9d


--
nosy: +miss-islington

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch, patch, patch
pull_requests: +11410, 11411, 11412
stage:  -> patch review

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


--
keywords: +patch, patch
pull_requests: +11410, 11411
stage:  -> patch review

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

The first idea makes sense, but because of how we've already architected things 
(and the direction we're trying to rearchitect things) it isn't really that 
feasible.

The second idea could be good. It isn't that hard to make globally named 
handles that can be reopened in the child process, and that avoids the need for 
a coherent inheritance chain of processes. Maybe it could break other scenarios 
that do rely on inheritance though? (But aren't those already broken? All this 
is *just* outside the edge of my experience, so I'd have to try them all out to 
be sure.)

It's a regression in 3.7.2, which is when the venv script changed. As I said, 
updating from 3.7.1 to 3.7.2 was going to change the venv "script" anyway 
(which was just the main Python executable and its binaries), so it should have 
been no more breaking than that. But it was, so I consider it a regression (in 
venv, to be clear, not in multiprocessing).

--

___
Python tracker 

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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-21 Thread Tzu-ping Chung

Tzu-ping Chung  added the comment:

I read a few of the logs, and all errors roots in the same place, when the test 
case tries to remove the tempdir during teardown/cleanup. The Windows (and 
other platforms not supporting directory fds) implementation of rmtree can have 
race conditions if files are added while the directory being walked, causing 
the error.

I don’t know the case of CPython, but Pipenv has a similar problem when running 
concurrent tests with subprocesses. We never solved it (but simply wrap the 
rmtree call inside a try block and look away).

--

___
Python tracker 

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



[issue35801] venv in 3.7 references python3 executable

2019-01-21 Thread Paul Watson


New submission from Paul Watson :

The documentation for venv in Python 3.7 references using `python3` to run 
venv. I do not find a `python3` executable in the kit.

https://docs.python.org/3.7/library/venv.html#module-venv

--
assignee: docs@python
components: Documentation
messages: 334165
nosy: Paul Watson, docs@python
priority: normal
severity: normal
status: open
title: venv in 3.7 references python3 executable
type: enhancement
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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Christian Ullrich


Christian Ullrich  added the comment:

I have two ideas, but no idea if either is remotely feasible:

1. Replicate the launcher's selection logic in multiprocessing and
   avoid the intermediate step via sys.executable. Perhaps put it
   into pythonXX.dll or export it from the launcher executable so
   the C implementation can be shared by both users.

2. Handle the command line argument(s) that control how 
   multiprocessing pulls the handle from the parent process in the
   launcher and perform the operation so the sub-subprocess can in
   turn get it from the launcher.

I had a third one, but it was so crazy I must have preemptively forgotten it.

Finally, I do not think this is a regression in 3.7 (although I have not tested 
it with anything earlier), but unless the implementation of multiprocessing has 
changed radically in 3.7 I cannot see how it could have (not) worked any 
differently before.

On the other hand, venv is essentially the "official" way of installing Python 
applications these days, so the issue should have a high priority for fixing 
anyway.

--

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

> We need a way to allow multiprocessing to spawn the real python.exe instead 
> of the launcher executable that's set as sys.executable.

Got to a computer and had just reached the same conclusion.

Given the environment is inherited, it's easy to do:

>>> import _winapi
>>> import multiprocessing.spawn
>>> multiprocessing.spawn.set_executable(_winapi.GetModuleFileName(0))

This may interfere with others who currently override sys.executable when 
hosting Python, since they'll get their override by default. But changing 
sys.executable to _not_ be the venv one will break anyone who doesn't correctly 
inherit environment variables (specifically, __PYVENV_LAUNCHER__, but this is 
deliberately not documented ;) ). 

Perhaps we just change the multiprocessing default on Windows when 
sys.base_prefix != sys.prefix?

--
assignee:  -> steve.dower

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Eryk Sun


Eryk Sun  added the comment:

The launchers have inheritance enabled (for the duplicated standard handles, 
which should be made inheritable via SetHandleInformation instead, but that's a 
separate issue). However, multiprocessing doesn't use inheritable handles. 
Spawning processes with inheritance would be a problem in a general-purpose 
library. Instead it depends on either the parent manually duplicating the 
handle to the child or vice versa (via the child opening the parent PID that's 
passed to it). The problem for a virtual environment that's using the launcher 
is the former, where the parent duplicates to the child (e.g. for the SemLock 
semaphore). We need a way to allow multiprocessing to spawn the real python.exe 
instead of the launcher executable that's set as sys.executable.

--

___
Python tracker 

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



[issue35777] mismatched eval() and ast.literal_eval() behavior with unicode_literals

2019-01-21 Thread jez


jez  added the comment:

I take the point about breaking backward compatibility. The problem, then, is 
in the `ast` documentation, and may not be confined to Python 2.7

The `literal_eval` doc  
states no more than that the function evaluates a "string containing a Python 
literal".  The future statement effectively changes the definition of "a Python 
literal" but of course, as the official `__future__` doc 
 explains, this 
is done for the compilation of each "particular module" in isolation. The 
question is left open whether the occurrence of this term in `ast` 
documentation should be read as "a Python literal (as defined by the ast module 
itself at compile time)",  or "a Python literal (as defined by the caller at 
compile time)".

More generally, future statements effectively change the definition of the term 
"Python syntax", sometimes also simply referred to as "Python".  Unfortunately, 
the `ast` documentation uses these terms loosely throughout, without 
acknowledging that they are mutable. I propose that the `ast` module 
documentation flag cases in which the `ast` module's own definitions of 
"Python" and "Python syntax" may not match those of a caller who has included 
`__future__` statements, leading to unexpected behavior.

I am insufficiently familiar with the full functionality of `ast` to be able to 
identify where this is and is not an issue, except in `literal_eval`, but I can 
see it could in principle affect Python 3.x too.

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python
versions:  -Python 2.7

___
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-21 Thread Christopher Hunt


Change by Christopher Hunt :


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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

You can't create symlinks on Windows without additional user permissions, and 
the old method of copying most of the binaries was slow and made DLL hell 
worse, as well as simply not working with the Windows Store model that does not 
let random executables load DLLs from within the app.

Because of the last one, I backported the fix (which is an independent 
executable that launches the correct one with additional context to know it's a 
venv) that was mostly there for 3.8 already. This also fixes the issue where 
upgrading Python would force you to recreate every virtual environment to avoid 
mismatched binary versions (which is also why it wasn't an incompatible change 
- the update was already incompatible).

So all in all, an overall positive change. It's unfortunate that this problem 
slipped through testing, and I assume it's going to exist for many cases using 
handle inheritance. When I get a chance I'll be looking up ways to simply flag 
the new Python process it creates as "inherit everything", but there may be 
other data structures that don't transfer automatically (such as file 
descriptors, which the OS knows nothing about and can't do automatically).

--

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread Samuel Colvin


Samuel Colvin  added the comment:

Great, https://bugs.python.org/issue35799 and 
https://bugs.python.org/issue35800 created.

--

___
Python tracker 

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



[issue35800] remove smtpd.MailmanProxy

2019-01-21 Thread Samuel Colvin


New submission from Samuel Colvin :

smtpd.MailmanProxy is completely broken, it takes the wrong arguments but also 
assumes the existence of a "Mailman" module which doesn't exist.

It should be removed in 3.8 or 3.9.

Created from https://bugs.python.org/issue35788

Happy to create a PR if this is agreed.

--
components: email
messages: 334157
nosy: barry, r.david.murray, samuelcolvin
priority: normal
severity: normal
status: open
title: remove smtpd.MailmanProxy
versions: Python 3.5, Python 3.6, 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



[issue35799] fix or remove smtpd.PureProxy

2019-01-21 Thread Samuel Colvin


New submission from Samuel Colvin :

smtpd.PureProxy.process_message is defined to not receive the extra kwargs 
which it is called with.

It also expects "data" to be str when it's actually bytes.

PureProxy should either be removed for fixed. 

Personally, I think it should be fixed as the fix is pretty simple and 
PureProxy can be very useful.

Created from https://bugs.python.org/issue35788

Happy to create a PR if this is agreed.

--
components: email
messages: 334156
nosy: barry, r.david.murray, samuelcolvin
priority: normal
severity: normal
status: open
title: fix or remove smtpd.PureProxy
type: crash
versions: Python 3.5, Python 3.6, 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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread R. David Murray


R. David Murray  added the comment:

Actually, thinking about it some more, you are right.  If PureProxy doesn't at 
least function according to the current docs it should either be fixed or we 
should deprecate-and-remove it in 3.8 or 3.9 (depending on how strongly people 
feel about the deprecation cycle), and we should remove MailmanProxy.  Feel 
free to open new, targeted issues for these.

--

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Hmm... Out of curiosity, why is the venv's python.exe not simply a symlink to 
the original python.exe?  What is the point of going through py.exe here?

Also, is this a regression? Otherwise I don't think it has to be a release 
blocker.

--

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread Samuel Colvin


Samuel Colvin  added the comment:

Ok. Thanks for your explanation. Makes sense.

--

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread R. David Murray


R. David Murray  added the comment:

The mailman proxy has been abandoned for a long time now, so no fixes there.  I 
have some sympathy to fixing PureProxy, but since the stdlib itself doesn't use 
it, not a lot :)

At some point we will start cleaning up old code (probably a while after 2.7 is 
dead) after going through a release-deprecation-cycle, but that time hasn't 
arrived yet.  smtpd itself will stay because the stdlib test suite uses it, but 
you are right that MailmanProxy can be removed, as well as PrueProxy if we 
don't fix it.

We are not in general going to fix bugs in it that don't impact the stdlib 
itself, but if Barry (or someone else) wants to review and accept the PureProxy 
PR that's fine with me.  I don't myself have time to review it, I'm afraid.

--

___
Python tracker 

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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

Good catch! I'm surprised we don't have any tests for this, but I guess we 
don't really create any virtual environments in our test suite. A shame nobody 
hit it during RC.

I don't actually know the best fix for this. The venv python.exe script is the 
same as the py.exe launcher, which means neither is passing on inherited 
handles. Any ideas?

--
assignee: docs@python -> 
components:  -Documentation
keywords: +3.7regression
nosy: +davin, eryksun, ned.deily, pitrou -docs@python
priority: normal -> release blocker
stage:  -> test needed
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



[issue35699] distutils cannot find Build Tools 2017 since 3.7.2

2019-01-21 Thread Steve Dower


Steve Dower  added the comment:

There is one buildbot 
(https://buildbot.python.org/all/#builders/40/builds/1524) that started 
randomly failing unrelated tests with this change - usually one of zipapp, 
pkgutil, or zipimport. I don't have any idea what the relationship here is, 
unless the distutils tests have stopped skipping on those machines and are 
affecting some sort of global state (which they shouldn't, and the other tests 
shouldn't be relying on, but here we are).

I haven't looked at the actual tests (from my phone) yet. Anyone have any 
better ideas?

--
nosy: +pablogsal

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread Samuel Colvin


Samuel Colvin  added the comment:

Thanks for the response.

I've created issues on aiosmtpd for both these things. There are much better 
ways of running the controller than threading, but that's a discussion for 
https://github.com/aio-libs/aiosmtpd/issues/160. I'll try and work on aiosmtpd 
in the future.

Regarding smtpd, please could you respond to:

> More generally I understand the idea of deprecated code that doesn't get 
> updated to conform to latest conventions, but surely if the code exists in 
> the standard lib. it should at least work as it was originally intended or be 
> removed?

Of course, I know part of this is my wish to get my PR merged into cpython, but 
I really don't see any argument for leaving completely broken code in the 
standard library.

Surely either it should be removed before the next minor release or fixed?

I would say PureProxy could still be useful and should be left in place while 
MailmanProxy should be removed.

--

___
Python tracker 

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



[issue35788] smtpd.PureProxy and smtpd.MailmanProxy broken by extra kwargs, bytes and more

2019-01-21 Thread R. David Murray


R. David Murray  added the comment:

It is documented as deprecated, but only in the 'seealso' note at the top.  I 
think it would be reasonable to open an issue to add an actual 'deprecated' 
ReST tag to the docs.

For your 1 and 2, the stdlib smtpd forwarding is also blocking; that code 
appears to be copied verbatim from stdlib smtpd.  It needs to be replaced with 
calls to aiosmtplib.  Feel free to submit a PR :)

For your 3, that design is so that you can run the smtpd server as part of a 
non-asyncio application (eg: for testing, which has always been the main 
purpose of this module).  For an asyncio-only application you would not use a 
Controller (unless you wanted to offload the smtp traffic to a different 
thread, of course, then it would be useful :)

--

___
Python tracker 

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



[issue35633] test_eintr fails on AIX since fcntl functions were modified

2019-01-21 Thread Michael Felt


Michael Felt  added the comment:

Done.

> On 1/15/2019 11:23 AM, STINNER Victor wrote:
> I would prefer to simply skip the lockf() test rather than ignoring 
> PermissionError for flock() and lockf() on all platforms. Can you please 
> write a PR for that?
> 
> There is no need to add a NEWS entry, I will add "skip news". If you want to 
> add a NEWS entry, mention at least the fixed test and AIX.

--

___
Python tracker 

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



[issue35795] test_pkgutil test_zipapp fail in AMD64 Windows7 SP1 3.x and AMD64 Windows7 SP1 3.7 buildbots

2019-01-21 Thread Jeremy Kloth


Jeremy Kloth  added the comment:

This is an old, but recurring issue with Windows and directory tree removal: 
see issue15496

Basically, for stable (Windows) buildbots, directory tree removal needs to go 
through support.rmtree, not any of the stdlib methods for doing so.  In a 
nutshell, the tests need to be changed to do this.  Or, I suppose, we finally 
bite the bullet and incorporate the support.rmtree logic into the stdlib 
somehow.

In other words, the buildbot is fine, the tests are broken.

--
nosy: +jkloth

___
Python tracker 

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



[issue34850] Emit a syntax warning for "is" with a literal

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

The warning is emited twice, see: bpo-35798.

--
nosy: +vstinner

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

The warning has been introduced by bpo-34850: commit 
3bcbedc9f1471d957a30a90f9d1251516b422416.

--
nosy: +vstinner

___
Python tracker 

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



[issue35798] duplicate SyntaxWarning: "is" with a literal

2019-01-21 Thread Jakub Wilk


New submission from Jakub Wilk :

$ python3.8 -c 'if object() is 42: pass'
:1: SyntaxWarning: "is" with a literal. Did you mean "=="?
:1: SyntaxWarning: "is" with a literal. Did you mean "=="?

I'd like only one copy of this warning, not two.

Tested with git master (e9b185f2a493cc54f0d49eac44bf21e8d7de2990).

--
components: Interpreter Core
messages: 334143
nosy: jwilk, serhiy.storchaka
priority: normal
severity: normal
status: open
title: duplicate SyntaxWarning: "is" with a literal
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



[issue35797] concurrent.futures.ProcessPoolExecutor does not work in venv on Windows

2019-01-21 Thread Christian Ullrich


New submission from Christian Ullrich :

Using concurrent.futures.ProcessPoolExecutor on Windows fails immediately with 
a lot of exceptions of the "access denied", "file not found", and "invalid 
handle" varieties. Running the script that creates the ProcessPoolExecutor from 
the main system-wide installation works correctly.

Due to Windows' infamous lack of fork(), ProcessPoolExecutor launches its 
worker processes by setting up an inheritable handle to a pipe and passing the 
handle on the command line.

In a venv situation, it appears that the venv's python.exe internally launches 
the parent environment's python.exe and passes on its command line, but not its 
handle table. This sub-subprocess therefore does not have the original handle, 
and may have a different handle at the same index.


Output of the ProcessPoolExecutor example program from the docs when run with 
the main installation:

C:\Daten>py cft.py
112272535095293 is prime: True
112582705942171 is prime: True
112272535095293 is prime: True
115280095190773 is prime: True
115797848077099 is prime: True
1099726899285419 is prime: False


Output when run using a venv:

C:\Daten>pyv\v37\Scripts\python.exe cft.py
Process SpawnProcess-4:
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 297, in 
_bootstrap
self.run()
  File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 99, in 
run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python37\lib\concurrent\futures\process.py", line 226, 
in _process_worker
call_item = call_queue.get(block=True)
  File "C:\Program Files\Python37\lib\multiprocessing\queues.py", line 93, in 
get
with self._rlock:
  File "C:\Program Files\Python37\lib\multiprocessing\synchronize.py", line 95, 
in __enter__
return self._semlock.__enter__()
PermissionError: [WinError 5] Access is denied
Process SpawnProcess-5:
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 297, in 
_bootstrap
self.run()
  File "C:\Program Files\Python37\lib\multiprocessing\process.py", line 99, in 
run
self._target(*self._args, **self._kwargs)
  File "C:\Program Files\Python37\lib\concurrent\futures\process.py", line 226, 
in _process_worker
call_item = call_queue.get(block=True)
  File "C:\Program Files\Python37\lib\multiprocessing\queues.py", line 93, in 
get
with self._rlock:
  File "C:\Program Files\Python37\lib\multiprocessing\synchronize.py", line 95, 
in __enter__
return self._semlock.__enter__()
PermissionError: [WinError 5] Access is denied
Traceback (most recent call last):
  File "cft.py", line 28, in 
main()
  File "cft.py", line 24, in main
for number, prime in zip(PRIMES, executor.map(is_prime, PRIMES)):
  File "C:\Program Files\Python37\lib\concurrent\futures\process.py", line 476, 
in _chain_from_iterable_of_lists
for element in iterable:
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 586, 
in result_iterator
yield fs.pop().result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 432, 
in result
return self.__get_result()
  File "C:\Program Files\Python37\lib\concurrent\futures\_base.py", line 384, 
in __get_result
raise self._exception
concurrent.futures.process.BrokenProcessPool: A process in the process pool was 
terminated abruptly while the future was running or pending.

--
assignee: docs@python
components: Documentation, Library (Lib), Windows
messages: 334142
nosy: chrullrich, docs@python, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: concurrent.futures.ProcessPoolExecutor does not work in venv on Windows
type: behavior
versions: Python 3.7

___
Python tracker 

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



[issue19660] decorator syntax: allow testlist instead of just dotted_name

2019-01-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

There is again some discussion about this at 
https://discuss.python.org/t/why-are-some-expressions-syntax-errors/420

--

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:


New changeset e9b185f2a493cc54f0d49eac44bf21e8d7de2990 by Pablo Galindo in 
branch 'master':
bpo-35794: Catch PermissionError in test_no_such_executable (GH-11635)
https://github.com/python/cpython/commit/e9b185f2a493cc54f0d49eac44bf21e8d7de2990


--

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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



[issue34294] re module: wrong capturing groups

2019-01-21 Thread Ma Lin


Ma Lin  added the comment:

Original post's bug was introduced in Python 3.7.0

When investigate the code, I found another bug about capturing groups. This bug 
exists since very early version.
regex module doesn't have this bug.

Python 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit 
(Intel)] on win32
>>> import re
>>> re.search(r"\b(?=(\t)|(x))x", "a\tx").groups()
('', 'x')

Expected result: (None, 'x')

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit 
(AMD64)] on win32
>>> import regex
>>> regex.search(r"\b(?=(\t)|(x))x", "a\tx").groups()
(None, 'x')

--
title: re.finditer and lookahead bug -> re module: wrong capturing groups

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Test with os.posix_spawn() is fine:

Indeed, the difference between posix_spawn() and posix_spawnp() is that only 
the latter uses $PATH to look up the executable.

--

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

To be clear, only os.posix_spawnp() (with "P") fails:

$ PATH=/root ./python -m test -v test_posix 
...
ERROR: test_no_such_executable (test.test_posix.TestPosixSpawnP)
--
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/Lib/test/test_posix.py", line 1522, 
in test_no_such_executable
pid = self.spawn_func(no_such_executable,
PermissionError: [Errno 13] Permission denied: 'no_such_executable'


Test with os.posix_spawn() is fine:

$ PATH=/root ./python -m test -v test_posix -m 
test.test_posix.TestPosixSpawn.test_no_such_executable
...
test_no_such_executable (test.test_posix.TestPosixSpawn) ... ok
...
Tests result: SUCCESS

--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +11407, 11408, 11409

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +11407, 11408

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Jeroen Demeyer


Change by Jeroen Demeyer :


--
pull_requests: +11407

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

> In other words: if we can only use __float__ and __int__, how do we know 
> which one to use?

I guess __index__. I've read the definition of object.__index__ in the data 
model documentation, and using __index__ for this conversion is fine. I need to 
educate my sense for when it's right to use this method...

Sorry about the noise.

--

___
Python tracker 

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



[issue34814] makesetup: must link C extensions to libpython when compiled in shared mode

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

Another Fedora on Python2:
https://bugzilla.redhat.com/show_bug.cgi?id=1667914

--

___
Python tracker 

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



[issue35795] test_pkgutil test_zipapp fail in AMD64 Windows7 SP1 3.x and AMD64 Windows7 SP1 3.7 buildbots

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

Old fixed rmtree issue: bpo-22022, bpo-30334.

This one is different. tempfile calls shutil.rmtree(). The test doesn't call 
rmtree() directly.

--
nosy: +vstinner

___
Python tracker 

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



[issue35796] time.localtime returns error for negative values

2019-01-21 Thread STINNER Victor


STINNER Victor  added the comment:

It's a limitation of the Windows C library. I'm quite sure that Python 2 has a 
the same issue, it shouldn't be a regression.

--
nosy: +vstinner

___
Python tracker 

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



[issue35796] time.localtime returns error for negative values

2019-01-21 Thread Mba


New submission from Mba :

Steps to reproduce the bug:
```
>>> import sys
>>> sys.version
'3.6.7 (v3.6.7:6ec5cf24b7, Oct 20 2018, 13:35:33) [MSC v.1900 64 bit (AMD64)]'

>>> import datetime
>>> print(datetime.datetime.now().astimezone().tzinfo)
datetime.timezone(datetime.timedelta(0, 3600), 'Central European Standard Time')

>>> import time
>>> time.localtime(0)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=1, tm_min=0, 
tm_sec=0, tm_wday=3, tm_yday=1, tm_isdst=0)
>>> time.localtime(-1)
Traceback (most recent call last):
  File "", line 1, in 
OSError: [Errno 22] Invalid argument
```

On Ubuntu it works fine:
```
>>> time.localtime(-1)
time.struct_time(tm_year=1970, tm_mon=1, tm_mday=1, tm_hour=0, tm_min=59, 
tm_sec=59, tm_wday=3, tm_yday=1, tm_isdst=0)
```

--
components: Windows
messages: 334132
nosy: mba, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: time.localtime returns error for negative values
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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch
pull_requests: +11404, 11405
stage:  -> patch review

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


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

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
keywords: +patch, patch, patch
pull_requests: +11404, 11405, 11406
stage:  -> patch review

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> If we want to support other numerical types with loss in double rounding

Looking at the existing code, I can already see several double-rounding "bugs" 
in the code, so I wouldn't be too much concerned here...

--

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
nosy: +vstinner

___
Python tracker 

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



[issue35794] test_posix.py test failure

2019-01-21 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I think that test should check for PermissionError as well.

--

___
Python tracker 

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



[issue35707] time.sleep() should support objects with __float__

2019-01-21 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

In other words: if we can only use __float__ and __int__, how do we know which 
one to use?

--

___
Python tracker 

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



  1   2   >