[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra

Narendra  added the comment:

Hi Storchaka,

As per re.groups(), its should work as below:

groups([default])
Return a tuple containing all the subgroups of the match, from 1 up to however 
many groups are in the pattern. The default argument is used for groups that 
did not participate in the match; it defaults to None. (Incompatibility note: 
in the original Python 1.5 release, if the tuple was one element long, a string 
would be returned instead. In later versions (from 1.5.1 on), a singleton tuple 
is returned in such cases.)

For example:

>>> m = re.match(r"(\d+)\.(\d+)", "24.1632")
>>> m.groups()
('24', '1632')
If we make the decimal place and everything after it optional, not all groups 
might participate in the match. These groups will default to None unless the 
default argument is given:

>>> m = re.match(r"(\d+)\.?(\d+)?", "24")
>>> m.groups()  # Second group defaults to None.
('24', None)
>>> m.groups('0')   # Now, the second group defaults to '0'.
('24', '0')

I tested some scenario as below:
Scenario: Suppose i have a match like 
m = re.match(r"(\d+)\.(\d+)", "24.1632")
Here if i pass m.groups(1), then it should check if there is optional match 
(optional match, pattern which is specified using ?), it should print 1 in 
that match and if not, it should throw error that there is no any optional 
match (didn't have any pattern with ?).

Expected Output:
>>> m.groups(1)
There is no any optional argument to use 1

Received Output:
>>> m.groups(1)
'24', '1632')

Please review the above and provide your comments?

--
resolution: not a bug -> 
status: closed -> open

___
Python tracker 

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



[issue31977] threading.Condition can not work with threading.Semaphore

2017-11-07 Thread 张晓林

Change by 张晓林 :


--
type: resource usage -> behavior

___
Python tracker 

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



[issue31834] BLAKE2: the (pure) SSE2 impl forced on x86_64 is slower than reference

2017-11-07 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

@tiran, can we close this again?

--

___
Python tracker 

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



[issue31977] threading.Condition can not work with threading.Semaphore

2017-11-07 Thread 张晓林

New submission from 张晓林 :

the python document say Condition work will Locks, like RLock...

but i find it not work with Semaphore, because Condition._is_owned is like this

def _is_owned(self):
# Return True if lock is owned by current_thread.
# This method is called only if _lock doesn't have _is_owned().
if self._lock.acquire(0):
self._lock.release()
return False
else:
return True

this work for RLock, but not work for Semaphore, and Semaphore do not have it's 
own _is_owned implement.

i spend a lot of time on this issue. maybe fix it, or document it out?

--
messages: 305807
nosy: 张晓林
priority: normal
severity: normal
status: open
title: threading.Condition can not work with threading.Semaphore
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



[issue31971] idle_test: failures on x86 Windows7 3.x

2017-11-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

In build 129, which finished perhaps 3 hours ago, test_idle passed again.  I 
think we should merge the fix anyway in case 'hover' appears again on some 
machine.

A similar try:except is needed elsewhere.

--

___
Python tracker 

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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-07 Thread Benjamin Fogle

Change by Benjamin Fogle :


--
type:  -> crash

___
Python tracker 

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



[issue31971] idle_test: failures on x86 Windows7 3.x

2017-11-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

The failure in tearDownClass is a side-effect of the failure in test_set_keys 
causing 'p.set_keys_type = Func' being skipped.  That could be prevented with 
'try:finally: p.set_keys_type = Func'.

I am completely puzzled at the sudden failure on one machine.  configdialog and 
test_configdialog were lasted changed 11 days ago (10/27) by Serhey's patch to 
make font samples editable.  test_idle passed consistently everywhere, 
including that machine, until build 121, 16 hours ago, and then suddenly 
started failing, consistently, on that one machine (as far as I know).  It 
continues to pass on my Win 10 machine, freshly updated with Python rebuilt.  I 
also checked the git log for tkinter.__init__ and tkinter.ttk and they have not 
been changed either.

The failure message is also a surprise.  'custom_keyset_on' is a ttk 
Radiobutton.
https://docs.python.org/3/library/tkinter.ttk.html#widget-states
does not list 'hover' as a state.  However
https://www.tcl.tk/man/tcl8.6/TkCmd/ttk_widget.htm#M-state
does (so the doc needs fixing): "The mouse cursor is within the widget."

Perhaps 'hover' is a result of previous mouse cursor positioning from 
event_generates in the font tab test.  (Why the sudden change on one system 
would still be a puzzle.)  If this is the reason, then I only need to worry 
about this one state test.

Otherwise, I would have to think about either parking the cursor where it 
cannot interfere, or about minimizing the dialog when it does not need to be 
de-iconified for event_generate to work.

Serhiy, any thoughts on this?

--
assignee:  -> terry.reedy
components: +IDLE
nosy: +serhiy.storchaka
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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-07 Thread Benjamin Fogle

Change by Benjamin Fogle :


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

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-07 Thread Éric Araujo

Éric Araujo  added the comment:

This can’t be backported, but could the docs of 2.7 and stable 3.x version gain 
an example of equivalent PYTHONWARNINGS envvar?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue31976] Segfault when closing BufferedWriter from a different thread

