[issue34670] Add set_post_handshake_auth for TLS 1.3

2018-09-23 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8914

___
Python tracker 

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



[issue34775] pathlib.PurePath division raises TypeError instead of returning NotImplemented

2018-09-23 Thread Roger Aiudi


New submission from Roger Aiudi :

PurePath.__truediv__ and __rtruediv__ raise a TypeError when passed something 
which is not an instance of string or PurePath. This prevents creating any sort 
of compatible class that doesn't inherit from the previously mentioned types.

--
components: Library (Lib)
messages: 326140
nosy: Roger Aiudi
priority: normal
pull_requests: 8915
severity: normal
status: open
title: pathlib.PurePath division raises TypeError instead of returning 
NotImplemented
type: behavior
versions: Python 3.4, 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



[issue34670] Add set_post_handshake_auth for TLS 1.3

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset 2756ef31656399a120589b7aa19c32e2b91a4758 by Miss Islington (bot) 
(Christian Heimes) in branch '3.7':
[3.7] bpo-34670: Add TLS 1.3 post handshake auth (GH-9460) (GH-9505)
https://github.com/python/cpython/commit/2756ef31656399a120589b7aa19c32e2b91a4758


--

___
Python tracker 

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



[issue34670] Add set_post_handshake_auth for TLS 1.3

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset 94812f717dde8b11a9ad9c0fd5be66ff9bd53f58 by Miss Islington (bot) 
(Christian Heimes) in branch '3.6':
[3.6] bpo-34670: Add TLS 1.3 post handshake auth (GH-9460) (GH-9507)
https://github.com/python/cpython/commit/94812f717dde8b11a9ad9c0fd5be66ff9bd53f58


--

___
Python tracker 

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



[issue34421] Cannot install package with unicode module names on Windows

2018-09-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8916

___
Python tracker 

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



[issue34421] Cannot install package with unicode module names on Windows

2018-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:


New changeset c73df53569f86d0c7742bafa55958c53d57a02e4 by Serhiy Storchaka in 
branch '3.7':
bpo-34421: Improve distutils logging for non-ASCII strings. (GH-9126) (GH-9506)
https://github.com/python/cpython/commit/c73df53569f86d0c7742bafa55958c53d57a02e4


--

___
Python tracker 

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



[issue17239] XML vulnerabilities in Python

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset 17b1d5d4e36aa57a9b25a0e694affbd1ee637e45 by Miss Islington (bot) 
(Christian Heimes) in branch 'master':
bpo-17239: Disable external entities in SAX parser (GH-9217)
https://github.com/python/cpython/commit/17b1d5d4e36aa57a9b25a0e694affbd1ee637e45


--
nosy: +miss-islington

___
Python tracker 

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



[issue34421] Cannot install package with unicode module names on Windows

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset 0b67995bfa45393585e2e0017c82c706c4a04b04 by Miss Islington (bot) 
in branch '3.6':
bpo-34421: Improve distutils logging for non-ASCII strings. (GH-9126) (GH-9506)
https://github.com/python/cpython/commit/0b67995bfa45393585e2e0017c82c706c4a04b04


--

___
Python tracker 

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



[issue34775] pathlib.PurePath division raises TypeError instead of returning NotImplemented

2018-09-23 Thread Berker Peksag


Berker Peksag  added the comment:

Thanks for the report and for the PR. Could you give us a little bit more 
information about your use case? Couldn't you make the class you want to use 
implement the __fspath__ protocol?

import pathlib as p

class Spam:
def __fspath__(self):
return 'pathlib.py'

And we can use it like:

>>> p.Path('Lib') / Spam()
PosixPath('Lib/pathlib.py')
>>> (p.Path('Lib') / Spam()).exists()
True

(3.4 and 3.5 are in security-fix-only mode, so I removed them from the versions 
field.)

--
nosy: +berker.peksag
stage:  -> test needed
versions:  -Python 3.4, Python 3.5

___
Python tracker 

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



[issue17239] XML vulnerabilities in Python

2018-09-23 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8917

___
Python tracker 

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



[issue17239] XML vulnerabilities in Python

2018-09-23 Thread Christian Heimes


Change by Christian Heimes :


--
pull_requests: +8918

___
Python tracker 

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



[issue34775] pathlib.PurePath division raises TypeError instead of returning NotImplemented

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> We shouldn't feel shoved into altering something that we don't agree is broken

It *is* broken. You are just denying the reality.

That's also the reason that I'm insisting so much: I don't want to push my 
personal fix (despite that it may seem so), I want to fix a bug.

--

___
Python tracker 

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



[issue21919] Changing cls.__bases__ must ensure proper metaclass inheritance

2018-09-23 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue17185] unittest mock create_autospec doesn't correctly replace mocksignature

2018-09-23 Thread Mark Lawrence


Change by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-23 Thread David Hagen


New submission from David Hagen :

The new postponed annotations have an unexpected interaction with dataclasses. 
Namely, you cannot get the type hints of any of the data classes methods.

For example, I have some code that inspects the type parameters of a class's 
`__init__` method. (The real use case is to provide a default serializer for 
the class, but that is not important here.)  

```
from dataclasses import dataclass
from typing import get_type_hints

class Foo:
pass

@dataclass
class Bar:
foo: Foo

print(get_type_hints(Bar.__init__))
```

In Python 3.6 and 3.7, this does what is expected; it prints `{'foo': , 'return': }`.

However, if in Python 3.7, I add `from __future__ import annotations`, then 
this fails with an error:

```
NameError: name 'Foo' is not defined
```

I know why this is happening. The `__init__` method is defined in the 
`dataclasses` module which does not have the `Foo` object in its environment, 
and the `Foo` annotation is being passed to `dataclass` and attached to 
`__init__` as the string `"Foo"` rather than as the original object `Foo`, but 
`get_type_hints` for the new annotations only does a name lookup in the module 
where `__init__` is defined not where the annotation is defined.

