[issue19518] Add new PyRun_xxx() functions to not encode the filename

2015-08-04 Thread Adam Bartoš

Adam Bartoš added the comment:

I'm not sure this is the right issue. The support for Unicode filenames is not 
(at least on Windows) ideal.

Let α.py be a Python script with invalid syntax.

 py α.py
  File encoding error, line 2
as as compile error
 ^
SyntaxError: invalid syntax

On the other hand, if run.py is does something like

path = sys.argv[1]
with tokenize.open(path) as f:
source = f.read()
code = compile(source, path, exec)
exec(code, __main__.__dict__)

we get 
 py run.py α.py
  File Python Unicode\\u03b1.py, line 2
as as compile error
 ^
SyntaxError: invalid syntax

(or 'File Python Unicode\α.py, line 2' depending on whether sys.stdout can 
encode the string).

So the encoding error in the first example is unfortunate as it is easy to 
get better result even by a simple pure Python approach.

--
nosy: +Drekin

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



[issue24747] ctypes silently truncates ints larger than C int

2015-08-04 Thread Christopher Meng

Changes by Christopher Meng cicku...@gmail.com:


--
nosy: +Christopher Meng

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



[issue9517] Make test.script_helper more comprehensive, and use it in the test suite

2015-08-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Berker committed the original patch to move the helper module, so adjusting the 
stage back to reflect the ongoing review on related issues.

--
keywords:  -easy
stage: commit review - patch review

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



[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-04 Thread Peter Otten

Peter Otten added the comment:

The sniffer actually changes its mind in the fourth line:

Python 3.4.0 (default, Jun 19 2015, 14:20:21) 
[GCC 4.8.2] on linux
Type help, copyright, credits or license for more information.
 import csv
 csv.Sniffer().sniff(\
... Invoice File,Credit Memo,Amount Claimed,Description,Invoice,Message,
... Sscanner ac15072911220.pdf,CM_15203,28714.32,MX Jan Feb,948198,,
... Sscanner ac15072911221.pdf,CM 16148,15600,MX Unkwon,948199,,
... ).delimiter
','
 csv.Sniffer().sniff(\
... Invoice File,Credit Memo,Amount Claimed,Description,Invoice,Message,
... Sscanner ac15072911220.pdf,CM_15203,28714.32,MX Jan Feb,948198,,
... Sscanner ac15072911221.pdf,CM 16148,15600,MX Unkwon,948199,,
... Sscanner ac15072911230.pdf,CM 16148,33488,MX Cavalier,948200,Photos don't 
match the invoice
... ).delimiter
'M'

That line has only 5 commas while all others have 6. Unfortunately all lines 
contain exactly two M...

--
nosy: +peter.otten

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



[issue20180] Derby #11: Convert 50 sites to Argument Clinic across 9 files

2015-08-04 Thread Tal Einat

Tal Einat added the comment:

Summary of the current state of this AC conversion derby group:

1) The collections, itertools and random modules should not be converted (at 
least for now).

2) The three example modules should not be converted (Modules/xxlimited.c, 
Modules/xxmodule.c and Modules/xxsubtype.c).

3) The latest unicodeobject.c patch has a LGTM from Serhiy after several rounds 
of review and improvement. This should probably go in at some point.

4) The single PyArg_ParseTuple in find.h should not be converted, since that is 
actually used for more than a single find() method via some precompiler macro 
magic.

5) transmogrify.h can be converted and has a conversion patch, but the patch 
likely needs updating since it is from Jan. 2014.

--
status: pending - open

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



[issue17570] Improve devguide Windows instructions

2015-08-04 Thread Steve Dower

Steve Dower added the comment:

Looks like the patchcheck section also has a PCBuild/python.exe that should 
be fixed.

Are the previous commenters satisfied with the fixes?

--

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



