[issue24905] Allow incremental I/O to blobs in sqlite3

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry Aviv, I just forget about this issue.

Added new comments on Rietveld. Many lines in sqlite3.rst still are too long.

It would be worth to ask other developers about wanted interface.

--
stage:  -> patch review
versions: +Python 3.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



[issue29446] Improve tkinter 'import *' situation

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--

___
Python tracker 

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



[issue29450] xattr functions aren't in os.supports_fd, os.supports_follow_symlinks

2017-02-05 Thread Omar Sandoval

New submission from Omar Sandoval:

{get,list,remove,set}xattr all support fds and follow_symlinks, but they are 
not in the os.supports_fds and os.supports_follow_symlinks sets. The attached 
patch adds them. There are no HAVE_* features for the f and l variants of these 
syscalls since it's an all-or-nothing thing, so we always add them if the 
functions are defined.

--
components: Extension Modules
files: xattrsupports.patch
keywords: patch
messages: 287042
nosy: Omar Sandoval, benjamin.peterson
priority: normal
severity: normal
status: open
title: xattr functions aren't in os.supports_fd, os.supports_follow_symlinks
type: enhancement
versions: Python 3.7
Added file: http://bugs.python.org/file46522/xattrsupports.patch

___
Python tracker 

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



[issue29451] Use _PyArg_Parser for _PyArg_ParseStack(): support positional only arguments

2017-02-05 Thread STINNER Victor

New submission from STINNER Victor:

Serhiy Storshaka wrote a kind of cache for PyArg_ParseTupleAndKeywords(): 
_PyArg_Parser structure used by _PyArg_ParseTupleAndKeywordsFast(). It makes 
argument parser much faster.

Would it be possible to modify it to be able to use it in _PyArg_ParseStack(). 
(Would it be faster?)

See also issue #29419 "Argument Clinic: inline PyArg_UnpackTuple and 
PyArg_ParseStack(AndKeyword)?" for a different kind of optimization.

--
components: Interpreter Core
messages: 287043
nosy: haypo, inada.naoki, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use _PyArg_Parser for _PyArg_ParseStack(): support positional only 
arguments
type: performance
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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch changes index(), insert() and rotate() functions of the 
collections.deque type to use FASTCALL calling convention. I chose to only 
modify these functions since they use METH_VARARGS which requires to create a 
temporary tuple, whereas other functions use METH_NOARGS or METH_O which is 
already fast ;-)

I know that Raymond, maintainer of the collections module, is not a big fan of 
Argument Clinic ;-) So I wrote the minimum change and chose to not use Argument 
Clinic yet. By the way, the index() method has the signature "D.index(value, 
[start, [stop]])" which is not supported by Argument Clinic yet: see issue 
#29299. For these reasons, I propose to wait to convert collections.deque to 
Argument Clinic, it can be done later.
 
Ok, now the cool part: it makes these methods faster ;-)

* d.rotate(): 1.10x faster
* d.rotate(1): 1.24x faster
* d.insert(): 1.18x faster
* d.index(): 1.24x faster

$ ./python -m perf timeit -s 'import collections; d=collections.deque()' 
'd.rotate()' --compare-to=../default-ref/python 

Median +- std dev: [ref] 70.5 ns +- 0.9 ns -> [patch] 64.2 ns +- 0.3 ns: 1.10x 
faster (-9%)

$ ./python -m perf timeit -s 'import collections; d=collections.deque()' 
'd.rotate(1)' --compare-to=../default-ref/python

Median +- std dev: [ref] 107 ns +- 1 ns -> [patch] 86.2 ns +- 1.1 ns: 1.24x 
faster (-20%)

$ ./python -m perf timeit -s 'import collections' 'd=collections.deque(); 
d.insert(0, None); d.insert(1, None); d.insert(2, None); d.insert(3, None); 
d.insert(4, None)' --compare-to=../default-ref/python -p3

Median +- std dev: [ref] 699 ns +- 6 ns -> [patch] 591 ns +- 5 ns: 1.18x faster 
(-15%)

$ ./python -m perf timeit -s 'import collections; d=collections.deque((None,))' 
'd.index(None)' --compare-to=../default-ref/python 

Median +- std dev: [ref] 115 ns +- 1 ns -> [patch] 92.5 ns +- 0.8 ns: 1.24x 
faster (-19%)

