[issue28681] About function renaming in the tutorial

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

To me, this is renaming:

 def f(x): pass
 f.__name__ = g

And this is aliasing:

 g = f

--

___
Python tracker 

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



[issue28681] About function renaming in the tutorial

2016-11-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I disagree that "aliasing" is more accurate.

We have a perfectly good name for symbols in Python: "name". A value (and that 
includes functions) can have multiple names. It seems to me that if we're to 
start distinguishing between names and aliases, then aliases have to be 
different from names. And the way I understand "alias" is that it is another 
symbol for a variable, not another symbol for the same value.

We wouldn't say that

x = 1
y = x

makes y an alias for x. y just happens to be a second name for the same value 
that x currently has. There's no guarantee that they will stay the same. 
Substitute a function object for the int 1, and you have the situation being 
discussed in the tutorial.

I would expect that aliases should not be effected by rebinding:

x = 1
y = alias(x)  # if such a thing existed
x = 2
assert y == 2

Obviously there's nothing in Python like that! This doesn't match Python's name 
binding model at all.

I think that talking about a "general aliasing" mechanism is exactly wrong. I 
think that the tutorial should emphasis the reality that functions are just 
ordinary values, like ints and floats and dicts and lists, and not try to 
indicate that there is something special or different about names bound to 
functions:

def f(): ...
g = f

is no different from the x = y example earlier.

--
nosy: +steven.daprano

___
Python tracker 

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



[issue28681] About function renaming in the tutorial

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 "Aliasing" is more accurate.

--
nosy: +rhettinger

___
Python tracker 

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



[issue11437] IDLE crash on startup with typo in config-keys.cfg

2016-11-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I closed #25662 in favor of this.

--

___
Python tracker 

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



[issue25662] _tkinter.TclError: bad event type or keysym "Alt"

2016-11-12 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A crash is when Python stops without a traceback, even when run with somewhere 
for a traceback to go.  However, I regard it as a bug for IDLE to stop because 
of a problem in a user.cfg file.  I am not re-opening because this appears to 
be a duplicate of #11437, which had the same error message with 'up' instead of 
'Alt'.

--
nosy: +terry.reedy
resolution: fixed -> duplicate
stage:  -> resolved
superseder:  -> IDLE crash on startup with typo in config-keys.cfg
type: crash -> behavior

___
Python tracker 

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



[issue28681] About function renaming in the tutorial

2016-11-12 Thread Xue Fuqiao

New submission from Xue Fuqiao:

In 
https://hg.python.org/cpython/file/6fbb7c9d77c6/Doc/tutorial/controlflow.rst#l295
 :

   A function definition introduces the function name in the
   current symbol table. The value of the function name has a
   type that is recognized by the interpreter as a user-defined
   function.  This value can be assigned to another name which
   can then also be used as a function.  This serves as a general
   renaming mechanism

Maybe "aliasing" is a better term than "renaming" here, since the original 
function name can still be used after the "renaming".

--
assignee: docs@python
components: Documentation
files: renaming.patch
keywords: patch
messages: 280683
nosy: docs@python, xfq
priority: normal
severity: normal
status: open
title: About function renaming in the tutorial
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45468/renaming.patch

___
Python tracker 

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



[issue28680] bdist_wininst generated 64-bit executable looks for 3.5-32

2016-11-12 Thread Timothy Widrick

New submission from Timothy Widrick:

Short version: wininst-14.0-amd64.exe has "-32" in it. It shouldn't, should it?

Longer version:

Running "python setup.py bdist_wininst" gives me a file named like:

project-version.win-amd64-py3.5.exe

When I run that, I get:

Python version 3.5-32 required, which was not found in the registry.

My "fix" was to edit the wininst-14.0-amd64.exe and replace the "-32" with 3 
null bytes.

--
components: Distutils
messages: 280682
nosy: Timothy Widrick, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: bdist_wininst generated 64-bit executable looks for 3.5-32
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



[issue28679] CGIHTTPServer displays raw python code when the url contains '/' after '?'

2016-11-12 Thread Yudai Fujiwara

New submission from Yudai Fujiwara:

I made a simple CGI server and prepared index.py on the root directory.
When I access to '/index.py?value=data', it displays 'value = data', which is 
working correctly.
However, when I access to '/index.py?/' or something like this, it displays its 
raw python code.
It seems that this bug occurs when I access to a url that contains '/' after '?'

--
Added file: http://bugs.python.org/file45467/index.py

___
Python tracker 

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



[issue28679] CGIHTTPServer displays raw python code when the url contains '/' after '?'

2016-11-12 Thread Yudai Fujiwara

Changes by Yudai Fujiwara :


--
components: Library (Lib)
nosy: Yudai Fujiwara
priority: normal
severity: normal
status: open
title: CGIHTTPServer displays raw python code when the url contains '/' after 
'?'
type: security
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



[issue28675] about PEP 528 / PEP 529

2016-11-12 Thread Steve Dower

Steve Dower added the comment:

Those are redirecting stdin and stdout from the real console to their own 
handlers, so they are responsible for setting the encoding. Both of those 
examples are able to fix the encoding issues whenever they like - assuming 
their GUI toolkits can handle it.

The change for 3.6 only affected the standard Windows console. Other consoles 
can specify a different encoding independently.

--

___
Python tracker 

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



[issue23284] Improve termcap detection in setup.py

2016-11-12 Thread Kubilay Kocak

Changes by Kubilay Kocak :


--
nosy: +koobs

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-12 Thread STINNER Victor

STINNER Victor added the comment:

> Can we commit this to 3.6 too?

I worked on patches to try to optimize json_loads and regex_effbot as well, but 
it's still unclear to me how the hot attribute works, and I'm not 100% sure 
that using the attribut explicitly does not introduce a performance regession.

So I prefer to experiment such change in default right now.

--

___
Python tracker 

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



[issue26934] android: test_faulthandler fails

2016-11-12 Thread STINNER Victor

STINNER Victor added the comment:

Oh, you didn't push your patch yet? Go ahead.

buggy_raise_5.patch LGTM and is better than perfect :-)

--

___
Python tracker 

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



[issue14061] Misc fixes and cleanups in archiving code in shutil and test_shutil

2016-11-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file45466/shutil_make_archive_misc_3.patch

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-12 Thread Yury Selivanov

Yury Selivanov added the comment:

I'll go through whatsnew on Monday, fixing errors etc.

--

___
Python tracker 

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



[issue28635] Update What's New for 3.6

2016-11-12 Thread Ned Deily

Ned Deily added the comment:

There are now a few markup errors that the Docs buildbots are catching.  See, 
for example:

http://buildbot.python.org/all/builders/Docs%203.x/builds/2849

--

___
Python tracker 

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



[issue28678] tarfile extract docs inconsistent naming of parameter numeric_owner or numeric_only

2016-11-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +easy
stage:  -> needs patch

___
Python tracker 

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



[issue28618] Decorate hot functions using __attribute__((hot)) to optimize Python

2016-11-12 Thread Yury Selivanov

Yury Selivanov added the comment:

Can we commit this to 3.6 too?

--
nosy: +yselivanov

___
Python tracker 

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



[issue28676] On macOS Sierra, warning: implicit declaration of function 'getentropy'

2016-11-12 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch, Gareth!  Pushed for release in 2.7.13, 3.5.3, 3.6.0b4, 
and 3.7.0.

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



[issue28678] tarfile extract docs inconsistent naming of parameter numeric_owner or numeric_only

2016-11-12 Thread Lewis McCarthy

New submission from Lewis McCarthy:

https://docs.python.org/3/library/tarfile.html#tarfile-objects

Most of the documentation for the extract and extractall methods refers to a 
parameter named numeric_owner. However, the notes on what changed in v3.5 refer 
instead to numeric_only. One of these names is incorrect and should be changed 
to match the other.

Same issue in the 3.6 and 3.7 docs.

https://docs.python.org/3.6/library/tarfile.html#tarfile-objects
https://docs.python.org/3.7/library/tarfile.html#tarfile-objects

--
assignee: docs@python
components: Documentation
messages: 280673
nosy: docs@python, pseudonym
priority: normal
severity: normal
status: open
title: tarfile extract docs inconsistent naming of parameter numeric_owner or 
numeric_only
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue28676] On macOS Sierra, warning: implicit declaration of function 'getentropy'

