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

2018-09-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

I think this change should be reverted.

--

___
Python tracker 

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



[issue34769] _asyncgen_finalizer_hook running in wrong thread

2018-09-22 Thread twisteroid ambassador


New submission from twisteroid ambassador :

When testing my happy eyeballs library, I occasionally run into issues with 
async generators seemingly not finalizing. After setting loop.set_debug(True), 
I have been seeing log entries like these:


Exception ignored in: 
Traceback (most recent call last):
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 466, in 
_asyncgen_finalizer_hook
self.create_task(agen.aclose())
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 386, in 
create_task
task = tasks.Task(coro, loop=self)
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 674, in 
call_soon
self._check_thread()
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 712, in 
_check_thread
"Non-thread-safe operation invoked on an event loop other "
RuntimeError: Non-thread-safe operation invoked on an event loop other than the 
current one
ERRORasyncio Task was destroyed but it is pending!
source_traceback: Object created at (most recent call last):
  File "/opt/Python3.7.0/lib/python3.7/threading.py", line 885, in _bootstrap
self._bootstrap_inner()
  File "/opt/Python3.7.0/lib/python3.7/threading.py", line 917, in 
_bootstrap_inner
self.run()
  File "/opt/Python3.7.0/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
  File "/opt/Python3.7.0/lib/python3.7/concurrent/futures/thread.py", line 80, 
in _worker
work_item.run()
  File "/opt/Python3.7.0/lib/python3.7/concurrent/futures/thread.py", line 57, 
in run
result = self.fn(*self.args, **self.kwargs)
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 746, in 
_getaddrinfo_debug
msg.append(f'type={type!r}')
  File "/opt/Python3.7.0/lib/python3.7/enum.py", line 572, in __repr__
self.__class__.__name__, self._name_, self._value_)
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 466, in 
_asyncgen_finalizer_hook
self.create_task(agen.aclose())
  File "/opt/Python3.7.0/lib/python3.7/asyncio/base_events.py", line 386, in 
create_task
task = tasks.Task(coro, loop=self)
task: ()> created 
at /opt/Python3.7.0/lib/python3.7/asyncio/base_events.py:386>



This is a typical instance. Usually several instances like this occur at once.

I'll try to reproduce these errors in a simple program. Meanwhile, here are 
some details about the actual program, which may or may not be related to the 
errors:

* I have several nested async generators (async for item in asyncgen: yield 
do_something(item); ), and when the errors appear, the above error messages and 
stack traces repeat several times, with the object names mentioned in 
"Exception ignored in: ..." being each of the nested async generators. Other 
parts of the error messages, including the stack traces, are exactly the same.

* I never used threads or loop.run_in_executor() explicitly in the program. 
However, the innermost async generator calls loop.getaddrinfo(), and that is 
implemented by running a Python function, socket.getaddrinfo(), with 
loop.run_in_executor(), so the program implicitly uses threads. 
(socket.getaddrinfo() is a Python function that calls a C function, 
_socket.getaddrinfo().)

* The outermost async generator is not iterated using `async for`. Instead, it 
is iterated by calling its `__aiter__` method, saving the returned async 
iterator object, and then awaiting on the `__anext__` method of the async 
iterator repeatedly. Of course, all of these are done in the same event loop.


Environment: Python 3.7.0 compiled from source, on Debian stretch.

--
components: asyncio
messages: 326090
nosy: asvetlov, twisteroid ambassador, yselivanov
priority: normal
severity: normal
status: open
title: _asyncgen_finalizer_hook running in wrong thread
type: behavior
versions: Python 3.7, Python 3.8

___
Python tracker 

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



[issue33346] Syntax error with async generator inside dictionary comprehension

2018-09-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

What is the status of this issue?

Similar change to the Grammar was just merged in issue32117. Both issue32117 
and this issue extend already implemented PEPs (PEP 448 and PEP 525 
correspondingly) to the corner case missed in the original PEP.

Pablo, Yury, could you please start a discussion about this on the Pythod-Dev 
mailing list?

--

___
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-22 Thread Vinay Sajip


Vinay Sajip  added the comment:

As I said in msg284106, it seems that the __PYVENV_LAUNCHER__ should be removed 
from the stub launcher and then tests should confirm that framework builds 
aren't adversely affected. Unfortunately, I can't do this testing as I don't 
have a Mac, and have been hoping that one of the Mac platform experts (or 
indeed anyone who can build and test framework builds) can look at this.