I know that the use of lambdas to implement PEP 563 was rejected for 
performance reasons. I could be wrong, but I think this was motivated by 
variable annotations because the lambda would have to be constructed each time 
the function body ran. I was wondering if I could motivate storing the 
annotations as lambdas in class bodies and function signatures, in which the 
environment is already being captured and is code that usually only runs once.

Original mailing list discussion: 
https://mail.python.org/pipermail/python-dev/2018-September/155289.html

--
messages: 326148
nosy: drhagen
priority: normal
severity: normal
status: open
title: Postponed annotations break inspection of dataclasses
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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

The pull request is wrong, the use of __PYVENV_LAUNCHER__ in pythonw.c is 
correct and should not be removed. Where the current code goes wrong is that it 
doesn't clear the environment as soon as possible.

This patch should basically do the trick (but requires testing and probably 
adjustments to some other code):

diff --git a/Modules/main.c b/Modules/main.c
index 3a6cf31fc8..c673d06c56 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -1360,6 +1360,8 @@ config_init_program_name(_PyCoreConfig *config)
  "variable", (Py_ssize_t)len);
 }
 config->program_name = program_name;
+
+   unsetenv("__PYVENV_LAUNCHER__");
 return _Py_INIT_OK();
 }
 }


Some background information on why and environment variable is used on macOS 
when using a framework install:  To use system GUI frameworks on macOS the 
executable should be part of an application bundle (".app"), otherwise a number 
of APIs just don't work (which would affect the use of for example Tkinter in 
command-line scripts).  To work around this platform limitation a framework 
install of Python has the actual interpreter in a Python.app bundle stored in 
the framework, and "{sys.prefix}/bin/python" is a small stub executable that 
launches the real interpreter. 

The environment variable is used to pass the path to the stub executable to the 
real interpreter, to enable it to behave correctly (look at venv configuration 
files, have sys.executable be correct, ...). 

That said, looking at the code it might be possible to do away with the 
environment variable after call because the code in pythonw.c suggests the the 
environment variable is only necessary for OSX 10.5 or earlier.

I'm working on an alternative pull request that implements the patch I included 
inline in this message, with some additional documentation.

--

___
Python tracker 

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



[issue34421] Cannot install package with unicode module names on Windows

2018-09-23 Thread Serhiy Storchaka


Change by Serhiy Storchaka :


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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8919
stage: commit review -> patch review

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread miss-islington


Change by miss-islington :


--
pull_requests: +8920

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset c87d9f406bb23657c1b4cd63017bb7bd7693a1fb by Miss Islington (bot) 
(Tal Einat) in branch 'master':
bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)
https://github.com/python/cpython/commit/c87d9f406bb23657c1b4cd63017bb7bd7693a1fb


--
nosy: +miss-islington

___
Python tracker 

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



[issue34774] IDLE: use theme colors for help viewer

2018-09-23 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

This is working on Ubuntu.  Probably not a big deal, but because the help 
viewer is not modal, it's possible to change the theme with the help window 
open and the text isn't updated on the help window.  If the help is closed and 
reopened, then the new theme appears.

--
nosy: +cheryl.sabella

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset aeadf59e457ca0ee20983eb1ed78b348f0b453e3 by Miss Islington (bot) 
in branch '3.7':
bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)
https://github.com/python/cpython/commit/aeadf59e457ca0ee20983eb1ed78b348f0b453e3


--

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread miss-islington


miss-islington  added the comment:


New changeset 6b48f9854e2ae35fd74bcd359451eb37ae65f798 by Miss Islington (bot) 
in branch '3.6':
bpo-34548: IDLE: use configured theme colors in TextView (GH-9008)
https://github.com/python/cpython/commit/6b48f9854e2ae35fd74bcd359451eb37ae65f798


--

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread Tal Einat


Tal Einat  added the comment:

Thanks for the review, discussion and approval, Cheryl and Terry!

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



[issue32990] Supporting extensible format(PCM) for wave.open(read-mode)

2018-09-23 Thread Zackery Spytz


Change by Zackery Spytz :


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



[issue19081] zipimport behaves badly when the zip file changes while the process is running

2018-09-23 Thread Tulir Asokan


Change by Tulir Asokan :


--
nosy: +tulir

___
Python tracker 

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



[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I just stumbled upon this issue while triaging. With the related issue 
https://bugs.python.org/issue12486 closed making generate_tokens public can 
this issue be closed since the original issue is not valid?

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue32915] Running Python 2 with -3 flag doesn't complain about cmp/__cmp__

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34775] pathlib.PurePath division raises TypeError instead of returning NotImplemented

2018-09-23 Thread Roger Aiudi


Roger Aiudi  added the comment:

Using your above example, my use case is returning an instance of Spam instead 
of PurePath from the division operation. The Spam class would have extra 
properties and methods for dealing with a substructure of our file system that 
can exist in different places, so being able to use a normal Path to locate it 
later with the division operation would be useful. (I know I could have a 
method that would do that, but I personally think reading the division left to 
right is clearer.)

The current implementation makes this impossible and I found raising a 
TypeError to be inconsistent with how Python handles operator overloading in 
the standard library.

--

___
Python tracker 

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



[issue33340] Inaccurate docs on `import` behaviour

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Ronald Oussoren


Change by Ronald Oussoren :


--
pull_requests: +8922

___
Python tracker 

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



[issue33947] Dataclasses can raise RecursionError in __repr__

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue33002] Making a class formattable as hex/oct integer with printf-style formatting requires both __int__ and __index__ for no good reason

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've added PR 9516 that just clears __PYVENV_LAUNCHER__ from the environment as 
soon as it is no longer needed.

A more involved change would be to change both the interpreter and the stub 
executable to avoid the need to use an environment variable in the first place:

- Add and "-X" flag to the interpreter to pass the information that's currently 
passed using an environment variable
- Change pythonw.c to add this new option to the argv vector.

This would be slightly cleaner, at the cost of having more complicated code 
(and is a change that would IMHO not qualify for a back port, while my current 
PR is minimal enough for a back port)

Note that both with and without this PR sys.executable points to the python 
executable inside the venv (when using a env).

--

___
Python tracker 

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



