[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2016-04-18 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
versions:  -Python 3.4

___
Python tracker 

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



Re: Convert input to upper case on screen as it is typed

2016-04-18 Thread Gregory Ewing

Ben Finney wrote:


I am still looking for a solution (a Python-specific one would be fine).



The only other way I can think of is to put the tty
into raw mode and do your own line editing and echoing.
You could wrap it all up in a file-like object for the
rest of the code to use.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> What platform do you get the AttributeError with? Perhaps the function is not 
> well covered in the test suite.

I guess `os.get_terminal_size()` didn't exist on ancient OSes like DOS, OS/2, 
ancient UNIXes. On all supported platforms (including such exotic as old AIX, 
QNX or Minix) it should be defined.

Tests should fail if `os.get_terminal_size()` doesn't exist.

> I think Rietveld doesn't like me because I made it a .diff file, and not a 
> .patch file, but who knows.

I think this is because the patch doesn't contain a revision number.

On Windows `os.get_terminal_size()` can raise ValueError if 
`sys.__stdout__.fileno()` is not one of 0, 1 or 2. It is worth to catch it too. 
An AttributeError is also raised if sys.__stdout__ has no the "fileno" 
attribute (StringIO or None).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Gregory Ewing

Ian Kelly wrote:

What happens when another
programmer reviews the code using a different font and finds that
there is only 3.5em worth of space? Do we descend into Calibri /
Verdana line-length edit wars?


That's easy, we just decree that all Python source
code is to be displayed in this font:

http://fontstruct.com/fontstructions/show/89341/flying_circus

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2016-04-18 Thread Joe Jevnik

Joe Jevnik added the comment:

bump

--

___
Python tracker 

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



[issue26730] SpooledTemporaryFile doesn't correctly preserve data for text (non-binary) SpooledTemporaryFile objects when Unicode characters are written

2016-04-18 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> This still depends on StringIO.tell() corresponding to the number of code 
> points, which is undocumented (we already disable newline translation in the 
> StringIO). See also Issue 25190.

And doesn't work with Python implementation of StringIO. More general solution 
needs the code like:

pos = file.tell()
tail = file.read()
file.seek(0)
head = file.read()
if tail:
head = head[:-len(tail)]
newfile.write(head)
pos = newfile.tell()  # TextIOWrapper position is opaque
newfile.write(tail)
newfile.seek(pos, 0)

Yet one bad thing with using independent StringIO instead of TextIOWrapper, is 
that saved tell() position becomes not valid after rollover(). I'm going to 
write few tests for cases when file position points not at the end of the 
stream.

--

___
Python tracker 

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



Re: error with tkinter, help

2016-04-18 Thread BlueRidiculous
On Sunday, April 17, 2016 at 10:24:32 AM UTC-7, BlueRidiculous wrote:
> On Sunday, April 17, 2016 at 10:18:09 AM UTC-7, BlueRidiculous wrote:
> > On Saturday, April 16, 2016 at 9:30:39 PM UTC-7, Terry Reedy wrote:
> > > On 4/16/2016 9:31 PM, blueridicul...@gmail.com wrote:
> > > > So I was reading https://wiki.python.org/moin/TkInter for help.
> > >  > I got to step 3 under "Checking your Tkinter support."
> > >  > Nothing happens when I do steps 1 or 2, and when I do step 3,
> > >  > I get this error:
> > > >
> > > > Traceback (most recent call last):
> > > >   File "", line 301, in runcode
> > > >   File "", line 1, in 
> > > >   File "C:\Python34\lib\tkinter\__init__.py", line 3882, in _test
> > > > root = Tk()
> > > >   File "C:\Python34\lib\tkinter\__init__.py", line 1856, in __init__
> > > > self.tk = _tkinter.create(screenName, baseName, className, 
> > > > interactive, wantobjects, useTk, sync, use)
> > > > _tkinter.TclError: Can't find a usable init.tcl in the following 
> > > > directories:
> > > > C:/Python34/lib/tcl8.6 C:/lib/tcl8.6 C:/lib/tcl8.6 C:/library 
> > > > C:/library C:/tcl8.6.1/library C:/tcl8.6.1/library
> > > >
> > > > This probably means that Tcl wasn't installed properly.
> > > > "
> > > 
> > > The directory list is obsolete.  You should have C:/Python34/tcl
> > > How did you install Python?  The Windows PSF installer from python.org 
> > > will create this directory unless you uncheck the box to include tcl/tk.
> > > 
> > > -- 
> > > Terry Jan Reedy
> > 
> > What is a PSF installer? Anyway, I installed the "Windows x86 MSI 
> > installer" from https://www.python.org/downloads/release/python-344/ Is 
> > that correct?
> 
> Actually nevermind, I uninstalled and reinstalled Python and it works now. I 
> remember I uninstalled and reinstalled before, and it worked, then stopped 
> working, so I'm not sure how permanent this fix will be. Stay tuned for 
> updates. Thanks again.

So no need to "stay tuned for updates" anymore, it has been working for a day 
and I think that it is good now. If ever it breaks again, I'll just start a new 
thread. You guys can ignore this now. Thanks again to you guys for the help.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Random832
On Mon, Apr 18, 2016, at 23:54, Rustom Mody wrote:
> Start no tabs:
> if foo# comment that is aligned
> do some stuff# across multiple indent levels 
> 
> Add tabs as leading indents with second line indented 1 tab more
> (showing tabs as |)
> |if foo# comment that is aligned
> ||do some stuff# across multiple indent levels 
>
> Indent the first comment with 2 tabs
> At this point the first comment is/shows lefter than the second
> 
> Indent the second with 1 tab -- the two #es now line up

Yeah but now the second line of code is to the right of the whole first
line of code. "if foo" must have been too short to illustrate it (it's
long enough if a tab is four spaces, but I guess it's longer in the
sample), but I assumed you would get the concept of what I was saying
and try putting something longer there or try extending the comments in
the C code the sample preloads.

Like, it ends up looking like this:

if foo("what if it's a much longer condition"):# comment
 do something  #
 comment2

There's no way to get this:

if foo("what if it's a much longer condition"):  # comment
do something # comment2
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: delete from pattern to pattern if it contains match

2016-04-18 Thread harirammanohar
On Monday, April 18, 2016 at 1:19:43 PM UTC+5:30, Joaquin Alzola wrote:
> Hi,
> 
> Try to use the xml module.
> 
> import xml.etree.ElementTree as ET
> 
> That might help.
> 
> BR
> 
> Joaquin
> 
> -Original Message-
> From: Python-list 
> [mailto:python-list-bounces+joaquin.alzola=lebara@python.org] On Behalf 
> Of harirammano...@gmail.com
> Sent: 18 April 2016 08:08
> To: python-list@python.org
> Subject: delete from pattern to pattern if it contains match
> 
> 
> HI All,
> 
> can you help me out in doing below.
> 
> file:
> 
>  guava
> fruit
> 
> 
>  mango
> fruit
> 
> 
>  orange
> fruit
> 
> 
> need to delete from start to end if it contains mango in a file...
> 
> output should be:
> 
> 
>  guava
> fruit
> 
> 
>  orange
> fruit
> 
> 
> Thank you
> --
> https://mail.python.org/mailman/listinfo/python-list
> This email is confidential and may be subject to privilege. If you are not 
> the intended recipient, please do not copy or disclose its content but 
> contact the sender immediately upon receipt.

hi Alzola,

xml parsing solution works fine only in the below case if input file is in 
below format.

 
 guava 
fruit 
 
 
 mango 
fruit 
 
 
 orange 
fruit 
 


its not working if the input file as below, just a change in the starting 
header...
http://xmlns.jcp.org/xml/ns/javaee;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance;
  xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
  http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd;
  version="3.1">
 
 guava 
fruit 
 
 
 mango 
fruit 
 
 
 orange 
fruit 



inthis case its not working pls suggest what i have to do to make it work..
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Rustom Mody
On Tuesday, April 19, 2016 at 9:00:12 AM UTC+5:30, Random832 wrote:
> On Mon, Apr 18, 2016, at 23:04, Rustom Mody wrote:
> > See elastic tabstops: http://nickgravgaard.com/elastic-tabstops/
> 
> >From there:
> >A column block is a run of uninterrupted vertically adjacent cells.
> 
> How's that going to handle this case:
> 
> if foo: # comment that is aligned
> do some stuff   # across multiple indent levels

Just tried it with the jar file¹ he supplies and it seems to work

Start no tabs:
if foo# comment that is aligned
do some stuff# across multiple indent levels 

Add tabs as leading indents with second line indented 1 tab more
(showing tabs as |)
|if foo# comment that is aligned
||do some stuff# across multiple indent levels 

Indent the first comment with 2 tabs
At this point the first comment is/shows lefter than the second

Indent the second with 1 tab -- the two #es now line up

The invariant of course is clear -- if the total no of tabs in the line
prior to the char are equal then all such lines line up

¹ yeah thats not very secure! And does not work with open java, works with
Sun/Oracle java
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26730] SpooledTemporaryFile doesn't correctly preserve data for text (non-binary) SpooledTemporaryFile objects when Unicode characters are written

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

According to Issue 12215, the TextIOWrapper.tell() position only includes 
decoder state, not encoder state. So we may be lucky that tell() is 
proportional to the file size. If so my concern about max_size isn’t so 
important. But it still feels like a bad hack.

Maybe another quick fix for this would be to do two writes of the StringIO 
data, and then seek back to the end of the first write:

pos = file.tell()  # StringIO position is in code points
file.seek(0)
newfile.write(file.read(pos))
pos = newfile.tell()  # TextIOWrapper position is opaque
newfile.write(file.read())
newfile.seek(pos, 0)

This still depends on StringIO.tell() corresponding to the number of code 
points, which is undocumented (we already disable newline translation in the 
StringIO). See also Issue 25190.