--
files: deque.patch
keywords: patch
messages: 287044
nosy: haypo, rhettinger, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Use FASTCALL for collections.deque methods: index, insert, rotate
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46523/deque.patch

___
Python tracker 

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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread STINNER Victor

Changes by STINNER Victor :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue29451] Use _PyArg_Parser for _PyArg_ParseStack(): support positional only arguments

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't think it would be faster.

But it is possible to get rid of some code duplication at the cost of making it 
slower.

--

___
Python tracker 

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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think _PyArg_NoStackKeywords() should be called before _PyArg_ParseStack(), 
otherwise this can cause not correct error messages.

--

___
Python tracker 

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



[issue28164] _PyIO_get_console_type fails for various paths

2017-02-05 Thread Eryk Sun

Eryk Sun added the comment:

It's an ugly inconsistency that GetFullPathName fails for bare CONIN$ and 
CONOUT$ prior to Windows 8, in that it gives a different result from simply 
passing those names to CreateFile. Anyway, thanks for modifying it to work 
correctly in this case.

We should test that _WindowsConsoleIO isn't used on Windows 7 and earlier when 
accessing CONIN$ or CONOUT$ in a directory. How about the following?

temp_path = tempfile.mkdtemp()
self.addCleanup(support.rmtree, temp_path)

conout_path = os.path.join(temp_path, 'CONOUT$')
   
with open(conout_path, 'wb', buffering=0) as f:
if sys.getwindowsversion()[:2] > (6, 1):
self.assertIsInstance(f, ConIO)
else:
self.assertNotIsInstance(f, ConIO)

--

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Removes `keys = sorted(keywords.keys())` from function example and removes the 
text that describes why this was necessary. As per PEP 468, this note is 
obsolete for 3.6+

Also changes the ordering of the function call to match the previous output.

--
assignee: docs@python
components: Documentation
files: controlflowdiff.patch
keywords: patch
messages: 287048
nosy: Jim Fasarakis-Hilliard, docs@python
priority: normal
severity: normal
status: open
title: Remove reference to undefined dictionary ordering in Tutorial
versions: Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46524/controlflowdiff.patch

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29446] Improve tkinter 'import *' situation

2017-02-05 Thread Eric V. Smith

Eric V. Smith added the comment:

Instead of:
__all__ = [name for name in globals() if not name.startswith('_') and name not 
in {'enum', 're', 'sys', 'wantobjects'}]

Maybe this would be less fragile:
import types
__all__ = [name for name, obj in globals().items() if not name.startswith('_') 
and not isinstance(obj, types.ModuleType) and name not in {'wantobjects'}]

That is, exclude all modules. Admittedly, I had to import types, but there are 
other ways to do this test without that import.

--
nosy: +eric.smith

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread INADA Naoki

INADA Naoki added the comment:

LGTM

--
nosy: +inada.naoki

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread R. David Murray

R. David Murray added the comment:

It is not (yet) a language requirement that ordinary dictionaries be ordered.  
This patch may become appropriate in 3.7, but that has not yet been determined. 
 It is not appropriate for 3.6.  In 3.6, the order of keys in an ordinary 
dictionary is still undefined, even though it is in practice consistent in 
CPython.

--
nosy: +r.david.murray
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



[issue29446] Improve tkinter 'import *' situation

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This also excludes "constants" implicitly added by importing names from 
tkinter.constants. I don't know whether this is good or bad.

Interesting, but

from tkinter import *
import tkinter.ttk

and

import tkinter.ttk
from tkinter import *

have different effects.

--

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Isn't it a language requirement that `**kwargs` be ordered in 3.6, David? 

PEP 468 states that `**kwargs` is to be an ordered *mapping* and, if I'm not 
mistaken, that was done in order to not depend on the fact that dicts became 
ordered. I might have understood something wrong, though :-)

--

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Xiang Zhang

Xiang Zhang added the comment:

David, actually I have the same thoughts as Jim. Ordered ordinary dicts is not 
a feature but ordered **kwargs is in 3.6. They seems not the same thing.

--

___
Python tracker 

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



[issue29454] Shutting down consumer on a remote queue

2017-02-05 Thread Tom

New submission from Tom:

Using code adapted from the example in the docs 
(https://docs.python.org/3/library/multiprocessing.html#using-a-remote-manager),
 if you create a remote queue server, a producer which puts items in the queue 
and a consumer which consumes elements from the queue. If the consumer gets 
killed and restarted again, it misses one item from the queue. For a 
reproducable example see the stackoverflow reference below.

Expected: items stay in the queue until a consumer consumes it
Happens: one item still gets consumed from the queue even if after a consumer 
gets killed

Version: Python 3.6.0
OS: Ubuntu 16.10

reference: 
http://stackoverflow.com/questions/42052248/remote-queue-consumer-misses-first-message-after-restart

--
messages: 287055
nosy: Semi
priority: normal
severity: normal
status: open
title: Shutting down consumer on a remote queue
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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I would not change the order of keyword arguments, but rather change the output.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

It was a random decision on my part, Serhiy, since I didn't see any difference. 
Why would you go the other way around?

--

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Because it shows preserving the order of keyword arguments (rather than sorting 
by keyword name).

--

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Indeed, good point. Changed it to the suggested way.

--
Added file: http://bugs.python.org/file46525/controlflowdiff2.patch

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thanks Jim.

But maybe it is worth to mention that the output corresponds to the order of 
passed keyword arguments.

--
stage:  -> commit review

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread R. David Murray

R. David Murray added the comment:

You are correct, I didn't read the full context of the diff.  My apologies.

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



[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-02-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8ccb3ad39ee4 by Serhiy Storchaka in branch 'default':
Issue #20186: Regenerated Argument Clinic.
https://hg.python.org/cpython/rev/8ccb3ad39ee4

--

___
Python tracker 

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



[issue20186] Derby #18: Convert 31 sites to Argument Clinic across 23 files

2017-02-05 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 5762cf299f863e06244e6b44ba3a91efee7b35c1 by Serhiy Storchaka in 
branch 'master':
Issue #20186: Regenerated Argument Clinic.
https://github.com/python/cpython/commit/5762cf299f863e06244e6b44ba3a91efee7b35c1


--

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-02-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46527/clinic_list_v5.diff

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-02-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46528/clinic_type_v5.diff

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a set of patches based on issue20185_conglomerate_v4.diff. They are 
synchronized with current sources. Addressed Martin's comments,converted 
list.index(), float.__round__() and resource.prlimit() and made other minor 
changes.

--
Added file: http://bugs.python.org/file46526/clinic_float_v5.diff

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-02-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46530/clinic_resource_v5.diff

___
Python tracker 

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



[issue20185] Derby #17: Convert 49 sites to Argument Clinic across 13 files

2017-02-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file46529/clinic_marshal_v5.diff

___
Python tracker 

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



[issue29442] Use argparse and drop dirty optparse hacks in setup.py

2017-02-05 Thread Brett Cannon

Changes by Brett Cannon :


--
nosy:  -brett.cannon

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2017-02-05 Thread Aviv Palivoda

Aviv Palivoda added the comment:

Thanks for the CR Serhiy. Attached is a new patch after the fixes from the CR.

What other developers should I ask? The interface is file like and is the same 
as apsw.

--
Added file: http://bugs.python.org/file46531/blob3.patch

___
Python tracker 

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



[issue29431] Add a PYTHONREVERSEDICTKEYORDER environment variable

2017-02-05 Thread lamby

lamby added the comment:

> order of other dicts are implementation detail.

Right, exactly :)

--

___
Python tracker 

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



[issue29431] Add a PYTHONREVERSEDICTKEYORDER environment variable

2017-02-05 Thread STINNER Victor

STINNER Victor added the comment:

While the use case makes sense, test if an application relies on the dictionary 
iterating order, I'm not sure that adding an option to change the order.

For me, it's a rare and very specific use case, whereas your option is public 
and "too easy" to find and use. For example, what if a developer decides that 
its application now requires this option to run?

Moreover, your code changes performance critical code. I don't want to get a 
slowdown here for rare use case, since we spent a lot of time to optimize these 
functions!

I suggest you to try to implement your feature in a dict subtype in a third 
party module, and try to monkey-patch applications to use your type. Attached 
hack_dict.py is an example, but it only handles code explicitly calling the 
"dict()" type to create a dictionray.

Another option for you is to maintain your downstream CPython patch, sorry.

--
nosy: +haypo
Added file: http://bugs.python.org/file46532/hack_dict.py

___
Python tracker 

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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread STINNER Victor

STINNER Victor added the comment:

deque-2.patch calls _PyArg_NoStackKeywords() before _PyArg_ParseStack().

--
Added file: http://bugs.python.org/file46533/deque-2.patch

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2017-02-05 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
assignee: docs@python -> serhiy.storchaka

___
Python tracker 

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



[issue29454] Shutting down consumer on a remote queue

2017-02-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +davin
type:  -> behavior

___
Python tracker 

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



[issue968063] Add fileinput.islastline()

2017-02-05 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the updated patch, but I'm not sure FileInput class needs a 
islastline() method. I couldn't find any similar or duplicate feature requests 
on the tracker after this opened in 2004 (which is a sign that the need for 
this method is low.)

Also, the patch needs some work. Some comments:

* There is no documentation changes to Doc/library/fileinput.rst
* 'mark' is unused in Lib/fileinput.py
* Not sure why we need 't1 = t2 = t3 = None' in tests
* We could use self.addCleanup() instead of 'try...finally'
* fileinput.islastline() is not tested. We could reuse 
Test_fileinput_isfirstline.

According to commit history of Lib/fileinput.py, Serhiy has done a lot of work 
in the past few years. I just added him to nosy list to get his feedback.

--
nosy: +berker.peksag, serhiy.storchaka
stage: needs patch -> patch review
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue29405] improve csv.Sniffer().sniff() behavior

