[issue27922] Make IDLE tests less flashy

2016-09-04 Thread Xiang Zhang

Xiang Zhang added the comment:

After some tries, I think it seems to be caused by the second open in 
test_open_and_close in SearchDialogBaseTest. The second open calls 
self.top.deiconify.

--

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2016-09-04 Thread Xiang Zhang

Xiang Zhang added the comment:

Hi Terry, I think this issue may be not completed. While running idlelib test 
with -ugui, I can sometimes still get a window flash. I think it's due to 
test_searchbase. Running python -m idlelib.idle_test.test_searchbase can 
reproduce the flash and adding withdraw doesn't work for me.

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue27923] PEP 467 -- Minor API improvements for binary sequences

2016-09-04 Thread Elias Zamaria

Elias Zamaria added the comment:

Martin, where am I supposed to get the patch URL from?

Also, is it too soon to issue DeprecationWarnings? Would it be more appropriate 
if they are PendingDeprecationWarnings instead?

--

___
Python tracker 

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



[issue27918] Running test suites without gui but still having windows flash

2016-09-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

This issue only addresses and fixes the 1 flash per process from 
test.support.is_gui_available.  I separately added root.withdraw to IDLE tests 
in #27922, to stop their flashes.  Doing the same for tkinter tests would be a 
third issue.  I believe it would be easy since tkinter has a support module 
with mechanisms to set up and tear down root windows.  (I am thinking of 
something similar for IDLE.)  I leave this to Serhiy.

--
assignee:  -> terry.reedy
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



[issue27918] Running test suites without gui but still having windows flash

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset de9e410e78d8 by Terry Jan Reedy in branch '2.7':
Issue #27918# test.resource.is_gui_available no longer flashes tk window.
https://hg.python.org/cpython/rev/de9e410e78d8

New changeset 756c27efe193 by Terry Jan Reedy in branch '3.5':
Issue #27918# test.resource.is_gui_available no longer flashes tk window.
https://hg.python.org/cpython/rev/756c27efe193

--
nosy: +python-dev

___
Python tracker 

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



[issue27950] Superfluous messages when running make

2016-09-04 Thread Xiang Zhang

Xiang Zhang added the comment:

Ohh, it's reasonable. I forgot # means also comments in shell. What a shame. :(

But can we make it '@ #...'? Note there is a space. In my editor(Emacs), 
'@#' will break highlight and highlight it as a command, which is a hurt 
during reading. You can see it in the screenshot I upload.

--
Added file: http://bugs.python.org/file44367/Selection_012.png

___
Python tracker 

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



Re: Why doesn't my finaliser run here?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 11:48 AM, Ben Finney  wrote:
> The larger point which remains true: Don't think of ‘__init__’ as a
> constructor, all it does is work on an *already-constructed* instance.
>
> The ‘__new__’ method is the constructor. The instance doesn't exist
> before that method is called; if successful, the instance is constructed
> and returned.
>
> The ‘__init__’ method is the initialiser. It receives the
> already-constructed instance, and returns ‘None’. That doesn't affect
> existing references to the instance.

It doesn't really matter, though. Here's the outside view of
constructing a class:

instance = Class()

Doesn't matter how it's implemented; you call something and you either
get an instance back, or catch an exception.

While it's technically true that __init__ raising an exception won't
affect existing references to that instance, it's almost immaterial.
You generally won't implement __new__ to retain refs, and you
generally won't call __init__ again after the instance has been fully
constructed. Generally, you can assume that an exception in __init__
means you can safely dispose of the object.

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


[issue21622] ctypes.util incorrectly fails for libraries without DT_SONAME

2016-09-04 Thread Martin Panter

Martin Panter added the comment:

I think it may be reasonable to change the code to return the library file name 
if no soname can be found.

In the long term, I think always returning the filename rather than soname 
might be reasonable. Or even returning the full path, which we tried in Issue 
21042 (but rolled back because the solution so far is not consistent across 
platforms).

--
stage:  -> needs patch
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: Why doesn't my finaliser run here?

2016-09-04 Thread Ben Finney
Steve D'Aprano  writes:

> On Sun, 4 Sep 2016 10:37 pm, Ben Finney wrote:
>
> > Short anser: because nothing has removed the reference to the
> > instance.
>
> Hmmm. You're probably right, but not for the reason you think :-)

Thanks to those who corrected some details in my explanation.

> > This is a good example of why it helps to *never* call ‘__init__’
> > the “constructor”. It isn't, because ‘__init__’ acts on an
> > already-constructed instance.
>
> I don't believe I did call it the constructor :-)

You have advocated that in the past, though :-) I am presenting this as
a counter-example: ‘__init__’ does not act as the constructor, so it's
needlessly misleading to refer to it that way.

> > Right. The instance is constructed successfully (by ‘__new__’, the
> > constructor). It will be bound to ‘s’, creating a reference to the
> > instance.
>
> Bound to `s`? Did you mean `e`?

I did. And yes, that was incorrect: the assignment statement does not
complete because the exception interrupts it. So ‘e’ is not a reference
to the instance.

> So it looks like what may have been holding onto the reference to the
> Eggs instance was the exception or traceback, and once that got
> garbage-collected (by me causing a new exception and traceback) the
> finaliser ran.
>
> Which both Oscar and Chris suggested, thanks guys!

Indeed. Thanks for dissecting the right and wrong parts :-)

The larger point which remains true: Don't think of ‘__init__’ as a
constructor, all it does is work on an *already-constructed* instance.

The ‘__new__’ method is the constructor. The instance doesn't exist
before that method is called; if successful, the instance is constructed
and returned.

The ‘__init__’ method is the initialiser. It receives the
already-constructed instance, and returns ‘None’. That doesn't affect
existing references to the instance.