2017-11-07 Thread Benjamin Fogle

New submission from Benjamin Fogle :

To reproduce:
```
import threading
import io
import time
import _pyio

class MyFileIO(io.FileIO):
def flush(self):
# Simulate a slow flush. Slow disk, etc.
time.sleep(0.25)
super().flush()

raw = MyFileIO('test.dat', 'wb')
#fp = _pyio.BufferedWriter(raw)
fp = io.BufferedWriter(raw)
t1 = threading.Thread(target=fp.close)
t1.start()
time.sleep(0.1) # Ensure t1 is sleeping in fp.close()/raw.flush()
fp.write(b'test')
t1.join()
```

_pyio.BufferedWriter ignores the error completely rather than throwing a 
ValueError("write to closed file").

--
components: Interpreter Core
messages: 305803
nosy: benfogle
priority: normal
severity: normal
status: open
title: Segfault when closing BufferedWriter from a different thread
versions: 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



[issue31971] idle_test: failures on x86 Windows7 3.x

2017-11-07 Thread Terry J. Reedy

Change by Terry J. Reedy :


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

___
Python tracker 

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



[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2017-11-07 Thread Anders Lorentsen

Anders Lorentsen  added the comment:

While researching this, I discovered that on MS Windows

>>> subprocess.run([pathlike_object, additional_arguments])

did not run like it did on Posix. My PR includes this problem and it's fix.

--

___
Python tracker 

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



[issue31961] subprocess._execute_child doesn't accept a single PathLike argument for args

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-07 Thread Barry A. Warsaw

Change by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue31975] Add a default filter for DeprecationWarning in __main__

2017-11-07 Thread Nick Coghlan

New submission from Nick Coghlan :

As per the post at 
https://mail.python.org/pipermail/python-dev/2017-November/150366.html, this is 
an RFE to cover adding a new warning filter to the default set:

once::DeprecationWarning:__main__

This means that all deprecation warnings triggered directly by code in __main__ 
will start being reported again, while deprecation warnings triggered by 
imported modules will continue to be ignored by default.

Thus the following will start emitting DeprecationWarning by default again (as 
they did in 2.6 and earlier):

- experiments at the REPL
- directly executed scripts
- modules executed with the -m switch
- pkg.__main__ submodules executed with the -m switch
- __main__.py files in executed directories and zip archives

However, any code *imported* from these will not trigger warnings.

This means that the following still won't trigger any warnings by default:

- modules imported & functions called from entry point wrapper scripts
- modules imported & functions called from pkg.__main__ submodules
- modules imported & functions called from __main__.py files

The intent behind the change is that it should be much harder for developers 
and educators to miss seeing a deprecation warning at least once for a 
deprecated API, while still silencing deprecation warnings by default for 
deployed Python applications.

--
messages: 305801
nosy: alex, gvanrossum, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: Add a default filter for DeprecationWarning in __main__
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue31974] Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra

2017-11-07 Thread Terry J. Reedy

New submission from Terry J. Reedy :

MacOS Sierra 10.12.6, Python 3.6.1, tk 8.5.15 or .18.  Consider this code with 
arbitrary compound statements and therefore indented lines.

for i in range(10):
if i%2:
print(f(i))

Irv Kalb on idle-dev thread 'Bug in cursor placement in IDLE editor' windows 
reports the following obnoxious behavior: click just to left or on left side of 
'p' and cursor appears on left margin.  Keep clicking and cursor moves right 
one space at a time until arriving next to 'p', where it should immediately go, 
and does on Windows, and, I presume, elsewhere.  (When the cursor first arrives 
at 'p', there is also the double-click selection highlight.)

At my suggestion, he also tested with code inserted directly in a tk Test 
window with this:

import tkinter as tk
root = tk.Tk()
text = tk.Text(root)
sample = '''

'''
text.insert('1.0', sample)
text.pack()
root.mainloop()

and encountered the same bug.  (Hence, this is not an IDLE issue.)The only 
difference is that clicking beside keyword 'if' does not show bug in IDLE but 
does in Text.  He also uploaded an unlisted video to YouTube.
https://www.youtube.com/watch?v=Us8px0BY5rg

Irv's current workaround is to click a letter or two to the right and use <-- 
key.

I realize that this is likely not a tkinter issue either, but I wanted to 
record it and get you two's thoughts.  Is this more likely to be a problem with 
a particular installation, or with at least one macOS release and even 8.5.18.

If the latter, can Irv install Python compiled elsewhere to work with 8.6?  
Ned, do you have a recommendation?

Kevin Walzer reported that he does not see the issue with Python built to run 
with 8.6 and using 8.6.7.  He noted that 8.5.18 does not get bug fixes.  I 
presume that this applies to 8.5 in general.  Will 3.7.0 be compiled for 8.6?