--

___
Python tracker 

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



[issue32892] Remove specific constant AST types in favor of ast.Constant

2018-09-22 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

thautwarm, ast.Constant is not new. You can use it since 3.8. What is new in 
this issue -- ast.parse() will produce ast.Constant instead of ast.Num, 
ast.Str, etc.

--

___
Python tracker 

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



[issue34709] Suggestion: make getuser.getpass() also look at SUDO_USER environment variable

2018-09-22 Thread Amos S


Change by Amos S :


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

___
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-22 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> I'm not aware of any research papers about picking multipliers in this 
> context, but would love to see one.

The only real condition that I can think of is that the order should be large: 
we do not want MULTIPLIER**n = 1 (mod 2**N) for a small number n.

Other than that, we could pick the multiplier to guarantee no hash collisions 
on some chosen subset of inputs. A bit like your product(range(100), repeat=4) 
example but then for more inputs.

If you agree with this approach, I could try to find a good multiplier this way.

--

___
Python tracker 

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



[issue34750] locals().update doesn't work in Enum body, even though direct assignment to locals() does

2018-09-22 Thread Antony Lee


Antony Lee  added the comment:

> I agree though that adding an update method would be nice though and can be 
> done in just a few lines of code.

Again, this can be done just be inheriting the methods from MutableMapping.

In fact even now one can just write

class E(Enum): MutableMapping.update(locals(), {"a": 1})

and this will do the "right" thing but that's hardly an obvious way to do it...

--

___
Python tracker 

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



[issue34561] Replace list sorting merge_collapse()?

2018-09-22 Thread Vincent Jugé

Vincent Jugé  added the comment:

I see... Indeed, my only goal when adapting Shivers Sort was to maintain some 
invariant that would make the analysis easy, while mimicking the arguments 
developed by Buss & Knop for their analysis of (plain) Shivers Sort. It is, 
however, sure that the n(H+4) upper bound I get should be refined when H is 
small, which more or less amounts to tackling the 3-run case you mention.

I am reasonably convinced that the current version of Adaptive Shivers Sort 
could be adapted to take this problem into account, while keeping its overall 
simple stricture and complexity analysis.

If this first step turns out to be feasible, I will also look at the latest 
version of runstack.py to investigate other possible improvements on Adaptive 
Shivers Sort.

--

___
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-22 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> Which was your original suggestion.  Which you appear to be opposed to now?  
> I'm unclear about why, if so.

I'm not strictly opposed to that. It's just that I have less confidence in the 
current ad-hoc hash compared to something following the DJBX33A scheme.

--

___
Python tracker 

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



[issue24307] pip error on windows whose current user name contains non-ascii characters

2018-09-22 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



[issue24997] mock.call_args compares as equal and not equal

2018-09-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Seems to have been implemented with ce913877e42b7fa03434c2e765ace891e0f5c4dc . 
https://bugs.python.org/issue25195 

$ git checkout ce913877e42b7fa03434c2e765ace891e0f5c4dc~1 Lib/unittest/mock.py
$ ./python.exe ../backups/bpo24997.py
1  True
2  True

$ git checkout ce913877e42b7fa03434c2e765ace891e0f5c4dc Lib/unittest/mock.py
$ ./python.exe ../backups/bpo24997.py
1  True
2  False

Thanks

--

___
Python tracker 

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



[issue24174] Python crash on exit

2018-09-22 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



[issue24834] pydoc should display the expression for a builtin argument default, not its result

2018-09-22 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-22 Thread Jeroen Demeyer


Jeroen Demeyer  added the comment:

> I don't know that primes are important here, but neither do I know that 
> they're _not_ important here.

Hashes are effectively computed modulo 2**N. "Primes" are meaningless in that 
setting (except for the prime 2 which does have a meaning). For example, 
103 is prime but 103 + 2**64 is not. But these represent the same 
number modulo 2**64. Also, multiplication by any odd number is a permutation 
modulo 2**N, so every odd number is invertible.

--

___
Python tracker 

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



[issue25952] code_context not available in exec()

2018-09-22 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



[issue34537] test_gdb fails with LC_ALL=C

2018-09-22 Thread STINNER Victor


STINNER Victor  added the comment:

Thank you Elvis for the fix!

--

___
Python tracker 

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