-- 
 \  “Shepherds … look after their sheep so they can, first, fleece |
  `\   them and second, turn them into meat. That's much more like the |
_o__)  priesthood as I know it.” —Christopher Hitchens, 2008-10-29 |
Ben Finney

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


Re: manually sorting images?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:09 PM, Gregory Ewing wrote:
> Quivis wrote:
>> 2. You want to sort them according to red houses, blue houses, green 
>> trees, yellow trees (that's autumn leaves), cats, dogs, children, elderly 
>> people,
> 
> But... but... what if you have a picture of a child
> playing with a dog that's chasing an elderly cat up a
> yellow tree in front of a blue house? What category do
> you put it in?

And this is the weakness in all photo sorting schemes (human schemes
that is).  Some people try organizing folders, others try tagging.
Neither system works that well.  Tags sound good in theory, but in
practice they suck almost as much as folders.  Actually all tag-based
indexing systems suck, even for things like ebooks and music.  Keeping
tags consistent is difficult, and making them complete is impossible.
Maybe computer vision will ease this difficulty, but I kind of doubt it.

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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Michael Torrie
On 09/04/2016 04:22 PM, Gregory Ewing wrote:
> Larry Hudson wrote:
>> If you continue to read this forum, you will quickly learn to ignore 
>> "Pointy-Ears".  He rarely has anything worth while to post, and his 
>> unique fetish about Real Names shows him to be a hypocrite as well.
> 
> To be fair, it's likely that Thomas Lahn is his real
> name, and he's never claimed that one shouldn't also
> include a nickname in one's posted identifier.
> 
> So Veek should be able to appease P.E. by calling
> himself 'Veek "David Smith" M'. The quotes clearly
> mark the middle part as an invented addition, so
> he's not lying, and it looks enough like a Western
> style real name to avoid triggering P.E.'s "fake name"
> reflex. :-)

Or better yet just ignore his posts entirely.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 10:37 pm, Ben Finney wrote:

> Steve D'Aprano  writes:
> 
>> Why doesn't __del__ run here?
> 
> Short anser: because nothing has removed the reference to the instance.

Hmmm. You're probably right, but not for the reason you think :-)


>> class Eggs(object):
>> def __new__(cls):
>> instance = object.__new__(cls)
>> print("instance created successfully")
>> return instance
>> def __init__(self):
>> print("self definitely exists:", self)
>> raise Exception
>> def __del__(self):
>> print("deleting", repr(self))
> 
> This is a good example of why it helps to *never* call ‘__init__’ the
> “constructor”. It isn't, because ‘__init__’ acts on an
> already-constructed instance.

I don't believe I did call it the constructor :-)


> Hance, an exception raised from ‘__init__’ is not going to affect
> whether the instance exists.
> 
>> And an example:
>>
>>
>> py> e = Eggs()
>> instance created successfully
>> self definitely exists: <__main__.Eggs object at 0xb7bf21ec>
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "", line 8, in __init__
>> Exception
>> py>
> 
> 
> Right. The instance is constructed successfully (by ‘__new__’, the
> constructor). It will be bound to ‘s’, creating a reference to the
> instance.

Bound to `s`? Did you mean `e`?

It's certainly not bound to `e`, since that is unbound. I went back to my
interpreter session and tried to view the value of `e`, and as I expected,
it was unbound:


py> e
deleting <__main__.Eggs object at 0xb7bf21ec>
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'e' is not defined


So it looks like what may have been holding onto the reference to the Eggs
instance was the exception or traceback, and once that got
garbage-collected (by me causing a new exception and traceback) the
finaliser ran.

Which both Oscar and Chris suggested, thanks guys!

So this isn't definite proof, but it is very suggestive that the thing
holding onto the reference to the half-built Eggs instance is something to
do with the exception.


> The exception raised from the initialiser does not stop you from binding
> the instance to a name. That binding succeeds; the reference remains.
> Nothing has caused that reference to go away.

That bit is actually wrong. Given:

name = expression

an exception in `expression` prevents the binding to `name` from occurring
at all. If `name` already existed, then it remains untouched, and if it
didn't it remains unbound.



-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue27951] the reply's additional "Re:" is ok

2016-09-04 Thread Martin Panter

New submission from Martin Panter:

Seif, you will have to give more details or context for people to make sense of 
this.

--
nosy: +martin.panter
stage:  -> test needed
status: open -> pending

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-09-04 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue25758] ensurepip/venv broken on Windows if path includes unicode

2016-09-04 Thread Steve Dower

Steve Dower added the comment:

Given a quick read, it looks like issue27781 (PEP 529) will resolve this?

Not encoding the path at all is obviously better, but maybe I'll add this as 
supporting evidence to the PEP...

--

___
Python tracker 

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



[issue27950] Superfluous messages when running make

2016-09-04 Thread Martin Panter

Martin Panter added the comment:

I think

@# Comment

would be just as good as (and slightly clearer than)

@: # Comment

They would both invoke the shell. The first has no command and just a shell 
comment; the second has a no-op command (:) with a comment. Let me know if you 
agree @# would be okay.

I can’t think of a simple solution for the pybuilddir.txt rule. (Other than 
using make -s :)

--

___
Python tracker 

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



Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Sunday, September 4, 2016 at 7:52:44 PM UTC-4, Chris Angelico wrote:
> FWIW, hex is much more common for displaying Unicode codepoints than
> decimal is. So I'd print it like this (incorporating the 'not CAPITAL'
> filter):

You are right, I went too quickly, and didn't realize until after I
posted that I had printed decimal instead of hex.

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


Re: manually sorting images?

2016-09-04 Thread cs

On 05Sep2016 10:09, Greg Ewing  wrote:

Quivis wrote:
2. You want to sort them according to red houses, blue houses, green 
trees, yellow trees (that's autumn leaves), cats, dogs, children, 
elderly people,


But... but... what if you have a picture of a child
playing with a dog that's chasing an elderly cat up a
yellow tree in front of a blue house? What category do
you put it in?

The algorithm has been insufficiently specified!


Yeah. Sounds like he wants a tool that lets him associate tags with images.  
Then he can tag all the photos with all the relevant attributes, then write his 
own classifier/sorted later by examining the tags.


I also suspect the OP is using the word "sort" to mean "classify" (eg "what 
sort of thing is this?") versus is more common programming meaning of 
"ordering".  Would be good to clarify that.


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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Chris Angelico
On Mon, Sep 5, 2016 at 9:40 AM, Ned Batchelder  wrote:
> But, 'CAP' appears in 'CAPITAL', which gives more than 1800 matches:
>
> >>> for c in range(32, 0x11):
> ...   try:
> ... name = unicodedata.name(chr(c))
> ...   except ValueError:
> ... continue
> ...   if 'CAP' in name:
> ... print(c, name)
> ...
> 65 LATIN CAPITAL LETTER A
> 66 LATIN CAPITAL LETTER B
> ..
> .. many other lines, mostly with CAPITAL in them ..
> ..
> 917593 TAG LATIN CAPITAL LETTER Y
> 917594 TAG LATIN CAPITAL LETTER Z
> >>>

FWIW, hex is much more common for displaying Unicode codepoints than
decimal is. So I'd print it like this (incorporating the 'not CAPITAL'
filter):

>>> for c in range(32, 0x11):
... try:
... name = unicodedata.name(chr(c))
... except ValueError:
... continue
... if 'CAP' in name and 'CAPITAL' not in name:
... print("U+%04X %s" % (c, name))
...
U+20E3 COMBINING ENCLOSING KEYCAP
U+2293 SQUARE CAP
U+2410 SYMBOL FOR DATA LINK ESCAPE
U+241B SYMBOL FOR ESCAPE
U+2651 CAPRICORN
U+2E3F CAPITULUM
U+A2B9 YI SYLLABLE CAP
U+CC42 HANGUL SYLLABLE CAP
U+101D3 PHAISTOS DISC SIGN CAPTIVE
U+1D10A MUSICAL SYMBOL DA CAPO
U+1F306 CITYSCAPE AT DUSK
U+1F393 GRADUATION CAP
U+1F3D4 SNOW CAPPED MOUNTAIN
U+1F3D9 CITYSCAPE
U+1F51F KEYCAP TEN
U+1F74E ALCHEMICAL SYMBOL FOR CAPUT MORTUUM
>>>

Takes advantage of %04X giving a minimum, but not maximum, of four digits :)

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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Ned Batchelder
On Saturday, September 3, 2016 at 7:55:48 AM UTC-4, Veek. M wrote:
> https://mail.python.org/pipermail//python-ideas/2014-October/029630.htm
> 
> Wanted to know if the above link idea, had been implemented and if 
> there's a module that accepts a pattern like 'cap' and give you all the 
> instances of unicode 'CAP' characters.
>  ⋂ \bigcap
>  ⊓ \sqcap
>  ∩ \cap
>  ♑ \capricornus
>  ⪸ \succapprox
>  ⪷ \precapprox
> 
> (above's from tex)
> 
> I found two useful modules in this regard: unicode_tex, unicodedata
> but unicodedata is a builtin which does not do globs, regexs - so it's 
> kind of limiting in nature.
> 
> Would be nice if you could search html/xml character entity references 
> as well.

The unicodedata module has all the information you need for searching
Unicode character names.  While it doesn't provide regex or globs, it's
all in-memory, so it's not bad for just iterating over the characters
and finding what you need.

But, 'CAP' appears in 'CAPITAL', which gives more than 1800 matches:

>>> for c in range(32, 0x11):
...   try:
... name = unicodedata.name(chr(c))
...   except ValueError:
... continue
...   if 'CAP' in name:
... print(c, name)
...
65 LATIN CAPITAL LETTER A
66 LATIN CAPITAL LETTER B
..
.. many other lines, mostly with CAPITAL in them ..
..
917593 TAG LATIN CAPITAL LETTER Y
917594 TAG LATIN CAPITAL LETTER Z
>>>

These were the character names without "CAPITAL":

8419 COMBINING ENCLOSING KEYCAP
8851 SQUARE CAP
9232 SYMBOL FOR DATA LINK ESCAPE
9243 SYMBOL FOR ESCAPE
9809 CAPRICORN
11839 CAPITULUM
41657 YI SYLLABLE CAP
52290 HANGUL SYLLABLE CAP
66003 PHAISTOS DISC SIGN CAPTIVE
119050 MUSICAL SYMBOL DA CAPO
127750 CITYSCAPE AT DUSK
127891 GRADUATION CAP
127956 SNOW CAPPED MOUNTAIN
127961 CITYSCAPE
128287 KEYCAP TEN
128846 ALCHEMICAL SYMBOL FOR CAPUT MORTUUM

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


[issue24837] await process.wait() does not work with a new_event_loop

2016-09-04 Thread Justin Mayfield

Justin Mayfield added the comment:

I agree with Guido.  I spent a couple hours trying to debug some of my own code 
that turned out to be this issue.  My use case is single threaded too.

Perhaps I'm daft but I don't understand why the child watcher is part of the 
event loop policy.  At first glance it appears that it would be better suited 
being attached to any event loop in the main thread and then this wouldn't be 
an issue.

I wonder if this design is intended to support launching subprocesses from 
non-main thread event loops, which seems inherently dangerous and potentially 
misguided to me.

--
nosy: +Justin Mayfield

___
Python tracker 

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



Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Gregory Ewing

Larry Hudson wrote:
If you continue to read this forum, you will quickly learn to ignore 
"Pointy-Ears".  He rarely has anything worth while to post, and his 
unique fetish about Real Names shows him to be a hypocrite as well.


To be fair, it's likely that Thomas Lahn is his real
name, and he's never claimed that one shouldn't also
include a nickname in one's posted identifier.

So Veek should be able to appease P.E. by calling
himself 'Veek "David Smith" M'. The quotes clearly
mark the middle part as an invented addition, so
he's not lying, and it looks enough like a Western
style real name to avoid triggering P.E.'s "fake name"
reflex. :-)

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


Re: manually sorting images?

2016-09-04 Thread Gregory Ewing

Quivis wrote:
2. You want to sort them according to red houses, blue houses, green 
trees, yellow trees (that's autumn leaves), cats, dogs, children, elderly 
people,


But... but... what if you have a picture of a child
playing with a dog that's chasing an elderly cat up a
yellow tree in front of a blue house? What category do
you put it in?

The algorithm has been insufficiently specified!

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


Question about abstract base classes and abstract properties -- Python 2.7

2016-09-04 Thread Gerald Britton
I was rereading the 2.7 docs  about abstract base classes the other day.  I
found this:

"This defines a read-only property; you can also define a read-write
abstract property using the ‘long’ form of property declaration:"

along with an example.  so I copied the example and put in a little
surrounding code:


from abc import ABCMeta, abstractproperty

class C:
__metaclass__ = ABCMeta
def getx(self): pass
def setx(self, value): pass
x = abstractproperty(getx, setx)

class D(C):
@property
def x(self):self._x

d = D()
print(d)

When I ran this, I expected an exception, since I defined a read/write
abstract property but only implemented the read operation.  However, the
example runs fine. That is the class D can be instantiated without error.
Of course I cannot set the property since I didn't implement that part.

Now, If I don't implement the property at all, I can' instantiate the
class.  I get:

"TypeError: Can't instantiate abstract class D with abstract methods x"

which is what I would expect.  What I don't understand is why I don't get a
similar error when I implement the read operation for the property but not
the write operation.

If this actually doesn't work (catching the non-implementation at
instantiation time), then why is it documented this way.  To me at least
the doc implies that it *will* raise on the missing write property
implementation.

Is this a doc bug, an  ABC bug or just me? (I've been known to be buggy
from time to time!)

-- 
Gerald Britton, MCSE-DP, MVP
LinkedIn Profile: http://ca.linkedin.com/in/geraldbritton
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: *args and **kwargs

2016-09-04 Thread Matt Ruffalo
On 2016-09-02 15:44, Ben Finney wrote:
> Note that this has nothing to do with how the function is defined; in
> the definition of the function, parameters are neither positional nor
> keyword. You name each of them, and you define an order for them; and
> neither of those makes any of them “positional” or “keyword”.
> Rather, “positional argument and “keyword argument” are characteristics of 
> the arguments you *supply* in a particular call to the function.
>

To be fair, this isn't quite the case. One can define keyword-only
arguments, which must be supplied as such and don't really have an "order":

"""
>>> def f(arg1, arg2, *, arg3=None):
... pass
...
>>> f(1, 2, 3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: f() takes 2 positional arguments but 3 were given
"""

One can even omit the default argument for something keyword-only, which
results in the consistent-but-initially-surprising situation of having a
required keyword argument:

"""
>>> def g(arg1, arg2, *, arg3):
... pass
...
>>> g(1, 2, 3)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: g() takes 2 positional arguments but 3 were given
"""

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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Larry Hudson via Python-list

On 09/04/2016 09:00 AM, Veek. M wrote:

Steve D'Aprano wrote:


On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote:


Regarding the name (From field), my name *is* Veek.M […]


Liar.  *plonk*


You have crossed a line now Thomas.

That is absolutely uncalled for. You have absolutely no legitimate
reason to believe that Veek is not his or her real name.

You owe Veek an apology, and a promise to the entire community that
you will not act in such a bigoted, racist manner again.





ah umm.. I'm not overly offended - it was more of a startle. I've gotten
used to USENET, somewhat - nature of the beast.



If you continue to read this forum, you will quickly learn to ignore "Pointy-Ears".  He rarely 
has anything worth while to post, and his unique fetish about Real Names shows him to be a 
hypocrite as well.


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


[issue23591] enum: Add Flags and IntFlags

2016-09-04 Thread Vedran Čačić

Vedran Čačić added the comment:

> As a side note, I suspect there would be much less confusion with Flag if we 
> had an AutoEnum.

No, there would be _different_ confusion. :-P

Anyway, let's get back to the discussion. I am quite aware about what's the 
intended use, but you can't just assume people will know about it. In my view, 
you must do one of two things:

1) (at least in documentation, and preferably in the code by raising Exceptions 
at class definition time) forbid the use of Flags whose values are not either 
a) powers of two, or b) bitwise or of some already declared values

-or-

2) Specify and implement a robust algorithm for finding the "cover of bits" for 
a given numeric value. If the intended algorithm is really "pick the largest 
member value smaller than given value, subtract and repeat until 0 remains", 
then it should be said so in the documentation, and preferably some reasons 
given for the usage of that exact algorithm. ("it was easiest to implement" 
does not rank very high on my list.)

In other words, MyFlags(7) should either be illegal, or I should be able to 
interpret what it will be by reading the documentation. Leaving it unspecified 
is not acceptable IMO.

(In case it isn't clear: I'm for option 1. I _don't_ intend to write MyFlags 
ever in Python. But if I happen to write it unintentionally (e.g. if I forget 
to declare 2), I would like Python to tell me I'm doing something wrong.)

(But if you really want option 2 for some reason, that's ok too. I'm just 
saying I would like it specified, with a rationale if it's not too much of a 
problem.)

--

___
Python tracker 

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



[issue27922] Make IDLE tests less flashy

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6e4475894a79 by Terry Jan Reedy in branch '2.7':
Issue #27922: IDLE test_idlehistory no longer flash tk widgets.
https://hg.python.org/cpython/rev/6e4475894a79

--

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8e9d3a5d47d5 by Ethan Furman in branch 'default':
issue23591: more docs; slight change to repr
https://hg.python.org/cpython/rev/8e9d3a5d47d5

--

___
Python tracker 

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



[issue27936] Inconsistent round behavior between float and int

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7108f2a708c9 by Raymond Hettinger in branch '3.5':
Issue 27936: Update doc for round() to indicate that None is an allowable 
argument.
https://hg.python.org/cpython/rev/7108f2a708c9

--

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-09-04 Thread David Edelsohn

David Edelsohn added the comment:

I believe that everything is functioning correctly.

--

___
Python tracker 

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



[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-09-04 Thread Michael Felt

Michael Felt added the comment:

Not always as elegant as I would wish (do not like the idea of "while 1:" and 
later a break...

But, all in all, much improved by redoing the processing of the subprocess 
output and getting rid of more noise.

Hope this meets your approval!

p.s. This is a patch compared to previous patch. If a diff compared to 
Python-3.6.0a4 I can remake the patch.

--
Added file: http://bugs.python.org/file44366/Python3.6.Lib.ctypes.160904.patch

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-09-04 Thread Ethan Furman

Ethan Furman added the comment:

As a side note, I suspect there would be much less confusion with Flag if we 
had an AutoEnum.

C'est la vie.

--

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-09-04 Thread Ethan Furman

Ethan Furman added the comment:

> All my questions pertain to Flags.

Ah, okay.

> You said what to me seem like two contradictory things:
> 
>> Not having 2 named has different consequences for Flag vs IntFlag
>> (although *neither is an error*): Flag: no combination of flags will
>> ever have the 2 bit set [...]

and

>> if MyFlags is a Flag then MyFlags(impossible_combination) *will raise an 
>> exception.*

First, let me state the intended use of Flags:  primary flags (single-bit 
flags) will have values of powers of 2:

--> class Perm(Flag):
... R = 4
... W = 2
... X = 1
...
--> Perm.R | Perm.W | Perm. X

-->

If nicer names are desired for certain combinations (aka secondary flags, or 
multi-bit), then name them:

--> class Perm(Flag):
... ...
... RWX = 7
...
--> Perm.R | Perm.W | Perm.X


If, for whatever strange reason, you don't give a certain power of 2 a name, 
Flag doesn't care:

--> class Perm(Flag):
... R = 8
... W = 4
... X = 1
...
--> Perm.R | Perm.W | Perm. X

-->

But trying to use that missing value will be an error:

--> Perm(6)
Traceback (most recent call last):
  ...
ValueError: 6 is not a valid MyFlags

This is what I was referring to as "not naming a bit is not an error, but using 
an impossible value is".  What I missed in your example was that, although you 
hadn't named 2, you still had multi-bit values that included the 2 bit.  In 
other words, in my example there will never be a combination that has the 2 bit 
set, while in yours (because of your weird values) it is possible.


> Are you saying that after I write
> 
>  class MyFlags(Flags):
>  b001 = 1
>  b011 = 3
>  b100 = 4
>  b110 = 6
> 
> this is _not_ an error, but if after that I call
> 
>  print(MyFlags(7))
> 
> it _is_ an error? 

No, that's not what I'm saying, and hopefully my explanation above clears that 
up.

--

___
Python tracker 

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



[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-04 Thread Ashish Nitin Patil

Ashish Nitin Patil added the comment:

Also, I noticed in the documentation for `csv.DictWriter` 
(https://docs.python.org/3/library/csv.html#csv.DictWriter.writeheader) does 
not contain the following line -
 to the writer's file object, formatted according to the current dialect.
Although it is there for the other 2 methods (`writerow` & `writerows`) and 
since `writeheader` uses `writerow` in turn, I believe the said line should be 
included for the `writeheader` documentation as well. I have created another 
patch with both the changes. I ran the Doc build (make html) and have checked 
the addition of the said lines looks good & does not break anything.

I can make another thread if required, if you feel both the changes can't be 
accommodated in the same issue.

--
Added file: 
http://bugs.python.org/file44365/issue_27497_add_return_to_DictWriter_writeheader_with_documentation_changes.patch

___
Python tracker 

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



[issue27497] csv module: Add return value to DictWriter.writeheader

2016-09-04 Thread Ashish Nitin Patil

Ashish Nitin Patil added the comment:

Hi, I have added the "return" to the writeheader method. I ran the tests for 
the csv library (./python -m test -v test_csv) and got no errors (Ran 101 tests 
in 0.322s; 1 test OK.).

Kindly review the patch.

--
keywords: +patch
nosy: +ashishnitinpatil
Added file: 
http://bugs.python.org/file44364/issue_27497_add_return_to_DictWriter_writeheader.patch

___
Python tracker 

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2016-09-04 Thread paul j3

Changes by paul j3 :


--
Removed message: http://bugs.python.org/msg274336

___
Python tracker 

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



[issue9351] argparse set_defaults on subcommands should override top level set_defaults

2016-09-04 Thread paul j3

paul j3 added the comment:

In http://bugs.python.org/issue27859 I've demonstrated how a subclass of 
_SubParsersAction can be used to revert the behavior to pre 2.7.9, passing the 
main namespace to the subparser.

The only other change is to the parser registry:

parser.register('action', 'parsers', MyParserAction)

So there's no need to change the argparse.py file itself.

--

___
Python tracker 

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



[issue27859] argparse - subparsers does not retain namespace

2016-09-04 Thread paul j3

paul j3 added the comment:

I've posted a file that runs your code as you expect.

It uses a custom Action class (like your test case).  It subclasses 
._SubParsersAction, and replaces the 9351 namespace use with the original one.  
I use the registry to change the class that parser.add_subparsers() uses.

The stock argparse.py file does not need to be changed.

ps

In your custom Action I access `namespace.foo` with `getattr(namespace, 'foo', 
None)` which is how argparse accesses the namespace, and does not throw 
attribute errors.

--
Added file: http://bugs.python.org/file44363/issue27859test.py

___
Python tracker 

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



Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Veek. M
Steve D'Aprano wrote:

> On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote:
> 
>>> Regarding the name (From field), my name *is* Veek.M […]
>> 
>> Liar.  *plonk*
> 
> You have crossed a line now Thomas.
> 
> That is absolutely uncalled for. You have absolutely no legitimate
> reason to believe that Veek is not his or her real name.
> 
> You owe Veek an apology, and a promise to the entire community that
> you will not act in such a bigoted, racist manner again.
> 
> 
> 

ah umm.. I'm not overly offended - it was more of a startle. I've gotten 
used to USENET, somewhat - nature of the beast. 

Here's a link: 
https://www.eff.org/deeplinks/2010/01/primer-information-theory-and-privacy

Apparently 33 bits of information are enough to identify you. I don't 
bother about the NSA, but plenty of shady scummy types around, so I tend 
to spread misinformation which *would* make me a big time liar. It's not 
a besetting sin.

Here's a link to my Youtube thingy: 
https://www.youtube.com/channel/UCj93gHgUt69R8oGE5hRXd9g

Really, if someone's feeling racist, hire someone of your own kind 
(whatever that is) to kick you and make you study - that way, you are 
more in control of your destiny. There's plenty of energy the sun kick 
out that just goes to waste. (Not the easiest thing to do - finding 
someone reliable enough to zap the toes, anyway..) It's rather 
unreasonable for humans to expect the Universe to spin around them 
indefinitely..

If there are trolls here, then:
https://www.psychologytoday.com/blog/your-online-secrets/201409/internet-trolls-are-narcissists-psychopaths-and-sadists
(scientific study of some sort)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: manually sorting images?

2016-09-04 Thread Christian Gollwitzer

Am 04.09.16 um 10:53 schrieb Ulli Horlacher:

I need to sort images (*.jpg), visually, not by file name.
It looks, there is no standard UNIX tool for this job?

So, I have to write one by myself, using Tkinter.

Are there any high-level widgets which can help me, for example a file
browser with thumbnails?



There is an example file browser that comes with tktreectrl:

http://tktreectrl.sourceforge.net/pics/imovie.png

Not sure, if there are (good) Python bindings to tktreectrl.
I've written such a beast myself in pure Tcl/Tk (with an extension to 
resize images for the thumbnails):


http://auriocus.de/slideshow/

- maybe it helps.

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


Re: Strange behaviour with numbers in exponential notation

2016-09-04 Thread Christian Gollwitzer

Am 04.09.16 um 10:29 schrieb Nobody:

On Fri, 02 Sep 2016 18:18:08 +0200, Christian Gollwitzer wrote:


1e26 denotes a *floating point number* Floating point has finite
precision, in CPython it is a 64bit IEEE number. The largest exact
integer there is 2**53 (~10^16), everything beyond cannot be accurately
represented.


Uh, that's wrong. All integers smaller than 2**53 can be represented
exactly. Some, but not all, of the integers above 2**53 can be represented
exactly.


Agreed. That's what I wanted to say. Of course you can represent 2**327 
exactly in 64 bit binary floating point. The point is, that you can't 
sensibly assumy to get exact integer results for numbers beyond 2**53 - 
except for special cases. For example, 133 * 2**53 is exactly 
representable in FP, but 2**53+1 is not.


Christian

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


[issue19500] Add client-side SSL session resumption

2016-09-04 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +alex
stage:  -> patch review
title: Error when connecting to FTPS servers not supporting SSL session 
resuming -> Add client-side SSL session resumption
type: behavior -> enhancement

___
Python tracker 

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



[issue19500] Error when connecting to FTPS servers not supporting SSL session resuming

2016-09-04 Thread Christian Heimes

Christian Heimes added the comment:

Here is my take on the SSLSession feature. The patch provides a SSLSession 
type, SSLSocket.session getter/setter and SSLSocket.session_reused getter. The 
setter makes sure that the session can only set for client sockets from the 
same SSLContext and before handshake. Tests and documentation need some 
improvements.

https://github.com/tiran/cpython/commits/feature/openssl_session

--
Added file: http://bugs.python.org/file44362/SSLSession-support.patch

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-04 Thread Christian Heimes

Changes by Christian Heimes :


Added file: http://bugs.python.org/file44361/Add-hashlib.scrypt-4.patch

___
Python tracker 

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



[issue27954] makesetup does not take into account subdirectories

2016-09-04 Thread David D

New submission from David D:

https://hg.python.org/cpython/file/tip/Modules/makesetup#l202

If I try to create a built-in module with a source file named exactly as 
another source file that already exists in a different module, the script 
generates the same output path for the object files, creating a conflict.

--
components: Build, Extension Modules
messages: 274366
nosy: David D
priority: normal
severity: normal
status: open
title: makesetup does not take into account subdirectories
type: compile error
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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-09-04 Thread Christian Heimes

Changes by Christian Heimes :


Added file: 
http://bugs.python.org/file44360/Port-Python-s-SSL-module-to-OpenSSL-1.1.0-5.patch

___
Python tracker 

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



[issue27744] Add AF_ALG (Linux Kernel crypto) to socket module

2016-09-04 Thread Christian Heimes

Christian Heimes added the comment:

I have removed binascii.(un)hexlify().

--
Added file: 
http://bugs.python.org/file44359/AF_ALG-kernel-crypto-support-for-socket-module-5.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-09-04 Thread Christian Heimes

Christian Heimes added the comment:

Thanks for your review. I have addressed your points and updated/fixed/renamed 
documentation and comments.

--
Added file: 
http://bugs.python.org/file44358/BLAKE2-hash-algorithm-for-CPython-5.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-09-04 Thread Martin Panter

Martin Panter added the comment:

Maybe call the RST file hashlib-blake2.rst (hyphen, not dot), otherwise it 
looks like it is a separate submodule under the hashlib package.

Also there seems to be a versionadded tag missing in the documentation.

In setup.py, the os.uname().machine check seems unsafe for cross-compilation, 
though I am not certain, and I don’t have a better suggestion.

--
nosy: +martin.panter

___
Python tracker 

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



[issue27950] Superfluous messages when running make

2016-09-04 Thread Xiang Zhang

Xiang Zhang added the comment:

After more study, I think we can do just as what I have pointed out as the 
problem, ': #...". This can make us have an indent comment that won't be 
evaluated by the shell. And we only need to add @ before it so it won't be 
echoed.

As for the part you comment, Martin, if we have to rely on the exit status, I'm 
afraid there is nothing we can do.

--
Added file: http://bugs.python.org/file44357/issue27950_v2.patch

___
Python tracker 

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



[issue21622] ctypes.util incorrectly fails for libraries without DT_SONAME

2016-09-04 Thread Thom Wiggers

Thom Wiggers added the comment:

This bug is still present in Python 3.5.

It breaks, probably among other things, this package: 
https://github.com/ahupp/python-magic/issues/114.

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



[issue27919] Deprecate and remove extra_path distribution kwarg

2016-09-04 Thread Jason R. Coombs

Jason R. Coombs added the comment:

I've done more work breaking down the findings:

pygoogle (7): All forks of a project of the same name. Ignorable since the name 
matches the project name.

cancelbot (3): All forks of a project of the same name. Ignorable since the 
name matches the project name.

Numeric (8): All projects seem to be peripherally related to numpy, but 
probably had their setup.py copied from an earlier version of numpy.

Aeosa (58): The most recent activity is all in one repository, so I've filed 
[mattneub/appscript#14](https://github.com/mattneub/appscript/issues/14) to 
request the change.

quasi (7): All forks of a project of the same name. Ignorable since the name 
matches the project name.

Motion and Graph (2): Two projects in https://github.com/scanlime/navi-misc. 
Ignorable since the name matches the project name.

Ohai (1): Made a comment here (https://github.com/bukzor/ohai).

NumPtr (5): The project makes the comment "I want to be able to remove them if 
I screw up this script; 'Sandboxing', if you will" and uses extra_path with the 
same name as the project; ignorable.

eispice (3): All forks of a project of the same name. Ignorable since the name 
matches the project name.

rtaudio (1): All forks of a project of the same name. Ignorable since the name 
matches the project name.

pyryutil (1): All forks of a project of the same name. Ignorable since the name 
matches the project name.

pbs (~5): Several projects are using the 'pbs' extra_path to group their 
packages 
(https://github.com/search?utf8=%E2%9C%93=extra_path+pbs+filename%3Asetup.py=Code=searchresults),
 even going as far as creating a setup.py.in template with that setting. I've 
posted a ticket with what I believe to be the parent project.

korean (1): Uses the feature for load-time import. I've posted a ticket 
suggesting the removal of that.

kodos (6): All forks of a project of the same name. Ignorable since the name 
matches the project name.

pygraphics (4): All forks of a project of the same name. Ignorable since the 
name matches the project name.

pythonutils(1): All forks of a project of the same name. Ignorable since the 
name matches the project name.

Spike (2): All forks of a project of the same name. Ignorable since the name 
matches the project name.

timml (2): All forks of a project of the same name. Ignorable since the name 
matches the project name.

orange-bioinformatics (1): Uses extra_path to set a custom destination dir for 
the package. I've filed a ticket referencing this one.

pyNameList (1): All forks of a project of the same name. Ignorable since the 
name matches the project name.

FontTools (42): All forks of a project of the same name. Ignorable since the 
name matches the project name.

flopy (1): All forks of a project of the same name. Ignorable since the name 
matches the project name.

At this point, I've gone through 11 of the 54 pages of (most relevant) search 
results from Github. I suspect that's a good enough sample to determine if this 
feature does indeed need to be retained.

--

___
Python tracker 

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



Re: Why doesn't my finaliser run here?

2016-09-04 Thread Chris Angelico
On Sun, Sep 4, 2016 at 10:37 PM, Ben Finney  wrote:
>> And an example:
>>
>>
>> py> e = Eggs()
>> instance created successfully
>> self definitely exists: <__main__.Eggs object at 0xb7bf21ec>
>> Traceback (most recent call last):
>>   File "", line 1, in 
>>   File "", line 8, in __init__
>> Exception
>> py>
>
>
> Right. The instance is constructed successfully (by ‘__new__’, the
> constructor). It will be bound to ‘s’, creating a reference to the
> instance.
>
> The exception raised from the initialiser does not stop you from binding
> the instance to a name. That binding succeeds; the reference remains.
> Nothing has caused that reference to go away.

Presumably you mean "bound to 'e'" here. But it isn't; the expression
Eggs() raised an exception, so nothing got assigned anywhere. It
doesn't depend on __new__ either:

>>> class Eggs:
...  def __init__(self):
...   print("init:", self)
...   raise Exception
...  def __del__(self):
...   print("del:", self)
...
>>> e=Eggs()
init: <__main__.Eggs object at 0x7ffa8fc97400>
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 4, in __init__
Exception
>>> e
del: <__main__.Eggs object at 0x7ffa8fc97400>
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'e' is not defined

There's a reference here somewhere, though. My suspicion is it's in
sys.exc_info / sys.last_traceback, which is why triggering another
exception causes the object to be cleaned up.

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


Re: Why doesn't my finaliser run here?

2016-09-04 Thread Oscar Benjamin
On 4 Sep 2016 13:27, "Steve D'Aprano"  wrote:
>
> Why doesn't __del__ run here?
>
>
> class Eggs(object):
> def __new__(cls):
> instance = object.__new__(cls)
> print("instance created successfully")
> return instance
> def __init__(self):
> print("self definitely exists:", self)
> raise Exception
> def __del__(self):
> print("deleting", repr(self))
>
>
> And an example:
>
>
> py> e = Eggs()
> instance created successfully
> self definitely exists: <__main__.Eggs object at 0xb7bf21ec>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 8, in __init__
> Exception

Maybe the Exception traceback holds a reference to the object. Also try the
example outside of interactive mode since that can hold references.

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


Re: Why doesn't my finaliser run here?

2016-09-04 Thread Ben Finney
Steve D'Aprano  writes:

> Why doesn't __del__ run here?

Short anser: because nothing has removed the reference to the instance.

> class Eggs(object):
> def __new__(cls):
> instance = object.__new__(cls)
> print("instance created successfully")
> return instance
> def __init__(self):
> print("self definitely exists:", self)
> raise Exception
> def __del__(self):
> print("deleting", repr(self))

This is a good example of why it helps to *never* call ‘__init__’ the
“constructor”. It isn't, because ‘__init__’ acts on an
already-constructed instance.

Hance, an exception raised from ‘__init__’ is not going to affect
whether the instance exists.

> And an example:
>
>
> py> e = Eggs()
> instance created successfully
> self definitely exists: <__main__.Eggs object at 0xb7bf21ec>
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "", line 8, in __init__
> Exception
> py>


Right. The instance is constructed successfully (by ‘__new__’, the
constructor). It will be bound to ‘s’, creating a reference to the
instance.

The exception raised from the initialiser does not stop you from binding
the instance to a name. That binding succeeds; the reference remains.
Nothing has caused that reference to go away.

-- 
 \   “I know that we can never get rid of religion …. But that |
  `\   doesn’t mean I shouldn’t hate the lie of faith consistently and |