--
messages: 305800
nosy: IrvKalb, ned.deily, serhiy.storchaka, terry.reedy
priority: normal
severity: normal
status: open
title: Cursor misbahavior with Tkinter 3.6.1/tk 8.5 Text on Mac Sierra
type: behavior
versions: 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



[issue24132] Direct sub-classing of pathlib.Path

2017-11-07 Thread Stephen M. Gava

Stephen M. Gava  added the comment:

Using a set of paths with special properties and formats in a project, thought 
"the cleanest oop way to do this is try out python's oop paths in pathlib". 
Subclassed Path to implement my extra (non platfor specific) properties and 
fell at the first hurdle because of this issue... 

for me pathlib does not provide oop paths if i can't subclass Path, for 
whatever reason.

reverted to treating paths as strings and writing functions to handle my 
special path properties and formats.

i was also surprised when i found another bug report on this issue that said it 
was closed for 3.7, great i thought this has been solved, but no, the other 
report was closed because it was about the same issue as this ancient report.

--
nosy: +elguavas

___
Python tracker 

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



[issue25862] TextIOWrapper assertion failure after read() and SEEK_CUR

2017-11-07 Thread Zackery Spytz

Change by Zackery Spytz :


--
nosy: +ZackerySpytz
versions: +Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



[issue31973] Incomplete DeprecationWarning for async/await keywords

2017-11-07 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



[issue31973] Incomplete DeprecationWarning for async/await keywords

2017-11-07 Thread Barry A. Warsaw

New submission from Barry A. Warsaw :

Issue bpo-26182 added DeprecationWarnings for "import async" and "import await" 
since both of those pseudo-keywords were to become actual reserved keywords in 
Python 3.7.  This latter has now happened, but the fix in bpo-26182 is 
incomplete.  It does not trigger warnings on "from .async import foo".

base/
__init__.py
async.py
good.py

-async.py
x = 1

-good.py
from .async import x


$ python3.6 -W error::DeprecationWarning -c "import base.good"
$ python3.7 -c "import base.good"
Traceback (most recent call last):
  File "", line 1, in 
  File "/private/tmp/x1/base/good.py", line 1
from .async import x
  ^
SyntaxError: invalid syntax
$ cd base
$ python3.6 -W error::DeprecationWarning -c "import async"
DeprecationWarning: 'async' and 'await' will become reserved keywords in Python 
3.7

--
messages: 305798
nosy: barry
priority: normal
severity: normal
status: open
title: Incomplete DeprecationWarning for async/await keywords
versions: 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



[issue26692] cgroups support in multiprocessing

2017-11-07 Thread Mihai Capotă

Change by Mihai Capotă :


--
nosy: +mihaic

___
Python tracker 

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



[issue31957] [Windows] PCbuild error: A numeric comparison was attempted

2017-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

Thank you Steve for the quick fix!

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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-07 Thread Pablo Galindo Salgado

Change by Pablo Galindo Salgado :


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



[issue31486] calling a _json.Encoder object raises a SystemError in case obj.items() returned a tuple

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

bpo-28280 fixed this issue only in the master branch. I had left this issue 
open for fixing 3.6.

--
resolution: out of date -> 
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



[issue28791] update sqlite to latest version before beta 1

2017-11-07 Thread Zachary Ware

Zachary Ware  added the comment:

I'd say that's up to Ned and Benjamin.  It's a very simple backport at this 
point.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue31486] calling a _json.Encoder object raises a SystemError in case obj.items() returned a tuple

2017-11-07 Thread Berker Peksag

Berker Peksag  added the comment:

PR 3840 has been merged and it looks like Oren was correct. I'm getting the 
following output with current master:

>>> encoder(obj=BadDict({'spam': 42}), _current_indent_level=4)
['{}']

--
nosy: +berker.peksag
resolution:  -> out of date
stage: needs patch -> 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



[issue31824] Missing default argument detail in documentation of StreamReaderWriter

2017-11-07 Thread Berker Peksag

Berker Peksag  added the comment:

For those who want to work on this issue: codecs.StreamReaderWriter 
documentation is located at Doc/library/codecs.rst.

--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
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



[issue31937] Add the term "dunder" to the glossary

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I never seen terms like "stir" or "inker", but the term "dunder" is used pretty 
widely. The glossary already contains abbreviations and Python folk terminology 
like EAFP and BDFL.

--

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Agreed with Raymond that Python folk terminology should not go into the 
glossary.  I don't think I ever say "dunder" myself.

--
nosy: +pitrou

___
Python tracker 

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



[issue31951] import curses is broken on windows

2017-11-07 Thread joe m

joe m  added the comment:

I would much prefer the curses module to be supported in newer versions  since 
I believe that curses is installed as a built in module (not sure about that).

Anyhow, thank you for your help but I have found a replacement module called 
"asciimatics" which for fills all the functions that I really need.

--

___
Python tracker 

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



[issue31620] asyncio.Queue leaks memory if the queue is empty and consumers poll it frequently

