[issue33113] Query performance is very low and can even lead to denial of service

2018-03-21 Thread Xiang Zhang

Change by Xiang Zhang :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue32506] dataclasses: no need for OrderedDict now that dict guarantees to keep insertion order

2018-03-21 Thread Eric V. Smith

Change by Eric V. Smith :


--
dependencies:  -Dict order is now guaranteed, so add tests and doc for it
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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 22136c94b6e43c8c584a54f3a513b83b753b96ee by Eric V. Smith (Miss 
Islington (bot)) in branch '3.7':
bpo-32896: Fix error when subclassing a dataclass with a field that uses a 
default_factory (GH-6170) (GH-6171)
https://github.com/python/cpython/commit/22136c94b6e43c8c584a54f3a513b83b753b96ee


--

___
Python tracker 

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



[issue32896] Error when subclassing a dataclass with a field that uses a defaultfactory

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Thanks again for the bug report. This ended up being a simple fix, but an 
important one.

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



[issue23239] SSL match_hostname does not accept IP Address

2018-03-21 Thread Christian Heimes

Christian Heimes  added the comment:

#32819 and #32185 have solved the last outstanding bugs with IP address 
validation and handling. I'm fine with a backport of the feature to 2.7 now.

--
assignee: christian.heimes -> 
versions:  -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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-21 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

I'm fairly sure this is expected behavior on macOS: _tkinter loads the Tk 
library, which loads Apple GUI frameworks. Those frameworks are not save w.r.t. 
fork(2) and that can lead to all kinds of unwanted behavior (although I would 
have expected a more explicit crash than this)

--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

(Adding the other import system maintainers to the nosy list, along with Ned as 
the release manager for 3.6 and 3.7)

Summarizing my current thoughts on this:

I think the fact that "-m" currently adds the empty directory as sys.path[0] 
instead of the fully resolved cwd is definitely worth changing for 3.8, and is 
at least arguably a bugfix that should be applied to 3.7 prior to release. 
(It's probably too late in 3.6's lifecycle to be worth backporting that far, 
even if we do reclassify this part as a bugfix instead of an enhancement)

The above is what I consider to be in scope for *this* particular issue.

(The details of the current behaviour probably arose from my borrowing an 
existing code path originally designed for "-c" rather than from a deliberate 
design decision)



As a separate question, I'd personally be open to the idea of:

1. Deprecating the implicit addition of the current working directory to 
sys.path (and have that emit a deprecation warning in 3.8)

2. Add support for an explicit leading dot on "-m" arguments to say "Run this 
from the current directory" (the -m switch was added in 2.4, while the explicit 
relative import syntax wasn't chosen until 2.5, so this wasn't an available 
option for the original feature design). Note: given implicit namespace 
packages, it may make sense to allow additional leading dots in order to add a 
parent directory to sys.path instead of the current directory.