_o__) without apology.” —Paul Z. Myers, 2011-12-28 |
Ben Finney

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


Why doesn't my finaliser run here?

2016-09-04 Thread Steve D'Aprano
Here's a finaliser that runs:


class Spam(object):
def __new__(cls):
instance = object.__new__(cls)
print("instance created successfully")
return instance
def __del__(self):
print("deleting", repr(self))


An example:


py> s = Spam(); del s
instance created successfully
deleting <__main__.Spam object at 0xb7bf270c>



Why doesn't __del__ run here?


class Eggs(object):
def __new__(cls):
instance = object.__new__(cls)
print("instance created successfully")
return instance
def __init__(self):
print("self definitely exists:", self)
raise Exception
def __del__(self):
print("deleting", repr(self))


And an example:


py> e = Eggs()
instance created successfully
self definitely exists: <__main__.Eggs object at 0xb7bf21ec>
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 8, in __init__
Exception
py>





-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Thomas 'PointedEars' Lahn wrote:

>> Regarding the name (From field), my name *is* Veek.M […]
> 
> Liar.  *plonk*

You have crossed a line now Thomas.

That is absolutely uncalled for. You have absolutely no legitimate reason to
believe that Veek is not his or her real name.

You owe Veek an apology, and a promise to the entire community that you will
not act in such a bigoted, racist manner again.