2017-02-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 724d1aa7589b by Xiang Zhang in branch 'default':
Issue #29405: Make total calculation in _guess_delimiter more accurate.
https://hg.python.org/cpython/rev/724d1aa7589b

--
nosy: +python-dev

___
Python tracker 

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



[issue29405] improve csv.Sniffer().sniff() behavior

2017-02-05 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks Milt. I committed with my change not because it's better, but I want to 
make the change small so others won't get unfamiliar with the new code. :-)

--
resolution:  -> fixed
stage: commit 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



[issue29405] improve csv.Sniffer().sniff() behavior

2017-02-05 Thread Roundup Robot

Roundup Robot added the comment:


New changeset 6d0a09623155710680ff19f05f279d45c007a304 by Xiang Zhang in branch 
'master':
Issue #29405: Make total calculation in _guess_delimiter more accurate.
https://github.com/python/cpython/commit/6d0a09623155710680ff19f05f279d45c007a304


--

___
Python tracker 

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



[issue29405] improve csv.Sniffer().sniff() behavior

2017-02-05 Thread Berker Peksag

Berker Peksag added the comment:

> [...] but I want to make the change small so others won't get unfamiliar with 
> the new code. :-)

Assuming it doesn't cause any behavior changes, I find Milt's patch simple 
enough and easier to understand than the version uses 'iteration' variable.

--
nosy: +berker.peksag

___
Python tracker 

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



[issue29405] improve csv.Sniffer().sniff() behavior

2017-02-05 Thread Xiang Zhang

Xiang Zhang added the comment:

I am fine with any version (both are simple and not the hardest part to 
understand in the logic). :-) I have no opinion on which is better.

--

___
Python tracker 

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



[issue29455] Mention coverage.py in trace module documentation

2017-02-05 Thread Brett Cannon

New submission from Brett Cannon:

In the trace module it would be nice to also mention that coverage.py is 
available.

--
assignee: docs@python
components: Documentation
messages: 287075
nosy: brett.cannon, docs@python
priority: normal
severity: normal
status: open
title: Mention coverage.py in trace module documentation
type: enhancement

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-02-05 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Hi everyone,

I made a patch to clarify that "or'ed" here really means "bitwise-OR'ed", and 
made a reference to the section of the docs about bitwise OR.

Please review and let me know if this will work.

Thanks.

--
keywords: +patch
Added file: http://bugs.python.org/file46534/issue29371.patch

___
Python tracker 

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



[issue29371] Typo in doctest documentation

2017-02-05 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
stage:  -> patch review

___
Python tracker 

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



[issue29456] bug in unicodedata.normalize: u1176

2017-02-05 Thread Wonsup Yoon

New submission from Wonsup Yoon:

unicodedata can't normalize(NFC) hangul strings which contain \u1176(HANGUL 
JUNGSEONG A-O).