2016-11-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 828251c2bccf by Ned Deily in branch '2.7':
Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
https://hg.python.org/cpython/rev/828251c2bccf

New changeset 0efd48d4c47c by Ned Deily in branch '3.5':
Issue #28676: Prevent missing 'getentropy' declaration warning on macOS.
https://hg.python.org/cpython/rev/0efd48d4c47c

New changeset e2faa8a22b69 by Ned Deily in branch '3.6':
Issue #28676: merge from 3.5
https://hg.python.org/cpython/rev/e2faa8a22b69

New changeset b31a7efd8b31 by Ned Deily in branch 'default':
Issue #28676: merge from 3.6
https://hg.python.org/cpython/rev/b31a7efd8b31

--
nosy: +python-dev

___
Python tracker 

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



[issue28677] difficult to parse sentence structure in "When an instance attribute is referenced that isn't a data attribute"

2016-11-12 Thread Viorel Tabara

New submission from Viorel Tabara:

Method objects are explained at:

https://docs.python.org/3/tutorial/classes.html#method-objects

I'd like to suggest a change from:

   When an instance attribute is referenced that isn’t a data attribute, its 
   class is searched. 

to something along this line:

   When an instance attribute --- that isn’t a data attribute --- is 
   referenced, the instance parent class will be searched.

--
assignee: docs@python
components: Documentation
messages: 280671
nosy: docs@python, viorel
priority: normal
severity: normal
status: open
title: difficult to parse sentence structure in "When an instance attribute is 
referenced that isn't a data attribute"
type: enhancement

___
Python tracker 

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



[issue5830] heapq item comparison problematic with sched's events

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--

___
Python tracker 

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



[issue28676] On macOS Sierra, warning: implicit declaration of function 'getentropy'

2016-11-12 Thread Gareth Rees

New submission from Gareth Rees:

On macOS Sierra (OSX 10.12.1):

$ ./configure --with-pydebug && make
[... lots of output omitted ...]
gcc -c -Wno-unused-result -Wsign-compare -g -O0 -Wall -Wstrict-prototypes   
 -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter 
-Wno-missing-field-initializers   -I. -I./Include-DPy_BUILD_CORE -o 
Python/random.o Python/random.c
Python/random.c:97:19: warning: implicit declaration of function 
'getentropy' is
  invalid in C99 [-Wimplicit-function-declaration]
res = getentropy(buffer, len);
  ^
1 warning generated.

This is because OSX 10.12.1 has getentropy() but does not have
getrandom(). You can see this in pyconfig.h:

/* Define to 1 if you have the `getentropy' function. */
#define HAVE_GETENTROPY 1

/* Define to 1 if the getrandom() function is available */
/* #undef HAVE_GETRANDOM */

and this means that in Python/random.c the header  is
not included:

#  ifdef HAVE_GETRANDOM
#include 
#  elif defined(HAVE_GETRANDOM_SYSCALL)
#include 
#  endif

It's necessary include  if either HAVE_GETRANDOM or
HAVE_GETENTROPY is defined.

--
components: Build, macOS
files: getentropy.patch
keywords: patch
messages: 280669
nosy: Gareth.Rees, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: On macOS Sierra, warning: implicit declaration of function 'getentropy'
type: compile error
versions: Python 3.7
Added file: http://bugs.python.org/file45465/getentropy.patch

___
Python tracker 

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



[issue28675] about PEP 528 / PEP 529

2016-11-12 Thread Big Stone

Big Stone added the comment:

same un-effect in Qtconsole, I'm disappointed. Maybe I mis-understood what 
these PEP would bring ?

--
Added file: http://bugs.python.org/file45464/pep_528-529_where_are_you_you.PNG

___
Python tracker 

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



[issue28675] about PEP 528 / PEP 529

2016-11-12 Thread Big Stone

New submission from Big Stone:

Hi, if possible a few words of explanation to implement it may be helpfull, as 
I don't see the difference yet, in the typical case where it was not good 
before:
https://cloud.githubusercontent.com/assets/4312421/20240181/5bf917fe-a912-11e6-95e8-e65fcb9a8845.PNG

(more an after PEP sales service request than a bug, I presume)

--
components: Windows
messages: 280667
nosy: Big Stone, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: about PEP 528 / PEP 529
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