-- 
Steve

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


[issue27953] math.tan has poor accuracy near pi/2 on OS X Tiger

2016-09-04 Thread Mark Dickinson

Changes by Mark Dickinson :


--
title: tan has poor accuracy near pi/2 on OS X Tiger -> math.tan has poor 
accuracy near pi/2 on OS X Tiger

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-09-04 Thread Christian Heimes

Christian Heimes added the comment:

Antoine, I have reconsidered your idea. Let's make the default value 
PROTOCOL_TLS in 3.6 and deprecated the other protocol methods. We can remove 
them in 3.8 or 3.9. I'll push another patch later today.

--

___
Python tracker 

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



[issue27928] Add hashlib.scrypt

2016-09-04 Thread Christian Heimes

Christian Heimes added the comment:

Thanks Alex, multiple is the wrong term. The argument 'n' must be 2^m for m > 1.

--

___
Python tracker 

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



Re: manually sorting images?

2016-09-04 Thread Steve D'Aprano
On Sun, 4 Sep 2016 06:53 pm, Ulli Horlacher wrote:

> I need to sort images (*.jpg), visually, not by file name.

I don't even understand this. What does it mean to sort images visually?
Which comes first, a 400x500 image of a cat climbing a tree, or a 300x600
image of a toddler playing with a dog?




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.

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