>>> from unicodedata import normalize
>>> normalize("NFC", "\u1100\u1176\u11a8")
'깍'

=> should be "\u1100\u1176\u11a8" not '깍' (\uae4d)

I attached a patch for this issue. (Fixing boundary of modern medial vowels)

--
components: Unicode
files: u1176.patch
keywords: patch
messages: 287077
nosy: ezio.melotti, haypo, pusnow
priority: normal
severity: normal
status: open
title: bug in unicodedata.normalize: u1176
versions: Python 2.7, Python 3.6
Added file: http://bugs.python.org/file46535/u1176.patch

___
Python tracker 

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



[issue29456] bug in unicodedata.normalize: u1176

2017-02-05 Thread Xiang Zhang

Xiang Zhang added the comment:

How about the third character's range? The code seems assuming it's 
[11a7..11c3] while the spec is [11a8..11c2]?

>>> unicodedata.normalize("NFC", "\u1100\u1175\u11a7")
'기'

while it should be '기ᆧ'?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29456] bug in unicodedata.normalize: u1176

2017-02-05 Thread Wonsup Yoon

Wonsup Yoon added the comment:

I think you are right. The modern final consonants is [11a8..11c2].
I attached another patch for this issue.

--
Added file: http://bugs.python.org/file46536/u11a7u11c3.patch

___
Python tracker 

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



[issue968063] Add fileinput.islastline()

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is outdated. It uses private _buffer attribute which no longer exist 
(see issue15068). But even when _buffer was existing the patch was not correct, 
because _buffer contained only a part of the file.

It is possible to implement islastline(), but at the cost of additional 
buffering. This effectively negates the result of issue15068. The user would 
need to enter two lines first than fileinput could return the fist one from 
stdin. And additional complication slows down reading for all users even if 
they don't need islastline().

If you need islastline() you can use a wrapper:

def yield_line_and_islastline(f):
try:
prevline = next(f)
except StopIteration:
return
for line in f:
yield (prevline, f.isfirstline())
prevline = line
yield prevline, True

--

___
Python tracker 

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



[issue24905] Allow incremental I/O to blobs in sqlite3

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

apsw has different order of arguments for blobopen(), all arguments are 
mandatory, and the parameter for read/write mode is called "writeable" rather 
than "readonly". This part of API needs to be discussed. Ask for discussion on 
mailing lists: Python-Ideas and maybe Python-List.

--

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Hugo Osvaldo Barrera

New submission from Hugo Osvaldo Barrera:

As the the posix spec for strftime:

%c   The preferred date and time representation for the current locale.
%x   The preferred date representation for the current locale without the time.

However, python doesn't seem to respect this:

$ python3.5 -c "from datetime import datetime; 
print(datetime.now().strftime('%x'))"
02/06/17

$ date +%x  # This one is right:
2017-02-06

$ echo $LC_TIME
en_DK.UTF-8

* The same applies for '%c'.
* The same applies for other python versions.
* The same applies regardless of LC_TIME and LANG.
* The same applies to time.strftime()
* I tried a few different LC_TIME values, with the same result every time.

--
components: Extension Modules
messages: 287082
nosy: hobarrera
priority: normal
severity: normal
status: open
title: strftime('%x') does not use my locale
type: behavior
versions: Python 2.7, Python 3.4, 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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is simple and technically it looks correct, but I'm not a fan of 
using FASTCALL outside of Argument Clinic at this stage. The API still can be 
changed. Fortunately only three deque methods could have a benefit from using 
FASTCALL.

--

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Martin Panter

Martin Panter added the comment:

Have you tried enabling the locale with locale.setlocale()? I believe Python 
only enables LC_CTYPE by default, so other locale aspects like LC_TIME won’t 
work until they are enabled.

--
nosy: +martin.panter

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Martin Panter

Martin Panter added the comment:

>>> datetime.now().strftime("%x")
'02/06/17'
>>> from locale import setlocale, LC_TIME
>>> setlocale(LC_TIME)
'C'
>>> setlocale(LC_TIME, "en_US.utf8")
'en_US.utf8'
>>> datetime.now().strftime("%x")
'02/06/2017'

--

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Eryk Sun

Eryk Sun added the comment:

As Martin said, you need to set the LC_TIME category using an empty string to 
use the locale LC_* environment variables. Python 3 sets LC_CTYPE at startup 
(on Unix platforms only), but LC_TIME is left in the initial C locale:

>>> locale.setlocale(locale.LC_CTYPE, None)
'en_DK.UTF-8'
>>> locale.setlocale(locale.LC_TIME, None)
'C'
>>> time.strftime('%x')
'02/06/17'

>>> locale.setlocale(locale.LC_TIME, "")
'en_DK.UTF-8'
>>> time.strftime('%x')
'2017-02-06'

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



[issue29028] Use-After-Free in PyString_FromStringAndSize() of stringobject.c

2017-02-05 Thread Ammar Askar

Ammar Askar added the comment:

Did you forget to close this or is this not fixed, Serhiy?

--

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Hugo Osvaldo Barrera

Hugo Osvaldo Barrera added the comment:

It would seem that

locale.setlocale(locale.LC_TIME, "")

fixes the issue. However, there seems to be no mention on this on the relevant 
documentation page[1], which is actually the source of my confusion.

As a "fix" to this issue (since I'm probably not the first nor last person to 
come across it), can we add a note regarding this below the table in section 
8.1.8.

[1]: 
https://docs.python.org/3.6/library/datetime.html#strftime-strptime-behavior

--

___
Python tracker 

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



[issue29458] random.seed version=1 behavior

2017-02-05 Thread Maciej Obarski

New submission from Maciej Obarski:

random.seed version=1 wont generate the same randint sequences in python2 and 
python3

Python 2.7:
>>> seed(1); randint(0,100)
13

Python 3.6:
>>> seed(1,version=1); randint(0,100)
17

The documentation states that versio=1 is "provided for reproducing random 
sequences from older versions of Python" and "If a new seeding method is added, 
then a backward compatible seeder will be offered."

--
components: Extension Modules
messages: 287089
nosy: Maciej Obarski
priority: normal
severity: normal
status: open
title: random.seed version=1 behavior
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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Xiang Zhang

Xiang Zhang added the comment:

I doubt the info belongs to datetime module documentation. When you encounter 
locale related problems maybe it's better for you to refer locale module 
documentation, and it mentions this behaviour 
https://docs.python.org/3/library/locale.html#background-details-hints-tips-and-caveats.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue29458] random.seed version=1 behavior

2017-02-05 Thread Xiang Zhang

Changes by Xiang Zhang :


--
nosy: +haypo, mark.dickinson, rhettinger

___
Python tracker 

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



[issue29452] Use FASTCALL for collections.deque methods: index, insert, rotate

2017-02-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Over this looks good.  Just one other minor tweak (one that has served me well 
elsewhere) would be to bypass the cross-module function call with a cheap (near 
zero cost) register variable test:

if (kwnames != NULL && !_PyArg_NoStackKeywords("rotate", kwnames)) {
return NULL;
}

--

___
Python tracker 

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



[issue26355] Emit major version based canonical URLs for docs

2017-02-05 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
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



[issue29458] random.seed version=1 behavior

2017-02-05 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue29453] Remove reference to undefined dictionary ordering in Tutorial

2017-02-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Patch 2 looks fine to me.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29457] strftime('%x') does not use my locale

2017-02-05 Thread Hugo Osvaldo Barrera

Hugo Osvaldo Barrera added the comment:

The problem is that the datetime/strftime documentation describes "%c" as:

Locale’s appropriate date and time representation.

However, this is not really accurate (this is not the *default* behaviour), 
that's why I was mentioning the clarification. IMHO, a mere mere link to that 
caveats section would be enough.

Maybe looking at the locale section sounded intuitive to you because you're 
already familiar with it, but for people who don't KNOW that there's a caveats 
section there, it's not really obvious.

--

___
Python tracker 

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



[issue29458] random.seed version=1 behavior

2017-02-05 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry Marciej, this isn't a bug.  The seeders are consistent. It is the code 
for randint() that has changed (to fix a minor imbalance in the distribution).  

$ python2.7 -c "from random import *; seed(1); print(repr(random()))"
0.13436424411240122
$ python3.5 -c "from random import *; seed(1); print(repr(random()))"
0.13436424411240122

The reproducibility guarantee is limited to the seeder and the output of 
random().  The downstream algorithms are allowed to change.  See
https://docs.python.org/3/library/random.html#notes-on-reproducibility

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