--

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Random832
On Mon, Apr 18, 2016, at 23:04, Rustom Mody wrote:
> See elastic tabstops: http://nickgravgaard.com/elastic-tabstops/

>From there:
>A column block is a run of uninterrupted vertically adjacent cells.

How's that going to handle this case:

if foo: # comment that is aligned
do some stuff   # across multiple indent levels

As far as I can tell, the model being proposed would align the indented
code either with the first line's comment, or somewhere after the colon.
I think it's excessively "clever" to think you can or should use the
same model to solve indentation as other forms of alignment.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Rustom Mody
On Tuesday, April 19, 2016 at 6:49:34 AM UTC+5:30, sohcatoa wrote:
> On Monday, April 18, 2016 at 2:14:17 PM UTC-7, Pete Forman wrote:
> > Why is it that Python continues to use a fixed width font and therefore
> > specifies the maximum line width as a character count?
> > 
> > An essential part of the language is indentation which ought to continue
> > to mandate that lines start with a multiple of 4 em worth of space (or
> > some other size or encode with hard tabs, that is not germane to my
> > question). The content of the line need not be bound by the rules needed
> > to position its start.
> > 
> > -- 
> > Pete Forman
> 
> "Why is it that Python continues to use a fixed width font "
> 
> This guy is trolling, right?

See elastic tabstops: http://nickgravgaard.com/elastic-tabstops/

And more generally that programmers sticking to text when rest of world has 
moved on is rather backward:
http://blog.languager.org/2012/10/html-is-why-mess-in-programming-syntax.html
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-18 Thread Emanuel Barry

Emanuel Barry added the comment:

I think Rietveld doesn't like me because I made it a .diff file, and not a 
.patch file, but who knows.

It's a bit of a shot in the dark though, because I can't reproduce an 
environment where `os.get_terminal_size()` doesn't exist. I'm on Windows and 
sometimes compile the latest trunk to play around and find bugs, so it could be 
in one of those times (even though I just tried and it didn't fail).

I think that if `NameError` was to be caught before, it means the function was 
to be "maybe there, maybe not", which could very well still be the case, so it 
makes sense to use the proper exception in that case. I don't see any 
significant drawback to catching AttributeError, anyway.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

The patch looks good to me. The function was originally written to be included 
in the “os” module, hence the NameError. The patch should probably be fine with 
Mercurial, but it looks like the Reitveld review system doesn’t like it :)

What platform do you get the AttributeError with? Perhaps the function is not 
well covered in the test suite.

--
nosy: +martin.panter
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



[issue17233] http.client header debug output format

2016-04-18 Thread Luiz Poleto

Changes by Luiz Poleto :


--
nosy: +luiz.poleto

___
Python tracker 

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



[issue26016] io.TextIOWrapper.tell() report 65bit number when mix readline() + tell()

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

EcmaXp: Do you think there is anything we can do for this? I think the cases 
discussed here are working as intended.

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

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Confirm that the CC license is valid/acceptable with Van L. first. That's
why I pointed at the Apache 2 code, already a known good license. :)

On Mon, Apr 18, 2016, 2:51 PM Christian Heimes 
wrote:

>
> Christian Heimes added the comment:
>
> BLAKE2 is under CC0 1.0 Universal, https://github.com/BLAKE2/libb2
>
> OpenSSL 1.1.0 has no API to set salt, personal, digest length and key
> length (for keyed BLAKE2). I have asked Richard Salz and MJC if they'd
> accept a patch.
>
> Or I could ask Dmitry Chestnykh if he is interested to submit his pyblake2
> module to the stdlib. It's under CC0. It looks pretty good except for his
> macro tricks. I can cope. :)
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread sohcahtoa82
On Monday, April 18, 2016 at 2:14:17 PM UTC-7, Pete Forman wrote:
> Why is it that Python continues to use a fixed width font and therefore
> specifies the maximum line width as a character count?
> 
> An essential part of the language is indentation which ought to continue
> to mandate that lines start with a multiple of 4 em worth of space (or
> some other size or encode with hard tabs, that is not germane to my
> question). The content of the line need not be bound by the rules needed
> to position its start.
> 
> -- 
> Pete Forman

"Why is it that Python continues to use a fixed width font "

This guy is trolling, right?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why are my files in in my list - os module used with sys argv

2016-04-18 Thread MRAB

On 2016-04-19 00:44, Sayth Renshaw wrote:

Hi

Why would it be that my files are not being found in this script?

from pyquery import PyQuery as pq
import pandas as pd
import os
import sys

if len(sys.argv) == 2:
 print("no params")
 sys.exit(1)

dir = sys.argv[1]
mask = sys.argv[2]

files = os.listdir(dir)

fileResult = filter(lambda x: x.endswith(mask), files)

# d = pq(filename='20160319RHIL0_edit.xml')
data = []

for file in fileResult:
 print(file)

for items in fileResult:
 d = pq(filename=items)
 res = d('nomination')
 attrs = ('id', 'horse')
 data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]

 # from nominations
# res = d('nomination')
# nomID = [res.eq(i).attr('id') for i in range(len(res))]
# horseName = [res.eq(i).attr('horse') for i in range(len(res))]

# attrs = ('id', 'horse')

frames = pd.DataFrame(data)
print(frames)


I am running this from the bash prompt as