[issue27427] Add new math module tests

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d7c31c73b1bd by Mark Dickinson in branch 'default':
Add Francisco Couzo to Misc/ACKS (for issue #27427 patch).
https://hg.python.org/cpython/rev/d7c31c73b1bd

--

___
Python tracker 

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



[issue27427] Add new math module tests

2016-09-04 Thread Mark Dickinson

Mark Dickinson added the comment:

Applied. Thank you, Francisco!

--
components: +Extension Modules -Tests
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
type:  -> enhancement

___
Python tracker 

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



[issue27427] Add new math module tests

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset eb98f6044638 by Mark Dickinson in branch 'default':
Issue #27427: Additional tests for the math module. Thanks Francisco Couzo.
https://hg.python.org/cpython/rev/eb98f6044638

--
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: manually sorting images?

2016-09-04 Thread Thomas 'PointedEars' Lahn
Ulli Horlacher wrote:

> I need to sort images (*.jpg), visually, not by file name.
> It looks, there is no standard UNIX tool for this job?

Depends.  What are the sort keys?

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26439] ctypes.util.find_library fails when ldconfig/glibc not available (e.g., AIX)

2016-09-04 Thread Michael Felt

Michael Felt added the comment:

On 04/09/2016 06:11, Martin Panter wrote:
> I do not know whether to fix the annotation (has 64 preceded by any number of 
> underscores), or whether to fix the regular expression (_?64).