2017-11-07 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset ac4f6d4448fb6f9affb817bafb8357450fe43349 by Andrew Svetlov (Miss 
Islington (bot)) in branch '3.6':
bpo-31620: have asyncio/queues not leak memory when you've exceptions during 
waiting (GH-3813) (#4326)
https://github.com/python/cpython/commit/ac4f6d4448fb6f9affb817bafb8357450fe43349


--

___
Python tracker 

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



[issue31972] Inherited docstrings for pathlib classes are confusing

2017-11-07 Thread Éric Araujo

New submission from Éric Araujo :

pydoc pathlib.Path shows the docstring of PurePath:

 |  PurePath represents a filesystem path and offers operations which
 |  don't imply any actual filesystem I/O.

But immediately after we see methods like chmod, exists and co which obviously 
aren’t pure.  Looking at the reST docs or the source code, the reader can 
deduce that this is the docstring of PurePath inherited by Path, but I find it 
confusing.

Solution: adding docstrings to all pathlib classes.  PurePath and Path can have 
all the info, Posix/Windows* subclasses only one line with a reference.

--
components: Library (Lib)
keywords: easy
messages: 305788
nosy: eric.araujo
priority: normal
severity: normal
stage: needs patch
status: open
title: Inherited docstrings for pathlib classes are confusing
type: enhancement
versions: 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



[issue31425] Expose AF_QIPCRTR in socket module

2017-11-07 Thread Christian Heimes

Change by Christian Heimes :


--
assignee:  -> christian.heimes
nosy: +christian.heimes

___
Python tracker 

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



[issue31620] asyncio.Queue leaks memory if the queue is empty and consumers poll it frequently

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4283

___
Python tracker 

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



[issue31620] asyncio.Queue leaks memory if the queue is empty and consumers poll it frequently

2017-11-07 Thread Andrew Svetlov

Andrew Svetlov  added the comment:


New changeset c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6 by Andrew Svetlov (Suren 
Nihalani) in branch 'master':
bpo-31620: have asyncio/queues not leak memory when you've exceptions during 
waiting (#3813)
https://github.com/python/cpython/commit/c62f0cb3b1f6f9ca4ce463b1c99b0543bdfa38d6


--
nosy: +asvetlov

___
Python tracker 

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



[issue31937] Add the term "dunder" to the glossary

2017-11-07 Thread Mariatta Wijaya

Mariatta Wijaya  added the comment:

Thanks Raymond. +1 for adding the above list. 

I don't think FAQ is the right place either, I prefer we don't have to add the 
entries in the form of questions & answers.

--

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread INADA Naoki

INADA Naoki  added the comment:

Thanks, Julien.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

Thank you for helping with asyncio!  I'll try to get to that transport 
performance issues you found sometime this week.  I've a few ideas how to add 
0-copy support to protocols.

--

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 64f10492dcda4117ac06399ae46ab645cb09b19e by INADA Naoki (Miss 
Islington (bot)) in branch '3.6':
bpo-31793: Doc: Specialize smart-quotes for Japanese (GH-4006)
https://github.com/python/cpython/commit/64f10492dcda4117ac06399ae46ab645cb09b19e


--

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 47eaaa55247b6ad8ae507c0048509c2e3db79bf0 by INADA Naoki (Miss 
Islington (bot)) in branch '2.7':
bpo-31793: Doc: Specialize smart-quotes for Japanese (GH-4006)
https://github.com/python/cpython/commit/47eaaa55247b6ad8ae507c0048509c2e3db79bf0


--

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset d8d218ffda6b7569625ff9edadbbc9a2b1055e32 by Antoine Pitrou in 
branch '3.6':
[3.6] bpo-31970: Reduce performance overhead of asyncio debug mode. (GH-4314) 
(#4322)
https://github.com/python/cpython/commit/d8d218ffda6b7569625ff9edadbbc9a2b1055e32


--

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Thank you for the quick reviews!

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4282

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4281

___
Python tracker 

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



[issue31793] Allow to specialize smart quotes in documentation translations

2017-11-07 Thread INADA Naoki

INADA Naoki  added the comment:


New changeset 5a66c8a64d180b5f3c80307924adaec53cc8faa3 by INADA Naoki (Julien 
Palard) in branch 'master':
bpo-31793: Doc: Specialize smart-quotes for Japanese (GH-4006)
https://github.com/python/cpython/commit/5a66c8a64d180b5f3c80307924adaec53cc8faa3


--
nosy: +inada.naoki

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
resolution:  -> postponed
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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

I guess you can set Resolution to "postponed", Stage to "Resolved".

--

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
pull_requests: +4280

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 921e9432a1461bbf312c9c6dcc2b916be6c05fa0 by Antoine Pitrou in 
branch 'master':
bpo-31970: Reduce performance overhead of asyncio debug mode. (#4314)
https://github.com/python/cpython/commit/921e9432a1461bbf312c9c6dcc2b916be6c05fa0


--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The documentation has been fixed.  Should we close this now?  Ideally I'd 
rather have asyncio warn me in such situations, but I feel this won't be doable.

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 518c6b97868d9c665475a40567b0aa417afad607 by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.6':
bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (GH-4319) 
(#4320)
https://github.com/python/cpython/commit/518c6b97868d9c665475a40567b0aa417afad607


--

___
Python tracker 

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



[issue31965] Incorrect documentation for multiprocessing.connection.{Client, Listener}

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



[issue31965] Incorrect documentation for multiprocessing.connection.{Client, Listener}

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset d9c61c2a2662761dc89e0be14ceb7ea57531c836 by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.6':
bpo-31965: fix doc for multiprocessing.connection.Client and Listener (GH-4304) 
(#4321)
https://github.com/python/cpython/commit/d9c61c2a2662761dc89e0be14ceb7ea57531c836


--

___
Python tracker 

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



[issue31965] Incorrect documentation for multiprocessing.connection.{Client, Listener}

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


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

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Maybe the solution is to fix Tornado?

That's a possibility.  I have to convince Ben Darnell that it deserves fixing 
:-)

Another possibility is to use the asyncio concurrency primitives on Python 3, 
though that slightly complicates things, especially as the various coroutines 
there don't take a timeout parameter.

--
stage: patch review -> 

___
Python tracker 

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



[issue31965] Incorrect documentation for multiprocessing.connection.{Client, Listener}

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 1e5d54cfa031f1de9ee2d2e968e0551b6e2397b7 by Antoine Pitrou (Jelle 
Zijlstra) in branch 'master':
bpo-31965: fix doc for multiprocessing.connection.Client and Listener (#4304)
https://github.com/python/cpython/commit/1e5d54cfa031f1de9ee2d2e968e0551b6e2397b7


--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4278
stage:  -> patch review

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:


New changeset 22b1128559bdeb96907da5840960691bb050d11a by Antoine Pitrou in 
branch 'master':
bpo-31960: Fix asyncio.Future documentation for thread (un)safety. (#4319)
https://github.com/python/cpython/commit/22b1128559bdeb96907da5840960691bb050d11a


--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

> Just try the snippet :-) If you want to see it finish in a finite time, move 
> the future instantiation inside the coroutine.

Yeah, I see the problem.  OTOH your proposed change to lazily attach a loop to 
the future isn't fully backwards compatible.  It would be a nightmare to find a 
bug in a large codebase caused by this change in Future behaviour.  So I'm -1 
on this idea, that ship has sailed.

> Unfortunately that's not possible in our case.  Short version: we are using 
> Tornado which creates a asyncio Future eagerly, see 
> https://github.com/tornadoweb/tornado/blob/master/tornado/locks.py#L199

Maybe the solution is to fix Tornado?

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> So imagine a Future `fut` is completed. And we call `fut.add_done_callback()` 
> in different contexts with different active event loops.  With your 
> suggestion we'll schedule our callbacks in different loops.

I'm wondering: does this situation occur in practice?  Since Future isn't 
threadsafe, is there really a point in using it from several loops at once?

> Ideally you should use `loop.create_future()` when you can (and in libraries 
> you usually can do that) to always make it explicit which loop your Future is 
> attached to.

Unfortunately that's not possible in our case.  Short version: we are using 
Tornado which creates a asyncio Future eagerly, see 
https://github.com/tornadoweb/tornado/blob/master/tornado/locks.py#L199

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

> My underlying question is why the Future has to set its loop in its 
> constructor, instead of simply using get_event_loop() inside 
> _schedule_callbacks().  This would always work.

So imagine a Future `fut` is completed. And we call `fut.add_done_callback()` 
in different contexts with different active event loops.  With your suggestion 
we'll schedule our callbacks in different loops.

Ideally you should use `loop.create_future()` when you can (and in libraries 
you usually can do that) to always make it explicit which loop your Future is 
attached to.

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The call_soon / call_soon_threadsafe distinction is not relevant to the problem 
I posted.  The problem is that the Future is registered with the event loop for 
the thread it was created in, even though it is only ever used in another 
thread (with another event loop).

Just try the snippet :-) If you want to see it finish in a finite time, move 
the future instantiation inside the coroutine.

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

>> I think we should update `Future._schedule_callbacks` to check if the loop 
>> is in debug mode.

> Unfortunately this is not sufficient for the snippet I posted.  The loop's 
> thread_id is only set when the loop runs, but the main loop in that example 
> never runs.

If the loop isn't running, call_soon works just fine from any thread.  

call_soon_threadsafe is different from call_soon when the loop *is* running.  
When it's running and blocked on IO, call_soon_threadsafe will make sure that 
the loop will be woken up.

Currently, _schedule_callbacks() calls loop.call_soon(), which already calls 
loop._check_thread().  So it looks like we don't need to change anything after 
all, right?

--
stage: patch review -> 

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

My underlying question is why the Future has to set its loop in its 
constructor, instead of simply using get_event_loop() inside 
_schedule_callbacks().  This would always work.

--

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread STINNER Victor

Change by STINNER Victor :


--
nosy:  -haypo

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> My opinion on this: update documentation for all Python versions to reflect 
> that Future uses call_soon.

Agreed.

> I think we should update `Future._schedule_callbacks` to check if the loop is 
> in debug mode.

Unfortunately this is not sufficient for the snippet I posted.  The loop's 
thread_id is only set when the loop runs, but the main loop in that example 
never runs.

--

___
Python tracker 

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



[issue31971] idle_test: failures on x86 Windows7 3.x

2017-11-07 Thread STINNER Victor

New submission from STINNER Victor :

http://buildbot.python.org/all/#/builders/58/builds/122

==
ERROR: tearDownClass (idlelib.idle_test.test_configdialog.KeysPageTest)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\idlelib\idle_test\test_configdialog.py",
 line 701, in tearDownClass
del page.set_keys_type, page.load_keys_list
AttributeError: set_keys_type
==
FAIL: test_set_keys_type (idlelib.idle_test.test_configdialog.KeysPageTest)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\idlelib\idle_test\test_configdialog.py",
 line 859, in test_set_keys_type
eq(d.custom_keyset_on.state(), ('selected',))
AssertionError: Tuples differ: ('selected', 'hover') != ('selected',)
First tuple contains 1 additional elements.
First extra element 1:
'hover'
- ('selected', 'hover')
? 
+ ('selected',)

--
components: Tests
messages: 305763
nosy: haypo, terry.reedy
priority: normal
severity: normal
status: open
title: idle_test: failures on x86 Windows7 3.x
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



[issue31966] [EASY C][Windows] print('hello\n', end='', flush=True) raises OSError when ran with py -u

2017-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

The _io__WindowsConsoleIO_write_impl() function should be fixed to not call 
MultiByteToWideChar() but use 0 if the input string is zero. Ok, it makes sense.

In that case, I agree to call it a simple issue ;-)

--
title: print('hello\n', end='', flush=True) raises OSError when ran with py -u 
-> [EASY C][Windows] print('hello\n', end='', flush=True) raises OSError when 
ran with py -u

___
Python tracker 

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



[issue31960] Protection against using a Future with another loop only works with await

2017-11-07 Thread Yury Selivanov

Yury Selivanov  added the comment:

> On the other hand, the Future implementation is entirely not thread-safe 
> (btw, the constructor optimistically claims the done callbacks are scheduled 
> using call_soon_threadsafe(), but the implementation actually calls 
> call_soon()).

This is weird.  PEP 3156 specifies that Future uses call_soon.  The 
implementation uses call_soon.  And it actually makes sense to use call_soon 
for Futures.  

Situations when Future.cancel() or Future.set_result() is called from a 
different thread are extremely rare, so we want to avoid the overhead of using 
call_soon_threadsafe().  Moreover, I bet there are many other cases where 
Future implementation is not threadsafe.

If one absolutely needs to call Future.set_result() from a different thread, 
they can always do `loop.call_soon_threadsafe(fut.set_result, ...)`.

My opinion on this: update documentation for all Python versions to reflect 
that Future uses call_soon.

> Do you think it would be fine for Future._schedule_callbacks() to check the 
> event loop is the current one, or do you think it would impact performance 
> too much (or perhaps it is simply not desirable)?

I think we should update `Future._schedule_callbacks` to check if the loop is 
in debug mode.  If it is call `loop._check_thread()`, which will raise a 
RuntimeError if the current thread is different from the one that the loop 
belongs to.  

This will have no detectable overhead, but will ease debugging of edge cases 
like writing multithreaded asyncio applications.

--

___
Python tracker 

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



[issue31955] distutils C compiler: set_executables() incorrectly parse values with spaces

2017-11-07 Thread Dee Mee

Dee Mee  added the comment:

I agree, that this fix is necessary only for Python 2. Submitted new PR 4316

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



[issue31956] Add start and stop parameters to the array.index()

2017-11-07 Thread Николай Спахиев

Николай Спахиев  added the comment:

I plan to work on a patch.

--

___
Python tracker 

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



[issue31955] distutils C compiler: set_executables() incorrectly parse values with spaces

2017-11-07 Thread Roundup Robot

Change by Roundup Robot :


--
pull_requests: +4275

___
Python tracker 

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



[issue31968] exec(): method's default arguments from dict-inherited globals

2017-11-07 Thread Ilya Polyakovskiy

Change by Ilya Polyakovskiy :


--
pull_requests: +4274

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


--
nosy: +asvetlov

___
Python tracker 

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



[issue31966] print('hello\n', end='', flush=True) raises OSError when ran with py -u

2017-11-07 Thread Eryk Sun

Eryk Sun  added the comment:

The error is in _io__WindowsConsoleIO_write_impl. If it's passed a length 0 
buffer, it still tries to decode it via MultiByteToWideChar, which fails as 
documented. As Serhiy says, it can simply return Python int(0) in the 
zero-length case.

--
nosy: +eryksun

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

If this is accepted on the principle, it would be great to also patch 3.6.

--

___
Python tracker 

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



[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka

Change by Serhiy Storchaka :


--
status: open -> closed

___
Python tracker 

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



[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

There is nothing wrong with this output if you use the first example.

--

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

Change by Antoine Pitrou :


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

___
Python tracker 

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



[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

All work as designed. In your example you don't see a difference because all 
groups are defined. Look at other example:

>>> import re
>>> m = re.match(r'(?:(\w+)@)?(\w+)\.(\w+)', 'hackerrank.com')
>>> m.groups()
(None, 'hackerrank', 'com')
>>> m.groups(1)
(1, 'hackerrank', 'com')
>>> m.groups(1000)
(1000, 'hackerrank', 'com')

--
nosy: +serhiy.storchaka
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra

Narendra  added the comment:

Please look in to the following example:

>>> m.groups()
('narendra', 'happiestmidns', 'com')
>>> m.groups(1)
('narendra', 'happiestmidns', 'com')
>>> m.groups(34)
('narendra', 'happiestmidns', 'com')
>>> m.groups(1000)
('narendra', 'happiestmidns', 'com')
>>>

--
status: closed -> open

___
Python tracker 

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



[issue31970] asyncio debug mode is very slow

2017-11-07 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Each time a new future, handle or task is created, asyncio with debug mode 
enabled will parse the whole call stack and create a StackSummary object for 
it.  Imagine a recursive coroutine: with N nested calls, you get O(N**2) 
performance.

Ideally debug mode wouldn't slow things too much, at least for development and 
testing setups.

--
components: Library (Lib), asyncio
messages: 305752
nosy: giampaolo.rodola, haypo, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: asyncio debug mode is very slow
type: behavior
versions: 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



[issue31968] exec(): method's default arguments from dict-inherited globals

2017-11-07 Thread Ilya Polyakovskiy

Change by Ilya Polyakovskiy :


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

___
Python tracker 

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



[issue31969] re.groups() is not checking the arguments

2017-11-07 Thread Narendra

New submission from Narendra :

Hi Team,

I have observed a bug in re.groups() function behavior in Python as below:

Issue:
re.groups() is not validating the arguments

Example:
>>> m = re.match(r'(\w+)@(\w+)\.(\w+)','usern...@hackerrank.com')
>>> m.groups()
('username', 'hackerrank', 'com')
>>> m.groups(1)
('username', 'hackerrank', 'com')
>>> m.groups(1000)
('username', 'hackerrank', 'com')
>>>

>From the above, its clear that re.groups() and re.groups() both are 
>same. I think re.groups() is not validating the arguments.

Please review the same and provide your comments whether my views are correct 
or wrong

--
components: Regular Expressions
messages: 305751
nosy: ezio.melotti, mrabarnett, narendrac
priority: normal
severity: normal
status: open
title: re.groups() is not checking the arguments
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue31966] print('hello\n', end='', flush=True) raises OSError when ran with py -u

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

I don't know which part of _WindowsConsoleIO.write() fails to handle empty 
bytes string, but the simplest and the most efficient way to fix this bug it to 
add an explicit check for zero length at the begin of this method and return 
Python integer 0 in this case.

The test should check that sys.stdout.buffer.write(b''), 
sys.stdout.buffer.write(b'') and sys.stdout.buffer.raw.write(b'') return 0 (the 
latter to checks should be performed only if the corresponding buffer and raw 
attributes exist). There are special tests for WindowsConsoleIO, it would be 
nice to add an explicit test here too.

--

___
Python tracker 

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



[issue20486] msilib: can't close opened database

2017-11-07 Thread Berker Peksag

Berker Peksag  added the comment:

Thank you, all. The OP's snippet should work now:

>>> import msilib as m
>>> db = m.OpenDatabase('py33.msi', m.MSIDBOPEN_TRANSACT)
>>> db.Commit()
>>> db2 = m.OpenDatabase('py33.msi', m.MSIDBOPEN_TRANSACT)
Traceback (most recent call last):
  File "", line 1, in 
_msi.MSIError: 1: 2203 2: py33.msi 3: -2147287008
>>> db.Close()
>>> db2 = m.OpenDatabase('py33.msi', m.MSIDBOPEN_TRANSACT)

I didn't backport this to bugfix branches since we added a new public function 
to the API.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions:  -Python 2.7, Python 3.6

___
Python tracker 

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



[issue20486] msilib: can't close opened database

2017-11-07 Thread Berker Peksag

Berker Peksag  added the comment:


New changeset a935654f0613640535fbf0ba190f81d02a63d35c by Berker Peksag in 
branch 'master':
bpo-20486: Implement Database.Close() method in msilib (GH-4141)
https://github.com/python/cpython/commit/a935654f0613640535fbf0ba190f81d02a63d35c


--

___
Python tracker 

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



[issue31968] exec(): method's default arguments from dict-inherited globals

2017-11-07 Thread R. David Murray

R. David Murray  added the comment:

Yes, that's the way it works (and is intended to work, for performance 
reasons).  The documentation on this could be improved...while it does say 
globals must be a dict and that locals can be any mapping object, it does it in 
a sentence that is a bit confusing in this context, and it doesn't make it 
clear that it has to be a "real" dict, not a subclass.  (I wouldn't be 
surprised if that sentence was written back when you couldn't subclass dict.)

--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, r.david.murray
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue31968] exec(): method's default arguments from dict-inherited globals

2017-11-07 Thread Ilya Polyakovskiy

Change by Ilya Polyakovskiy :


--
type:  -> behavior

___
Python tracker 

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



[issue31968] exec(): method's default arguments from dict-inherited globals

2017-11-07 Thread Ilya Polyakovskiy

New submission from Ilya Polyakovskiy :

I'm using exec() to run code with globals object inherited from dict. The 
problem is overloaded __getitem__ doesn't called to load default argument for 
class methods.
Here the example. Let's assume we create some variable storage for code 
execution

class Env(dict):
def __init__(self, external_storage):
super().__init__()
self._external_storage = external_storage

def __setitem__(self, key, value):
print('__setitem__: {}'.format(key))
self._external_storage[key] = value

def __getitem__(self, key):
print('__getitem__: {}'.format(key))
return self._external_storage[key]


storage = {}
env = Env(storage)
env['var'] = 2

exec("""
class A:
def foo(self, x=var):
print('foo(): {}'.format(x))

a = A()
a.foo()
""", env)

This code will fail with output:
__setitem__: var
Traceback (most recent call last):
  File "inheri-test.py", line 29, in 
""", env)
  File "", line 2, in 
  File "", line 3, in A
NameError: name 'var' is not defined


As far as I understand the problem is Python/ceval.c:2120. There is only 
PyDict_GetItem used to load variable from f_globals, instead of 
PyObject_GetItem in case of f_globals is not exact dict.

--
components: Interpreter Core
messages: 305746
nosy: Ilya Polyakovskiy
priority: normal
severity: normal
status: open
title: exec(): method's default arguments from dict-inherited globals
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue28791] update sqlite to latest version before beta 1

2017-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

> sqlite-3.15.1 fixes an old annoying bug (hidden since 3.8.0)

Since the bug seems to be important, maybe it's worth it to backport the commit 
upgrading SQLite to Python 2.7 and 3.6?

--

___
Python tracker 

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



[issue31966] print('hello\n', end='', flush=True) raises OSError when ran with py -u

2017-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

serhiy.storchaka: "keywords: + easy (C)"

For easy issue, you should explain how do you want the issue to be fixed.

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-07 Thread STINNER Victor

STINNER Victor  added the comment:

For allocations larger than 512 bytes, PyObject_Malloc() calls 
PyMem_RawMalloc(). When debug hooks are installed, PyObject_Malloc() calls a 
debug hook which calls PyMem_RawMalloc() which calls another debug hook.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

Also, based on reviewing this, I suspect the same approach would also work for 
the pure Python profile module.

--

___
Python tracker 

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



[issue21862] cProfile command-line should accept "-m module_name" as an alternative to script path

2017-11-07 Thread Nick Coghlan

Nick Coghlan  added the comment:

I added an inline comment on the PR - I think what's there now would work fine, 
but I also suggested a slightly shorter and clearer (at least to me) 
alternative.

--

___
Python tracker 

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



[issue31889] difflib SequenceMatcher ratio() still have unpredictable behavior

2017-11-07 Thread Simon Descarpentries

Simon Descarpentries  added the comment:

Hi,

I missed the part of the doc you pointed out, being focused on ratio()
function family.

Thanks for your gentle reply.

--

___
Python tracker 

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



[issue31967] [Windows] test_distutils: fatal error LNK1158: cannot run 'rc.exe'

2017-11-07 Thread David Bolen

David Bolen  added the comment:

Ok, so rc.exe appears truly not to be found when the test runs.  The binary is 
a bit buried in the Windows Kit directory tree, and I'm guessing something is 
off after the upgrade (I'm not sure where it was in the tree before).  I 
manually placed a copy in a directory I know is on the path and that seems to 
have resolved it.

I also found a similar copy of rc.exe from the SDK to a local directory on my 
Windows 7 worker, so I suspect that was what I was remembering, and I probably 
hit the same thing when updating the SDK on that worker previously.

Not sure if there's some better way it should work, but at least this resolves 
the issue from the SDK update - builds are currently in progress, but both 
workers passed test_distutils.

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-07 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Yet one issue is left. In debug mode two debug allocators are used, the one is 
nested in the other. Is it correct?

--

___
Python tracker 

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



[issue31626] Writing in freed memory in _PyMem_DebugRawRealloc() after shrinking a memory block

2017-11-07 Thread STINNER Victor

Change by STINNER Victor :


--
pull_requests: +4271

___
Python tracker 

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



  1   2   >