[issue26752] Mock(2.0.0).assert_has_calls() raise AssertionError in two same calls

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue9134] sre bug: lastmark_save/restore

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34609] Importing certain modules while debugging raises an exception

2018-09-23 Thread ppperry


ppperry  added the comment:

The Pdb bug and the IDLE bug are unrelated to each other:

   Pdb fails because it is attempting to import the readline module every time 
its `trace_dispatch` is called, and the import implementation is not reentrant 
in that way.

   IDLE is crashing because the uninitialized _ModuleLock instance raised an 
error when `repr` is called, and the IDLE debugger lacks code to catch that 
exception.

--
nosy: +ppperry

___
Python tracker 

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



[issue27261] io.BytesIO.truncate does not work as advertised

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue25403] urllib.parse.urljoin is broken in python 3.5

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue26144] test_pkg test_4 and/or test_7 sometimes fail

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

I think this was fixed with https://bugs.python.org/issue34200 though the patch 
was not applied to 3.5 and 3.4 as they are in security bug fixes mode.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue26000] Crash in Tokenizer - Heap-use-after-free

2018-09-23 Thread Karthikeyan Singaravelan

Karthikeyan Singaravelan  added the comment:

Is this still reproducible? On master (Python 3.8) with a debug build it throws 
a SyntaxError. I don't have Python 3.5 installed to check this though

$ ./python.exe
Python 3.8.0a0 (heads/master:c87d9f406b, Sep 23 2018, 19:48:30)
[Clang 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
➜  cpython git:(master) ./python.exe -c 'with open("vuln.py", "wb") as f: 
f.write(b"\x61\x73\x00\x0a\x79\x6e\x63\x5c\x0a\xef")'
➜  cpython git:(master) ✗ ./python.exe vuln.py
  File "vuln.py", line 2
SyntaxError: Non-UTF-8 code starting with '\xef' in file vuln.py on line 2, but 
no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
➜  cpython git:(master) ✗ ./python.exe -c 'with open("vuln2.py", "wb") as f: 
f.write(b"\x61\x73\x00\x0a\x79\x6e\x63\x5c\x0a\x00\x0d\xdd")'
➜  cpython git:(master) ✗ ./python.exe vuln2.py
  File "vuln2.py", line 3
SyntaxError: Non-UTF-8 code starting with '\xdd' in file vuln2.py on line 3, 
but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details


Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue33553] Documentation improvement proposal for multiprocessing

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34777] urllib.request accepts anything as a header parameter for some URLs

2018-09-23 Thread Jose Gama


New submission from Jose Gama :

It is possible to use urllib.request defining a header that can be junk in some 
cases and still get the contents without any warning or error.
The behavior depends on the URL and also on the header.

--
components: IO
files: header-illegal.py
messages: 326162
nosy: tuxcell
priority: normal
severity: normal
status: open
title: urllib.request accepts anything as a header parameter for some URLs
type: behavior
versions: Python 3.6
Added file: https://bugs.python.org/file47819/header-illegal.py

___
Python tracker 

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



[issue26374] concurrent_futures Executor.map semantics better specified in docs

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

There were some improvements made that clarify differences between builtin map 
with https://bugs.python.org/issue32306 and 
https://github.com/python/cpython/commit/a7a751dd7b08a5bb6cb399c1b2a6ca7b24aba51d

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue25567] shlex.quote doesn't work on bytestrings

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Thanks for the patch since the current workflow uses GitHub PR the patch can be 
made as a PR to move it forward. It seems there are some conflicts as I tried 
to apply the attached patch against latest master.

Thanks

--
nosy: +xtreak

___
Python tracker 

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



[issue24653] Mock.assert_has_calls([]) is surprising for users

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue20463] sqlite dumpiter dumps invalid script when virtual tables are used

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Eric V. Smith


Eric V. Smith  added the comment:

[Adding to nosy people who were on the original email]

Copying (part of) my response from the email thread:

These work:
print(get_type_hints(Bar.__init__, globals()))
print(get_type_hints(Bar.__init__, Bar.__module__))

But I agree that maybe doing something with dataclasses to address this would 
be good. Especially as the first one requires being in the same module as Foo.

See this for Yury's self-described "hack-ish fix we can use" until we do 
something better:

https://gist.github.com/1st1/37fdd3cc84cd65b9af3471b935b722df

--
nosy: +eric.smith, gvanrossum, ivan, lukasz.langa, yselivanov

___
Python tracker 

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



[issue34548] IDLE: Make TextView use the configured theme colors

2018-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

I removed 2.7 because I stopped routinely backporting to 2.7 some time ago 
because a) renaming files (which could not be backported) and using ttk widgets 
(ditto) made it much harder, and b) it was empirically too easy to introduce 
regressions without *thorough* hand testing. Given that most beginners now 
start with 3.x, I prefer merging more patches for current 3.x.

--
type:  -> enhancement

___
Python tracker 

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



[issue28418] Raise Deprecation warning for tokenize.generate_tokens

2018-09-23 Thread Thomas Kluyver


Thomas Kluyver  added the comment:

Yes, I think this can be closed now.

--

___
Python tracker 

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



[issue22499] [SSL: BAD_WRITE_RETRY] bad write retry in _ssl.c:1636

2018-09-23 Thread James Lu


Change by James Lu :


--
nosy: +tacocat

___
Python tracker 

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



[issue9134] sre bug: lastmark_save/restore

2018-09-23 Thread Armin Rigo


Change by Armin Rigo :


--
nosy:  -arigo

___
Python tracker 

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



[issue34778] Memoryview for column-major (f_contiguous) arrays from bytes impossible to achieve

2018-09-23 Thread Laurent Gautier


New submission from Laurent Gautier :

The buffer protocol is accounting for the row-major or column-major arrays, and 
that information is shown in the attributes, `c_contiguous` and `f_contiguous` 
respectively, of a memoryview object.

Using the method `cast` allows one to specify a shape but does not allow
to specify whether row or column major:

```
# column-major 3x2 array of bytes that was serialized
b = bytearray([1,2,3,4,5,6])

mv = memoryview(b)
mv_b = mv.cast('b', shape=(3,2))
```

The result object is believed to be row-major and little can be done
to correct it:


```
>>> mv_int.c_contiguous
True
>>> mv_int.c_contiguous = False
AttributeError: attribute 'c_contiguous' of 'memoryview' objects is not writable
```

--
components: Interpreter Core
messages: 326167
nosy: lgautier
priority: normal
severity: normal
status: open
title: Memoryview for column-major (f_contiguous) arrays from bytes impossible 
to achieve
type: enhancement
versions: Python 3.4, 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



[issue34609] Importing certain modules while debugging raises an exception

2018-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The IDLE issue here is a duplicate of #33065, where the OP said that only step, 
not go, created the problem.  ppperry, thank you for the solution.

Cheryl, please open a new issue for the pdb bug with a little more detail and 
ppperry's comment.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE debugger: problem importing user created module

___
Python tracker 

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



[issue33065] IDLE debugger: problem importing user created module

2018-09-23 Thread ppperry


Change by ppperry :


--
nosy: +ppperry

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Yury Selivanov


Change by Yury Selivanov :


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

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Jason R. Coombs


Jason R. Coombs  added the comment:

Is it documented anywhere how to do a framework build of Python? When I try to 
do a framework build by running `./configure --enable-framework` then `make`, 
`./python.exe` emits the following:

dyld: Library not loaded: 
/Library/Frameworks/Python.framework/Versions/3.8/Python
  Referenced from: /Users/jaraco/code/public/cpython/./python.exe
  Reason: image not found
Aborted (core dumped)

--

___
Python tracker 

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



[issue33065] IDLE debugger crashes when `repr` raises an exception

2018-09-23 Thread ppperry


Change by ppperry :


--
title: IDLE debugger: problem importing user created module -> IDLE debugger 
crashes when `repr` raises an exception

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

> See this for Yury's self-described "hack-ish fix we can use" until we do 
> something better:

Actually, I think I found a better solution that doesn't require any changes to 
anything besides dataclasses.

Currently, dataclasses uses 'exec()' function to dynamically create methods 
like '__init__'.  The generated code for '__init__' needs to access MISSING and 
_HAS_DEFAULT_FACTORY constants from the dataclasses module.  To do that, we 
compile the code with 'exec()' with globals set to a dict with {MISSING, 
_HAS_DEFAULT_FACTORY} keys in it.  This does the trick, but 
'__init__.__globals__' ends up pointing to that custom dict, instead of 
pointing to the module's dict.

The other way around is to use a closure around __init__ to inject MISSING and 
_HAS_DEFAULT_FACTORY values *and* to compile the code in a proper __dict__ of 
the module the dataclass was defined in.  Please take a look at the PR.

--

___
Python tracker 

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



[issue34776] Postponed annotations break inspection of dataclasses

2018-09-23 Thread Yury Selivanov


Yury Selivanov  added the comment:

And FWIF I don't think we need to use lambdas for annotations to solve issues 
like this one.

--

___
Python tracker 

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



[issue34779] IDLE internals show up in tracebacks when returning objects that cannot be `repr`ed

2018-09-23 Thread ppperry


New submission from ppperry :

>>> class NoRepr:
def __repr__(self):
raise ValueError
>>> NoRepr()
Traceback (most recent call last):
  File "", line 1, in 
NoRepr()
  File "C:\Program Files\Python37\lib\idlelib\rpc.py", line 617, in displayhook
text = repr(value)
  File "", line 3, in __repr__
raise ValueError
ValueError

What should happen in this case isn't exactly clear, but the current traceback 
is wrong in multiple ways.

--
assignee: terry.reedy
components: IDLE
messages: 326172
nosy: ppperry, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE internals show up in tracebacks when returning objects that cannot 
be `repr`ed
versions: 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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Tim Peters


Tim Peters  added the comment:

Oh, I don't agree that it's "broken" either.  There's still no real-world test 
case here demonstrating catastrophic behavior, neither even a contrived test 
case demonstrating that, nor a coherent characterization of what "the problem" 
is.

I'm nevertheless open to making improvements, but keeping in mind foremost that 
_all_ changes are potentially damaging to patterns of data we know nothing 
about precisely because they've been working fine for many years.  So, e.g., 
there's no chance that gratuitous changes will be accepted.  For example, don't 
_like_ adding 97531UL at the end?  Tough luck - it's staying, and it's not 
worth one word of argument.

To my eyes, the _strongest_ case in all these messages is for boosting the 
multiplier size on 64-bit boxes.  That's principled and well-motivated.  Python 
itself changed the multiplier from 3 to 103 long ago for the same reasons.  
But that apparently has nothing to do with "the problem" this report was opened 
about ;-)

--

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

To use the framework build you either have to install, use or set 
"DYLD_FRAMEWORK_PATH" in the environment (See the definition of RUNFORSHARED in 
Makefile for the value to use).

To properly test the this issue you have to install (or trick the system into 
thinking there is an install: I created a symlink in 
/Library/Frameworks/Python.framework/Versions: 
/Library/Frameworks/Python.framework/Versions/3.8 -> 
/Users/ronald/Projects/python/github/cpython-ronald/build/Python.framework/Versions/3.8).

--

___
Python tracker 

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



[issue34780] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2018-09-23 Thread Alexey Izbyshev


New submission from Alexey Izbyshev :

In the following code inspired by a production issue I had to debug recently 
subprocess.call() won't return:

import os
import subprocess
import sys
import time

r, w = os.pipe()
p1 = subprocess.Popen([sys.executable, '-c',
   'import sys; sys.stdin.read()'],
  stdin=r)

time.sleep(1)
subprocess.call([sys.executable, '-c', ''], stdin=r)

os.close(w)
p1.wait()

The underlying reason is the same as in #22976. Python performs certain 
operations on stdin during it's initialization (different in 2.7 and 3.x), 
which block because there is an outstanding ReadFile() on the pipe end stdin 
refers to. Assuming that subprocess.call() runs some app that doesn't use stdin 
at all, if a developer doesn't control how the app is run (which was my case), 
I don't see any way to workaround this in pure Python. (An obvious workaround 
is to make a wrapper which closes stdin or redirects it to something else, but 
this wrapper can't be run with CPython).