The later - _?64. Working on this today. Thank you for the correction.

--

___
Python tracker 

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



[issue27953] tan has poor accuracy near pi/2 on OS X Tiger

2016-09-04 Thread Mark Dickinson

Mark Dickinson added the comment:

The relevant tests are now skipped on OS X < 10.5, and test_math and test_cmath 
are passing on the OS X Tiger buildbot. Closing (as "wont fix", since we 
haven't actually fixed the underlying issue).

--
resolution:  -> wont fix
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



[issue27953] tan has poor accuracy near pi/2 on OS X Tiger

2016-09-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4d52df5595e by Mark Dickinson in branch 'default':
Issue #27953: skip failing math and cmath tests for tan on OS X 10.4.
https://hg.python.org/cpython/rev/b4d52df5595e

--
nosy: +python-dev

___
Python tracker 

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



manually sorting images?

2016-09-04 Thread Ulli Horlacher
I need to sort images (*.jpg), visually, not by file name.
It looks, there is no standard UNIX tool for this job?

So, I have to write one by myself, using Tkinter.

Are there any high-level widgets which can help me, for example a file
browser with thumbnails?


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum TIK 
Universitaet Stuttgart E-Mail: horlac...@tik.uni-stuttgart.de
Allmandring 30aTel:++49-711-68565868
70569 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue26040] Improve coverage and rigour of test.test_math