[issue24828] Segfault when using store-context AST node in a load context

2018-09-22 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

Reproducible on latest 2.7 branch as well. Stack trace as below : 

Program received signal SIGSEGV, Segmentation fault.
dict_set_item_by_hash_or_entry (
op={'code': , 'ast': , '__builtins__': , '__file__': 
'../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, key=, hash=,
value=, ep=) at Objects/dictobject.c:792
792 Py_INCREF(value);
(gdb) bt
#0  dict_set_item_by_hash_or_entry (op={'code': , 
'ast': , '__builtins__': , '__file__': '../backups/bpo24828.py', 'm': 
, 
id='foo', col_offset=0, lineno=1) at remote 0x1005c2790>, col_offset=0) at 
remote 0x1005c27d0>]) at remote 0x1005c2810>, '__package__': None, '__name__': 
'__main__', '__doc__': None}, key=, hash=, 
value=, ep=) at Objects/dictobject.c:792
#1  PyDict_SetItem (op={'code': , 'ast': , '__builtins__': , 
'__file__': '../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, key='foo', value=0x0) at Objects/dictobject.c:848
#2  0x0001000ab62e in PyEval_EvalFrameEx (f=, 
throwflag=) at Python/ceval.c:2186
#3  0x0001000a735a in PyEval_EvalCodeEx (co=, 
globals=, locals=, args=0x0, argcount=, kws=, kwcount=, defs=0x0, 
defcount=, closure=) at Python/ceval.c:3604
#4  0x0001000a6cb6 in PyEval_EvalCode (co=0x100293168, globals='foo', 
locals=0x0) at Python/ceval.c:669
#5  0x0001000a302a in builtin_eval (self={'code': , 'ast': , '__builtins__': , '__file__': '../backups/bpo24828.py', 'm': 
, 
id='foo', col_offset=0, lineno=1) at remote 0x1005c2790>, col_offset=0) at 
remote 0x1005c27d0>]) at remote 0x1005c2810>, '__package__': None, '__name__': 
'__main__', '__doc__': None}, args=) at Python/bltinmodule.c:679
#6  0x0001000ae8a7 in call_function (oparg=, 
pp_stack=) at Python/ceval.c:4372
#7  PyEval_EvalFrameEx (f=Frame 0x1002d4bc0, for file ../backups/bpo24828.py, 
line 7, in  (), throwflag=) at Python/ceval.c:3009
#8  0x0001000a735a in PyEval_EvalCodeEx (co=, 
globals=, locals=, args=0x0, argcount=, kws=, kwcount=, defs=0x0, 
defcount=, closure=) at Python/ceval.c:3604
#9  0x0001000a6cb6 in PyEval_EvalCode (co=0x100293168, globals='foo', 
locals=0x0) at Python/ceval.c:669
#10 0x0001000d4de4 in run_mod (mod=, filename=, globals={'code': , 'ast': , '__builtins__': , '__file__': 
'../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, locals={'code': , 'ast': , '__builtins__': , '__file__': 
'../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, flags=, arena=) at Python/pythonrun.c:1385
#11 PyRun_FileExFlags (fp=, filename=, 
start=, globals={'code': , 'ast': 
, '__builtins__': , 
'__file__': '../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, locals={'code': , 'ast': , '__builtins__': , '__file__': 
'../backups/bpo24828.py', 'm': , id='foo', col_offset=0, 
lineno=1) at remote 0x1005c2790>, col_offset=0) at remote 0x1005c27d0>]) at 
remote 0x1005c2810>, '__package__': None, '__name__': '__main__', '__doc__': 
None}, closeit=1, flags=) at Python/pythonrun.c:1371
#12 0x0001000d491a in PyRun_SimpleFileExFlags (fp=0x7fff71bec070, 
filename=0xc6079cb3d3de86bb , closeit=8, flags=0x7fff5fbffa70) at Python/pythonrun.c:957
#13 0x0001000ea8f2 in Py_Main (argc=, argv=) 
at Modules/main.c:645
#14 0x7fff8b5055c9 in start () from /usr/lib/system/libdyld.dylib
#15 0x7fff8b5055c9 in start () from /usr/lib/system/libdyld.dylib
#16 0x in ?? ()


Adding Benjamin since he is the 2.7 release manager and it's something specific 
to 2.7.


Thanks

--
nosy: +benjamin.peterson

___
Python tracker 

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



<    1   2