[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees

Gareth Rees added the comment:

Here's a patch that copies the text for the -u option from the man page to the 
--help output.

--
keywords: +patch
Added file: http://bugs.python.org/file45463/issue28647.patch

___
Python tracker 

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



[issue28647] python --help: -u is misdocumented as binary mode

2016-11-12 Thread Gareth Rees

Gareth Rees added the comment:

The output of "python3.5 --help" says:

-u : unbuffered binary stdout and stderr, stdin always buffered;
 also PYTHONUNBUFFERED=x
 see man page for details on internal buffering relating to '-u'

If you look at the man page as instructed then you'll see a clearer
explanation:

-u   Force  the  binary  I/O  layers  of  stdout  and  stderr  to  be
 unbuffered.  stdin is always buffered.  The text I/O layer  will
 still be line-buffered.

For example, if you try this:

python3.5 -uc 'import 
sys,time;w=sys.stdout.buffer.write;w(b"a");time.sleep(1);w(b"b");'

then you'll see that the binary output is indeed unbuffered as
documented.

The output of --help is trying to abbreviate this explanation, but I
think it's abbreviated too much. The explanation from the man page
seems clear to me, and is only a little longer, so I suggest changing
the --help output to match the man page.

--
nosy: +Gareth.Rees

___
Python tracker 

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



[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-12 Thread Eric V. Smith

Eric V. Smith added the comment:

Can you provide a short sample that causes this error? Without a way to 
reproduce it, there's not a lot we can do.

--
nosy: +eric.smith

___
Python tracker 

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



[issue25996] Add support of file descriptor in os.scandir()

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for the review Josh. Updated patch addresses your comments and adds 
yet few microoptimizations.

--
Added file: http://bugs.python.org/file45462/os-scandir-fd-2.patch

___
Python tracker 

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



[issue28674] Spam

2016-11-12 Thread Zachary Ware

Changes by Zachary Ware :


Removed file: http://bugs.python.org/file45461/samsungapps.html

___
Python tracker 

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



[issue28674] Spam

2016-11-12 Thread Zachary Ware

Changes by Zachary Ware :


--
assignee: docs@python -> 
components:  -2to3 (2.x to 3.x conversion tool), Cross-Build, Demos and Tools, 
Documentation, Extension Modules, Installation, Interpreter Core, Library 
(Lib), SSL, Tests, XML, email
nosy:  -Alex.Willmer, barry, docs@python, fosa.zd.dj...@gmail.com, 
r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
title: fosa.zd.dj...@gmail.com -> Spam
versions:  -Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 
3.7

___
Python tracker 

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



[issue28674] fosa.zd.dj...@gmail.com

2016-11-12 Thread Damian Kotlar

Changes by Damian Kotlar :


--
assignee: docs@python
components: 2to3 (2.x to 3.x conversion tool), Cross-Build, Demos and Tools, 
Documentation, Extension Modules, Installation, Interpreter Core, Library 
(Lib), SSL, Tests, XML, email
files: samsungapps.html
nosy: Alex.Willmer, barry, docs@python, fosa.zd.dj...@gmail.com, r.david.murray
priority: normal
severity: normal
status: open
title: fosa.zd.dj...@gmail.com
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file45461/samsungapps.html

___
Python tracker 

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



[issue28587] list.index documentation missing start and stop arguments

2016-11-12 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks for the feedback, Raymond :)

I rephrased the docs like the following, what do you think?

Return zero-based index in the list of the first item whose value is *x*.  It 
is an error if there is no such item.  Optional arguments ``start`` and ``end`` 
are interpreted as in slice notation.

--
Added file: http://bugs.python.org/file45460/issue28587v4.patch

___
Python tracker 

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



[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-12 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Sat, Nov 12, 2016 at 08:23:45AM +, Raymond Hettinger wrote:
> I can't even dream up any scenarios where 
> ``operator.subscript[3:7:2]`` would be better than 
> ``slice(3, 7, 2)``.

For that specific example, I completely agree. But I think that in 
general ``slice[::-1]`` is better than either the current alternative 
``slice(None, None, -1)`` or the proposed ``operator.subscript[::-1]``.

And there's no comparison once you get to multi-dimensional slices:

s = slice[::-1, 1:, 1::2]
spam[s] + eggs[s]

versus:

s = slice(slice(None, None, -1), slice(1, None), slice(1, None, 2))
spam[s] + eggs[s]

Even simple examples look nice in slice syntax:

slice[3:7:2]

I had completely forgotten about this feature request, but 
coincidentally re-suggested it on the Python-Ideas mailing 
list earlier today:

https://mail.python.org/pipermail/python-ideas/2016-November/043630.html

The downside is that beginners who are still learning Python's 
syntax may try writing:

slice(::-1)

by mistake. Nevertheless, it seems to me that the advantage to more 
experienced developers to be able to read and write slice objects using 
slice format outweighs the temporary confusion to beginners. (I would 
expect that outside of the Numpy community, few beginners use the 
slice() object directly, so this would not often affect them.)

--

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Okay. test_multiprocessing_queue_2.patch LGTM.

--

___
Python tracker 

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



[issue28648] False assert in _Py_DecodeUTF8_surrogateescape

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since the crash can be caused by environment I consider it as a security issue 
(bot not critical) and applied the patch to 3.3 and 3.4.

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



[issue28648] False assert in _Py_DecodeUTF8_surrogateescape

2016-11-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bf1ca6ce1fe by Serhiy Storchaka in branch '3.3':
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
https://hg.python.org/cpython/rev/9bf1ca6ce1fe

New changeset bfd0da08438f by Serhiy Storchaka in branch '3.4':
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
https://hg.python.org/cpython/rev/bfd0da08438f

New changeset 65b5518da6e2 by Serhiy Storchaka in branch '3.5':
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
https://hg.python.org/cpython/rev/65b5518da6e2

New changeset 2cbd2ec6307d by Serhiy Storchaka in branch '3.6':
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
https://hg.python.org/cpython/rev/2cbd2ec6307d

New changeset 0b576ab589c5 by Serhiy Storchaka in branch 'default':
Issue #28648: Fixed crash in Py_DecodeLocale() in debug build on Mac OS X
https://hg.python.org/cpython/rev/0b576ab589c5

--
nosy: +python-dev

___
Python tracker 

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



[issue21145] Add the @cached_property decorator

2016-11-12 Thread Nick Coghlan

Nick Coghlan added the comment:

Having just said that I don't see much use for lazily initialized slots, it 
does occur to me that __weakref__ is essentially such a slot, and __dict__ 
itself could usefully be such a slot for types where instances mostly have a 
fixed set of attributes, but still allow for arbitrary additional attributes at 
runtime.

However, I do think any such proposal should be considered as its own issue, 
rather than being treated as part of this one - the assumed absence of the 
instance dict creates too many differences in the design trade-offs involved 
and the potential use cases.

--

___
Python tracker 

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



[issue28648] False assert in _Py_DecodeUTF8_surrogateescape

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. Thank you for your patch Xiang.

--
components: +Interpreter Core
versions: +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



[issue21145] Add the @cached_property decorator

2016-11-12 Thread Nick Coghlan

Nick Coghlan added the comment:

I realised that PEP 487's __set_name__ can be used to detect the `__slots__` 
conflict at class definition time rather than on first lookup:

def __set_name__(self, owner, name):
try:
slots = owner.__slots__
except AttributeError:
return
if "__dict__" not in slots:
msg = f"'__dict__' attribute required on {owner.__name__!r} 
instances to cache {name!r} property."
raise TypeError(msg)

It also occurred to me that at the expense of one level of indirection in the 
runtime lookup, PEP 487's __set_name__ hook and a specified naming convention 
already permits a basic, albeit inefficient, "cached_slot" implementation:

class cached_slot:
def __init__(self, func):
self.func = func
self.cache_slot = func.__name__ + "_cache"
self.__doc__ = func.__doc__
self._lock = RLock()

def __set_name__(self, owner, name):
try:
slots = owner.__slots__
except AttributeError:
msg = f"cached_slot requires '__slots__' on {owner!r}"
raise TypeError(msg) from None
if self.cache_slot not in slots:
msg = f"cached_slot requires {self.cache_slot!r} slot on {owner!r}"
raise TypeError(msg) from None

def __get__(self, instance, cls=None):
if instance is None:
return self
try:
return getattr(instance, self.cache_slot)
except AttributeError:
# Cache not initialised yet, so proceed to double-checked locking
pass
with self.lock:
# check if another thread filled cache while we awaited lock
try:
return getattr(instance, self.cache_slot)
except AttributeError:
# Cache still not initialised yet, so initialise it
setattr(instance, self.cache_slot, self.func(instance))
return getattr(instance, self.cache_slot)

def __set__(self, instance, value):
setattr(instance, self.cache_slot, value)

def __delete__(self, instance):
delattr(instance, self.cache_slot)

It can't be done as a data descriptor though (and can't be done efficiently in 
pure Python), so I don't think it makes sense to try to make cached_property 
itself work implicitly with both normal attributes and slot entries - instead, 
cached_property can handle the common case as simply and efficiently as 
possible, and the cached_slot case can be either handled separately or else not 
at all.

The "don't offer cached_slot at all" argument would be that, given slots are 
used for memory-efficiency when handling large numbers of objects and lazy 
initialization is used to avoid unnecessary computations, a "lazily initialised 
slot" can be viewed as "64 bits of frequently wasted space", and hence we can 
expect demand for the feature to be incredibly low (and the community 
experience to date bears out that expectation).

--

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

IMHO other tests in the future may instantiate multiprocessing.Queue() and come 
up with another new decorator when the test fails on the (yet to come) Android 
buildbot, ignoring that one already exists if we move the decorator to the 
test_logging module.

--

___
Python tracker 

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



[issue28648] False assert in _Py_DecodeUTF8_surrogateescape

2016-11-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue26865] Meta-issue: support of the android platform