2016-09-04 Thread Mark Dickinson

Mark Dickinson added the comment:

Opened #27953 to track the issue with tan on OS X Tiger. Re-closing here.

--
status: open -> closed

___
Python tracker 

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



[issue27953] tan has poor accuracy near pi/2 on OS X Tiger

2016-09-04 Thread Mark Dickinson

New submission from Mark Dickinson:

Opening this for the record; I intend to close as "wont fix".

The tan function has poor accuracy for inputs near pi/2 on OS X 10.4. This is a 
direct consequence of a poor libm implementation, so there's little we can do 
about it short of re-implenting tan ourselves. 10.4 is ancient enough by now 
that it's difficult to care too much.

Example failures:

==
FAIL: test_testfile (test.test_math.MathTests)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_math.py", 
line 1190, in test_testfile
'\n  '.join(failures))
AssertionError: Failures in test_testfile:
  tan0064: tan(1.5707963267948961): expected 1978937966095219.0, got 
1978945885716843.0 (error = 7.92e+09 (31678486496 ulps); permitted error = 0 or 
5 ulps)


and a corresponding failure in cmath:

==
FAIL: test_specific_values (test.test_cmath.CMathTests)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", 
line 398, in test_specific_values
msg=error_message)
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", 
line 147, in rAssertAlmostEqual
'{!r} and {!r} are not sufficiently close'.format(a, b))
AssertionError: tan0064: tan(complex(1.5707963267948961, 0.0))
Expected: complex(1978937966095219.0, 0.0)
Received: complex(1978945885716843.0, 0.0)
Received value insufficiently close to expected value.

--
assignee: mark.dickinson
components: Extension Modules, Macintosh
messages: 274350
nosy: mark.dickinson, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: tan has poor accuracy near pi/2 on OS X Tiger
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27450] bz2: BZ2File should expose compression level as an attribute

2016-09-04 Thread Josh Triplett

Josh Triplett added the comment:

As part of a reproducible build project, to allow recompressing a file with the 
same compression level previously used.

--

___
Python tracker 

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



Re: Strange behaviour with numbers in exponential notation

2016-09-04 Thread Nobody
On Fri, 02 Sep 2016 18:18:08 +0200, Christian Gollwitzer wrote:

> 1e26 denotes a *floating point number* Floating point has finite 
> precision, in CPython it is a 64bit IEEE number. The largest exact 
> integer there is 2**53 (~10^16), everything beyond cannot be accurately 
> represented.

Uh, that's wrong. All integers smaller than 2**53 can be represented
exactly. Some, but not all, of the integers above 2**53 can be represented
exactly.

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


Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Rustom Mody
On Sunday, September 4, 2016 at 11:18:07 AM UTC+5:30, Rustom Mody wrote:
> On Sunday, September 4, 2016 at 9:32:28 AM UTC+5:30, Veek. M wrote:
> > Regarding the name (From field), my name *is* Veek.M though I tend to 
> > shorten it to Vek.M on Google (i think Veek was taken or some such 
> > thing). Just to be clear, my parents call me something closely related 
> > to Veek that is NOT Beek or Peek or Squeak or Sneak and my official name 
> > is something really weird. Identity theft being what it is, I probably 
> > am lying anyhow about all this, but it sounds funny so :p
> 
> Please dont take the name-police bait.
> As far as I am concerned telling someone “I dont like your name” is in the 
> same
> bracket as “I don’t like your religion/skin-color/gender/nationality/etc”
> Ie its highly offensive

Sorry...
That should have been just “offensive” not “highly offensive”
Too much disorder in the world from people ratcheting up their expressions 
beyond appropriate levels.
And since I am at it let me correct more precisely:
Namism — Thomas ‘bogus-appelation’ Lahn’s affliction — lies between
mildly amusing and mildly offensive as does 
racism/sexism/casteism/nationalism/etc

Einstein’s “Nationalism is an infantile disease; its the measles of mankind” 
should be applied to all such
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue27450] bz2: BZ2File should expose compression level as an attribute

2016-09-04 Thread Martin Panter

Martin Panter added the comment:

I guess the compression level you want is the same as the 100–900 kB block size 
recorded as the third byte in the header.

But I don’t see this as a particularly useful feature either. Why do you want 
to know the compression level?

--

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-09-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thanks Martin.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26040] Improve coverage and rigour of test.test_math

2016-09-04 Thread Mark Dickinson

Mark Dickinson added the comment:

> or at least, no more unhappy than before

Not quite true: test_math and test_cmath are failing for the x86 Tiger 3.x 
buildbot:

==
FAIL: test_testfile (test.test_math.MathTests)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_math.py", 
line 1190, in test_testfile
'\n  '.join(failures))
AssertionError: Failures in test_testfile:
  tan0064: tan(1.5707963267948961): expected 1978937966095219.0, got 
1978945885716843.0 (error = 7.92e+09 (31678486496 ulps); permitted error = 0 or 
5 ulps)


==
FAIL: test_specific_values (test.test_cmath.CMathTests)
--
Traceback (most recent call last):
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", 
line 398, in test_specific_values
msg=error_message)
  File "/Users/db3l/buildarea/3.x.bolen-tiger/build/Lib/test/test_cmath.py", 
line 147, in rAssertAlmostEqual
'{!r} and {!r} are not sufficiently close'.format(a, b))
AssertionError: tan0064: tan(complex(1.5707963267948961, 0.0))
Expected: complex(1978937966095219.0, 0.0)
Received: complex(1978945885716843.0, 0.0)
Received value insufficiently close to expected value.


It's probably not worth trying to fix this for such an ancient version of OS X. 
Re-opening; I'll aim to skip the test on the platform.

--
status: closed -> open

___
Python tracker 

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



[issue27078] Make f'' strings faster than .format: BUILD_STRING opcode?

2016-09-04 Thread Antti Haapala

Antti Haapala added the comment:

Though it is clean to do like this: let _PyUnicode_JoinArray have `NULL` mean 
empty string, as it is more logical anyway; then PyUnicode_Join itself just 
needs to:

   if (separator == NULL) {
   separator = PyUnicode_FromOrdinal(' ');
   /* check omitted */
   res = _PyUnicode_JoinArray(separator, items, seqlen);
   Py_DECREF(separator);
   }
   else {
  res = _PyUnicode_JoinArray(separator, items, seqlen);
   }

The NULL argument I guess isn't that common to pass to PyUnicode_Join (Python 
code especially would always have to pass in ' ' instead), so this shouldn't 
really affect performance for any case at all.

--

___
Python tracker 

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



[issue27800] Regular expressions with multiple repeat codes

2016-09-04 Thread Martin Panter

Martin Panter added the comment:

Here is a patch for the documentation.

--
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file44356/multiple-repeat.patch

___
Python tracker 

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



[issue23591] enum: Add Flags and IntFlags

2016-09-04 Thread Vedran Čačić

Vedran Čačić added the comment:

Ok, I believe you that you have the interface for IntFlags right (I always did, 
and I apologize if I didn't make it clear from the start). All my questions 
pertain to Flags.

You said what to me seem like two contradictory things:

> Not having 2 named has different consequences for Flag vs IntFlag (although 
> *neither is an error*): Flag: no combination of flags will ever have the 2 
> bit set

> if MyFlags is a Flag then MyFlags(impossible_combination) *will raise an 
> exception.*

Are you saying that after I write

class MyFlags(Flags):
b001 = 1
b011 = 3
b100 = 4
b110 = 6

this is _not_ an error, but if after that I call

print(MyFlags(7))

it _is_ an error? It doesn't seem so bad now I think about it, but I'd like the 
error to be reported before ("3 has bit of value 2 set, but that bit is not a 
member" or something like that).

--

___
Python tracker 

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



[issue27950] Superfluous messages when running make

2016-09-04 Thread Xiang Zhang

Xiang Zhang added the comment:

That is not ideal. @# can silence the comment but actually it is still not a 
comment. The "# ..." part still will be evaluated by shell.

--

___
Python tracker 

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



[issue27952] Finish converting fixcid.py from regex to re

2016-09-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Tools/scripts/fixcid.py initially used old regex module. In 4727f260f6f8 it was 
converted to using new re module, but not all generated regular expressions 
were converted to new syntax. The script is not working since that time.

--
components: Demos and Tools
messages: 274341
nosy: ezio.melotti, martin.panter, serhiy.storchaka
priority: low
severity: normal
stage: needs patch
status: open
title: Finish converting fixcid.py from regex to re
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



Re: Extend unicodedata with a name/pattern/regex search for character entity references?

2016-09-04 Thread Jussi Piitulainen
Chris Angelico  writes:

> On Sun, Sep 4, 2016 at 12:49 PM, Steve D'Aprano
>  wrote:
>> On Sun, 4 Sep 2016 12:19 pm, Chris Angelico wrote:
>>
>> [...]
 Please either comply, or give up your stupid and pointless obsession with
 trying to be the Internet Police for something that isn't even a real
 rule.
>>>
>>> His posts aren't making it across the news->list gateway any more.
>>> Killfile him and move on...
>>
>> But but but... I couldn't do that.
>>
>> https://www.xkcd.com/386/
>
> Ah, you got me. Can't force anyone to violate standards documents like
> RFCs and XKCDs.
>
> ChrisA
> who may or may not have recently pushed a commit to make something
> XKCD 859 compliant...

(-:

(You were baiting for that.)
-- 
https://mail.python.org/mailman/listinfo/python-list