[issue19569] Use __attribute__((deprecated)) to warn usage of deprecated functions and macros

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

FYI I used Py_DEPRECATED for marking PyUnicode_AsDecodedObject, 
PyUnicode_AsDecodedUnicode, PyUnicode_AsEncodedObject and 
PyUnicode_AsEncodedUnicode.

--

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue28485] compileall.compile_dir(workers=) does not raise ValueError if multithreading disabled

2016-11-04 Thread Martin Panter

Changes by Martin Panter :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue4347] Circular dependency causes SystemError when adding new syntax

2016-11-04 Thread Martin Panter

Martin Panter added the comment:

Here is a patch for Python 3 implementing my idea. There is already code 
conditionally compiled out for the pgen build, so my patch just expands that to 
avoid the "graminit.h" include and derived functions.

--
stage: needs patch -> patch review
status: closed -> open
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 2.6
Added file: http://bugs.python.org/file45363/graminit-dep.patch

___
Python tracker 

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



[issue25868] test_eintr.test_sigwaitinfo() hangs on "AMD64 FreeBSD CURRENT 3.x" buildbot

2016-11-04 Thread Martin Panter

Martin Panter added the comment:

My patch doesn’t help answer the question of why this only fails on BSD, so I 
will hold off on committing it. However v2 has a minor update to skip the test 
when pthread_sigmask() is unavailable.

--
versions: +Python 3.7
Added file: http://bugs.python.org/file45362/sigwaitinfo-block.v2.patch

___
Python tracker 

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



[issue28485] compileall.compile_dir(workers=) does not raise ValueError if multithreading disabled

2016-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 532b0b9f41e0 by Martin Panter in branch '3.5':
Issue #28485: Check for negative workers even without ProcessPoolExecutor
https://hg.python.org/cpython/rev/532b0b9f41e0

New changeset a7c76c3843af by Martin Panter in branch '3.6':
Issue #28485: Merge single-threading fix from 3.5 into 3.6
https://hg.python.org/cpython/rev/a7c76c3843af

New changeset 7d9885fd6777 by Martin Panter in branch 'default':
Issue #28485: Merge single-threading fix from 3.6
https://hg.python.org/cpython/rev/7d9885fd6777

--
nosy: +python-dev

___
Python tracker 

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



[issue28542] document cross compilation

2016-11-04 Thread Martin Panter

Martin Panter added the comment:

Actually I think it is good to document DESTDIR (you weren’t seem aware of it 
before?). I was just pointing out that it is useful to more than just Android. 
Perhaps Guido shouldn’t have trimmed it from the 2.7 readme (original text: 
https://hg.python.org/cpython/diff/988b3e807043/README). On the other hand, 
--prefix etc are already mentioned in “./configure --help”, and more people 
already seem to know about it.

--

___
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-04 Thread STINNER Victor

New submission from STINNER Victor:

When analyzing results of Python performance benchmarks, I noticed that 
call_method was 70% slower (!) between revisions 83877018ef97 (Oct 18) and 
3e073e7b4460 (Oct 22), including these revisions, on the speed-python server.

On these revisions, the CPU L1 instruction cache is less efficient: 8% cache 
misses, whereas it was only 0.06% before and after these revisions.

Since the two mentioned revisions have no obvious impact on the call_method() 
benchmark, I understand that the performance difference by a different layout 
of the machine code, maybe the exact location of functions.

IMO the best solution to such compilation issue is to use PGO compilation. 
Problem: PGO doesn't work on Ubuntu 14.04, the OS used by speed-python (the 
server runining benchmarks for http://speed.python.org/).

I propose to decorate manually the "hot" functions using the GCC 
__attribute__((hot)) decorator:
https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes
(search for "hot")

Attached patch adds Py_HOT_FUNCTION and decorates the following functions:

* _PyEval_EvalFrameDefault()
* PyFrame_New()
* call_function()
* lookdict_unicode_nodummy()
* _PyFunction_FastCall()
* frame_dealloc()

These functions are the top 6 according to the Linux perf tool when running the 
call_simple benchmark of the performance project:

32,66%: _PyEval_EvalFrameDefault
13,09%: PyFrame_New
12,78%: call_function
12,24%: lookdict_unicode_nodummy
 9,85%: _PyFunction_FastCall
 8,47%: frame_dealloc

--
components: Interpreter Core
files: hot_function.patch
keywords: patch
messages: 280097
nosy: haypo
priority: normal
severity: normal
status: open
title: Decorate hot functions using __attribute__((hot)) to optimize Python
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file45361/hot_function.patch

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Francisco Couzo

Francisco Couzo added the comment:

I think removing None as a valid predicate to filterfalse would make the API 
simpler, but I don't know if it's worth the API change, please do close the 
issue if you think it's not worth it.

--

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Note that the predicate is optional argument in groupby but mandatory in 
dropwhile and takewhile. I suppose that filter and filterfalse accept None for 
historical reason (they precede bool).

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread Fred L. Drake, Jr.

Fred L. Drake, Jr. added the comment:

"in" and "not in" are not comparisons, regardless of implementation mechanics 
(which could change).

They aren't really dependent on iteration, though they often correlate with 
iteration.

I'd rather see them described as "containment tests" or something similar.

--
nosy: +fdrake

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread wim glenn

wim glenn added the comment:

Perhaps it's better to call a spade a spade here - if they're implemented as 
comparisons, then why not document them as comparisons?

A colleague has mentioned one point that sets `in` and `not in` apart from the 
other comparisons in the table: comparisons are generally made between objects 
of the same type (with the exception of numbers).  But membership "comparisons" 
are made between different types (with the exception of substring checks).  

Here is an alternate patch which leaves the table alone, but corrects the 
inaccuracy in the note.

--
Added file: http://bugs.python.org/file45360/newpatch.diff

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think that the simpler signature is better, that the None argument isn't 
clear, and that there aren't use cases that warrant and API churn.

On your last post, it seemed that you were withdrawing the request.  Can this 
tracker item be closed now?

--

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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

___
Python tracker 

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



[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I think that the simpler signature is better, that the None argument isn't 
clear, and that there aren't use cases that warrant and API churn.

On your last post, I seemed that you were withdrawing the request.  Can this 
tracker item be closed now?

--
assignee:  -> rhettinger
components: +Extension Modules
versions: +Python 3.7

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread Raymond Hettinger

Raymond Hettinger added the comment:

At a grammar and implementation level, the "in" and "not in" operators are 
treated like comparisons (same precedence and opcodes), but at a semantic 
level, I concur with David Murray and don't think of these as being comparisons 
at all.   Accordingly, I prefer the current presentation
and agree with David that the note should be revised to say "only by types that 
support iteration".

--
nosy: +rhettinger

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-04 Thread Senthil Kumaran

Senthil Kumaran added the comment:

@Sohaib,

Thanks for the ping. Yeah, I will act on it.

Your analysis in msg276795 seems plausible, On the patch itself, I will try to 
reproduce this and see if I can avoid introducing this clear_buffer function. 
If no other go, then it should just be a private method (_clear_buffer).

That's my update and we will have it included by 2.7.13 and in 3.x versions if 
have a similar fate.

Thanks.

--

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue28616] sys.version_info.releaselevel - 'final' or 'release'

2016-11-04 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch!

--
nosy: +ned.deily
resolution:  -> fixed
stage:  -> resolved
status: open -> closed
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



[issue28616] sys.version_info.releaselevel - 'final' or 'release'

2016-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0b4bcd954554 by Ned Deily in branch '2.7':
Issue #28616: Correct help for sys.version_info releaselevel component.
https://hg.python.org/cpython/rev/0b4bcd954554

New changeset 1390bde4b768 by Ned Deily in branch '3.5':
Issue #28616: Correct help for sys.version_info releaselevel component.
https://hg.python.org/cpython/rev/1390bde4b768

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

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

--
nosy: +python-dev

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread wim glenn

wim glenn added the comment:

I want to add that the grammar explicitly mentions them as comparisons

https://docs.python.org/3/reference/grammar.html

And they are also listed in the comparisons section of the expressions 
documentation

https://docs.python.org/3/reference/expressions.html#comparisons

So the docs seem to be contradicting themselves here.

--

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread wim glenn

wim glenn added the comment:

Well, that wouldn't be true either.  Because you can easily implement objects 
which support membership tests but don't support iteration.

--

___
Python tracker 

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



[issue28563] Arbitrary code execution in gettext.c2py

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> It doesn't solve the case when an identifier or number is used as a function:

In the first case we should convert an argument to integer.

ns = {}
exec('''if True:
def func(arg):
n = int(arg)
return {}
'''.format(plural), ns)
return ns['func']

Or raise an exception if argument is not integer.

In the second case I think we can just left it as is. This is not valid C 
expression.

Or we can add try/except in above code and convert TypeError to ValueError if 
this is more preferable exception.

--

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

It should really say "only by types that support iteration".  They are not 
comparison operations, they are containment predicates.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue28563] Arbitrary code execution in gettext.c2py

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> But there is still a problem. Both patched and original c2py fail to handle 
> nested ternary operator. They respect the right associative but fails to 
> handle expressions like '1?2?3:4:5'.

What if make repeated replacements with regular expression 
r'([^?:]*?)\?([^?:]*?):([^?:]*)'?

--

___
Python tracker 

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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

This looks great, thanks.

--
stage: needs patch -> commit review

___
Python tracker 

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



[issue28617] Why isn't "in" called a comparison operation?

2016-11-04 Thread wim glenn

New submission from wim glenn:

Regarding 

https://docs.python.org/3/library/stdtypes.html#comparisons

There is a line at the bottom claiming:

> Two more operations with the same syntactic priority, in and not in, are 
> supported only by sequence types (below).

The claim is incorrect because `in` and `not in` are also supported by 
non-sequence types such as sets, mappings, etc for membership testing.

Is there any good reason why we don't include them in the table of comparison 
operations, and say that there are ten comparison operations in python?  They 
do support comparison chaining in the same way: 

>>> 'x' in 'xy' in 'xyz'
True
>>> 0 in {0} in [{0}]
True