I propose to fix this in CPython. The details are slightly different for 2.7 
and 3.x.

2.7 calls fstat(stdin) in dircheck() (Objects/fileobject.c). This hangs because 
msvcrt calls PeekNamedPipe() if stdin refers to a pipe. Ironically, this 
fstat() call is completely useless on Windows because msvcrt never sets S_IFDIR 
in st_mode (it can't distinguish between a file and a directory because it uses 
GetFileType() and doesn't perform extra checks). I've implemented a PR that 
skips dircheck() on Windows. (If we do want to add a proper dircheck() to 2.7, 
it should do something similar to 3.x).

3.x performs the dir check without relying on fstat(), but it also calls 
lseek() (in _buffered_init() (Modules/_io/bufferedio.c), if removed, there is 
another one in _io_TextIOWrapper___init___impl (Modules/_io/textio.c). mscvrt 
calls SetFilePointerEx(), which hangs too, which is somewhat surprising because 
its docs [1] say:

You cannot use the SetFilePointerEx function with a handle to a nonseeking 
device such as a pipe or a communications device.

The wording is unclear though -- it doesn't say what happens if I try. lseek() 
docs [2] contain the following:

On devices incapable of seeking (such as terminals and printers), the return 
value is undefined.

In practice, lseek() succeeds on pipes on Windows, but is nearly useless:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit 
(AMD64)] on win32
>>> import os
>>> r, w = os.pipe()
>>> os.write(w, b'xyz')
3
>>> os.lseek(r, 0, os.SEEK_CUR)
0
>>> os.lseek(r, 0, os.SEEK_END)
3
>>> os.lseek(r, 2, os.SEEK_SET)
2
>>> os.read(r, 1)
b'x'
>>> os.lseek(r, 0, os.SEEK_CUR)
2
>>> os.read(r, 1)
b'y'
>>> os.lseek(r, 0, os.SEEK_CUR)
2
>>> os.lseek(r, 0, os.SEEK_END)
1

So lseek() can be used to check the current pipe buffer size, and that seems 
about it. Given the above, I suggest two solutions for the hang on Windows:

1) Make lseek() fail on pipes on Windows, as it does on Unix. A number of 
projects have already done that:

https://referencesource.microsoft.com/#mscorlib/system/io/filestream.cs,1029
https://go.googlesource.com/go/+/ce58a39fca067a19c505220c0c907ccf32793427/src/syscall/syscall_windows.go#374
https://trac.ffmpeg.org/ticket/986 (workaround: 
https://lists.ffmpeg.org/pipermail/ffmpeg-cvslog/2012-June/051590.html)
https://github.com/erikd/libsndfile/blob/123cb9f9a5a356b951a23e9e2ab8527f967425cc/src/file_io.c#L266

2) Delay lseek() until it's really needed. In both cases (BufferedIO and 
TextIO), lseek() is used to set some cached fields, so ISTM it's not necessary 
to do it during initialization. This would also be an optimization (skip 
lseek() syscall until a user really wants to tell()/seek()). This can be done 
as a sole fix or can be combined with the above (as an optimization).

I'd like to hear other people's opinions before doing anything for Python 3.

[1] 
https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfilepointerex
[2] 
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/lseek-lseeki64

--
components: IO, Windows
messages: 326175
nosy: eryksun, izbyshev, paul.moore, steve.dower, tim.golden, vstinner, 
zach.ware
priority: normal
severity: normal
status: open
title: Hang on startup if stdin refers to a pipe with an outstanding concurrent 
operation on Windows
type: behavior
versions: Python 2.7, 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



[issue34780] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2018-09-23 Thread Alexey Izbyshev


Change by Alexey Izbyshev :


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

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

Jason if you could test this we would be grateful!

Ronald what do you think of marking this as backportable to 3.7, 3.6 and
3.5?

--

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Ronald Oussoren


Ronald Oussoren  added the comment:

I've added back port labels for 3.6 and 3.7. 

AFAIK 3.5 is closed for bugfixes at this point (except for security fixes).

--

___
Python tracker 

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



[issue34781] infinite waiting in multiprocessing.Pool

2018-09-23 Thread Tomáš Bouda

New submission from Tomáš Bouda :

I have encountered a possible bug inside multiprocessing.Pool which behaves 
like race-condition while I don't believe it is a typical one.

Simply put, Pool from time to time freezes. It is occasional and hard to 
reproduce, but e.g. unit-tests running 3/day freeze several times a week.

We are using Pool heavily in our applications. Usually tens of workers and 
heavy load for each one of them. This production environment is using Python 
2.7 (RHEL) and custom build, etc. However, I reproduced the same behavior in 
Python 3.6 (OSX) on my local machine.

When I run the following script like 20x, I get one or two frozen instances. 
You may notice in the output that ForkPoolWorker-42 never calls self.run(). The 
application than freezes as-is since it is probably waiting for the process.

It is easier to reproduce the behavior using debugger (PyCharm-Pro in my case), 
however, in our production environment there is just clean run, the bug occurs 
more often since multiprocessing is used quite a lot in there.

Thanks,
Tomas


--- My script:

import logging
from multiprocessing.pool import Pool
from multiprocessing.util import log_to_stderr

def f(i):
print(i)

log_to_stderr(logging.DEBUG)

pool = Pool(50)
pool.map(f, range(2))
pool.close()
pool.join()

--- Output:

[DEBUG/MainProcess] created semlock with handle 9
[DEBUG/MainProcess] created semlock with handle 10
[DEBUG/MainProcess] created semlock with handle 13
[DEBUG/MainProcess] created semlock with handle 14
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-1] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-2] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-3] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-4] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-5] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-6] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-7] child process calling self.run()
[INFO/ForkPoolWorker-9] child process calling self.run()
[INFO/ForkPoolWorker-10] child process calling self.run()
[INFO/ForkPoolWorker-8] child process calling self.run()
[INFO/ForkPoolWorker-12] child process calling self.run()
[INFO/ForkPoolWorker-13] child process calling self.run()
[INFO/ForkPoolWorker-11] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-14] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-15] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-16] child process calling self.run()
[INFO/ForkPoolWorker-17] child process calling self.run()
[INFO/ForkPoolWorker-18] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-19] child process calling self.run()
[INFO/ForkPoolWorker-20] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-21] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-22] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-23] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-24] child process calling self.run()
[INFO/ForkPoolWorker-25] child process calling self.run()
[INFO/ForkPoolWorker-26] child process calling self.run()
[INFO/ForkPoolWorker-27] child process calling self.run()
[INFO/ForkPoolWorker-28] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-29] child process calling self.run()
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-30] child process calling self.run()
[INFO/ForkPoolWorker-31] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-32] child process calling self.run()
[DEBUG/MainProcess] added worker
[DEBUG/MainProcess] added worker
[INFO/ForkPoolWorker-33] child process calling self.run()
[INFO/ForkPoolWorker-34] child process calling self.run()
[INFO/ForkPoolWorker-35] child process calling self.run()
[INFO/ForkPoolWorker-36] child process calling self.run()
[INFO/ForkPoolWorker-37] child process calling self.run()
[INFO/ForkPoolWorker-38] child process calling self.run()
[DEBUG/MainProcess] adde

[issue33065] IDLE debugger: failure stepping through module loading

2018-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The problem is not limited to user modules.  In duplicate issue #34609 (not 
closed), the same traceback was obtained with unittest.  I also got the same 
with asyncio.  There will not be a problem if the module is already loaded in 
sys.modules, so that importlib is not invoked.

The traceback is obscured by the fact that the executed importlib is frozen, 
leaving it traceable, but the code not directly available.  Hence the code is 
omitted from the debugger display and traceback.  However, the line numbers can 
be used to find the code within Lib/importlib._bootstrap.py.  Using current 
master (updated last night), the functions and lines executed by stepping with 
import unittest are (as expected when reading the code, up to the unexpected 
exception):

_find_and_load: 980
ModuleLock.__init__: 144, 145
ModuleLock.__enter__: 148
_get_module_lock: 163-168, 170-171, 174: lock = _ModuleLock(name)
_ModuleLock.__init__: 59: self.lock = _thread.allocate_lock()

IDLE's visual debugger has name-value panels for locals, including non-locals, 
and for globals.  It uses repr to gets value representations.  The locals panel 
is displayed by default.

Before line 174, 'lock' is bound to None, so before executing line 59, the 
display is "lock:None\nname:'unittest'".  After line 59, debugger apparently 
tries to get the repr of the in-process instance.  Since the call in 174 has 
not completed and should not have rebound 'lock' to the instance, I do not 
understand why.  (Brett, I now understand what you wrote to be pointing as this 
puzzle also.)  ppperry, additional light would be appreciated.

Given that debugger does try to get the repr of the instance, both Brett 
Cannon, here, and (ppperry), on duplicate issue #34609 (now closed), have 
pointed out that _ModuleLock.__repr__ uses self.name:
return '_ModuleLock({!r}) at {}'.format(self.name, id(self))

I verified that updating the locals panel is the problem by starting over and 
turning the panel off until past the the assignment to self.name, at which 
point, the lock value is "_ModuleLock('unittest') at ...".

Debugger should be prepared for repr to fail, and display something 
informative.  In the present case, perhaps

repr raised "AttributeError: '_ModuleLock' object has no attribute 'name'"

with a check for whether the exception message contains "'.*' object" (and add 
such if not present).

--
nosy:  -ppperry
title: IDLE debugger crashes when `repr` raises an exception -> IDLE debugger: 
failure stepping through module loading
versions: +Python 3.7, Python 3.8

___
Python tracker 

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



[issue34705] Python 3.8 changes how returns through finally clauses are traced

2018-09-23 Thread Ned Batchelder


Ned Batchelder  added the comment:

I can't tell if you think this is something that should be fixed, or not? 
(Also, I'm not getting email notifications from bpo, sorry for the delay).

--

___
Python tracker 

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



[issue33012] Invalid function cast warnings with gcc 8 for METH_NOARGS

2018-09-23 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

If I click the link for PR 6748, I see a page with "We went looking everywhere, 
but couldn’t find those commits."  Maybe the PR needs to be refreshed or closed 
and maybe reopened. PR 6749 looks normal.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue22490] Using realpath for __PYVENV_LAUNCHER__ makes Homebrew installs fragile

2018-09-23 Thread Guido van Rossum


Guido van Rossum  added the comment:

I would love to know how to repro the original bug so I can demonstrate this 
actually fixes it.

Here's what I think should be the repro:

/Library/Frameworks/Python.framework/Versions/3.8/bin/python3  -c 'import 
subprocess; p = 
subprocess.Popen([".mypy/venv/bin/python3","-m","mypy.dmypy","-h"]).communicate()'

The setup is that .mypy/venv is a virtualenv that has mypy.dmypy installed. 
This is what failed for the user who reported this.

Unfortunately this does not fail for me (with a framework build from master 
installed). Would I have to do the install via brew? (I would have to learn 
about locally testing modified brew recipes, I suppose.)

--

___
Python tracker 

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



[issue34734] Azure linux buildbot failure

2018-09-23 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems this is a known problem with VSTS and I am closing this as third party. 
Reference : 
https://mail.python.org/pipermail/python-committers/2018-September/006084.html

--
resolution:  -> third party
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



[issue34582] VSTS builds should use jobs, pools, and test results

2018-09-23 Thread Steve Dower


Change by Steve Dower :


--
pull_requests: +8925

___
Python tracker 

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



[issue34779] IDLE internals show up in tracebacks when returning objects that cannot be `repr`ed

2018-09-23 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The baseline for what should happen is what does happen in interactive 
python.exe.

>>> class N:
...   def __repr__(self): raise ValueError
...
>>> N()
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 2, in __repr__
ValueError

