[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

[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- resolution: -> rejected status: open -> closed ___ Python tracker ___

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

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

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

[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

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

[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

[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

[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

[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

[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

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

[issue28593] Inconsistent itertools' predicate behaviour

2016-11-04 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- Removed message: http://bugs.python.org/msg280091 ___ Python tracker ___

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

[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

[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

[issue23996] _PyGen_FetchStopIterationValue() crashes on unnormalised exceptions

2016-11-04 Thread Guido van Rossum
Changes by Guido van Rossum : -- nosy: -gvanrossum ___ Python tracker ___ ___

[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

[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

[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

[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

[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 {}

[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

[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

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

[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

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

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

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

[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

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

[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

[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

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

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

[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

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

[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

[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

[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

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

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

[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

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

[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

[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

[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

[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

[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

[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\"

[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

[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

[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

[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

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

[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",

[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

[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

[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

[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

[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

[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

[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

[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

[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, ...).

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

[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

[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

[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

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

[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

[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

[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

[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

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

[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