3. Add a "--basepath " argument to have "-m" resolve explicit relative 
imports against a directory other than the current one (this would be a 
different potential spelling for https://bugs.python.org/issue13475 )

4. Once the current directory is no longer added implicitly (in 3.9 at the 
earliest), if runpy fails to find the main module, then check the current 
directory and ask "Did you mean '.name'?" in the error message.

However, that second part is the part I consider out of scope for this issue, 
and think would require a PEP due to the backwards compatibility challenges.

--
nosy: +brett.cannon, eric.snow

___
Python tracker 

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



[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation

2018-03-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

Over in https://bugs.python.org/issue33053#msg314192, I came up with 
`--basepath ` as another possible spelling (`--no-basepath` would then be 
an option for turning it off.

The main argument *against* that name is that we use "base" to mean something 
different in the `sys` module: "base_prefix" and "base_exec_prefix" refer to 
the info for the parent environment when in a virtual environment.

Another alternative would be "--mainpath", since what we're really overriding 
is the default path entry that's normally derived from the location of 
`__main__`. As an added bonus, we could define "main path" as a glossary entry, 
rather than having to talk about "sys dot path zero" all the time.

--

___
Python tracker 

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



[issue13475] Add '-p'/'--path0' command line option to override sys.path[0] initialisation

2018-03-21 Thread Jakub Wilk

Change by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



[issue28247] Add an option to zipapp to produce a Windows executable

2018-03-21 Thread Cheryl Sabella

Change by Cheryl Sabella :


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



[issue33042] New 3.7 startup sequence crashes PyInstaller

2018-03-21 Thread Nick Coghlan

Nick Coghlan  added the comment:

Thinking about PySys_AddWarnOptionUnicode a little further, I'm not sure we 
actually need to change anything in the implementation there - I think we can 
just make it clearer in the docs that *only* PySys_AddWarnOption is supported 
prior to Py_Initialize for the embedding use case - the unicode version of the 
API currently only makes sense in CPython, where we can call it after 
_Py_InitializeCore.

It will make sense for embedding applications in 3.8 once we make 
Py_InitializeCore a public API.

--

___
Python tracker 

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



[issue33103] Syntax to get multiple arbitrary items from an iterable

2018-03-21 Thread AmjadHD

AmjadHD  added the comment:

Yes that's a way to do it but "a, b, c = my_list[1, 3, -1]" seems so pythonic 
and straight forward, it's like formatting, python had already 3 methods to do 
it when it introduced a 4th one (f-strings), easier is better especially in 
python.

--
status: closed -> open

___
Python tracker 

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



[issue25345] Unable to install Python 3.5 on Windows 10

2018-03-21 Thread Arran McCutcheon

Arran McCutcheon  added the comment:

No problem Steve, I found the solution! I downloaded 'Windows Repair' from 
tweaking.com, and then used it to repair only the MSI installer. So I've now 
installed Python correctly. Thanks again for your help!

--

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2018-03-21 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
keywords: +patch
Added file: https://bugs.python.org/file47496/compile-warnings.diff

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2018-03-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

It is possible to make the compiler producing warnings for such kind of errors. 
The following sample patch does this. I'm not sure it is worth to do.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

OTOH if we don't do this now, it's not going to be any easier to make this
change in 3.8. Maybe now's the time to experiment with it, and we can drop
it in rc1 if it causes problems. @Ivan, your thoughts? Would you merge this
into master?

--

___
Python tracker 

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



[issue33102] get the nth folder of a given path

2018-03-21 Thread AmjadHD

AmjadHD  added the comment:

Yes but i dont know if this is cross platform solution, i guess this function 
should be in the os.path module.

--

___
Python tracker 

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



[issue33102] get the nth folder of a given path

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

Yes, it's cross platform.

For a plain string version, you can use a utility function:

>>> for i in range(n+1):
...   path = os.path.dirname(path)
...

I'm not sure it's worth adding this to os.path.

--

___
Python tracker 

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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman

New submission from Scott Eilerman :

I ran into a "bug" when using random.sample() in which I got some results I 
didn't expect. After digging a little more, this is either a side effect of  
the optimization that's made when k > 5, or I am using the function in a way 
that wasn't intended. If that's the case, I would recommend calling out this 
behavior in the documentation.

The crux of the issue is that, for a given seed, random.sample(choices,k) gives 
the same sequence of results for k=1 to k=5, but that sequence can be different 
(for the same seed) at k=6 and higher. From my initial testing this seems to 
only occur when 'choices' has an even length.

Example code to reproduce this issue:

import random
seed = 199
choices = range(-10,12)

for k in range(10):
random.seed(seed)
print(random.sample(choices,k))


Example code to look at many different occurrences of this issue:

import random
choices = range(-10,12)
count = 0
for seed in range(200):
for k in range(8):
random.seed(seed)
seq1 = random.sample(choices, k)
random.seed(seed)
seq2 = random.sample(choices, k+1)
if seq1 != seq2[:-1]:
print(seed)
print(seq1)
print(seq2)
count += 1
print(f'Number of bugged results: {count}/200')


To illustrate the odd/even issue, changing choices to range(-10,11) results in 
zero bugged results.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 314201
nosy: Scott Eilerman, docs@python
priority: normal
severity: normal
status: open
title: random.sample() behavior is unexpected/unclear from docs
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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

What additional wording do you propose?

--
assignee: docs@python -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue33103] Syntax to get multiple arbitrary items from an sequence

2018-03-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Please leave this closed -- there is no chance that this will go forward on the 
bug tracker.  It would first need to be thoroughly discussed on the 
python-ideas mail list.

--
status: open -> closed
title: Syntax to get multiple arbitrary items from an iterable -> Syntax to get 
multiple arbitrary items from an sequence
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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman

Scott Eilerman  added the comment:

Something along the lines of: "For a fixed seed, random.sample(population, k) 
is not guaranteed to return the same samples for different values of k."

--

___
Python tracker 

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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman

Scott Eilerman  added the comment:

To clarify the use case where this behavior was problematic for me, I wanted to 
get the nth random draw from a given distribution, so I used something like:

random.seed(fixed_seed)
random.sample(choices, n)[-1]

Then, later, I want the next draw, so I did:

random.seed(fixed_seed)
random.sample(choices, n)[-1]


The workaround would be to use random.shuffle and pick the nth item, or use 
random.sample once with the highest k value I expect to need and then pick the 
nth element from that list. But I settled on the above implementation because 
for the first few cases I tested, it returned the results I expected, and 
nothing in the docs suggested I should expect otherwise.

--

___
Python tracker 

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



[issue33114] random.sample() behavior is unexpected/unclear from docs

2018-03-21 Thread Scott Eilerman

Scott Eilerman  added the comment:

Sorry, there's a typo in that example. It should look like:


random.seed(fixed_seed)
random.sample(choices, n)[-1]

Then, later, I want the next draw, so I did:

random.seed(fixed_seed)
random.sample(choices, n+1)[-1]

--

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Marat Sharafutdinov

New submission from Marat Sharafutdinov :

I want to schedule a lot of parallel tasks, but it becomes slow with loop 
blocking:

```python
import asyncio

task_count = 1

async def main():
for x in range(1, task_count + 1):
asyncio.ensure_future(f(x))

async def f(x):
if x % 1000 == 0 or x == task_count:
print(f'Run f({x})')
await asyncio.sleep(1)
loop.call_later(1, lambda: asyncio.ensure_future(f(x)))

loop = asyncio.get_event_loop()
loop.set_debug(True)
loop.run_until_complete(main())
loop.run_forever()
```

Outputs:
```
Executing  
result=None created at /usr/lib/python3.6/asyncio/base_events.py:446> took 
0.939 seconds

...

Executing , None) at 
/usr/lib/python3.6/asyncio/futures.py:339 created at 
/usr/lib/python3.6/asyncio/tasks.py:480> took 0.113 seconds

...

Executing  wait_for=()] created at 
/usr/lib/python3.6/asyncio/base_events.py:275> created at test_aio.py:13> took 
0.100 seconds

...
```

What can be another way to schedule a lot of parallel tasks?

--
components: asyncio
messages: 314207
nosy: asvetlov, decaz, yselivanov
priority: normal
severity: normal
status: open
title: Asyncio loop blocks with a lot of parallel tasks
type: resource usage
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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5928

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset e2f33add635df4fde81be9960bab367e010c19bf by Antoine Pitrou 
(Thomas Moreau) in branch 'master':
bpo-33078 - Fix queue size on pickling error (GH-6119)
https://github.com/python/cpython/commit/e2f33add635df4fde81be9960bab367e010c19bf


--

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
versions:  -Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Yury Selivanov

Yury Selivanov  added the comment:

Well, there's nothing we can do here, it's just a lot of work for a 
single-threaded process to get a 1 tasks going.  You'll get the same 
picture in any other async Python framework.

--

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Antoine Pitrou

Change by Antoine Pitrou :


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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset bb5b5291971c104ea773db1a30e46d410b6b3e1e by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.7':
bpo-33078 - Fix queue size on pickling error (GH-6119) (GH-6178)
https://github.com/python/cpython/commit/bb5b5291971c104ea773db1a30e46d410b6b3e1e


--

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Ned Deily

Ned Deily  added the comment:

Buildbots are failing on macOS:

http://buildbot.python.org/all/#/builders/14/builds/804/steps/4/logs/stdio
http://buildbot.python.org/all/#/builders/93/builds/459/steps/4/logs/stdio

--
nosy: +ned.deily
resolution: fixed -> 
stage: resolved -> needs patch
status: closed -> open

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Thomas Moreau

Change by Thomas Moreau :


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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-21 Thread Ethan Welty

Ethan Welty  added the comment:

I have tried running the script with:

- command line (python ): Works without (breaks with) `import _tkinter`.
- basic python console (python): Same as with command line.
- ipython: Fails with or without `import _tkinter`. However, if for example I 
make the matrix in the scripts smaller or use only functions that don't resort 
to multithreading, code runs successfully in parallel in ipython.
- IDLE: Perhaps unsurprisingly, the code fails with or without `import 
_tkinter` (never terminates, or prompts endless "Your program is still running! 
Do you want to kill it?")

Suspecting a problem with Tcl/Tk (Apple's original 8.5.9), I rebuilt python 
pointing to tcl-tk installed with brew (8.6.8), which I checked with IDLE and 
_tkinter.TCL_VERSION() / _tkinter.TK_VERSION(). However, this did not fix the 
problem.

--

___
Python tracker 

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



[issue9338] argparse optionals with nargs='?', '*' or '+' can't be followed by positionals

2018-03-21 Thread TD22057

TD22057  added the comment:

Is there any chance this will ever get fixed?  Patches have been available for 
5 years with no progress.

--

___
Python tracker 

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



[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-21 Thread Brett Cannon

Brett Cannon  added the comment:

The proposed change for 3.8 and 3.7 seems reasonable to me.

--

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Marat Sharafutdinov

Marat Sharafutdinov  added the comment:

But why if I use multiprocessing (run 100 tasks by 100 workers) it still 
continue blocking loop within some workers? Are 100 tasks "a lot of work" for 
asyncio loop?

```python
import asyncio
from multiprocessing import Process

worker_count = 100
task_count = 100

def worker_main(worker_id):
async def main():
for x in range(1, task_count + 1):
asyncio.ensure_future(f(x))

async def f(x):
if x % 1000 == 0 or x == task_count:
print(f'[WORKER-{worker_id}] Run f({x})')
await asyncio.sleep(1)
loop.call_later(1, lambda: asyncio.ensure_future(f(x)))

loop = asyncio.get_event_loop()
loop.set_debug(True)
loop.run_until_complete(main())
loop.run_forever()

if __name__ == '__main__':
for worker_id in range(worker_count):
worker = Process(target=worker_main, args=(worker_id,), daemon=True)
worker.start()
while True:
pass
```

--

___
Python tracker 

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



[issue33115] Asyncio loop blocks with a lot of parallel tasks

2018-03-21 Thread Yury Selivanov

Yury Selivanov  added the comment:

The "blocking" you observe is caused by Python GC.  If I add "import gc; 
gc.disable()" the warnings disappear.

--

___
Python tracker 

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-21 Thread Ethan Welty

Ethan Welty  added the comment:

I've tried with additional backends: WX, WXAgg, WXCairo, Qt5Agg (in matplotlib 
speak).

With these, I can at least import matplotlib.pyplot, but as soon as say 
matplotlib.pyplot.plot is called and the backend is loaded, the code breaks 
(error message for WXAgg below). Is multiprocessing in an interactive shell 
simply not meant to be supported on MacOS?

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File 
"/Users/Admin/.pyenv/versions/3.6.4/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/_pylab_helpers.py",
 line 78, in destroy_all
manager.destroy()
  File 
"/Users/Admin/.pyenv/versions/3.6.4/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_wx.py",
 line 1303, in destroy
self.frame.Destroy()
  File 
"/Users/Admin/.pyenv/versions/3.6.4/Python.framework/Versions/3.6/lib/python3.6/site-packages/matplotlib/backends/backend_wx.py",
 line 1256, in Destroy
if not self.IsBeingDeleted():
RuntimeError: wrapped C/C++ object of type FigureFrameWxAgg has been deleted

--

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2018-03-21 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Reviewing Serhiy's patch, I changed my mind from 6 years ago (msg164774).  I 
may have over-estimated the difficulty; in any case the code patch is written.  
(Tests are still needed.)  And the code is rather straightforward and readable.

Beyond that, I see the patch as detecting a SyntaxError during compilation, as 
explained below, with the hint being frosting on top of that.  (It is not an 
'Error' as the grammar is now, but it is an error as we might like it to be, 
hence Serhiy used SyntaxWarning instead.)

In addition, we now have the 'print' precedent of 'print'.
  >>> print 1
  SyntaxError: Missing parentheses in call to 'print'. Did you mean print(1)?
I don't remember when this was added, but I don't see any mention above.

And it seems from other discussions, like the recent python-ideas thread about 
possibly deprecating 'string' 'joining', that several people have much more of 
a problem with missing commas than some of us do.

If it were possible, we would like the 'call' production to be
  call ::=  callable "(" [argument_list [","] | comprehension] ")"
but 'callable' is not syntactically definable.  What is syntactically definable 
and what Serhiy's patch implements is
 possible_callable  ::= primary - 
 call  ::= possible_callable ...

As it happens, our grammar metasyntax does not (I believe) include set 
difference, and I suspect that implementing 'possible_callable' by set addition 
would result in something that is not LL(1) and possibly ambiguous.  Even if 
'possible_callable' could be defined within the LL(1) constraint, I suspect it 
would be messy, and special-casing would still be needed for the special-case 
message.

Ditto for 'possibly_subscriptable'.

I have 3 questions:
1. Why 'chech' instead of 'check'?
2. Will chech_index catch "[1,2] [3,4]"? (I am guessing that is the intent.)
3. Does Syntax Warning stop compilation, or at least execution, as at a >>> 
prompt?

Aside from that, I would be inclined to mark this for 'Interpreter Core' and 
seriously consider it.

--
versions: +Python 3.8 -Python 2.7, Python 3.3, Python 3.4

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Ned Deily

Ned Deily  added the comment:

PR 6180 appears to have fixed the 3.x failures, thanks!

--

___
Python tracker 

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



[issue15248] Better explain "TypeError: 'tuple' object is not callable"

2018-03-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Actually the precedence was a warning for an assert like:

assert(x % 2 == 0, "x is odd")

Currently it is the only syntax warning produced by the compiler.

> 1. Why 'chech' instead of 'check'?

Just a typo replicated with a copy-paste.

> 2. Will chech_index catch "[1,2] [3,4]"? (I am guessing that is the intent.)

Yes, it is. It could be extended to catch also "['foo','bar'] ['baz']".

> 3. Does Syntax Warning stop compilation, or at least execution, as at a >>> 
> prompt?

No, it is just a warning unless you run Python with -Werror.

This patch was inspired by usability improvements in GCC 8 [1]. I haven't 
created a pull request because I have doubts about that this should be in the 
compiler rather of a third-party linter. But if several other core developers 
will support this idea I'll continue working in this direction.

[1] https://developers.redhat.com/blog/2018/03/15/gcc-8-usability-improvements/

--

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Good, I think we can close again now!

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



[issue33111] Merely importing tkinter breaks parallel code (multiprocessing, sharedmem)

2018-03-21 Thread Ethan Welty

Change by Ethan Welty :


--
components: +macOS

___
Python tracker 

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



[issue28677] difficult to parse sentence structure in "When an instance attribute is referenced that isn't a data attribute"

2018-03-21 Thread Steven Downum

Change by Steven Downum :


--
nosy: +steven.downum

___
Python tracker 

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



[issue33116] Field is not exposed in dataclasses.__all__

2018-03-21 Thread Eric V. Smith

New submission from Eric V. Smith :

'Field' needs to be added to __all__.

--
assignee: eric.smith
messages: 314222
nosy: eric.smith
priority: normal
severity: normal
status: open
title: Field is not exposed in dataclasses.__all__
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



[issue33116] Field is not exposed in dataclasses.__all__

2018-03-21 Thread Eric V. Smith

Change by Eric V. Smith :


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

___
Python tracker 

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



[issue33117] asyncio example uses non-existing/documented method

2018-03-21 Thread Henrique Fingler

New submission from Henrique Fingler :

In the documentation of asyncio.run_coroutine_threadsafe(coro, loop), in 
Section 19.5.3.6 
(https://docs.python.org/3/library/asyncio-task.html#asyncio.run_coroutine_threadsafe),
 the example code does the following:

future = asyncio.run_coroutine_threadsafe(coro, loop)
# Wait for the result with an optional timeout argument
assert future.result(timeout) == 3

 The problem is that the result method of a future, according to the 
documentation doesn't take parameters. It's in Section 19.5.3.4 
(https://docs.python.org/3.8/library/asyncio-task.html#asyncio.Future.done)

result()
Return the result this future represents.


 The same function is used in Section 18.5.9.3 
(https://docs.python.org/3/library/asyncio-dev.html#concurrency-and-multithreading)


 This error is present in all Python 3.* docs.

 From the asyncio source code 
(https://github.com/python/cpython/blob/master/Lib/asyncio/futures.py), we have 
this in the Future class definition:

class Future:
"""This class is *almost* compatible with concurrent.futures.Future.
Differences:
- This class is not thread-safe.
- result() and exception() do not take a timeout argument and
  raise an exception when the future isn't done yet.



So this example needs to be reworked, I'd do it if I knew more about asyncio. 
My ideas involve either using a add_done_callback with a flag or just busy 
waiting until future.done().

--
assignee: docs@python
components: Documentation
messages: 314223
nosy: Henrique Fingler, docs@python
priority: normal
severity: normal
status: open
title: asyncio example uses non-existing/documented method
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



[issue33116] Field is not exposed in dataclasses.__all__

2018-03-21 Thread miss-islington

Change by miss-islington :


--
pull_requests: +5931

___
Python tracker 

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



[issue33078] Queue with maxsize can lead to deadlocks

2018-03-21 Thread Ned Deily

Ned Deily  added the comment:

(Fot the record, PR 6181 was the 3.7 backport of PR 6180.)

--

___
Python tracker 

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



[issue33116] Field is not exposed in dataclasses.__all__

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:


New changeset 4ddc99d15963b0374f9dbfd57f14e6194ad65669 by Eric V. Smith (Miss 
Islington (bot)) in branch '3.7':
bpo-33116: Add 'Field' to dataclasses.__all__. (GH-6182) (GH-6183)
https://github.com/python/cpython/commit/4ddc99d15963b0374f9dbfd57f14e6194ad65669


--

___
Python tracker 

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



[issue33116] Field is not exposed in dataclasses.__all__

2018-03-21 Thread Eric V. Smith

Change by Eric V. Smith :


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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

I'm not sure this is worth preventing. I can certainly make it an error, but 
since dataclasses ignores anything without a type annotation, I don't think 
it's a big deal. Basically I'd have to look through all class attributes that 
are of type Field but aren't in the class's __annotations__.

I cannot find the original conversation that caused me to open this issue. If 
anyone feels strongly that this case should be an error, let me know.

--

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Guido van Rossum

Guido van Rossum  added the comment:

Fine to close as wontfix.

--

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

Some part of the discussion is in https://bugs.python.org/issue32428

I still think it is important to flag things like this as an error:

@dataclass
class C:
x = field()

This is a big bug magnet. Especially taking into account that attrs behave in 
the opposite way in this case.

--

___
Python tracker 

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



[issue33110] Adding a done callback to a concurrent.futures Future once it has already completed, may raise an exception, contrary to docs

2018-03-21 Thread Ned Deily

Change by Ned Deily :


--
nosy: +bquinlan, pitrou

___
Python tracker 

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



[issue33018] Improve issubclass() error checking and message

2018-03-21 Thread Ivan Levkivskyi

Ivan Levkivskyi  added the comment:

> Would you merge this into master?

OK, I played with this a bit and it looks good. There is however a merge 
conflict now, and a NEWS item is missing. I will leave a comment in the PR.

--

___
Python tracker 

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



[issue33108] Unicode char 304 in lowercase has len = 2

2018-03-21 Thread INADA Naoki

INADA Naoki  added the comment:

Maybe, we should update UnicodeData?

--

___
Python tracker 

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



[issue32505] dataclasses: make field() with no annotation an error

2018-03-21 Thread Eric V. Smith

Eric V. Smith  added the comment:

But surely when you instantiate this: 
c = C(1)

you'll notice that's an error?

--

___
Python tracker 

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



[issue33108] Unicode char 304 in lowercase has len = 2

2018-03-21 Thread Ma Lin

Ma Lin  added the comment:

There was a discussion about "Latin Capital Letter I with Dot Above"
https://bugs.python.org/issue17252

--
nosy: +Ma Lin

___
Python tracker 

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




[issue33053] Avoid adding an empty directory to sys.path when running a module with `-m`

2018-03-21 Thread Ned Deily

Ned Deily  added the comment:

I am OK with changing '' to the initial resolved working directory for 3.7 as 
long as we get that change in now, i.e. before the 3.7.0b3 ABI freeze next 
Monday.  And I agree that we should not attempt to change this behavior for 
3.6.x at this stage of its life cycle.

--
nosy: +ned.deily
priority: normal -> release blocker
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



[issue33117] asyncio example uses non-existing/documented method

2018-03-21 Thread Ned Deily

Change by Ned Deily :


--
nosy: +asvetlov, giampaolo.rodola, yselivanov

___
Python tracker 

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



[issue33108] Unicode char 304 in lowercase has len = 2

2018-03-21 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thank you Ma Lin.

Closed as a duplicate of issue17252.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Latin Capital Letter I with Dot Above

___
Python tracker 

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



[issue27212] Doc for itertools, 'islice()' implementation have unwanted behavior for recipe 'consume()'

2018-03-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Cheryl, I think you take this one.  It hasn't been touched in a long time and 
Nofar is focused on another issue.

--
assignee: Nofar Schnider -> csabella

___
Python tracker 

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



[issue33118] No clean way to get notified when a Transport's write buffer empties out

2018-03-21 Thread Vitaly Kruglikov

New submission from Vitaly Kruglikov :

There doesn't appear to be an ordained mechanism for getting notified when a 
Transport's (or WriteTransport's) write buffer drains to zero (i.e., all output 
data has been transferred to socket). I don't want to hijack 
`set_write_buffer_limits()` for this purpose, because that would preclude me 
from using it for its intended purpose.

I see that transport in selector_events.py has a private method 
`_make_empty_waiter()`, which is along the lines of what I need, but it's 
private and is used by `BaseSelectorEventLoop._sendfile_native()`.

Just like `BaseSelectorEventLoop._sendfile_native()`, my app needs equivalent 
functionality in order to be able to run the loop (`run_until_complete()`) 
until the transport's write buffer empties out.

--
components: asyncio
messages: 314236
nosy: asvetlov, vitaly.krug, yselivanov
priority: normal
severity: normal
status: open
title: No clean way to get notified when a Transport's write buffer empties out
type: enhancement
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