IDLE's Shell very intentionally improves on this by including the code, which 
would be present if one ran the code from a file.  This is most definitely not 
a bug.

idlelib.run.cleanup_traceback removes internal items from the beginning and end 
of tracebacks (as long as something is left) but intentionally leaves them in 
the middle, as they may add useful information.  (Situations like this are 
rare.)  This is also not a bug.  These details are not part of the language 
definition.

In this case, I think the extra line will on net be informative to beginners.  
But even if you disagree, there is no way for code to decide.  I cannot imagine 
what else you think is 'wrong'.

--

___
Python tracker 

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



[issue34705] Python 3.8 changes how returns through finally clauses are traced

2018-09-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think that this can be fixed. But this is not easy.

--

___
Python tracker 

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



[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`

2018-09-23 Thread ppperry


New submission from ppperry :

class FakeContainer:
def __getitem__(self, key)
raise KeyError(key)
pdb.run("pass",{},FakeContainer())

Traceback (most recent call last):
  File "", line 1, in 
pdb.run("pass",{},FakeContainer())
  File "C:\Program Files\Python37\lib\pdb.py", line 1590, in run
Pdb().run(statement, globals, locals)
  File "C:\Program Files\Python37\lib\bdb.py", line 585, in run
exec(cmd, globals, locals)
  File "", line 1, in 
  File "", line 1, in 
  File "C:\Program Files\Python37\lib\bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
  File "C:\Program Files\Python37\lib\bdb.py", line 112, in dispatch_line
self.user_line(frame)
  File "C:\Program Files\Python37\lib\pdb.py", line 261, in user_line
self.interaction(frame, None)
  File "C:\Program Files\Python37\lib\pdb.py", line 351, in interaction
self.print_stack_entry(self.stack[self.curindex])
  File "C:\Program Files\Python37\lib\pdb.py", line 1453, in print_stack_entry
self.format_stack_entry(frame_lineno, prompt_prefix))
  File "C:\Program Files\Python37\lib\bdb.py", line 549, in format_stack_entry
if '__args__' in frame.f_locals:
  File "", line 3, in __getitem__
raise KeyError
KeyError: 0

Obviously, the debugger shouldn't crash in this case (running code outside of 
the debugger works as expected, producing a NameError on variable reads and a 
TypeError whenever a name is assigned).

--
components: Library (Lib)
messages: 326186
nosy: ppperry
priority: normal
severity: normal
status: open
title: Pdb crashes when code is executed in a mapping that does not define 
`__contains__`
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`

2018-09-23 Thread ppperry


Change by ppperry :


--
type:  -> behavior

___
Python tracker 

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



[issue34781] infinite waiting in multiprocessing.Pool

2018-09-23 Thread Tomáš Bouda

Tomáš Bouda  added the comment:

After more digging, I found that the following happens:

popen_fork.py -> _launch(self, process_obj) -> self.pid = os.fork()

When I let process (both child and parent) print resulting pid, on freezing I 
can see:
a) 50-times pid > 0
b) 49-times pid == 0

That means the parent is aware of 50 children, while only 49 of them get to the 
next line. Not sure if the one remaining process crashes on segfault, but 
parent apparently hangs later in os.waitpid() on this valid pid of the missing 
child.

--

___
Python tracker 

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



[issue2771] Test issue

2018-09-23 Thread Ned Batchelder


Change by Ned Batchelder :


--
nosy: +nedbat

___
Python tracker 

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



[issue2771] Test issue

2018-09-23 Thread Ezio Melotti


Ezio Melotti  added the comment:

test

--
nosy:  -nedbat

___
Python tracker 

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



[issue2771] Test issue

2018-09-23 Thread Ezio Melotti


Ezio Melotti  added the comment:

test

--
nosy: +nedbat

___
Python tracker 

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



[issue2771] Test issue

2018-09-23 Thread Ned Batchelder


Ned Batchelder  added the comment:

A test comment from nedbat

--

___
Python tracker 

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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread eohm


New submission from eohm :

segmentation-fault/core dump when try to run non-existing file specified on 
commandline (pymain_run_filename)

https://github.com/docker-library/python/issues/320

--
messages: 326191
nosy: eohm
priority: normal
severity: normal
status: open
title: segmentation-fault/core dump when try to run non-existing file specified 
on commandline
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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread eohm


eohm  added the comment:

bug was probably introduced here: 
python/cpython@1976086#diff-75445bdc3b6b3dd20b005698fa165444R2443 (but I did 
not test the version from before that commit)

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

> To my eyes, the _strongest_ case in all these messages is 
> for boosting the multiplier size on 64-bit boxes.  That's
> principled and well-motivated.

Yes, that would be perfectly reasonable (though to some extent the objects in 
the tuple also share some of the responsibility for getting all bits into play).

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Tim Peters


Tim Peters  added the comment:

Has anyone figured out the real source of the degeneration when mixing in 
negative integers?  I have not.  XOR always permutes the hash range - it's 
one-to-one.  No possible outputs are lost, and XOR with a negative int isn't 
"obviously degenerate" in general:

>>> for i in range(-16, 17):
...print(i, i ^ -5)
-16 11
-15 10
-14 9
-13 8
-12 15
-11 14
-10 13
-9 12
-8 3
-7 2
-6 1
-5 0
-4 7
-3 6
-2 5
-1 4
0 -5
1 -6
2 -7
3 -8
4 -1
5 -2
6 -3
7 -4
8 -13
9 -14
10 -15
11 -16
12 -9
13 -10
14 -11
15 -12
16 -21

Clear enough? "Distinct integers in, distinct integers out", but with the twist 
that the sign bit flips.  That's _seemingly_ minor to me.  Yet it has massive 
effects on tuple hash distribution.  Here's a function to show that:

def doit(cands, repeat=4):
from collections import Counter
from itertools import product

print(len(cands), "cands **", repeat, "=", len(cands)**repeat)
c1 = Counter(map(hash, product(cands, repeat=repeat)))
print(len(c1), "distinct hash codes")
c2 = Counter(c1.values())
for dups in sorted(c2):
print(dups, c2[dups])