2016-11-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

issue #28662: catch also PermissionError in tests when spawning a non existent 
program
issue #28664: test_bz2 fails with BrokenPipeError when bunzip2 is missing
issue #28668: instanciation of multiprocessing.Queue raises ImportError in 
test_logging

--
dependencies: +catch also PermissionError in tests when spawning a non existent 
program, instanciation of multiprocessing.Queue raises ImportError in 
test_logging, test_bz2 fails with BrokenPipeError when bunzip2 is missing

___
Python tracker 

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



[issue26934] android: test_faulthandler fails

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

requires_multiprocessing_queue is used only in test_logging. Is it worth to add 
it in test.support?

--

___
Python tracker 

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



[issue26934] android: test_faulthandler fails

2016-11-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

New patch using a plain 'requires_raise' decorator without argument.

--
Added file: http://bugs.python.org/file45459/buggy_raise_5.patch

___
Python tracker 

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



[issue28668] instanciation of multiprocessing.Queue raises ImportError in test_logging

2016-11-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

When the test is to be skipped:
  * The decorator in the previous patch (a decorator with arguments that takes 
no argument) returns a decorator which is unittest.skip (to be applied to the 
test method).
  * On the other side, the skip_unless_symlink decorator pattern (no argument) 
applies the unittest.skip decorator to the test method and returns the 
decorated test method.
This new patch uses the second method suggested by Serhiy.