--
assignee: docs@python
components: Documentation
files: patch.diff
keywords: patch
messages: 280080
nosy: docs@python, wim.glenn
priority: normal
severity: normal
status: open
title: Why isn't "in" called a comparison operation?
type: enhancement
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/file45359/patch.diff

___
Python tracker 

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



[issue28614] Slice limit documentation is incorrect

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

The formula is documenting the behavior, not the implementation.  So the 
formula is a mathematical formula that assumes infinite precision, not a 
floating point calculation.  I always thought that was clear by context and 
phrasing, but perhaps I'm wrong.

--

___
Python tracker 

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



[issue27973] urllib.urlretrieve() fails on second ftp transfer

2016-11-04 Thread Sohaib Ahmad

Sohaib Ahmad added the comment:

Can someone please review this patch so that it would be in 2.7.13 when it 
comes out?

--

___
Python tracker 

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



[issue28610] Provide PDB hook to customize how to find source files

2016-11-04 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The lazycache() function of the linecache module meets your request, I think. 
See the following debugging session using the attached script:

$ python -m pdb debug_script.py
> /path/to/cwd/debug_script.py(1)()
-> def debug_script(script):
(Pdb) n
> /path/to/cwd/debug_script.py(19)()
-> """
(Pdb) n
> /path/to/cwd/debug_script.py(20)()
-> code, globs = debug_script(s)
(Pdb) n
> /path/to/cwd/debug_script.py(21)()
-> exec(code, globs)
(Pdb) s
--Call--
> /path/to/cwd/script_name(2)()
-> x = 1
(Pdb) s
> /path/to/cwd/script_name(2)()
-> x = 1
(Pdb) s
> /path/to/cwd/script_name(3)()
-> y = 'blabla'
(Pdb) s
--Return--
> /path/to/cwd/script_name(3)()->None
-> y = 'blabla'
(Pdb) s
--Return--
> /path/to/cwd/debug_script.py(21)()->None
-> exec(code, globs)
(Pdb)

--
nosy: +xdegaye
Added file: http://bugs.python.org/file45358/debug_script.py

___
Python tracker 

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



[issue28614] Slice limit documentation is incorrect

2016-11-04 Thread airwin

airwin added the comment:

You can easily prove the limit is correct for real numbers.  So I would be 
willing to accept as a resolution of this issue that the type of division that 
is going on here is real.  However, that is a bit disquieting since if you try 
a real slice index you get "TypeError: slice indices must be integers or None 
or have an __index__ method". Thus, m < real limit test is a comparison of an 
integer and real which implies m gets changed to real before the comparison. 
Which obviously gives the correct result in the 1.5 case, but in general I 
dislike real comparisons where the distinction between < and <=, for example, 
can get blurred because of potential roundoff issues with reals.  So I think my 
suggested one-sentence resolution to the issue is better then updating the 
documentation to clarify what kind of division is occurring in the limit.

--

___
Python tracker 

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



[issue28615] Document clarification: Section 5.4 Complex Number

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

For anyone who wants to work on this: this is 5.4 of the python2.7 docs.  The 
wording in the python3 docs 
(https://docs.python.org/3/library/stdtypes.html#numeric-types-int-float-complex)
 is much clearer, if someone wants to prepare a backport patch.

--
keywords: +easy
nosy: +r.david.murray
stage:  -> needs patch
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



[issue28609] argparse claims '*' positional argument is required in error output

2016-11-04 Thread Reuben Thomas

Reuben Thomas added the comment:

Thanks very much for this. It would be great if the redundancy I referred to in 
the usage message could also be removed, so that instead of "[ARGUMENT 
[ARGUMENT ...]]" it just said "[ARGUMENT ...]".

(Similarly, for a '+' argument, it could say just

ARGUMENT ...

)

--

___
Python tracker 

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



[issue28614] Slice limit documentation is incorrect

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

My guess is that the formula is not using integer division.  There are two 
elements, n=0, and n=1.  1 is less than 1.5.  In python2 it would be a natural 
assumption that that formula was referring to python2 division, and that should 
be clarified if I'm right.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue28609] argparse claims '*' positional argument is required in error output

2016-11-04 Thread Charlie Proctor

Charlie Proctor added the comment:

I agree that the message is slightly misleading.

Uploading one possible solution. I'm sure someone more familiar with the 
library might have a better approach...

--
keywords: +patch
nosy: +charlie.proctor
Added file: http://bugs.python.org/file45357/optional_arguments.patch

___
Python tracker 

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



[issue28616] sys.version_info.releaselevel - 'final' or 'release'

2016-11-04 Thread Anish Tambe

New submission from Anish Tambe:

help(sys.version_info) suggests releaselevel is one among - 

 |  releaselevel
 |  'alpha', 'beta', 'candidate', or 'release'

Notice that the last one is 'release'.

But the implementation says current value is - 'final'.

$ python
Python 2.7.12 (default, Oct 11 2016, 05:24:00) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=2, minor=7, micro=12, releaselevel='final', serial=0)
>>> 


$ python3
Python 3.5.2 (default, Oct 11 2016, 05:05:28) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)
>>> 


The documentation (https://docs.python.org/3/library/sys.html#sys.version_info 
or Doc/library/sys.rst) agrees with the implementation.

The tests also agree with the implementation. 
grep for releaselevel and see - 
Lib/test/test_sys.py:504:self.assertIn(vi.releaselevel, ("alpha", 
"beta", "candidate", "final"))

Hence, submitting a patch to change the help documentaion to reflect the 
correct value for releaselevel.

[Motivation - I tried to print a warning to the user in case my app was not 
being run on a final release, and I tried to do that by equating releaselevel 
with 'release' as the help suggested.]

--
assignee: docs@python
components: Documentation
files: releaselevel.patch
keywords: patch
messages: 280071
nosy: anish.tambe, docs@python
priority: normal
severity: normal
status: open
title: sys.version_info.releaselevel - 'final' or 'release'
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/file45356/releaselevel.patch

___
Python tracker 

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



[issue28612] str.translate needs a mapping example

2016-11-04 Thread Chris Barker

Chris Barker added the comment:

Agreed:

the custom dict type would be nice for a recipe or blog post or...

but not for the docs.

I'll note that the other trick to this recipe is that you need to know to use 
lambda to make a "None factory" for defaultdict -- though maybe that's a ToDo 
for the defaultdict docs...

--
nosy: +ChrisBarker

___
Python tracker 

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



[issue28615] Document clarification: Section 5.4 Complex Number

2016-11-04 Thread David.Johnston

New submission from David.Johnston:

Section 5.4: Numeric Types

Second paragraph reads: 
Appending 'j' or 'J' to a numeric literal yields a complex number with a zero 
real part.

After reading the table following the paragraphs I thought that the sentence 
needed revised to the following:
Appending 'j' or 'J' to a numeric literal yields a complex number with a zero 
imaginary part.

Table in same section for complex(re, im) indicates possible required doc 
change.

But after testing the use of J and complex I see there is no error here, but 
perhaps a little better clarification would help others reading the information 
without access to an editor to test against.

--
assignee: docs@python
components: Documentation
messages: 280069
nosy: David.Johnston, docs@python
priority: normal
severity: normal
status: open
title: Document clarification: Section 5.4 Complex Number

___
Python tracker 

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



[issue28614] Slice limit documentation is incorrect

2016-11-04 Thread airwin

New submission from airwin:

Note 5 (at 

 for Python 2 and at 
 
for Python 3) concerning s[i:j:k] (the slice of s from i to j with step k) 
contains the following two sentences:

"The slice of s from i to j with step k is defined as the sequence of items 
with index x = i + n*k such that 0 <= n < (j-i)/k. In other words, the indices 
are i, i+k, i+2*k, i+3*k and so on, stopping when j is reached (but never 
including j)."

That limit, "(j-i)/k" is demonstrably wrong when the integer division has a 
non-zero remainder.  For example, for i=0, j=3, and k=2, n must be less than 
int(3/2) = 1 (i.e., the slice only has one element) according to that limit, 
but in fact the slice has two elements in agreement with the second sentence 
and which can be seen from the following python (2 or 3) code example:

>>> x = [0,1,2,3,4,5]
>>> x[0:3:2]
[0, 2]

The following Python result is also instructive for negative steps.

>>> y=[5,4,3,2,1,0]
>>> y[-1:-4:-2]
[0, 2]

For this case as well the result is consistent with the second sentence of the 
documentation but inconsistent with the first sentence since according to that 
limit = int((len-4 - (len-1))/-2) = int(3/2) = 1 implying only one element in 
the slice in contradiction to the above result.

Therefore, I suggest removing the incorrect mathematical limit "(j-i)/k" from 
note 5 by replacing the above two sentences as follows:

"The slice of s from i to j with positive or negative step k is defined as the 
sequence of items with index x = i + n*k such that the indices are i, i+k, 
i+2*k, i+3*k and so on, stopping when j is reached (but never including j)."

Alternatively, one could replace the current incorrect limit by the correct 
mathmatical expression.  My guess is the limit should be "(j-i)/k" when there 
is a zero remainder for that division, and "(j-i)/k + 1" when there is a 
non-zero remainder.  That limit works for the above two examples, but I don't 
know how to prove that in general for this integer limit case.  Furthermore, 
even if somebody else can provide that proof, I still think the above single 
sentence documents the slice limits exactly, is simpler, and therefore is 
preferred.

N.B. I am formally reporting this issue as a Python 3 bug but as shown above 
the same two sentences occur in the Python 2 documentation so when this bug is 
fixed for the Python 3 documentation it should also be consistently fixed for 
Python 2.

--
assignee: docs@python
components: Documentation
messages: 280068
nosy: airwin, docs@python
priority: normal
severity: normal
status: open
title: Slice limit documentation is incorrect
versions: Python 3.7

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added comments.

--
Added file: http://bugs.python.org/file45355/gen_set_stopiteration_value_2.patch

___
Python tracker 

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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread Charlie Proctor

Charlie Proctor added the comment:

I broke the two cases (interrupt_main from test thread and from sub-thread) 
into two separate tests, using an "expect_sigint" helper.

Let me know what you think -- thanks!

--
Added file: http://bugs.python.org/file45354/test_interrupt_main.patch

___
Python tracker 

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



[issue28613] Make get_event_loop() return the current loop if called from coroutines

2016-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa37f3859462 by Yury Selivanov in branch '3.5':
Issue #28613: Fix get_event_loop() to return the current loop
https://hg.python.org/cpython/rev/aa37f3859462

New changeset 1473b9a17a91 by Yury Selivanov in branch '3.6':
Merge 3.5 (issue #28613)
https://hg.python.org/cpython/rev/1473b9a17a91

New changeset af4ac4e4b188 by Yury Selivanov in branch 'default':
Merge 3.6 (issue #28613)
https://hg.python.org/cpython/rev/af4ac4e4b188

--
nosy: +python-dev

___
Python tracker 

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



[issue28613] Make get_event_loop() return the current loop if called from coroutines

2016-11-04 Thread Yury Selivanov

Changes by Yury Selivanov :


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



[issue28613] Make get_event_loop() return the current loop if called from coroutines

2016-11-04 Thread Yury Selivanov

New submission from Yury Selivanov:

Proxy for https://github.com/python/asyncio/pull/452

--
assignee: yselivanov
components: asyncio
messages: 280064
nosy: gvanrossum, yselivanov
priority: normal
severity: normal
stage: resolved
status: open
title: Make get_event_loop() return the current loop if called from coroutines
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



[issue28612] str.translate needs a mapping example

2016-11-04 Thread Jim Jewett

Jim Jewett added the comment:

https://mail.python.org/pipermail/python-ideas/2016-November/043539.html by 
Chris Barker points out that a custom object (which doesn't ever store the 
missing "keys") may be better still... though I'm not sure it is better enough 
to complicate the docs.

--

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yet one special case -- if asynchronous iterator in aiter_wrapper is an 
instance of StopIteration.

Proposed patch adds the function _PyGen_SetStopIterationValue() that raises 
StopIteration with correctly wrapped value (exception is normalized only if 
needed) and replaces 4 code duplications with it. The patch also includes 
Yury's variant of Stefan's patch and additional tests.

--
stage: test needed -> patch review
Added file: http://bugs.python.org/file45353/gen_set_stopiteration_value.patch

___
Python tracker 

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



[issue28612] str.translate needs a mapping example

2016-11-04 Thread Jim Jewett

New submission from Jim Jewett:

One commonly needed string transformation is stripping out certain characters 
(or only keeping certain characters).  This is common enough that it might be 
worth a dedicated method, except, that, as Stephen J. Turnbull wrote in 
https://mail.python.org/pipermail/python-ideas/2016-November/043501.html

"""
So really translate with defaultdict is a specialized loop that
marries an algorithmic body (which could do things like look up the
original script or other character properties to decide on the
replacement for the generic case) with a (usually "small") table of
exceptions.  That seems like inspired design to me.
"""

Alas, while inspired, it isn't obvious to someone who isn't yet used to the 
power of python custom classes.

The documentation (such as 
https://docs.python.org/3/library/stdtypes.html?highlight=translate#str.translate
 ) should include such an example.

One possible example would be a defaultdict that says to discard any characters 
except lower case ASCII lettersI.

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 280061
nosy: Jim.Jewett, docs@python
priority: normal
severity: normal
stage: needs patch
status: open
title: str.translate needs a mapping example
type: enhancement
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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

Ah, of course.  The revised comments look good.

I think I'd rather see the two cases tested separately, but if they are kept as 
one another comment ("lock was successfully released; reacquire the lock and 
test that it also works from a sub-thread") might be helpful.

--

___
Python tracker 

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



[issue28611] Syntax error when using raw strings ending with a backslash.

2016-11-04 Thread Ned Deily

Ned Deily added the comment:

To expand a bit, the "Python Language Reference" section on "String and Byte 
Literals" explains:

"Even in a raw literal, quotes can be escaped with a backslash, but the 
backslash remains in the result; for example, r"\"" is a valid string literal 
consisting of two characters: a backslash and a double quote; r"\" is not a 
valid string literal (even a raw string cannot end in an odd number of 
backslashes). Specifically, a raw literal cannot end in a single backslash 
(since the backslash would escape the following quote character). Note also 
that a single backslash followed by a newline is interpreted as those two 
characters as part of the literal, not as a line continuation."

https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals

Because of the difference between Posix- and Windows-style paths and the 
potential conflicts in the use of `\` (such as you ran into), Python provides 
the older os.path and the newer pathlib modules, both of which allow you to 
deal with path manipulations in a more platform-independent manner.

https://docs.python.org/dev/library/pathlib.html
https://docs.python.org/dev/library/os.path.html

--
nosy: +ned.deily

___
Python tracker 

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



[issue28611] Syntax error when using raw strings ending with a backslash.

2016-11-04 Thread Emanuel Barry

Emanuel Barry added the comment:

That's how strings work, unfortunately. You can't end any string (raw or not) 
with an odd number of backslashes. You could do the following to get around 
this limitation:

>>> r"C:\Folder" "\\"
'C:\\Folder\\'

As a side note, please don't upload screenshots if what you're capturing 
consists only of text (you can paste it directly in your message). This makes 
it impossible to copy-paste input in the interpreter to try to replicate the 
issue, and makes it harder/impossible for the blind and visually-impaired to 
contribute. Thanks!

--
nosy: +ebarry
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
type: compile error -> behavior

___
Python tracker 

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



[issue28611] Syntax error when using raw strings ending with a backslash.

2016-11-04 Thread Mallow

New submission from Mallow:

I'm not sure if this is a bug or not but I've noticed a behavior that seems 
incorrect.

The use of raw strings, when used for directory paths ending with a back slash 
(/) creates a syntax error.

How to reproduce


Code:

print (r"C:\path\to\a\dir\" + "file.ext")

Result: Syntax Error

Why is this an error, (in my perspective)
-

One could attempt to be storing the directory information in a variable to 
write to file that is composed later but would be forced to use a cumbersome 
normal string having to escape all backslashes.

Example:

outputdir = r"C:\path\to\dir\"
filename = r"file.ext"
writetofile(outputdir + filename)

Argument for why the workaround is not a fix


I believe I read somewhere that python is smart enough to deal with filepaths 
correctly on linux and windows if you were to switch the slashes. So 
technically 
outputdir = r"C:/path/to/dir/" 
would work
however this is hard on the workflow since I find it easier to copy and paste 
paths within windows.

I guess it wouldn't be too unreasonable to do something like:
r"C:\path\to\dir/"

--
files: Capture.PNG
messages: 280057
nosy: princemallow
priority: normal
severity: normal
status: open
title: Syntax error when using raw strings ending with a backslash.
type: compile error
versions: Python 3.5
Added file: http://bugs.python.org/file45352/Capture.PNG

___
Python tracker 

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



[issue28610] Provide PDB hook to customize how to find source files

2016-11-04 Thread Pinku Surana

New submission from Pinku Surana:

I am using Python as a hosted scripting runtime for a product. All the user 
scripts are stored in a database. I use "compile" and "exec" to run the 
scripts. I'd like to use PDB to debug scripts. Unfortunately, PDB makes a call 
to linecache, which calls tokenize.open assuming the code is in a file. I'd 
like to pass in a function that takes a filename and returns the source code in 
a string. 

At the very least, moving the call to "linecache.getline" into a separate 
method in PDB ("self.get_lines") would allow me to override that method with my 
own.

--
components: Demos and Tools, Library (Lib)
messages: 280056
nosy: Pinku Surana
priority: normal
severity: normal
status: open
title: Provide PDB hook to customize how to find source files
type: enhancement
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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread Charlie Proctor

Charlie Proctor added the comment:

To clarify further, the SIGALRM handler catches the timeout sent by the 
ITIMER_REAL... whereas the SIGINT handler catches the interrupt_main() signals.

--

___
Python tracker 

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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread Charlie Proctor

Charlie Proctor added the comment:

Thanks for the feedback David!

I've posted a revised patch with more descriptive comments and the restoration 
code moved into addCleanup.

As described in the comments, in the context of this test, the "main" thread is 
the one running the test suite... so rather than 
self.assertRaises(KeyboardInterrupt), I assert that appropriate SIGINTS are 
received. The lock is used to facilitate these assertions, since signals are 
asynchronous.

--
Added file: http://bugs.python.org/file45351/test_interrupt_main.patch

___
Python tracker 

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



[issue26926] test_io large file test failure on 32 bits Android platforms

2016-11-04 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The tests are run on an ext4 file system.
test_large_file_ops does not fail on the x86_64 and arm64 (aka aarch64) Android 
64 bits platforms.
test_large_file_ops still fails on x86 with the latest Android API level 24 
(i.e. the latest released libc).

FWIW, the second item in 
https://android.googlesource.com/platform/bionic.git/#32_bit-ABI-bugs may 
explain why there is still no large file support on Android 32 bits platforms.
HAVE_LARGEFILE_SUPPORT cannot be used to skip the test since it is also 
undefined on the Android 64 bits platforms and on linux x86_64.
This new patch is not specific to Android and uses the same method as the one 
used in test_mmap to skip the test on platforms that do not support large files.

--
assignee:  -> xdegaye
components: +Tests -Cross-Build, Library (Lib)
dependencies:  -add the 'is_android' attribute to test.support
stage:  -> patch review
title: Large files are not supported on Android -> test_io large file test 
failure on 32 bits Android platforms
versions: +Python 3.7
Added file: http://bugs.python.org/file45350/skip-large-file_2.patch

___
Python tracker 

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



[issue28609] argparse claims '*' positional argument is required in error output

2016-11-04 Thread Reuben Thomas

New submission from Reuben Thomas:

In Python 3.5.2, with a positional argument with nargs='*', running the program 
with no arguments gives an error like this:

usage: caffeinate [-h] [-V] COMMAND [ARGUMENT [ARGUMENT ...]]
caffeinate: error: the following arguments are required: COMMAND, ARGUMENT

Here it is clear from the (correct, though redundant) syntax that "ARGUMENT" is 
optional, but the error message claims, incorrectly, that it is required.

The add_argument calls used were:

parser.add_argument('COMMAND', help='command to run')
parser.add_argument('ARGUMENT', nargs='*', help='arguments to COMMAND')
parser.add_argument('-V', '--version', action='version', version=PROGRAM_NAME + 
' ' + VERSION)

--
components: Library (Lib)
messages: 280052
nosy: rrt
priority: normal
severity: normal
status: open
title: argparse claims '*' positional argument is required in error output
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



[issue24564] shutil.copytree fails when copying NFS to NFS

2016-11-04 Thread Gabriel Devenyi

Gabriel Devenyi added the comment:

I'm running into this issue with python 3.5 and a ZFS-backed NFS4 mount.

Strace of a setuptools install:
chmod("/opt/quarantine/pydpiper/2.0/build/lib/python3.4/site-packages/pydpiper-2.0-py3.4.egg",
 0644) = 0
listxattr("dist/pydpiper-2.0-py3.4.egg", "system.nfs4_acl\0", 256) = 16
getxattr("dist/pydpiper-2.0-py3.4.egg", "system.nfs4_acl", 
"\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16\x01\x87\x00\x00\x00\x06OWNER@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x81\x00\x00\x00\x06GROUP@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x81\x00\x00\x00\x09EVERYONE@\x00\x00",
 128) = 80
setxattr("/opt/quarantine/pydpiper/2.0/build/lib/python3.4/site-packages/pydpiper-2.0-py3.4.egg",
 "system.nfs4_acl", 
"\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x16\x01\x87\x00\x00\x00\x06OWNER@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x81\x00\x00\x00\x06GROUP@\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x12\x00\x81\x00\x00\x00\x09EVERYONE@\x00\x00",
 80, 0) = -1 EIO (Input/output error)
stat("/tmp/easy_install-41z79x8r", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
openat(AT_FDCWD, "/tmp/easy_install-41z79x8r", 
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 4
getdents(4, /* 2 entries */, 32768) = 48
getdents(4, /* 0 entries */, 32768) = 0
close(4)= 0
rmdir("/tmp/easy_install-41z79x8r") = 0
write(2, "error: [Errno 5] Input/output er"..., 125error: [Errno 5] 
Input/output error: 
'/opt/quarantine/pydpiper/2.0/build/lib/python3.4/site-packages/pydpiper-2.0-py3.4.egg'
) = 125

--
nosy: +Gabriel Devenyi
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



[issue28584] ICC compiler check is too permissive

2016-11-04 Thread Josh Rosenberg

Josh Rosenberg added the comment:

It's probably bad form, but I've seen people set CC to name/path to compiler 
followed by switches, e.g.:

   export CC='gcc -march=native -O3'

or the like (usually because they want to keep the build tool's default CFLAGS, 
and setting CFLAGS causes them to be replaced, not supplemented).

basename seems to strip the leading path components, but if someone shoved in 
other switches, they aren't removed, so if they happen to have "icc" in them, 
this would still have issues. Perhaps a basename followed by splitting on 
whitespace and only keeping the first component? Not a configure expert, not 
sure what's possible.

--
nosy: +josh.r

___
Python tracker 

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



[issue28563] Arbitrary code execution in gettext.c2py

2016-11-04 Thread Carl Ekerot

Carl Ekerot added the comment:

It doesn't solve the case when an identifier or number is used as a function:

   >>> import os
   >>> gettext.c2py("n()")(lambda: os.system("sh"))
   $ 
   0
   >>> gettext.c2py("1()")(0)
   Traceback (most recent call last):
 File "", line 1, in 
 File "", line 1, in 
   TypeError: 'int' object is not callable

This is more of an unintended behavior than a security issue.

Xiang Zhang: I've created a patch based on yours which handles the above case. 
I've also added a corresponding test case.

Imo it would be even better if we could avoid eval. One possible (and safe) way 
would be to construct a safe subset of Python using the ast module. This would 
however still require that the C-style syntax is translated to Python. As you 
mention, there are issues parsing and translating nested ternary operators, and 
I doubt it will be possible to cover all cases with the regex replace utilized 
today.

--
Added file: http://bugs.python.org/file45349/gettext_c2py_func.patch

___
Python tracker 

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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread R. David Murray

R. David Murray added the comment:

Thanks, Charlie.

You should use addCleanup to handle the resetting of the state, so that it gets 
cleaned up no matter what happens in the test.  IMO the comments should either 
be omitted or be more descriptive about what exactly is being tested.  For 
example "If this timer goes off, then interrupt_main did not work, so fail the 
test".

I don't really understand what exactly is being tested in the body...it looks 
like two tests, one for calling it from the main thread (I suppose it makes 
sense to test that, but I don't know what behavior is expedted) and one from a 
subthread, which I would think was the real test.  I would expect the main 
thread to be catching KeyboardInterrupt, based on the description of 
interrupt_main, so I'm not even sure what the sigalrm is for.  Can you explain?

--
nosy: +r.david.murray

___
Python tracker 

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



[issue19899] No test for thread.interrupt_main()

2016-11-04 Thread Charlie Proctor

Charlie Proctor added the comment:

Found this through the "Random Issue" button -- I've uploaded a simple test 
case for thread.interrupt_main().

This is my first patch :) So let me know if there's something else I should do 
and I'd love to hear any feedback...

--
keywords: +patch
nosy: +charlie.proctor
Added file: http://bugs.python.org/file45348/test_interrupt_main.patch

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Yury Selivanov

Yury Selivanov added the comment:

> No, this cannot be tested from the Python level.

Stefan, could you please upload a C program that showcases the bug you're 
trying to fix?

--

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: 
http://bugs.python.org/file45347/test_stopiteration_tuple_value.patch

___
Python tracker 

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



[issue28595] shlex.shlex should not augment wordchars

2016-11-04 Thread Evan

Changes by Evan :


--
title: shlex.split should not augment wordchars -> shlex.shlex should not 
augment wordchars

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Yury Selivanov

Yury Selivanov added the comment:

Serhiy, I think you forgot to attach the patch.

aiter_wrapper shouldn't ever receive tuples, so it should be fine with 
PyErr_SetObject.

--

___
Python tracker 

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



[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a test that passed with current code but will fail with the patch. I 
don't know whether it make much sense. If yes, then perhaps 
aiter_wrapper_iternext needs the same workaround as other invocations of 
PyErr_SetObject(PyExc_StopIteration, ...).

--

___
Python tracker 

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



[issue28604] Exception raised by python3.5 when using en_GB locale

2016-11-04 Thread Charalampos Stratakis

Changes by Charalampos Stratakis :


--
nosy: +cstratak

___
Python tracker 

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



[issue26931] android: test_distutils fails

2016-11-04 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The problem raised in msg264946 has been fixed at changeset 15835311b5e6.

This new cross-compiled-skip_2.patch is not specific to Android and fixes 
test_distutils when the executables used to build the interpreter do not exist 
on the platform
where the test is run.  The patch also does:
* Fix a bug in test_run of Lib/distutils/tests/test_build_clib.py that was 
using the values of the 'compiler.executables' dictionary instead of the 
attributes of 'compiler'.
* Removes test_get_python_inc from test_sysconfig.py as Python.h may not be 
installed on systems where extension modules are not expected to be built (BTW 
the comment in the test
points out: "This is not much of a test" :).

With this patch, test_distutils runs fine on the Android emulator.

--
components: +Tests -Cross-Build, Library (Lib)
dependencies:  -add the 'is_android' attribute to test.support
stage:  -> patch review
versions: +Python 3.7
Added file: http://bugs.python.org/file45346/cross-compiled-skip_2.patch

___
Python tracker 

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



[issue28199] Compact dict resizing is doing too much work

2016-11-04 Thread Xiang Zhang

Xiang Zhang added the comment:

#28580 and #28583 are resolved now. I think dictresize4 can be recommited now.

--
stage: needs patch -> commit review

___
Python tracker 

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



[issue28580] Optimize iterating split table values

2016-11-04 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks!

--

___
Python tracker 

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



[issue28580] Optimize iterating split table values

2016-11-04 Thread INADA Naoki

Changes by INADA Naoki :


--
resolution:  -> fixed
stage: commit review -> resolved
status: open -> closed

___
Python tracker 

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



[issue28580] Optimize iterating split table values

2016-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3904194d06e6 by INADA Naoki in branch 'default':
Issue #28580: Optimize iterating split table values.
https://hg.python.org/cpython/rev/3904194d06e6

--
nosy: +python-dev

___
Python tracker 

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



[issue28608] Support creating hardlink using `pathlib`

2016-11-04 Thread Ram Rachum

Changes by Ram Rachum :


--
components: Library (Lib)
nosy: cool-RR
priority: normal
severity: normal
status: open
title: Support creating hardlink using `pathlib`
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue28580] Optimize iterating split table values

2016-11-04 Thread INADA Naoki

INADA Naoki added the comment:

LGTM. I'll commit.

--

___
Python tracker 

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



[issue28088] Document Transport.set_protocol and get_protocol

2016-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3f5af4a25995 by INADA Naoki in branch '3.5':
Issue #28088: Document Transport.set_protocol and get_protocol
https://hg.python.org/cpython/rev/3f5af4a25995

New changeset a5e52b7be71f by INADA Naoki in branch '3.6':
Issue #28088: Document Transport.set_protocol and get_protocol.
https://hg.python.org/cpython/rev/a5e52b7be71f

New changeset a0299574a733 by INADA Naoki in branch 'default':
Issue #28088: Document Transport.set_protocol and get_protocol.
https://hg.python.org/cpython/rev/a0299574a733

--
nosy: +python-dev

___
Python tracker 

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



[issue28088] Document Transport.set_protocol and get_protocol

2016-11-04 Thread INADA Naoki

Changes by INADA Naoki :


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



[issue28563] Arbitrary code execution in gettext.c2py

2016-11-04 Thread Xiang Zhang

Xiang Zhang added the comment:

gettext_c2py.patch tries to avoid the problem. It still uses eval but manually 
parse the expression using tokens extracted from gettext. Tests are passed.

But there is still a problem. Both patched and original c2py fail to handle 
nested ternary operator. They respect the right associative but fails to handle 
expressions like '1?2?3:4:5'.

--
keywords: +patch
Added file: http://bugs.python.org/file45345/gettext_c2py.patch

___
Python tracker 

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