Then an example we're proud of:

>>> doit(range(100))
100 cands ** 4 = 1
1 distinct hash codes
1 1

Much the same, mixing in negative ints, but _excluding_ the problematic -1 and 
-2 inputs:

>>> cands = list(range(-50, 51))
>>> cands.remove(-1) # hashes to -2
>>> cands.remove(-2) # for j odd, j ^ -2 == -j
>>> doit(cands)
99 cands ** 4 = 96059601
15736247 distinct hash codes
1 70827
2 1005882
3 228578
4 5000424
5 19728
6 1047762
8 8363046

What accounts for such a massive difference?  It's not merely that we're using 
negative ints:

>>> doit(range(-101, -1)) # leave -2 in, for a change
100 cands ** 4 = 1
1 distinct hash codes
1 1

So, on their own, negative ints are as spectacularly well-behaved in this range 
as positive ints, and including -2 creates no problems.

I suspect it's related to that x ^ -(x + 1) == -1, but not in a way obvious 
enough to be ... well, obvious ;-)

--

___
Python tracker 

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



[issue34659] Inconsistency between functools.reduce & itertools.accumulate

2018-09-23 Thread Lisa Roach


Lisa Roach  added the comment:


New changeset 9718b59ee5f2416cdb8116ea5837b062faf0d9f8 by Lisa Roach in branch 
'master':
bpo-34659: Adds initial kwarg to itertools.accumulate() (GH-9345)
https://github.com/python/cpython/commit/9718b59ee5f2416cdb8116ea5837b062faf0d9f8


--

___
Python tracker 

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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread eohm


Change by eohm :


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

___
Python tracker 

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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread eohm


eohm  added the comment:

Did a quick cross-check with other Distro.
With a debian stretch for example there is no SEGV and core-dump but a "(null)" 
output for program name instead.

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Tim Peters


Tim Peters  added the comment:

[Raymond, on boosting the multiplier on 64-bit boxes]
> Yes, that would be perfectly reasonable (though to some
> extent the objects in the tuple also share some of the
> responsibility for getting all bits into play).

It's of value independent of that.  Tuples of ints used as keys and set 
elements are very important, and I doubt we'll ever give up on that `hash(i) == 
i` for the typically "not huge" ints used in such contexts.  Jeroen gave a 
reasonable example of how boosting the multiplier can help in a case of that 
above:

https://bugs.python.org/msg326032

--

___
Python tracker 

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



[issue33962] IDLE: use ttk.spinbox with configdialog

2018-09-23 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
title: IDLE: use ttk.spinbox -> IDLE: use ttk.spinbox with configdialog

___
Python tracker 

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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue34782] Pdb crashes when code is executed in a mapping that does not define `__contains__`

2018-09-23 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

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



[issue26000] Crash in Tokenizer - Heap-use-after-free

2018-09-23 Thread William Bowling


William Bowling  added the comment:

> Is this still reproducible? On master (Python 3.8) with a debug build it 
> throws a SyntaxError. I don't have Python 3.5 installed to check this though

Looks like it's fixed in master and 3.6.6 but still happening in 3.5.6

--

___
Python tracker 

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



[issue34751] Hash collisions for tuples

2018-09-23 Thread Tim Peters


Tim Peters  added the comment:

FYI, using this for the guts of the tuple hash works well on everything we've 
discussed.  In particular, no collisions in the current test_tuple hash test, 
and none either in the cases mixing negative and positive little ints.  This 
all remains so using the current multiplier, or "the standard" FNV-1a 
multipliers 16777619UL (32 bit) and 1099511628211UL (64 bit).  I've done no 
other tests:

while (--len >= 0) {
y = PyObject_Hash(*p++);
if (y == -1)
return -1;
Py_uhash_t t = (Py_uhash_t)y;
t ^= t << 7;
x = (x ^ t) * mult;
}

Note that the multiplier doesn't change anymore.  The twist is adding

t ^= t << 7;

to _permute_ the native hash space (stuff like "t += t >> 16" is a many-to-one 
function, not a permutation).  Other than that, it's exactly FNV-1a.  I don't 
know that 7 is especially magical - it's just the first thing I tried.

In the absence of a real analysis, the intuition is simply that "t ^= t << 7" 
will clear masses of leading sign bits when hashing "small" negative integers.  
For whatever reason(s), they appear to be the cause of the troubles.

However, since that line of code permutes the space, exactly the same 
statistics can be provoked by some other inputs.

--

___
Python tracker 

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



[issue34783] segmentation-fault/core dump when try to run non-existing file specified on commandline

2018-09-23 Thread Ned Deily


Change by Ned Deily :


--
nosy: +vstinner

___
Python tracker 

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



[issue34780] Hang on startup if stdin refers to a pipe with an outstanding concurrent operation on Windows

2018-09-23 Thread Eryk Sun


Eryk Sun  added the comment:

> lseek() succeeds on pipes on Windows, but is nearly useless

lseek isn't meaningful for pipe and character files (i.e. FILE_TYPE_PIPE and 
FILE_TYPE_CHAR). While SEEK_SET and SEEK_CUR operations trivially succeed in 
these cases, the underlying device simply ignores the current file position. I 
think it would be reasonable to fail these cases instead of succeeding 
misleadingly.

When a file is opened for synchronous access, its  FilePositionInformation is 
managed by the I/O manager, not the device or file system. All the I/O manager 
does is get or set the CurrentByteOffset value in the File object [1]. It 
doesn't matter whether the device actually uses this information. 

Regarding the observed SEEK_END behavior, the named-pipe file system (NPFS) 
supports querying the FileStandardInformation of a pipe, in which it sets the 
EndOfFile value as the number of bytes available to be read from the pipe's 
inbound (server-side) queue. So SEEK_END (or WinAPI FILE_END) does provide some 
information to us, but it's misleading because the seek itself is meaningless.

[1]: https://msdn.microsoft.com/en-us/library/windows/hardware/ff545834

--

___
Python tracker 

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



  1   2   >