--
Added file: http://bugs.python.org/file45458/test_multiprocessing_queue_2.patch

___
Python tracker 

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



[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-12 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

I think it would be more useful for multidimensional slicing:
>>> subscript[::-1, ..., ::-1]
(slice(None, None, -1), Ellipsis, slice(None, None, -1))

--

___
Python tracker 

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



[issue26929] android: test_strptime fails

2016-11-12 Thread Xavier de Gaye

Xavier de Gaye added the comment:

Thanks Serhiy for your help with this issue.
I will push this patch with the other Android patches after 3.6 is released.

--

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think small changes are fine while there is still another beta ahead but 
would rather just push it to 3.7 than spend more time talking about it.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5f3b7ceb394c by Raymond Hettinger in branch 'default':
Issue #28665:  Use macro form of PyCell_GET/SET
https://hg.python.org/cpython/rev/5f3b7ceb394c

--

___
Python tracker 

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



[issue26929] android: test_strptime fails

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

exclude_ymd_3.patch LGTM.

--
stage: patch review -> commit review

___
Python tracker 

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



[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-12 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The argument about "harmonizing" doesn't look strong to me. Opcodes for locals 
use the SETLOCAL() macro which decrefs 
old value, while opcodes for nonlocals with your patches use the PyCell_SET() 
macro which doesn't.

But performance arguments look more weighty. I made benchmarks. fastcell.diff 
speeds up STORE_FAST by 40%, delete_deref.diff speeds up DELETE_DEREF by 50%. 
and concat_deref.diff speeds up string concatenating up to 15%. All these 
operations are rare in comparison with operations with locals or LOAD_DEREF, 
but the cognitive cost of the optimization is pretty low. All patches LGTM.

I only have doubts that such changes could be pushed in 3.6 at this stage. This 
is not bug fix and isn't tweaking new 3.6 feature.

--
assignee: serhiy.storchaka -> rhettinger
stage: patch review -> commit review
versions:  -Python 3.6
Added file: http://bugs.python.org/file45457/issue28665.py

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think the speed benefit for the last two patches is likely too modest to care 
about. The main reason I did the work was because you suggested it and because 
it seemed like a reasonable idea (the patched code looks nice, it does only 
work that is necessary, and it is more consistent with the other opcodes).

Let me know if you want to go forward with it or leave it in the current state 
(the current juxtaposition of PyCell_GET with PyCell_Set looks a little weird 
but it does get the job done).

--

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think to speed benefit for the last two patches is likely too modest to care 
about. The main reason I did the work was because you suggested it and because 
it seemed like a reasonable idea (the patched code looks nice, it does only 
work that is necessary, and it is more consistent with the other opcodes).

Let me know if you want to go forward with it or leave it in the current state 
(the current juxtaposition of PyCell_GET with PyCell_Set looks a little weird 
but it does get the job done).

--

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue26929] android: test_strptime fails

2016-11-12 Thread Xavier de Gaye

Changes by Xavier de Gaye :


Added file: http://bugs.python.org/file45456/exclude_ymd_3.patch

___
Python tracker 

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



[issue28665] Harmonize STORE_DEREF with STORE_FAST and LOAD_DEREF

2016-11-12 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue28673] When using pyro4 with more than 15 threads, python 2.7.12 cores frequently