[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-04 Thread Skip Montanaro

Skip Montanaro added the comment:

I should have probably pointed out that the Sniffer class is the unloved 
stepchild of the csv module. In my experience it is rarely necessary. You 
either:

* Are reading CSV files which are about what Excel would produce with its 
default settings

or

* Know just what your format is, and can define the various parameters easily

It's pretty rare, I think, to get a delimited file in some format which is 
completely unknown and which thus has to be deduced.

As Peter showed, the Sniffer class is also kind of unreliable. I didn't write 
it, and there are precious few test cases for it. One of your datasets should 
probably be added to the mix and bugs fixed.

--

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



[issue17570] Improve devguide Windows instructions

2015-08-04 Thread Zachary Ware

Zachary Ware added the comment:

In the patch:

-add configuration settings to ``~/.hgrc`` for the relevant repo(s) (remember
+add configuration settings to ``~/.hgrc`` (``mercurial.ini`` on Windows)
+for the relevant repo(s) (remember

This is nonsensical, `~/.hgrc` (`%USERPROFILE%\Mercurial.ini`) is the 
user-level Mercurial configuration; the settings for the relevant repo(s) are 
in `.hg/hgrc` in the repository (same on all platforms).

Btw, for me, the user-level config file on Windows has always been title-cased 
(`Mercurial.ini`) unless I preemptively created it myself.  Really doesn't 
matter, though :)

--

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



[issue24790] Idle: improve stack viewer

2015-08-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

5. Change title to something better than 'Idle'.  Perhaps 'Idle Shell 
Traceback'?

--

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



[issue24790] Idle: improve stack viewer

2015-08-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

5b. Add Python version to end of , as with Shell window.

This will be more than one patch. Some should be easy.

--
keywords: +easy

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



[issue24791] *args regression

2015-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3c170f68407f by Zachary Ware in branch '3.4':
Issue #24791: Add tests for things that regressed with PEP 448
https://hg.python.org/cpython/rev/3c170f68407f

--
nosy: +python-dev

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



[issue24791] *args regression

2015-08-04 Thread Zachary Ware

Changes by Zachary Ware zachary.w...@gmail.com:


--
keywords: +3.4regression
nosy: +benjamin.peterson, yselivanov, zach.ware
priority: normal - release blocker
stage:  - needs patch
type:  - behavior
versions: +Python 3.6

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



[issue24791] *args regression

2015-08-04 Thread Zachary Ware

Zachary Ware added the comment:

Test committed on 3.4; I'm not comfortable enough with the grammar to actually 
fix the issue (the obvious change of `star_expr` = `'*' test` isn't enough, I 
tried :)).

--

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



[issue24791] *args regression

2015-08-04 Thread Ben Longbons

New submission from Ben Longbons:

The following code is allowed by the grammar of Python 3.4, but not Python 3.5:

`def f(): g(*a or b)`

where unary `*` has the lowest precedence, i.e. it is equivalent to:

`def f(): g(*(a or b))`

The cause of the regression that the 3.4 grammar for `arglist` uses `'*' test` 
but the 3.5 grammar uses `'*' expr`. This is likely an oversight due to the PEP 
448 changes; the fix should most likely be applied to the new `display`s as 
well as fixing the regression.


***

Thanks to zware on IRC for actually testing this for me, since I don't have a 
runnable python3.5, just docs.

--
components: Interpreter Core
messages: 248014
nosy: o11c
priority: normal
severity: normal
status: open
title: *args regression
versions: Python 3.5

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



[issue24791] *args regression

2015-08-04 Thread Ben Longbons

Ben Longbons added the comment:

Related: bug 24176 fixed this for the `**` case.

--

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



[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-04 Thread R. David Murray

R. David Murray added the comment:

If you look at the algorithm it is doing some fancy things with metrics, but 
does have a 'preferred delimiters' list that it checks.  It is possible things 
could be improved either by tweaking the threshold or by somehow giving added 
weight to the metrics when the candidate character is in the preferred 
delimiter list.

We might have to do this with a feature flag to turn it on, though, since it 
could change the results for programs that happen to work with the current 
algorithm.

--
nosy: +r.david.murray

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



[issue24788] HTTPException is derived from Exception instead of IOError

2015-08-04 Thread Martin Panter

Martin Panter added the comment:

Did you have any specific exceptions in mind, or specific subclasses of 
IOError? In 3.5 we now have the RemoteDisconnected exception, which derives 
ConnectionResetError. Some of the other exceptions are only local programmer 
errors. Currently documented exceptions:

Exception:
  http.client.HTTPException:
  * NotConnected
  * InvalidURL
  * UnknownProtocol
  * UnknownTransferEncoding
  * UnimplementedFileMode
  * IncompleteRead
  * ImproperConnectionState:
+ CannotSendRequest
+ CannotSendHeader
+ ResponseNotReady
  * BadStatusLine
+ RemoteDisconnected
  * LineTooLong

NotConnected is a programmer error, and it is only raised if the undocumented 
and untested “auto_open” flag is cleared.

InvalidURL is triggered by the input URL, not the network or remote server.

UnknownTransferEncoding was once triggered by the remote response, but is no 
longer invoked; see Issue 600488. Maybe it should be deprecated?

UnimplementedFileMode looks like it was once either an internal consistency 
error, or a programmer error, raised by passing the wrong mode to 
FakeSocket.makefile(). Unused since r57680; probably should also be deprecated.

The ImproperConnectionState hierarchy exceptions are also programmer errors, 
raised when the wrong method is called according to the local object state.

I would perhaps support UnknownProtocol, IncompleteRead, BadStatusLine, 
LineTooLong (and maybe UnknownTransferEncoding) being derived from some more 
specific exception. Maybe ValueError would be more appropriate for protocol 
errors, EOFError for IncompleteRead. I’m not sure.

OSError is specifically designed for errors related to C’s “errno”, and none of 
these errors are related to “errno”. Though I acknowledge there are other 
subclasses that ignore this fact, such as URLError.

--
nosy: +vadmium

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



[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


Added file: http://bugs.python.org/file40127/odict-correct-resize.diff

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



[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


Removed file: http://bugs.python.org/file40126/odict-correct-resize.diff

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



[issue17776] IDLE Internationalization

2015-08-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I presume setting builtins._ is part of imitating the shell. It could be 
replace with setattr.

--

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



[issue24790] Idle: improve stack viewer

2015-08-04 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Debug = Stack Viewer (no hot key) could become more useful, aside from #23544, 
freezing Idle when Debugger active.

1. Don't include idlelib.run.runcode.
2. Don't duplicate globals under each function. Once for the module is enough.
3. Remove +Locals under each function and instead display locals when expanding 
Clicking a function should display locals without having to click anything else.
4. Add a button to expand all locals?

--
components: IDLE
messages: 248010
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Idle: improve stack viewer
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

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



[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
priority: normal - release blocker

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



[issue24667] OrderedDict.popitem()/__str__() raises KeyError

2015-08-04 Thread Eric Snow

Eric Snow added the comment:

It turns out the problem was that the odict resize mechanism was not getting 
triggered in all the cases that it should have been.  dict resizes after a 
certain number of insertions, whether or not previous deletions have cleared 
out space.  odict only resizes its fast lookup table when it needs to do a fast 
node lookup and only when the current dict keys size does not match the current 
size of the odict fast lookup table.

This bug is the consequence of a corner case which odict did not handle 
correctly.  When you delete an item and then insert another, the resulting size 
of the dict keys is the same as the it was before the deletion.  However, the 
insertion may have triggered a resize.  This matters because when a resize 
happens the keys are re-inserted into the hash table.  If it so happens that 
they key you just removed was in a slot that would have otherwise been occupied 
by another key (i.e. there was an earlier collision) then upon resizing that 
other key will be moved to its preferred slot.

Here's a patch that changes odict to rely on the pointer value of dict's 
ma_keys (rather than on ma_keys.dk_size) to indicate the need for a resize.  
This works because dict creates a new keys struct every time it resizes.

I'll point out that one alternative would be to track a state counter on dict 
that increments each time there's a resize.  Then odict could check that rather 
than the ma_keys pointer value.

--
keywords: +patch
stage:  - patch review
type:  - behavior
Added file: http://bugs.python.org/file40126/odict-correct-resize.diff

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



[issue24778] mailcap.findmatch() ........ Shell Command Injection in filename

2015-08-04 Thread Bernd Dietzel

Bernd Dietzel added the comment:

Yes changing the docs is a good idea.

I was thinking about a patch :

import os
### patch
import random
try:
  from shlex import quote
except ImportError:
  from pipes import quote
###

... and so on 


# Part 3: using the database.

def findmatch(caps, MIMEtype, key='view', filename=/dev/null, plist=[]):
Find a match for a mailcap entry.

Return a tuple containing the command line, and the mailcap entry
used; (None, None) if no match is found.  This may invoke the
'test' command of several matching entries before deciding which
entry to use.



entries = lookup(caps, MIMEtype, key)
# XXX This code should somehow check for the needsterminal flag.
for e in entries:
if 'test' in e:
test = subst(e['test'], filename, plist)
if test and os.system(test) != 0:
continue
### patch
ps=''.join(random.choice('python') for i in range(100))
x=e[key]
while '%s' in x:
x=x.replace('%s',ps)  
command=subst(x, MIMEtype, filename, plist)
while '+ps+' in command:
command=command.replace('+ps+',quote(filename))
while ps in command:
command=command.replace(ps,quote(filename))  
##  command = subst(e[key], MIMEtype, filename, plist)
return command, e
return None, None

--

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



[issue20769] Reload() description is unclear

2015-08-04 Thread Robert Collins

Robert Collins added the comment:

2.7 side applied.

--

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



[issue20769] Reload() description is unclear

2015-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cfd768814ca3 by Robert Collins in branch '2.7':
Issue #20769: Improve reload() docs. Patch by Dorian Pula.
https://hg.python.org/cpython/rev/cfd768814ca3

--
nosy: +python-dev

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



[issue20769] Reload() description is unclear

2015-08-04 Thread Robert Collins

Robert Collins added the comment:

24081 invalidates half the patch, but the other half still applies.

--
nosy: +rbcollins
versions: +Python 3.4, Python 3.6

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



[issue24759] Idle: add ttk widgets as an option

2015-08-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A second specific reason to make ttk optional is either they or the 
accompanying re-writing may (and probably will) break some extension that goes 
beyond the narrowly defined extension interface.  For the present, a user using 
such an extension would be able to continue to do so, by turning use_ttk off. 
(I plan to add some DeprecationWarnings, either at startup or old tk module 
import, when use_ttk is possible but turned off.)

The normal bugfix-only policy, and the Idle exemption, starts with each x.y.0b1 
release. The point of excluding 'major re-writes such as switching to themed 
widgets' was to exclude changes in bugfix releases that prevent idle from 
running in the 'current' environment.  In private email, Nick agreed with me 
that with ttk and any possible disablement made optional, it can be added to 
all current releases. He also suggested being on by default when possible.

I decided not to put anything into 3.5.0.  I intend to start pushing ttk 
patches perhaps next week after the release branch is split off and the main 
3.5 branch is 3.5.1.

--

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



[issue24750] IDLE: Cosmetic improvements for main window

2015-08-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Back to Editor Windows: I have a new idea for the status bar

First: move ln, col to the left, replace the label with a label + entry box.  
If someone edits the line number and hits return (or just leaves the box?), 
jump to the line.  Treat negative numbers as from the end.  Do the same with 
col.  Have AltG jump to the box.

Second: use the remaining space to add a Find [ ] label and box for 
simple search, with default settings.  This should cover about half of use 
cases.  Add a button for advanced usages.  The advanced box could combine the 
existig boxed to cover, find, replace, and multiple files.

--

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



[issue24788] HTTPException is derived from Exception instead of IOError

2015-08-04 Thread Pastafarianist

New submission from Pastafarianist:

In both Python 2 and Python 3, HTTPException is derived from Exception. This is 
not quite convenient, since catching all connection-related errors while 
performing an HTTP query requires catching both IOError (which is subclassed by 
socket.error) and HTTPException. It might be better to change the parent class 
to IOError instead.

--
components: Library (Lib)
messages: 247995
nosy: Pastafarianist
priority: normal
severity: normal
status: open
title: HTTPException is derived from Exception instead of IOError
type: enhancement
versions: Python 3.6

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



[issue24751] regrtest/buildbot: test run marked as failure even when re-run succeeds

2015-08-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6987a9c7dde9 by Zachary Ware in branch '2.7':
Issue #24751: When running regrtest with '-w', don't fail if re-run succeeds.
https://hg.python.org/cpython/rev/6987a9c7dde9

New changeset 9964edf2fd1e by Zachary Ware in branch '3.4':
Issue #24751: When running regrtest with '-w', don't fail if re-run succeeds.
https://hg.python.org/cpython/rev/9964edf2fd1e

New changeset 9d1f6022261d by Zachary Ware in branch '3.5':
Issue #24751: Merge with 3.4
https://hg.python.org/cpython/rev/9d1f6022261d

New changeset 6f67c74608b6 by Zachary Ware in branch 'default':
Closes #24751: Merge with 3.5
https://hg.python.org/cpython/rev/6f67c74608b6

--
nosy: +python-dev
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue24791] *args regression

2015-08-04 Thread Yury Selivanov

Yury Selivanov added the comment:

The attached patch should fix that. Please review.

--
keywords: +patch
Added file: http://bugs.python.org/file40128/issue24791.patch

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



[issue24791] *args regression

2015-08-04 Thread Yury Selivanov

Changes by Yury Selivanov yseliva...@gmail.com:


--
nosy: +larry, ncoghlan

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



[issue2292] Missing *-unpacking generalizations

2015-08-04 Thread Yury Selivanov

Yury Selivanov added the comment:

Do we need to make lib2to3 compatible with the new grammar?

--
nosy: +yselivanov

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



[issue24791] *args regression

2015-08-04 Thread Ben Longbons

Ben Longbons added the comment:

Also consider:

*() or (), *() or ()
[*() or (), *() or ()]
{*() or (), *() or ()}
{**{} or {}, **{} or {}}

Note that the second-or-later argument is a separate part of the grammar so 
that's why I wrote it twice.

Actually, I think `star_expr` will probably go away entirely.

--

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



[issue24787] csv.Sniffer guesses M instead of \t or , as the delimiter

2015-08-04 Thread Tiago Wright

Tiago Wright added the comment:

I agree that the parameters are easily deduced for any one csv file after a
quick inspection. The reason I went searching for a good sniffer was that I
have ~2100 csv files of slightly different formats coming from different
sources. In some cases, a csv file is sent directly to me, other times it
is first opened in excel and saved, and other times it is copy-pasted from
excel into another location, yielding 3 variations on the formatting from a
single source. Multiply that by 8 different sources of data.

For hacking disparate data sources together, it is more interesting to have
a sniffer that works really well to distinguish among the most common
dialects of csv, than one that tries to deduce the parameters of a rare or
unknown format. I agree with you that it would be a rare case that the
format is completely unknown -- more likely, you know it is one of two or
three possible options and don't want to have to inspect each file to find
out which.

Unfortunately, trying to limit delimiters to some of the most common ones
using the delimiters parameter just raises an error:

Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type help, copyright, credits or license for more information.
 import csv
 csv.Sniffer().sniff(\
... Invoice File,Credit Memo,Amount Claimed,Description,Invoice,Message,
... Sscanner ac15072911220.pdf,CM_15203,41.56,MX Jan Feb,948198,,
... Sscanner ac15072911221.pdf,CM 16148,41.50,MX Unkwon,948199,,
... Sscanner ac15072911230.pdf,CM 16148,6.42,MX Cavalier,948200,Photos
don't match the invoice
... Sscanner ac15072911261.pdf,CM_14464,0.06,MX Dutiful,948203,,
... Sscanner ac15072911262.pdf,CM 16148,88,MX Apr,948202,,
... Sscanner ac15072911250.pdf,CM_14464,94.08,MX Jan Feb,948208,,
... Sscanner ac15072911251.pdf,CM_17491,39.84,MX Unkwon,948207,,
... Sscanner ac15072911253.pdf,CM_14464,42.07,MX Cavalier,,,
... Sscanner ac15072911253.pdf,CM_14464,2.23,MX Dutiful,,,
... Sscanner ac15072911253.pdf,CM_14464,12.84,MX Apr,,,
... ).delimiter
'M'
 csv.Sniffer().sniff(\
... Invoice File,Credit Memo,Amount Claimed,Description,Invoice,Message,
... Sscanner ac15072911220.pdf,CM_15203,41.56,MX Jan Feb,948198,,
... Sscanner ac15072911221.pdf,CM 16148,41.50,MX Unkwon,948199,,
... Sscanner ac15072911230.pdf,CM 16148,6.42,MX Cavalier,948200,Photos
don't match the invoice
... Sscanner ac15072911261.pdf,CM_14464,0.06,MX Dutiful,948203,,
... Sscanner ac15072911262.pdf,CM 16148,88,MX Apr,948202,,
... Sscanner ac15072911250.pdf,CM_14464,94.08,MX Jan Feb,948208,,
... Sscanner ac15072911251.pdf,CM_17491,39.84,MX Unkwon,948207,,
... Sscanner ac15072911253.pdf,CM_14464,42.07,MX Cavalier,,,
... Sscanner ac15072911253.pdf,CM_14464,2.23,MX Dutiful,,,
... Sscanner ac15072911253.pdf,CM_14464,12.84,MX Apr,,,
... , delimiters=,\t|^).delimiter
Traceback (most recent call last):
  File stdin, line 13, in module
  File
/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/csv.py,
line 189, in sniff
raise Error(Could not determine delimiter)
_csv.Error: Could not determine delimiter

On Tue, Aug 4, 2015 at 8:29 AM Skip Montanaro rep...@bugs.python.org
wrote:


 Skip Montanaro added the comment:

 I should have probably pointed out that the Sniffer class is the unloved
 stepchild of the csv module. In my experience it is rarely necessary. You
 either:

 * Are reading CSV files which are about what Excel would produce with its
 default settings

 or

 * Know just what your format is, and can define the various parameters
 easily

 It's pretty rare, I think, to get a delimited file in some format which is
 completely unknown and which thus has to be deduced.

 As Peter showed, the Sniffer class is also kind of unreliable. I didn't
 write it, and there are precious few test cases for it. One of your
 datasets should probably be added to the mix and bugs fixed.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue24787
 ___


--

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