(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ python jqxml.py samples *.xml

my directory structure

(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ ls -a
.  ..  environment.yml  .git  .gitignore  #jqxml.py#  jqxml.py  samples

and samples contains

(pyquery)sayth@sayth-E6410:~/Projects/pyquery/samples$ ls -a
.   20160319RHIL0_edit.xml  20160409RAND0.xml
..  20160402RAND0.xml   20160416RAND0.xml

yet I get no files out of the print statement.

Ideas?

I don't use Linux, but I think it might be a problem with what you have 
on the command line. I believe that Linux expands wildcarded names, so 
what you might be getting is "samples" followed by all the names in the 
current directory that match "*.xml".


Even if that isn't the case, and mask is "*.xml", the filtering that 
you're doing is asking for those names that end with "*.xml"; you might 
find a name that ends with ".xml", but I doubt you'll ever find one that 
ends with "*.xml"!


--
https://mail.python.org/mailman/listinfo/python-list


[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-18 Thread Joe Jevnik

New submission from Joe Jevnik:

When star unpacking positions into a function we can avoid a copy iff there are 
no extra arguments coming from the stack. Syntactically this looks like: 
`f(*args)`

This reduces the overhead of the call by about 25% (~30ns on my machine) based 
on some light profiling of just * unpacking. I can imagine this having a slight 
impact on code that uses this feature in a loop.

The cost is minimal when we need to make the copy because the int != 0 check is 
dwarfed by the allocation. I did not notice a significant change between the 
slow path and the original code.

The macro benchmark suite did not show a difference on my machine but this is 
not much more complex code.

--
components: Interpreter Core
files: call-function-var.patch
keywords: patch
messages: 263702
nosy: ll
priority: normal
severity: normal
status: open
title: Avoid copy in call_function_var when no extra stack args are passed
versions: Python 3.6
Added file: http://bugs.python.org/file42512/call-function-var.patch

___
Python tracker 

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



Re: Why are my files in in my list - os module used with sys argv

2016-04-18 Thread Steven D'Aprano
On Tue, 19 Apr 2016 09:44 am, Sayth Renshaw wrote:

> Hi
> 
> Why would it be that my files are not being found in this script?

You are calling the script with:

python jqxml.py samples *.xml

This does not do what you think it does: under Linux shells, the glob *.xml
will be expanded by the shell. Fortunately, in your case, you have no files
in the current directory matching the glob *.xml, so it is not expanded and
the arguments your script receives are:


"python jqxml.py"  # not used

"samples"  # dir

"*.xml"  # mask


You then call:

fileResult = filter(lambda x: x.endswith(mask), files)

which looks for file names which end with a literal string (asterisk, dot,
x, m, l) in that order. You have no files that match that string.

At the shell prompt, enter this:

touch samples/junk\*.xml

and run the script again, and you should see that it now matches one file.

Instead, what you should do is:


(1) Use the glob module:

https://docs.python.org/2/library/glob.html
https://docs.python.org/3/library/glob.html

https://pymotw.com/2/glob/
https://pymotw.com/3/glob/


(2) When calling the script, avoid the shell expanding wildcards by escaping
them or quoting them:

python jqxml.py samples "*.xml"



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue13826] Having a shlex example in the subprocess.Popen docs is confusing

2016-04-18 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.5, Python 3.6 -Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue23251] mention in time.sleep() docs that it does not block other Python threads

2016-04-18 Thread Berker Peksag

Changes by Berker Peksag :


--
status: open -> closed

___
Python tracker 

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



[issue17233] http.client header debug output format

2016-04-18 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
versions: +Python 3.5, Python 3.6 -Python 3.3, Python 3.4

___
Python tracker 

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



Why are my files in in my list - os module used with sys argv

2016-04-18 Thread Sayth Renshaw
Hi

Why would it be that my files are not being found in this script?

from pyquery import PyQuery as pq
import pandas as pd
import os
import sys

if len(sys.argv) == 2:
print("no params")
sys.exit(1)

dir = sys.argv[1]
mask = sys.argv[2]

files = os.listdir(dir)

fileResult = filter(lambda x: x.endswith(mask), files)

# d = pq(filename='20160319RHIL0_edit.xml')
data = []

for file in fileResult:
print(file)

for items in fileResult:
d = pq(filename=items)
res = d('nomination')
attrs = ('id', 'horse')
data = [[res.eq(i).attr(x) for x in attrs] for i in range(len(res))]

# from nominations
# res = d('nomination')
# nomID = [res.eq(i).attr('id') for i in range(len(res))]
# horseName = [res.eq(i).attr('horse') for i in range(len(res))]

# attrs = ('id', 'horse')

frames = pd.DataFrame(data)
print(frames)


I am running this from the bash prompt as

(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ python jqxml.py samples *.xml

my directory structure

(pyquery)sayth@sayth-E6410:~/Projects/pyquery$ ls -a
.  ..  environment.yml  .git  .gitignore  #jqxml.py#  jqxml.py  samples

and samples contains

(pyquery)sayth@sayth-E6410:~/Projects/pyquery/samples$ ls -a
.   20160319RHIL0_edit.xml  20160409RAND0.xml
..  20160402RAND0.xml   20160416RAND0.xml

yet I get no files out of the print statement.

Ideas?

Sayth

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-18 Thread Emanuel Barry

New submission from Emanuel Barry:

`shutil.get_terminal_size()` will sometimes propagate `AttributeError: module 
 has not attribute 'get_terminal_size'` to the caller. The call checks for 
NameError, which makes no sense, so I guess it must be an oversight. Attached 
patch fixes it.

(diff was generated with git, I don't know if it works with Mercurial, but it's 
a trivial change anyway)

--
components: Library (Lib)
files: get_terminal_size.diff
keywords: patch
messages: 263701
nosy: ebarry
priority: normal
severity: normal
stage: patch review
status: open
title: Fix shutil.get_terminal_size() to catch AttributeError
type: behavior
Added file: http://bugs.python.org/file42511/get_terminal_size.diff

___
Python tracker 

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



[issue18591] threading.Thread.run returning a result

2016-04-18 Thread Berker Peksag

Berker Peksag added the comment:

What is your use case? I think this can easily be implemented by subclassing 
the threading.Thread class:

class MyThread(threading.Thread):

def run(self):
# skip try...finally to make the example shorter
result = None
if self._target:
result = self._target(*self._args, **self._kwargs)
return result

We can reopen this if you can share a valid use case. Thanks for the report!

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Ben Finney
Pete Forman  writes:

> Why is it that Python continues to use a fixed width font

I think you know this isn't true.

> and therefore specifies the maximum line width as a character count?

and that this “therefore” is not justified by that.

You've seen elsewhere the justification for *having* a maximum line
width (primarily because of limits on human cognition of lines of text).

As for what the limit *is*, it's much better to have an easy-to-apply
and easy-to-measure rule, because consistent application is important
for such a guide.

Counting characters is objectively easy and easily comparable.

-- 
 \ “I think Western civilization is more enlightened precisely |
  `\ because we have learned how to ignore our religious leaders.” |
_o__)—Bill Maher, 2003 |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue11416] netrc module does not handle multiple entries for a single host

2016-04-18 Thread Frew Schmidt

Frew Schmidt added the comment:

This issue is causing a problem in OfflineIMAP.  I wrote a patch that I think 
is a little simpler than the existing one, including tests and docs, though 
honestly I don't care one way or another.  See attached.  Note that the patch 
is for Python 2.7 but it mostly applies to 3.5 just fine.  Any chance we could 
get mine or the other one applied?

Thanks

--
nosy: +Frew Schmidt
versions: +Python 2.7
Added file: http://bugs.python.org/file42510/netrc.patch

___
Python tracker 

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



[issue26730] SpooledTemporaryFile doesn't correctly preserve data for text (non-binary) SpooledTemporaryFile objects when Unicode characters are written

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

I noticed another possible problem with using TextIOWrapper. We call tell() to 
see if a rollover is needed. But I think TextIOWrapper streams can return 
complicated values from tell(), encoding stuff like codec state and buffered 
data in an integer. At the minimum, I think the meaning of max_size has changed 
(code points vs bytes). And perhaps it won’t work very well with some codecs 
that record state in the tell() value.

--

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Pete Forman
Ian Kelly  writes:

> On Mon, Apr 18, 2016 at 3:14 PM, Pete Forman  wrote:
>> Why is it that Python continues to use a fixed width font and
>> therefore specifies the maximum line width as a character count?
>>
>> An essential part of the language is indentation which ought to
>> continue to mandate that lines start with a multiple of 4 em worth of
>> space (or some other size or encode with hard tabs, that is not
>> germane to my question). The content of the line need not be bound by
>> the rules needed to position its start.
>
> How many spaces is "4 em worth"? How would you incorporate that into
> the Python compiler or a linter without needing to know what
> particular font the programmer is using? What happens when another
> programmer reviews the code using a different font and finds that
> there is only 3.5em worth of space? Do we descend into Calibri /
> Verdana line-length edit wars?

4 em is what PEP 8 implies, with the implicit use of a monospaced font.
I was trying to convey that the mechanics of indentation was not
relevant to my question about why Python and indeed other programming
languages are rarely edited or viewed with proportional fonts. The
programmer, other humans reading the source and the interpreter need to
be able to discern structure by the indentation. It is what follows the
indentation that interests me.

The current Python interpreter will happily digest a combination of
spaces and hard tabs as long as consistency rules are obeyed.

My question was intended to concentrate on the presentation after the
leading whitespace.

-- 
Pete Forman
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

No, admin privileges should not be needed to run Command Prompt.  Ditto for 
python if you did not already need same to run IDLE.

--

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Christian Heimes

Christian Heimes added the comment:

BLAKE2 is under CC0 1.0 Universal, https://github.com/BLAKE2/libb2

OpenSSL 1.1.0 has no API to set salt, personal, digest length and key length 
(for keyed BLAKE2). I have asked Richard Salz and MJC if they'd accept a patch.

Or I could ask Dmitry Chestnykh if he is interested to submit his pyblake2 
module to the stdlib. It's under CC0. It looks pretty good except for his macro 
tricks. I can cope. :)

--

___
Python tracker 

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



Re: How to track files processed

2016-04-18 Thread Sayth Renshaw
Thank you Martin and Peter

To clarify Peter at the moment only writing to csv but am wanting to set up an 
item pipeline to SQL db next.

I will have a go at your examples Martin and see how i go.

Thank you both for taking time to help.

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26754] PyUnicode_FSDecoder() accepts arbitrary iterable

2016-04-18 Thread Philip Jenvey

Philip Jenvey added the comment:

See issue26800 for reasoning to go with #4

--
nosy: +pjenvey

___
Python tracker 

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



Re: I have been dealing with Python for a few weeks...

2016-04-18 Thread Fillmore

On 04/14/2016 10:12 PM, justin walters wrote:

On Thu, Apr 14, 2016 at 1:50 PM, Fillmore 
wrote:



...and I'm loving it.

Sooo much more elegant than Perl...and so much less going back to the
manual to lookup the syntax of simple data structures and operations...

REPL is so useful

and you guys rock too

cheers
--
https://mail.python.org/mailman/listinfo/python-list



Good to hear you're enjoying it. Out of curiosity, what were you using Perl
for?



I am a programmer by education but have not programmed in years. Sometimes I 
need to get
my point across to people in my team that something can be done. The fact that 
I could prototype
in Perl (now Python) certainly makes it harder for others to argue that this or 
that cannot be done
in (java/PHP) or that it would take a disproportionate amount of time to carry 
out...

Thanks

--
https://mail.python.org/mailman/listinfo/python-list


[issue26800] Don't accept bytearray as filenames part 2

2016-04-18 Thread Philip Jenvey

New submission from Philip Jenvey:

Basically a reopen of the older issue8485 with the same name. It was decided 
there to drop support for bytearray filenames -- partly because of the 
complexity of handling buffers but it was also deemed to just not make much 
sense.

This regressed or crept back into the posix module with the big path_converter 
changes for 3.3:

https://hg.python.org/cpython/file/ee9921b29fd8/Lib/test/test_posix.py#l411

IMHO this functionality should be deprecated/removed per the original 
discussion, or does someone want to reopen the debate?

The os module docs (and path_converter's own docs) explicitly advertise 
handling of str or bytes, not bytearrays or buffers. Even os.fsencode rejects 
bytearrays/buffers.

Related to issue26754 -- further inconsistencies around filename handling

--
assignee: larry
components: Interpreter Core
keywords: 3.3regression
messages: 263694
nosy: Ronan.Lamy, haypo, larry, pitrou, pjenvey, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Don't accept bytearray as filenames part 2
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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Ian Kelly
On Mon, Apr 18, 2016 at 3:14 PM, Pete Forman  wrote:
> Why is it that Python continues to use a fixed width font and therefore
> specifies the maximum line width as a character count?
>
> An essential part of the language is indentation which ought to continue
> to mandate that lines start with a multiple of 4 em worth of space (or
> some other size or encode with hard tabs, that is not germane to my
> question). The content of the line need not be bound by the rules needed
> to position its start.

How many spaces is "4 em worth"? How would you incorporate that into
the Python compiler or a linter without needing to know what
particular font the programmer is using? What happens when another
programmer reviews the code using a different font and finds that
there is only 3.5em worth of space? Do we descend into Calibri /
Verdana line-length edit wars?
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Gregory P. Smith

Gregory P. Smith added the comment:

CPython should not attempt make a judgement about the safety of a particular 
function.  We can only document if something has known issues.

We should only include things in the stdlib which are either (a) standard or 
(b) widely used regardless of being standard.  Given that librsync and RAR both 
support BLAKE2 and that it is defined by an RFC, I'd say it should go in.

The reference implementation appears to have Apache 2.0 licensed C code would 
can fall back to when the OpenSSL in use does not include it.

PEP-452 seems to address the necessary API changes.

--
assignee:  -> christian.heimes
stage:  -> needs patch
type:  -> enhancement
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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Pete Forman
Why is it that Python continues to use a fixed width font and therefore
specifies the maximum line width as a character count?

An essential part of the language is indentation which ought to continue
to mandate that lines start with a multiple of 4 em worth of space (or
some other size or encode with hard tabs, that is not germane to my
question). The content of the line need not be bound by the rules needed
to position its start.

-- 
Pete Forman
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26797] Segafault in _PyObject_Alloc

2016-04-18 Thread STINNER Victor

STINNER Victor added the comment:

Usually a "bug in the memory allocator" means a buffer overflow in your
code. Did you check your code using a debug build, PYTHONDEBUG=debug (if
CPython is compiled in release mode), or PYTHONMALLOC=malloc + valgrind?
(The env var requires CPython 3.6)

--

___
Python tracker 

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



[issue26799] gdb support fails with "Invalid cast."

2016-04-18 Thread Thomas

New submission from Thomas:

Trying to use any kind of python gdb integration results in the following error:

(gdb) py-bt
Traceback (most recent call first):
Python Exception  Invalid cast.: 
Error occurred in Python command: Invalid cast.

I have tracked it down to the _type_... globals, and I am able to fix it with 
the following commands:

(gdb) pi
>>> # Look up the gdb.Type for some standard types:
... _type_char_ptr = gdb.lookup_type('char').pointer() # char*
>>> _type_unsigned_char_ptr = gdb.lookup_type('unsigned char').pointer() # 
>>> unsigned char*
>>> _type_void_ptr = gdb.lookup_type('void').pointer() # void*
>>> _type_unsigned_short_ptr = gdb.lookup_type('unsigned short').pointer()
>>> _type_unsigned_int_ptr = gdb.lookup_type('unsigned int').pointer()

After this, it works correctly. I was able to workaround it by making a 
fix_globals that resets the globals on each gdb.Command. I do not understand 
why the originally initialized types are not working properly. It feels like 
gdb-inception trying to debug python within a gdb that debugs cpython while 
executing python code.

I have tried this using hg/default cpython (--with-pydebug --without-pymalloc 
--with-valgrind --enable-shared) 
1) System install of gdb 7.11, linked against system libpython 3.5.1.
2) Custom install of gdb 7.11.50.20160411-git, the debug cpython I am trying to 
debug

--
components: Demos and Tools
messages: 263690
nosy: tilsche
priority: normal
severity: normal
status: open
title: gdb support fails with "Invalid cast."
type: crash
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



[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-18 Thread MICHAEL JACOBSON

MICHAEL JACOBSON added the comment:

Is the command prompt itself admin?
I don't have access to the admin command prompt.

--

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Hrvoje Abraham

Hrvoje Abraham added the comment:

IEEE & C/C++ standards allow and explicitly mention it, some people and 
projects are using it, many compilers preserve it...

I believe it's reasonable to support it despite the fact it does not have 
standardized semantic meaning. Maybe one day...

--

___
Python tracker 

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



Re: [Python-ideas] Changing the meaning of bool.__invert__

2016-04-18 Thread Ian Kelly
On Sun, Apr 17, 2016 at 12:24 PM, Pavol Lisy  wrote:
> 2016-04-09 17:43 GMT+02:00, Steven D'Aprano :
>> flag ^ flag is useful since we don't have a boolean-xor operator and
>> bitwise-xor does the right thing for bools. And I suppose some people
>> might prefer & and | over boolean-and and boolean-or because they're
>> shorter and require less typing. I don't think that's a particularly
>> good reason for using them, and as you say, you do have to guard
>> against non-bools slipping, but Consenting Adults applies.
>
> They are also useful if you need to avoid short-circuit evaluation.

One can easily write functions to do that.

def long_or(a, b):
"""Equivalent to a or b but always evaluates both expressions."""
return a or b

long_or(a, b) may not be as pretty as a | b, but I'll argue that it's
more readable since it's up-front about its intent, whereas a | b
looks like it could just be a mistake.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Christian Heimes

Christian Heimes added the comment:

I have SHA-3, SHAKE and BLAKE2s / BLAKE2b on my radar.

PEP 247 and the current API definition of the hashlib module is too limited for 
the new hashing algorithms. It lacks variable output for SHAKE as well as salt 
and personalization for BLAKE. I started to work on PEP 452 while I was working 
on SHA-3 support for Python 3. The PEP is still work-in-progress. I can address 
the needs of BLAKE and submit the PEP to a formal review.

I'm already working on OpenSSL 1.1.0 support for Python. blake will be 
automatically supported with OpenSSL builds. See for yourself:

$ ./python 
Python 3.6.0a0 (default, Apr 18 2016, 21:16:54) 
[GCC 5.3.1 20160406 (Red Hat 5.3.1-6)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>> import ssl
>>> ssl.OPENSSL_VERSION
'OpenSSL 1.1.0-pre5-dev  xx XXX '
>>> hashlib.new('BLAKE2s256').hexdigest()
'69217a3079908094e11121d042354a7c1f55b6482ca1a51e1b250dfd1ed0eef9'


Donald:
I love to add SHA-3 support to Python. After all I had a working patch for 
SHA-3 before NIST changed the padding. Now my old patch is worthless. The new 
reference implementations are either too complicated (spread across like twenty 
files for various optimizations) or are one-shot implementations. I'm still 
looking for a good implementation that supports incremental updates, copy and 
SHAKE at the same time.

--

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson

Mark Dickinson added the comment:

This StackOverflow answer from one of the IEEE 754 committee members is highly 
relevant here:

http://stackoverflow.com/a/21350299/270986

--

___
Python tracker 

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



Re: Convert input to upper case on screen as it is typed

2016-04-18 Thread Ben Finney
Ben Finney  writes:

> Ben Finney  writes:
>
> > Okay, ‘termios.tcgetattr’ will let me preserve the attributes, and
> > with Dan Sommers's suggestion of which attribute to use, I may have
> > a shot at setting the terminal attributes.
>
> This works!

Except, it doesn't. As designed and documented in the Single Unix
Specification ,
the behaviour of the OLCUC feature is:

OLCUC Map lower case to upper on output. (LEGACY)



That ominous “LEGACY” annotation is applied, notably, to all the
case-conversion features of ‘termios’.

The mapping is ignorant of Unicode, ignorant of ANSI escape sequences;
it blindly converts bytes via a mapping that assumes all bytes are ASCII
text, regardless of whether those bytes actually represent text.

It breaks the “visual bell” feature, among others. I end up with garbage
on the screen, that would otherwise have been Unicode text or useful
control sequences.

> I had been hoping that I could simply wrap some stream in a simple
> “convert what they actually type so it's upper case” text codec,
> without fiddling at such a low operating-system specific level. This
> is rather more esoteric than I had hoped.

And, it turns out, doesn't address the requirements without causing more
problems.

I am still looking for a solution (a Python-specific one would be fine).

-- 
 \   “Anything that we scientists can do to weaken the hold of |
  `\religion should be done and may in the end be our greatest |
_o__)  contribution to civilization.” —Steven Weinberg |
Ben Finney

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Guido van Rossum

Guido van Rossum 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



[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Hans Lawrenz

Hans Lawrenz added the comment:

New patch attached. Includes comments and a note in the documentation.

The documentation note is inside a versionchanged:: 3.5 block. Should this be 
more specific about the version it changed in? It could be confusing for 
someone using a version of 3.5 that doesn't have the change.

Contributor form is signed.

Thanks!

--
Added file: 
http://bugs.python.org/file42509/run_in_executor_max_workers_with_docs.patch

___
Python tracker 

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



[issue26779] pdb continue followed by an exception in the same frame shows incorrect frame linenumber

2016-04-18 Thread Sriram Rajagopalan

Changes by Sriram Rajagopalan :


Removed file: http://bugs.python.org/file42486/bdbfix.patch

___
Python tracker 

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



[issue26779] pdb continue followed by an exception in the same frame shows incorrect frame linenumber

2016-04-18 Thread Sriram Rajagopalan

Changes by Sriram Rajagopalan :


Added file: http://bugs.python.org/file42508/bdbfix.patch

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +christian.heimes, gregory.p.smith

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Donald Stufft

Donald Stufft added the comment:

> Right now all the hashlib algorithms are backed by OpenSSL.

As far as I know, hashlib ships it's own implementations of anything that is a 
guaranteed algorithms (currently md5, sha1, and sha2, presumably sha3 too once 
that gets added).

So I guess one question is whether we want to guarantee the existence of blake2 
or not.

--

___
Python tracker 

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



[issue26797] Segafault in _PyObject_Alloc

2016-04-18 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +ronaldoussoren

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Alex Gaynor

Alex Gaynor added the comment:

Right now all the hashlib algorithms are backed by OpenSSL. OpenSSL 1.1.0 will 
have blake2, so perhaps the right move is just to wait for that to drop in a 
few weeks?

Sadly many users with old OpenSSL's still won't have blake2, but pretty quickly 
Windows and OS X users will get blake2!

--
nosy: +alex

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Zooko Wilcox-O'Hearn

Zooko Wilcox-O'Hearn added the comment:

Oh, just to be clear, I didn't mean to imply that BLAKE2 is _less_ safe than 
SHA-3. My best estimate is that BLAKE2 and SHA-3 are equivalently safe, and 
that either of them is safer than SHA-2, SHA-1, or MD5.

--

___
Python tracker 

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



[issue26755] Update version{added,changed} docs in devguide

2016-04-18 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue26755] Update version{added,changed} docs in devguide

2016-04-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ef3d77b3c27 by Berker Peksag in branch 'default':
Issue #26755: Clarify when version{added,changed} directives should be used in 
docs
https://hg.python.org/devguide/rev/6ef3d77b3c27

--
nosy: +python-dev

___
Python tracker 

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



[issue26798] add BLAKE2 to hashlib

2016-04-18 Thread Zooko Wilcox-O'Hearn

New submission from Zooko Wilcox-O'Hearn:

(Disclosure: I'm one of the authors of BLAKE2.)

Please include BLAKE2 in hashlib. It well-suited for hashing long inputs (e.g. 
files), because it is substantially faster than SHA-3, SHA-2, SHA-1, or MD5 
while also being safer than SHA-2, SHA-1, or MD5.

BLAKE2 and/or its relatives, BLAKE, ChaCha20, and Salsa20, have gotten 
extensive cryptographic peer review.

It is widely used in modern applications and widely supported in modern crypto 
libraries (https://en.wikipedia.org/wiki/BLAKE_%28hash_function%29#BLAKE2_uses).

Here is the official reference implementation: https://github.com/BLAKE2

Here are some Python modules (wrappers or implementations):
 * https://github.com/buggywhip/blake2_py
 * https://github.com/dchest/pyblake2
 * https://github.com/darjeeling/python-blake2

--
components: Library (Lib)
messages: 263679
nosy: Zooko.Wilcox-O'Hearn, dstufft
priority: normal
severity: normal
status: open
title: add BLAKE2 to hashlib

___
Python tracker 

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



[issue26797] Segafault in _PyObject_Alloc

2016-04-18 Thread Yury Selivanov

New submission from Yury Selivanov:

I'm working on an implementation of asyncio event loop on top of libuv [1].  
One of my tests crashes on Mac OS X with a segfault [2].  The problem is that 
it's not consistent -- looks like it depends on size of uvloop so binary, 
or/and amount of objects allocated in program.

I can't reproduce the problem on a debug build, or write a test for it, it is 
really a weird edge-case.  But I'm certain that we have a bug in our memory 
allocator.

Here's a screenshot of crash log [3], and here's an lldb disassembly of crash 
location [4].

Now, what's going on in [2] is:
1. uvloop sets a sigint signal handler the moment it starts the loop
2. uvloop start to execute a coroutine, which blocks on a long "time.sleep(..)" 
call
3. sigint handler receives a SIGINT and calls PyErr_SetInterrupt
4. CPython interrupts the code, KeyboardInterrupt is instantiated and raised
5. CPython starts to render the traceback to print it to stderr, and this is 
where it tries to allocate some object, and this is where we hit a bad-access 
in _PyObject_Alloc.

I'd really appreciate any ideas on what's going on here and how we can fix this.


[1] https://github.com/magicstack/uvloop
[2] https://github.com/MagicStack/uvloop/blob/v0.4.6/tests/test_signals.py#L14
[3] http://imgur.com/6GcE92X
[4] https://gist.github.com/1st1/b46f3702aeb1b57fe4ad32b19ed63c3f

--
messages: 263678
nosy: haypo, ned.deily, serhiy.storchaka, yselivanov
priority: normal
severity: normal
stage: test needed
status: open
title: Segafault in _PyObject_Alloc
type: crash
versions: Python 3.5

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson

Changes by Mark Dickinson :


--
type: behavior -> enhancement

___
Python tracker 

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



[issue26785] repr of -nan value should contain the sign

2016-04-18 Thread Mark Dickinson

Mark Dickinson added the comment:

> Looks like the sign bit is off (0) in 2.7.

Yep, that looks like issue 22590. It's "fixed" in Python 3, and I don't think 
it's worth changing in Python 2.

About this issue (sign in repr of NaN): sorry, but I'm unconvinced. :-)

>From the standpoint of IEEE 754, the only part that's really relevant is 
>section 5.12 ("Details of conversion between floating-point data and external 
>character sequences"), and there's nothing in that section indicating that a 
>sign is either recommended or required. The most relevant part is this one:

"""
Conversion of a quiet NaN in a supported format to an external character 
sequence shall produce a language-defined one of “nan” or a sequence that is 
equivalent except for case (e.g., “NaN”), with an optional preceding sign. 
(This standard does not interpret the sign of a NaN.)
"""

Yes, it's true that copysign copies the sign bit, but I don't see the leap from 
there to saying that the *repr* of a NaN should include it. total_order doesn't 
really seem relevant here, since Python doesn't implement it, and if it were 
implemented that implementation would almost certainly not be via the repr.

To your catan example: Python follows Annex G of the C99 specification for its 
cmath functions. catan is specified in terms of catanh, and the relevant line 
there is:
"""
catanh(NaN + i∞) returns ±0 + iπ /2 (where the sign of the real part of the 
result is unspecified).
"""
Note that the sign of the zero is unspecified here. There's no part of Annex G 
that introduces any dependence on the sign of a NaN. So no, unlike the sign of 
a zero, the sign of a NaN does *not* play a role in selecting which side of a 
branch cut an input to a complex function lies on. (The branch cuts for 
cmath.atan are both on the imaginary axis, with real part 0; while it's not 
really clear what kind of topology applies to a C99-style extended complex 
plane, it would be a stretch to regard inf +/- iNaN as being anywhere on or 
near that branch cut.)

The roundtrip argument doesn't really hold water either: a quiet NaN has 52 
extra bits of information - a sign bit and a 51-bit payload; if we were 
attempting to roundtrip the bits, we'd need to include the payload information 
too. I don't see that it's any more important to distinguish NaNs with 
different signs than to distinguish NaNs with different payloads.

> MSVC 2015 and MinGW-W64 v4.9.2 output (source below) for '-nan' values are:
> MSVC:  -nan(ind)
> MinGW-W64: -1.#IND00

Sure, and clang on OS X produces "nan" for the same source.

> It is reasonable to assume some will need to preserve it.

Maybe, but I've read and worked with a lot of numerical code over the last two 
and a half decades, and I have yet to see any whose correctness depends on 
interpreting the sign of a NaN. Access to the sign bit of a NaN is a rare need, 
and not something that needs be included in the repr. For those who really do 
need it for some kind of custom use-case, it's not hard to use copysign to 
extract it.

In sum, I don't see any benefit to adding the sign, and there's an obvious 
drawback in the form of code breakage (in doctests, for example).

--

___
Python tracker 

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



[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-18 Thread Terry J. Reedy

Terry J. Reedy added the comment:

0. OK, 2.7.5 came out in 2013 May, after the 2.7 backport.  Kristján, you did 
the backport.  Do you have any idea about this?

1. Open a Command Prompt window, the command line console.  For Win 7, it can 
be found find it on the Start menu under Admin or something or started on the 
run line with 'cmd.exe'.  You should learn how to get the console.

On the command line, after the ...> prompt, enter "python patth/to/Skier.py".

Or, maybe, find Skier.py in Windows Explorer, and either double click or 
right-click and select "Run".  (I am not sure if this works with 2.7.5 on 
Vista.)

--
keywords: +3.4regression
nosy: +kristjan.jonsson

___
Python tracker 

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



[issue26615] Missing entry in WRAPPER_ASSIGNMENTS in update_wrapper's doc

2016-04-18 Thread Berker Peksag

Berker Peksag added the comment:

__qualname__ was added to WRAPPER_ASSIGNMENTS in 963e98f5ad31 (issue 13544).

Thanks for the patch!

--
nosy: +berker.peksag
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> behavior
versions: +Python 3.5

___
Python tracker 

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



[issue26615] Missing entry in WRAPPER_ASSIGNMENTS in update_wrapper's doc

2016-04-18 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 11d8f5d1968d by Berker Peksag in branch '3.5':
Issue #26615: Add missing __qualname__ entry to functools.update_wrapper() docs
https://hg.python.org/cpython/rev/11d8f5d1968d

New changeset ee9921b29fd8 by Berker Peksag in branch 'default':
Issue #26615: Add missing __qualname__ entry to functools.update_wrapper() docs
https://hg.python.org/cpython/rev/ee9921b29fd8

--
nosy: +python-dev

___
Python tracker 

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



Re: How to track files processed

2016-04-18 Thread Martin A. Brown

Greetings,

>If you are parsing files in a directory what is the best way to 
>record which files were actioned?
>
>So that if i re-parse the directory i only parse the new files in 
>the directory?

How will you know that the files are new?

If a file has exactly the same content as another file, but a 
different name, is it new?

Often this depends on the characteristics of the system in which 
your (planned) software is operating.

Peter Otten has also asked for some more context, which would help 
us give you some tips that are more targetted to the problem you are 
trying to solve.

But, I'll just forge ahead and make some assumptions:

  * You are watching a directory for new/changed files.
  * New files are appearing regularly.
  * Contents of old files get updated and you want to know.

Have you ever seen an MD5SUMS file?  Do you know what a content hash 
is?  You could find a place to store the content hash (a.k.a. 
digest) of each file that you process.

Below is a program that should work in Python2 and Python3.  You 
could use this sort of approach as part of your solution.  In order 
to make sure you have handled a file before, you should store and 
compare two things.

  1.  The filename.
  2.  The content hash.

Note:  If you are sure the content is not going to change, then just 
use the filename to track whether you have handled something or not.

How would you use this tracking info ?

  * Create a dictionary (or a set), e.g.:

handled = dict()
handled[('410c35da37b9a25d9b5d701753b011e5','setup.py')] = time.time()

Lasts only as long as the program runs.  But, you will know
that you have handled any file by the tuple of its content hash 
and filename.

  * Store the filename (and/or digest) in a database.  So many 
options: sqlite, pickle, anydbm, text file of your own 
crafting, SQLAlchemy ...

  * Create a file, hardlink or symlink in the filesystem (in the 
same directory or another directory), e.g.:

trackingfile = os.path.join('another-directory', 'setup.py')
with open(trackingfile, 'w') as f:
f.write('410c35da37b9a25d9b5d701753b011e5')
 
  OR

os.symlink('setup.py', '410c35da37b9a25d9b5d701753b011e5-setup.py')

Now, you can also examine your little cache of handled files to 
compare for when the content hash changes.  If the system is an 
automated system, then this can be perfectly fine.  If humans 
create the files, I would suggest not doing this.  Humans tend 
to be easily confused by such things (and then want to delete 
the files or just be intimidated by them; scary hashes!).

There are lots of options, but without some more context, we can 
only make generic suggestions.  So, I'll stop with my generic 
suggestions now.

Have fun and good luck!

-Martin


#! /usr/bin/python

from __future__ import print_function

import os
import sys
import logging
import hashlib

logformat = '%(levelname)-9s %(name)s %(filename)s#%(lineno)s ' \
 + '%(funcName)s %(message)s'
logging.basicConfig(stream=sys.stderr, format=logformat, level=logging.ERROR)
logger = logging.getLogger(__name__)

def hashthatfile(fname):
contenthash = hashlib.md5()
try:
with open(fname, 'rb') as f:
contenthash.update(f.read())
return contenthash.hexdigest()
except IOError as e:
logger.warning("See exception below; skipping file %s", fname)
logger.exception(e)
return None


def main(dirname):
for fname in os.listdir(dirname):
if not os.path.isfile(fname):
logger.debug("Skipping non-file %s", fname)
continue
logger.info("Found file %s", fname)
digest = hashthatfile(fname)
logger.info("Computed MD5 hash digest %s", digest)
print('%s %s' % (digest, fname,))
return os.EX_OK


if __name__ == '__main__':
if len(sys.argv) == 1:
sys.exit(main(os.getcwd()))
else:
sys.exit(main(sys.argv[1]))

# -- end of file


-- 
Martin A. Brown
http://linux-ip.net/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue22873] Re: SSLsocket.getpeercert - return ALL the fields of the certificate.

2016-04-18 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> ssl.getpeercert() should include extensions

___
Python tracker 

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



[issue26787] test_distutils fails when configured --with-lto

2016-04-18 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

This patch is for CPython 3, and if it looks good I will post also the CPython 
2 version.

--

___
Python tracker 

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



[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Guido van Rossum

Guido van Rossum added the comment:

There should at least be a comment at the definition of _MAX_WORKERS that it's 
only used on Python 3.4 and before.

Maybe a note in the docs about the default executor would also be useful.

Otherwise this is exactly what I had in mind -- thanks!

PS. Could you sign a contributor form online
https://www.python.org/psf/contrib/contrib-form/

--

___
Python tracker 

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



[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Hans Lawrenz

Hans Lawrenz added the comment:

Thanks, that makes sense. I've attached a patch with a version check.

--
Added file: 
http://bugs.python.org/file42507/run_in_executor_max_workers_vcheck.patch

___
Python tracker 

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



Re: Creating a hot vector (numpy)

2016-04-18 Thread Paulo da Silva
Às 05:05 de 18-04-2016, Reto Brunner escreveu:
> Hi,
> It is called broadcasting an array, have a look here:
> http://docs.scipy.org/doc/numpy-1.10.1/user/basics.broadcasting.html
> 
So, there are two broadcasts here.
OK.
Thanks.

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Guido van Rossum

Guido van Rossum added the comment:

I like this idea for 3.5 and later. I know this is a pain, but I would like the 
code to have a version check so that the identical code can still be used in 
Python 3.3 and 3.4. We go through great lengths to keep the asyncio package 
compatible with those versions so that we can occasionally push a version out 
to PyPI for 3.3 and 3.4 users. If the versions diverge we would be unable to 
keep track of other bug fixes.

--

___
Python tracker 

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



Re: Moderation and slight change of (de facto) policy

2016-04-18 Thread Grant Edwards
On 2016-04-18, Barry Warsaw  wrote:
> On Apr 17, 2016, at 06:08 PM, Matt Ruffalo wrote:
>
>>That seems like a reasonable approach, though I think there *really*
>>needs to be an option along the lines of "subscribed to the list for the
>>purposes of moderation, but not receiving list messages via email".

> Alternatively, individuals can subscribe to a mailing list and then disable
> delivery to their address.

AFAIR, all the mailing lists I've ever joined offer this setting, and
I generally use it (I read all my mailing lists by pointing a NNTP
client at news.gmane.org).  If a mailing list doesn't allow to to
disable delivery, then it's usually pretty trivial to set up a filter
to toss all messages received from that list into /dev/null.

-- 
Grant Edwards   grant.b.edwardsYow! ... I want to perform
  at   cranial activities with
  gmail.comTuesday Weld!!

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26796] BaseEventLoop.run_in_executor shouldn't specify max_workers for default Executor

2016-04-18 Thread Hans Lawrenz

New submission from Hans Lawrenz:

In issue 21527  the 
concurrent.futures.ThreadPoolExecutor was changed to have a default value for 
max_workers. When asyncio.base_events.BaseEventLoop.run_in_executor creates a 
default ThreadPoolExecutor it specifies a value of 5 for max_workers, 
presumably because at the time it was written ThreadPoolExecutor didn't have a 
default for max_workers. This is confusing because on reading the documentation 
for ThreadPoolExecutor one might assume that the default specified there is 
what will be used if a default executor isn't supplied via 
BaseEventLoop.set_default_executor.

I propose that BaseEventLoop.run_in_executor be changed to not supply a default 
for max_workers. If this isn't acceptable, a note ought to be put in the 
run_in_executor documentation.

--
components: asyncio
files: run_in_executor_max_workers.patch
keywords: patch
messages: 263669
nosy: Hans Lawrenz, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: BaseEventLoop.run_in_executor shouldn't specify max_workers for default 
Executor
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file42506/run_in_executor_max_workers.patch

___
Python tracker 

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



Re: Moderation and slight change of (de facto) policy

2016-04-18 Thread Barry Warsaw
On Apr 17, 2016, at 06:08 PM, Matt Ruffalo wrote:

>That seems like a reasonable approach, though I think there *really*
>needs to be an option along the lines of "subscribed to the list for the
>purposes of moderation, but not receiving list messages via email".

We can do this effectively in Mailman 2.1 by adding the non-member to
accept_these_nonmembers, and that's fairly easy to do from the admin page.
Mailman 3 will make this more explicit by actually assigning a role of
"nonmember" to the person, so as to be able to more granularly control their
posting privileges.  While we're starting to roll out some Mailman 3 lists, it
will probably be a while before python-list is converted.

Alternatively, individuals can subscribe to a mailing list and then disable
delivery to their address.  This essentially accomplishes the same thing,
although for some lists, posts start out moderated until the person builds
some positive reputation.  Then the admin can turn off their moderation bit
and their posts will go straight through.

Cheers,
-Barry
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26795] Fix PEP 344 Python version

2016-04-18 Thread SilentGhost

SilentGhost added the comment:

I think the note at the top makes it perfectly clear that PEP 344 is superseded 
by PEP 3134 which has correct Python version.

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



[issue26787] test_distutils fails when configured --with-lto

2016-04-18 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

Hello,

You can find a patch for this issue attached. Basically, since LTO needs LD 
flags when used, I modified the makefile template file and the test to push the 
flags up to the sysconfig module.

--
keywords: +patch
Added file: http://bugs.python.org/file42504/issue26787.patch

___
Python tracker 

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



[issue26795] Fix PEP 344 Python version

2016-04-18 Thread Marat Sharafutdinov

New submission from Marat Sharafutdinov:

Should be 3.0 instead of 2.5

--
assignee: docs@python
components: Documentation
files: pep-0344-version.patch
keywords: patch
messages: 263667
nosy: decaz, docs@python
priority: normal
severity: normal
status: open
title: Fix PEP 344 Python version
type: enhancement
Added file: http://bugs.python.org/file42505/pep-0344-version.patch

___
Python tracker 

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



[issue26720] memoryview from BufferedWriter becomes garbage

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

Closing this as a duplicate of Issue 15994, where I have proposed a patch to 
add a note for RawIOBase.write(), and call memoryview.release() when the method 
returns.

--
resolution:  -> duplicate
status: open -> closed
superseder:  -> memoryview to freed memory can cause segfault

___
Python tracker 

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



[issue15994] memoryview to freed memory can cause segfault

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

I think idea 2 (error if memoryview not released) would not work. It would rely 
on garbage collection, which is not always immediate. E.g. if the memoryview 
were kept alive by a reference cycle, it may not immediately be released. I 
don’t think idea 3 is worthwhile, because the memoryview API does not seem 
designed for this use case, and it would not be 100% consistent anyway.

So that leaves my first idea, to call view.release() when readinto(), etc, 
return. This should avoid the crash and data loss problems in some common 
cases. It is implemented in release-view.patch, along with some notes.

--
components: +Unicode
keywords: +patch
nosy: +ezio.melotti, haypo
stage:  -> patch review
Added file: http://bugs.python.org/file42503/release-view.patch

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Sivan Greenberg
On Sat, Apr 16, 2016 at 8:25 PM, Terry Reedy  wrote:

> On 4/16/2016 12:58 PM, Larry Martell wrote:
>
>> On Sat, Apr 16, 2016 at 12:51 PM, Marko Rauhamaa 
>> wrote:
>>
>>> Larry Martell :
>>>
>>> I have worked for many companies where you are required to get a clean
 run of pep8 on your code before your pull request will even be
 considered for approval. I don't agree with this at all, as I think it
 makes the code very ugly, especially enforcing the max line length.

>>>
>>> Agh, I was with you until your last remark.
>>>
>>> A max line length of 79 characters is among the *only* rigorous
>>> principles I judge coding style on.
>>>
>>> It comes with the maxim that one function must be visible at once on the
>>> screen.
>>>
>>
>> if we still had 1970's 80 character TTYs that would matter but on my
>> 29" 1920x1080 screen it doesn't.
>>
>
> It depends on whether one prefers to use the extra width to have long
> lines or side-by-side windows.  I prefer the latter.


That's my use case as well, and why I admire the forethought in the width
length. Side by side windows rock when doing TTD.

-Sivan
-- 
https://mail.python.org/mailman/listinfo/python-list


Wing IDE 5.1.11 released

2016-04-18 Thread Wingware

Hi,

Wingware has released version 5.1.11 of Wing IDE, our cross-platform 
integrated development environment for the Python programming language.


Wing IDE features a professional code editor with vi, emacs, visual 
studio, and other key bindings, auto-completion, call tips, 
context-sensitive auto-editing, goto-definition, find uses, refactoring, 
a powerful debugger, version control, unit testing, search, project 
management, and many other features.


This release includes the following minor improvements:

Fix Django template debugging for Django version 1.9 (requires 1.9.3+)
Fix Debian package dependency for newer Linux distributions
Fix git status when --use-porcelain is disabled with recent git 
versions

Correctly find points of use of class attributes
Added block commenting option for PEP8 style column 0 comment
Fix analysis of extension modules when using Python 3.5 on Windows
Sort alphabetically within type in Source Browser when using Sort 
by Type

Fix problems with extra argument passing to unit test runners
Several auto-editing fixes
About 20 other bug fixes

For details see http://wingware.com/news/2016-04-15 and 
http://wingware.com/pub/wingide/5.1.11/CHANGELOG.txt


What's New in Wing 5.1:

Wing IDE 5.1 adds multi-process and child process debugging, syntax 
highlighting in the shells, support for pytest, Find Symbol in Project, 
persistent time-stamped unit test results, auto-conversion of indents on 
paste, an XCode keyboard personality, support for Flask, Django 1.7, 
1.8, and 1.9, Python 3.5 and recent Google App Engine versions, improved 
auto-completion for PyQt, recursive snippet invocation, and many other 
minor features and improvements.


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com

--
https://mail.python.org/mailman/listinfo/python-announce-list

   Support the Python Software Foundation:
   http://www.python.org/psf/donations/


ANN: Wing IDE 5.1.11 released

2016-04-18 Thread Wingware

Hi,

Wingware has released version 5.1.11 of Wing IDE, our cross-platform 
integrated development environment for the Python programming language.


Wing IDE features a professional code editor with vi, emacs, visual 
studio, and other key bindings, auto-completion, call tips, 
context-sensitive auto-editing, goto-definition, find uses, refactoring, 
a powerful debugger, version control, unit testing, search, project 
management, and many other features.


This release includes the following minor improvements:

Fix Django template debugging for Django version 1.9 (requires 1.9.3+)
Fix Debian package dependency for newer Linux distributions
Fix git status when --use-porcelain is disabled with recent git 
versions

Correctly find points of use of class attributes
Added block commenting option for PEP8 style column 0 comment
Fix analysis of extension modules when using Python 3.5 on Windows
Sort alphabetically within type in Source Browser when using Sort 
by Type

Fix problems with extra argument passing to unit test runners
Several auto-editing fixes
About 20 other bug fixes

For details see http://wingware.com/news/2016-04-15 and 
http://wingware.com/pub/wingide/5.1.11/CHANGELOG.txt


What's New in Wing 5.1:

Wing IDE 5.1 adds multi-process and child process debugging, syntax 
highlighting in the shells, support for pytest, Find Symbol in Project, 
persistent time-stamped unit test results, auto-conversion of indents on 
paste, an XCode keyboard personality, support for Flask, Django 1.7, 
1.8, and 1.9, Python 3.5 and recent Google App Engine versions, improved 
auto-completion for PyQt, recursive snippet invocation, and many other 
minor features and improvements.


Free trial: http://wingware.com/wingide/trial
Downloads: http://wingware.com/downloads
Feature list: http://wingware.com/wingide/features
Sales: http://wingware.com/store/purchase
Upgrades: https://wingware.com/store/upgrade

Questions?  Don't hesitate to email us at supp...@wingware.com.

Thanks,

--

Stephan Deibel
Wingware | Python IDE

The Intelligent Development Environment for Python Programmers

wingware.com

--
https://mail.python.org/mailman/listinfo/python-list


[issue8027] distutils fail to determine c++ linker with unixcompiler if using ccache

2016-04-18 Thread Erik Bray

Erik Bray added the comment:

I'm also inclined to agree that the buggy code (and it *is* buggy even if it 
was meant to fix something originally) should be removed outright.  Nobody can 
point to a real world issue that it fixes anymore, yet we can point to real 
world consequences caused by this bug still.

However, I could also agree that this should come with better support for 
CXXFLAGS and CXXLINK.  It's no wonder these variables are ignored by 
CPython--it doesn't use any c++.  That said, extension module compilation is 
tied, through distutils, to CPython. And there are plenty of c++ extension 
modules in the wild that are affected.  So it's worth addressing how these 
variables are used--or rather not used properly--by distutils.

I'd be happy to take a look at that if that sounds like a good approach?  
Otherwise I'd push for accepting some versions of the existing patches by 
Joshua.J.Cogliati that remove the buggy code.

--

___
Python tracker 

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



[issue8027] distutils fail to determine c++ linker with unixcompiler if using ccache

2016-04-18 Thread Erik Bray

Changes by Erik Bray :


--
nosy: +erik.bray

___
Python tracker 

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



Re: How to track files processed

2016-04-18 Thread Peter Otten
Sayth Renshaw wrote:

> If you are parsing files in a directory what is the best way to record
> which files were actioned?

What do you do with the result of the parsing process? If you write it to 
another file you can just look if that file already exists. If you write it 
to a database there may be a specific record to look for.

> So that if i re-parse the directory i only parse the new files in the
> directory?

Can you give some context? What are you trying to do? Is your application 
running all the time or would you like to invoke it, process new files and 
then terminate?

-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-18 Thread MICHAEL JACOBSON

MICHAEL JACOBSON added the comment:

0. I have Python 2.7.5
1. I don't know what you mean.
2. It fails right when I run it.
IDLE stands for Python's Integrated DeveLopment Environment
I am running IDLE / Python on a Windows Vista, Service pack 2

--

___
Python tracker 

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



Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread David Palao
2016-04-18 5:19 GMT+02:00 Steven D'Aprano :
> On Mon, 18 Apr 2016 11:39 am, Rustom Mody wrote:
>
>> yes we can agree on this -- arbitrary line lengths are almost certainly
>> unreadable.
>> The problem then becomes so what is optimal?
>
> I really don't think it is a problem. We have about 400 years
> of experience with printed text, and that experience tells us
> that the optimal width for reading prose in Western languages
> is about 60 characters, give or take. This width is optimal
> for eye movement, and minimizes the number of errors and
> reduces eye-strain.
>
> There's only so far that our eyes can follow a line to the
> right without increasing stress or reading errors, and
> likewise when returning back to the left margin. The longer
> the line, the higher the chance of losing track, and the
> physical effort it takes to read. (You have to move the eyes
> further, and for extremely long lines, you may have to move
> your entire head.)
>
> Long lines are simply harder to read because you have to
> move your eyes more, and the longer the lines, the greater
> the tendency to wander across the lines. Especially if the
> lines are close together and the height of the lines is
> small. (It boggles my mind how many programmers I've met who
> routinely view their code in tiny physical heights, even
> when reading it in fine detail.)
>
> The optimal width for eye-tracking (that is, the maximum
> width for which the rate of such errors can be disregarded)
> is somewhere about sixty characters per line.
>
> The same eye-tracking considerations apply to code, but:
>
> when it comes to code, we don't always have to track all the
> way back to the left-hand margin. If we start (say) up to
> twenty columns in, then we can afford to write up to twenty
> columns further to the right too.
>
>
> (Also, code tends to have VERY ragged right-hand margins.
> Not all lines end up even close to sixty characters wide.)
>
> There are other considerations though. Unlike prose, with
> code, shorter lines *may* sometimes force an increase in
> complexity. For instance, temporary variables need to be
> created, or new functions created, just to avoid otherwise
> excessively long lines. So one might be willing to accept a
> little more eye-movement for a little less code complexity.
>
> So allowing a total width of 80 (give or take) is already a
> compromise from the optimal sixty characters. This compromise
> allows for indented code, and allows up to 20 characters
> extra to avoid creating more complexity elsewhere.
>
>
> But there's another factor: long lines of code are themselves
> a code-smell. Perhaps:
>
> - you have indented too deeply, suggesting that your function
>   is doing too much or has too much internal complexity:
>
>   def func():
>   if a:
>   for b in seq:
>   while c:
>   with d:
>   try:
>   try:
>   for e in it:
>   block  # only 48 columns available here
>
>   (But note also that even with this extreme example, eight
>   indentation levels deep, you can still fit almost
>   characters per line without breaking the 80-char limit.
>   You can do a lot in 50 characters.)
>
>
> - you have too many expressions on one line, suggesting that
>   the over-all complexity of the line is excessive;
>
> - your variable or function names are needlessly verbose or
>   are doing too much or are too specific
>   ("calculate_number_of_pages_and_number_of_semicolons_in_chapter_one");
>
> - or you are violating the rule of Demeter:
>   get(customer.trousers.pocket.wallet).open().money.pay(1)
>
>
> In other words, long lines of code are themselves an
> indication of poorly-designed code. Even though there are
> exceptions, we should resist strongly the urge to extend
> beyond the 60-80 (or perhaps 90 in extreme cases) limit.
> Whenever I hear people saying that they regularly need to
> use 100 or even 120 columns for their code, what I hear is
> "my code is badly written".
>
>
>
> --
> Steven
>
> --
> https://mail.python.org/mailman/listinfo/python-list

Excellent! Thank you for this contribution.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [OT] Java generics (was: Guido sees the light: PEP 8 updated)

2016-04-18 Thread Tim Delaney
On 18 April 2016 at 09:30, Chris Angelico  wrote:

> On Mon, Apr 18, 2016 at 8:02 AM, Tim Delaney
>  wrote:
> > I also wouldn't describe Java as a
> > "perfectly good language" - it is at best a compromise language that just
> > happened to be heavily promoted and accepted at the right time.
> >
> > Python is *much* closer to my idea of a perfectly good language.
>
> "Java" was originally four related, but separate, concepts: a source
> language, a bytecode, a sandboxing system, and one other that I can't
> now remember.


I was very specifically referring to Java the language. The JVM is fairly
nice, especially with the recent changes specifically aimed at more easily
supporting dynamic languages.

Speaking of JVM changes - I had to take over support of a chat applet
developed by a contractor built on Java 1.0. We just could not get it to
work reliably (this was for the original Foxtel web site - I remember
trying to keep it up and running while Richard Fidler was doing a promoted
chat session ...). Then Java 1.1 was released and what a huge improvement
that was.

Tim Delaney
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Rustom Mody
On Monday, April 18, 2016 at 2:34:10 PM UTC+5:30, Gregory Ewing wrote:
> Rustom Mody wrote:
> > Come to think of it take an SQL DBMS browser.
> > Should we say: Horizontal scrolls are BAD; just reformat the table after 
> > reaching 80 columns?
> 
> I would say, yes, horizontal scrolling *is* bad in a table --
> probably even worse than it is for text or code.
> 
> The reason is that tables are usually laid out so that
> data items in a row are related to each other. You can't
> make sense of a piece of data in the table without seeing
> the other items in the same row. That's hard to do if
> you can't see the whole row at once.

"horizontal scrolling: BAD" + "Need to see whole row at once"
How to reconcile these two? (Think of a 50 column table/spreadsheet)
The only answer I know in DBMS lingo is "normalize" (refactor in programming
lingo)
which one way or other amounts to "Store some of those columns in your head"

Obviously I am not against normalization when it actually cleans up
I am against normalization just to reduce no of columns

> 
> > In fact much of the point of 
> > http://blog.languager.org/2012/10/layout-imperative-in-functional.html
> > is just this: that as code becomes more and more data-ish,
> > a more-lines-less-columns regime becomes correspondingly irksome.
> 
> I draw the opposite conclusion. The more your code is
> laid out like a table, the more important it is to be
> able to see the whole width of it at once.
> 
> Your Haskell lexer example looks all very nice in a
> good wide browser window. But reduce it so you can only
> see half of it at a time and then tell me how readable
> it is.

Horrible.
So what are we (if at all) disagreeing on?

-- 
https://mail.python.org/mailman/listinfo/python-list


How to track files processed

2016-04-18 Thread Sayth Renshaw
Hi

If you are parsing files in a directory what is the best way to record which 
files were actioned?

So that if i re-parse the directory i only parse the new files in the 
directory? 

Thanks

Sayth
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What iterable method should I use for Lists of Lists

2016-04-18 Thread Peter Otten
Sayth Renshaw wrote:

> Think I have a solution of sorts, although my numpy array failed, zip
> worked.
> 
> from pyquery import PyQuery as pq
> import numpy as np
> 
> d = pq(filename='20160319RHIL0_edit.xml')
> res = d('nomination')
> # myAt = pq.each(res.attr('bbid'))
> # print(repr(res))
> # myAt = [res.eq(i).attr('horse') for i in range(len(res))]
> # print(myAt)
> 
> nomID = [res.eq(i).attr('id') for i in range(len(res))]
> horseName = [res.eq(i).attr('horse') for i in range(len(res))]
> zipped = zip(nomID, horseName)
> 
> # yes = np.array(zipped)
> for items in zipped:
> print(items)
> 
> In [8]: ('171115', 'Vergara')
> ('187674', 'Heavens Above')
> ('184732', 'Sweet Fire')
> ('181928', 'Alegria')
> ('158914', 'Piamimi')
> ('171408', 'Blendwell')
> ('166836', 'Adorabeel (NZ)')
> ('172933', 'Mary Lou')
> ('182533', 'Skyline Blush')
> ('171801', 'All Cerise')
> ('181079', 'Gust of Wind (NZ)')
> 
> Still interested if there is a better to do this.

I don't know pyquery, so there may still be better ways. This is how far I 
got with dir() and the common Python wisdom "Never use range(len(...))":

>>> import pyquery
>>> d = pyquery.PyQuery(filename="horse.xml")
>>> pairs = [(n.attrib["horse"], n.attrib["id"]) for n in d("nomination")]
>>> import pprint
>>> pprint.pprint(pairs)
[('Vergara', '171115'),
 ('Heavens Above', '187674'),
 ('Sweet Fire', '184732'),
 ('Alegria', '181928'),
 ('Piamimi', '158914'),
 ('Blendwell', '171408'),
 ('Adorabeel (NZ)', '166836'),
 ('Mary Lou', '172933'),
 ('Skyline Blush', '182533'),
 ('All Cerise', '171801'),
 ('Gust of Wind (NZ)', '181079')]

pprint is not really necessary, it just gives more readable output than

>>> pairs
[('Vergara', '171115'), ('Heavens Above', '187674'), ('Sweet Fire', 
'184732'), ('Alegria', '181928'), ('Piamimi', '158914'), ('Blendwell', 
'171408'), ('Adorabeel (NZ)', '166836'), ('Mary Lou', '172933'), ('Skyline 
Blush', '182533'), ('All Cerise', '171801'), ('Gust of Wind (NZ)', 
'181079')]

To extract more than one attribute operator.itemgetter comes in handy:

>>> from operator import itemgetter
>>> get = itemgetter("horse", "id", "saddlecloth")
>>> pprint.pprint([get(n.attrib) for n in d("nomination")])
[('Vergara', '171115', '4'),
 ('Heavens Above', '187674', '2'),
 ('Sweet Fire', '184732', '6'),
 ('Alegria', '181928', '7'),
 ('Piamimi', '158914', '11'),
 ('Blendwell', '171408', '10'),
 ('Adorabeel (NZ)', '166836', '3'),
 ('Mary Lou', '172933', '8'),
 ('Skyline Blush', '182533', '9'),
 ('All Cerise', '171801', '5'),
 ('Gust of Wind (NZ)', '181079', '1')]

If you need to do some post-processing use a helper function:

>>> def extract(n):
... attrib = n.attrib
... id = int(attrib["id"])
... name = attrib["horse"].upper()
... return id, name
... 
>>> pprint.pprint([extract(n) for n in d("nomination")])
[(171115, 'VERGARA'),
 (187674, 'HEAVENS ABOVE'),
 (184732, 'SWEET FIRE'),
 (181928, 'ALEGRIA'),
 (158914, 'PIAMIMI'),
 (171408, 'BLENDWELL'),
 (166836, 'ADORABEEL (NZ)'),
 (172933, 'MARY LOU'),
 (182533, 'SKYLINE BLUSH'),
 (171801, 'ALL CERISE'),
 (181079, 'GUST OF WIND (NZ)')]


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26657] Directory traversal with http.server and SimpleHTTPServer on windows

2016-04-18 Thread Martin Panter

Martin Panter added the comment:

Thanks for the report and the patch.

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



Re: Python2.7 win64 --- cannot install the package of scipy

2016-04-18 Thread Oscar Benjamin
On 16 April 2016 at 22:53,   wrote:
> I failed to install the package of scipy on Python2.7(win64).
>
> 1. I tried the direct way that use cmd--pip install scripy. The result shows 
> that it failed with error code 1 in 
> c:\tyk\appdata\local\temp\pip-build-an9fye\scipy\.
>
> 2. I tried to install in another way. I download the 
> scipy-0.17.0-cp27-none-win_amd64.whl from Unofficial Windows Binaries for 
> Python Extension Packages. And use cmd to install that in the Scripts 
> direction, but still failed.(I have installed the package wheel already). The 
> result shows that scipy-0.17.0-cp27-none-win_amd64.whl is not a supported 
> wheel on this platform.

That should be the right wheel if you have 64-bit Python 2.7 on
Windows. Note that it's possible you have 32 bit Python even if the
computer and Windows is 64-bit.

It's also possible that you need to update pip.

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: QWERTY was not designed to intentionally slow typists down

2016-04-18 Thread Gregory Ewing

Steven D'Aprano wrote:

Even on a modern keyboard, out of the ten most common digraphs:

th he in er an re nd at on nt

only er/re use consecutive keys,


Also keep in mind that E and R being adjacent on the
keyboard does *not* mean they're adjacent in the type
basket -- they're actually separated by two other
characters (D and C). That's only one less than
I and N (separated by U, J nd M).

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-18 Thread Steven Adams

Steven Adams added the comment:

Ok but the question still remains, why does it only happen on py3.4+??

--

___
Python tracker 

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



Re: scipy install error,need help its important

2016-04-18 Thread Oscar Benjamin
On 18 April 2016 at 08:38, Xristos Xristoou  wrote:
> Τη Δευτέρα, 18 Απριλίου 2016 - 6:53:30 π.μ. UTC+3, ο χρήστης Xristos Xristoou 
> έγραψε:
>> guys i have big proplem i want to install scipy
>> but all time show me error
>> i have python 2.7 and windows 10
>> i try to use pip install scipy and i take that error
>>
>> raise NotFoundError('no lapack/blas resources found')
>> numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
>>
>
> yes i have idle python 2.7 before,must delete first before install anaconda 
> ?how can anaconda packages to run with old idle ?because i have to many 
> packages in old python.

Just install numpy and scipy from here (as already mentioned earlier
in the thread):

http://www.lfd.uci.edu/~gohlke/pythonlibs/

--
Oscar
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Guido sees the light: PEP 8 updated

2016-04-18 Thread Marko Rauhamaa
Gregory Ewing :

> Marko Rauhamaa wrote:
>> Steven D'Aprano :
>>
>>>def Do_The_Thing():
>>>def internal_subpart_start(): ...
>>>def internal_subpart_middle(): ...
>>>def internal_subpart_end(): ...
>>>...
>>
>> That really should be done more. C weaned us from the routine Pascal
>> mechanism, but there's no reason not to exploit it again in Python.
>
> Two things Python has that Pascal didn't are modules and classes. They
> take care of a lot of the grouping that you had to rely on nested
> functions for in Pascal.

I don't think Pascal did it for grouping or readability but for
conceptual correctness. When I moved from Pascal to C, I felt the
absence of local functions; it was a slight unease about abstraction
leakage.

> I do find myself nesting functions like that in Python, but only very
> occasionally.

Same for me. Essentially, I use local functions to register callbacks.
Decades of C has done that to us.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list


  1   2   >