2016-11-12 Thread Michael Hu

New submission from Michael Hu:

When using pyro4 with more than 15 threads, python 2.7.12 cores frequently 
(>60% time)

Note "v" (op in frame 1) in frame 2 is NULL which has some value in frame 3. So 
some other thread cleans it.

=== gdb ===
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `python /etc/remoting/remoting_agent.zip run --system'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  PyDict_SetItem (op=op@entry=0x0, key=key@entry=0x7f0aa11cd420, 
value=value@entry=0x920ce0 <_PyExc_AttributeError.12478>) at 
../Objects/dictobject.c:832

warning: Source file is more recent than executable.
832if (!PyDict_Check(op)) {
(gdb) bt
#0  PyDict_SetItem (op=op@entry=0x0, key=key@entry='exc_type', 
value=value@entry=) at ../Objects/dictobject.c:832
#1  0x00529e86 in PyDict_SetItemString (item=, 
key=0x61d02a "exc_type", v=0x0) at ../Objects/dictobject.c:2469
#2  PySys_SetObject (name=name@entry=0x61d02a "exc_type", v=v@entry=) at ../Python/sysmodule.c:83
#3  0x0055acc0 in set_exc_info (tb=, value=exceptions.AttributeError("'NoneType' object has no 
attribute 'SHUT_RDWR'",),
type=, tstate=0x95ad10) at ../Python/ceval.c:3736
#4  PyEval_EvalFrameEx (f=f@entry=Frame 0x7f0a9e929b60, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketutil.py, line 463, in close 
(self=),
throwflag=throwflag@entry=0) at ../Python/ceval.c:3251
#5  0x00559c27 in fast_function (nk=, na=, n=1, pp_stack=0x7ffce435ab00, func=) 
at ../Python/ceval.c:4435
#6  call_function (oparg=, pp_stack=0x7ffce435ab00) at 
../Python/ceval.c:4370
#7  PyEval_EvalFrameEx (f=f@entry=Frame 0x7f0a4b50, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketutil.py, line 453, in __del__ 
(self=),
throwflag=throwflag@entry=0) at ../Python/ceval.c:2987
#8  0x0056aa8a in PyEval_EvalCodeEx (closure=, 
defcount=, defs=0x0, kwcount=, kws=, argcount=1073744720, args=,
locals=0x0, globals=, co=) at 
../Python/ceval.c:3582
#9  function_call (func=func@entry=, 
arg=arg@entry=(,), kw=kw@entry=0x0) 
at ../Objects/funcobject.c:523
#10 0x004be724 in PyObject_Call (kw=0x0, arg=(,), func=) at 
../Objects/abstract.c:2546
#11 instancemethod_call.8803 (func=, 
arg=(,), kw=0x0) at 
../Objects/classobject.c:2602
#12 0x004c4683 in PyObject_Call (kw=0x0, arg=(), func=) at ../Objects/abstract.c:2546
#13 PyEval_CallObjectWithKeywords (kw=0x0, arg=(), func=) at ../Python/ceval.c:4219
#14 slot_tp_del.25647 (self=self@entry=) at ../Objects/typeobject.c:5844
#15 0x004c5880 in subtype_dealloc.25650 (self=) at ../Objects/typeobject.c:1002
#16 0x005336cf in dict_dealloc.18423 (mp=0x7f0a9e93c398) at 
../Objects/dictobject.c:1040
#17 0x004c56e7 in subtype_dealloc.25650 (

self=) at remote 
0x7f0a9e924190>, objectsById={'root': 
, _started_at=, 
cookie='cookie_9de0e8d93ed84452a1ce8cc92268979e', _com
 plete=<_Condition(_Condition__lock=...(truncated)) at 
../Objects/typeobject.c:1035
#18 0x00534b93 in frame_dealloc.14921 (f=Frame 0x7f0a9f6d49d8, for file 
/etc/remoting/remoting_agent.zip/Pyro4/socketserver/threadpool.py, line 39, in 
run ())
at ../Objects/frameobject.c:458
#19 0x004d86c6 in tb_dealloc.46270 (tb=0x7f0aa1278f38) at 
../Python/traceback.c:28
#20 0x004d87e1 in tb_dealloc.46270 (tb=0x7f0aa1278ea8) at 
../Python/traceback.c:27
#21 0x005336cf in dict_dealloc.18423 (mp=0x7f0aa1277280) at 
../Objects/dictobject.c:1040
#22 0x005a52db in PyInterpreterState_Clear (interp=0x95ac80) at 
../Python/pystate.c:111
#23 0x00423aea in Py_Finalize () at ../Python/pythonrun.c:500
#24 0x004672c5 in Py_Main (argc=, argv=0x7ffce435b2d8) 
at ../Modules/main.c:665
#25 0x7f0aa0aa7f45 in __libc_start_main (main=0x4672f4 , argc=4, 
argv=0x7ffce435b2d8, init=, fini=, 
rtld_fini=, stack_end=0x7ffce435b2c8)
at libc-start.c:287
#26 0x0057c581 in _start ()



Google shows similar trace has been reported back in 2009 for python 2.6
https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/478071

--
components: Interpreter Core
messages: 280640
nosy: pwp333
priority: normal
severity: normal
status: open
title: When using pyro4 with more than 15 threads, python 2.7.12 cores 
frequently
type: crash
versions: Python 2.7

___
Python tracker 

[issue24379] Add operator.subscript as a convenience for creating slices

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

When I first looked at this a year ago, I thought it seemed like a reasonable 
idea and might be useful.  Since that time, I've haven't encountered any 
situations whether this would have improved my or someone else's code.  And 
now, I can't even dream up any scenarios where ``operator.subscript[3:7:2]`` 
would be better than ``slice(3, 7, 2)``.   Accordingly, I think we should 
re-evaluate whether there is any real benefit to be had by adding this to the 
standard library.  Perhaps, we're better off without it.

--

___
Python tracker 

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



[issue28626] Tutorial: rearrange discussion of output formatting to encourage f-strings

2016-11-12 Thread Raymond Hettinger

Raymond Hettinger added the comment:

It makes sense to drop zfill() and ljust().  If there is any mention of 
string.Template, it could be limited to mentioning why you would want to use it 
(i.e. is a great format to expose to non-programmer end-users) and include a 
reference to the string.Template docs.

--
nosy: +rhettinger

___
Python tracker 

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