[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PEP 399 requires that the C code must pass the test suite used for the pure 
Python code.

--

___
Python tracker 

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



[issue27117] turtledemo does not work with IDLE's new dark theme.

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Heads are not merged.

--

___
Python tracker 

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



[issue16500] Add an 'atfork' module

2016-05-29 Thread Марк Коренберг

Changes by Марк Коренберг :


--
nosy: +mmarkk

___
Python tracker 

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



[issue16500] Add an 'atfork' module

2016-05-29 Thread Марк Коренберг

Марк Коренберг added the comment:

Also I have to add, maybe you also add automatic file descriptor closing on 
fork. We already have O_CLOEXEC, we have no O_CLOFORK. So, maybe it useful to 
add such flag ?

--

___
Python tracker 

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



[issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

2016-05-29 Thread Марк Коренберг

New submission from Марк Коренберг:

1. Need fix the code
2. Fix documentation
3. Update PEP446 description.

There is F_DUPFD_CLOEXEC constant, that must be used instead of F_DUPFD 
transparently when kernel >= 2.6.24.

--
messages: 266591
nosy: mmarkk
priority: normal
severity: normal
status: open
title: PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., 
fcntl.F_DUPFD)

___
Python tracker 

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



[issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

2016-05-29 Thread Марк Коренберг

Changes by Марк Коренберг :


--
assignee:  -> docs@python
components: +Documentation, Library (Lib)
nosy: +docs@python
type:  -> behavior
versions: +Python 3.4, 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



[issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

2016-05-29 Thread Martin Panter

Martin Panter added the comment:

I don’t see any violation or anything needing fixing in the documentation or 
code. Can you elaborate?

The fcntl() documentation says “The values used for ‘cmd’ [F_DUPFD, etc] are 
operating system dependent, and are available as constants in the ‘fcntl’ 
module, using the same names as used in the relevant C header files.” The 
newest version of Posix specifies both the F_DUPFD and F_DUPFD_CLOEXEC. It 
would be misleading for Python to use one when the user specified the other.

If you want a best-effort version of F_DUPFD_CLOEXEC for a single-threaded 
program, why not use os.dup()? I presume this uses F_DUPFD_CLOEXEC where 
appropriate, and uses some non-atomic fallback if necessary.

--
nosy: +haypo, martin.panter

___
Python tracker 

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



[issue27117] turtledemo does not work with IDLE's new dark theme.

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 169551a8d5d1 by Martin Panter in branch 'default':
Issue #27125: Merge typo fixes from 3.5
https://hg.python.org/cpython/rev/169551a8d5d1

--

___
Python tracker 

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



[issue27125] Typo in Python 2 multiprocessing documentation

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c817d1b5b937 by Martin Panter in branch '2.7':
Issue #27125: Fix various errors like “will [be] inherited”
https://hg.python.org/cpython/rev/c817d1b5b937

New changeset f7c85accbde9 by Martin Panter in branch '3.5':
Issue #27125: Fix various errors like “will [be] inherited”
https://hg.python.org/cpython/rev/f7c85accbde9

New changeset 169551a8d5d1 by Martin Panter in branch 'default':
Issue #27125: Merge typo fixes from 3.5
https://hg.python.org/cpython/rev/169551a8d5d1

--
nosy: +python-dev

___
Python tracker 

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



[issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

2016-05-29 Thread STINNER Victor

STINNER Victor added the comment:

I don't think that it's possible nor worth it to wrap all fcntl() and all
ioctl() calls. I see these functions as very low-level APIs and so I
consider that the caller is responsible of what he/she does.

If you want to change something, explian in fcntl module doc that the PEP
466 is not implemented in this module znd it's a deliberate choice.

I agree with Martin, it's the responsability of the dev to use the right
command depending on the use case.

--

___
Python tracker 

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



[issue27117] turtledemo does not work with IDLE's new dark theme.

2016-05-29 Thread Martin Panter

Martin Panter added the comment:

It looks like your commit to the “default” branch already included the relevant 
changes, so I did the merge while keeping the files the same. If I missed 
something, it may need an extra update. But the tests seem to be working (is 
there a turtledemo test?)

--
nosy: +martin.panter

___
Python tracker 

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



[issue27125] Typo in Python 2 multiprocessing documentation

2016-05-29 Thread Martin Panter

Martin Panter added the comment:

Thanks for the report Phoenix

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



[issue27151] multiprocessing.Process leaves read pipes open (Process.sentinel)

2016-05-29 Thread Roman Bolshakov

New submission from Roman Bolshakov:

There's no code that closes read pipe(Process.sentinel) when a Process is 
joined. That creates issues in long running programs as the pipe's file 
descriptors are effectively leaked.

--
components: Library (Lib)
files: leak.py
messages: 266598
nosy: Roman Bolshakov
priority: normal
severity: normal
status: open
title: multiprocessing.Process leaves read pipes open (Process.sentinel)
type: resource usage
versions: Python 3.3, Python 3.4, Python 3.5
Added file: http://bugs.python.org/file43046/leak.py

___
Python tracker 

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



[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

Functionally, both versions are equivalent, but one is a class and the other is 
not. From PEP 399:

"Technical details of the VM providing the accelerated code are allowed to 
differ as necessary, e.g., a class being a `type` when implemented in C."

It clearly states that it's an implementation detail. I've been beaten! 
However, the next paragraph also says this:

"Acting as a drop-in replacement also dictates that no public API be provided 
in accelerated code that does not exist in the pure Python code."

I think this contradicts itself, since IMO an object being a type is part of 
the public API (but obviously this thought isn't universal). Whatever happens 
with the pure Python implementation, shouldn't the PEP be clarified on that 
point?

--

___
Python tracker 

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



[issue27137] functools.partial: Inconsistency between Python and C implementations

2016-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch adds the ExtraAssertions mix-in that provides additional assert 
methods. These methods provide better failure report than 
assertTrue/assertFalse with a result of corresponding function. For example 
assertStartsWith outputs shorten reprs of the start of the string and prefix.

These checks are quite popular and can be used tens or hundreds times in tests 
(the patch makes tests using new assert methods):

assertHasAttr   121 times
assertNotHasAttr 99 times
assertIsSubclass243 times
assertNotIsSubclass  95 times
assertStartsWith131 times
assertEndsWith   73 times

--
components: Tests
files: extra_assertions.patch
keywords: patch
messages: 266600
nosy: ezio.melotti, michael.foord, r.david.murray, rbcollins, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Additional assert methods for unittest
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43047/extra_assertions.patch

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Additional statistics that proves that specified checks are not specific for 
narrow group of tests:

assertHasAttr   121 times in 57 files
assertNotHasAttr 99 times in 31 files
assertIsSubclass243 times in 30 files
assertNotIsSubclass  95 times in 5 files
assertStartsWith131 times in 59 files
assertEndsWith   73 times in 36 files

--

___
Python tracker 

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



[issue27151] multiprocessing.Process leaves read pipes open (Process.sentinel)

2016-05-29 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +jnoller, sbt
versions: +Python 3.6 -Python 3.3, Python 3.4

___
Python tracker 

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



[issue27148] Make VENV_DIR relative to Script directory

2016-05-29 Thread SilentGhost

Changes by SilentGhost :


--
components: +Library (Lib) -Demos and Tools
nosy: +vinay.sajip
versions:  -Python 3.2, Python 3.3, Python 3.4, Python 3.5

___
Python tracker 

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



[issue27153] Default value shown by argparse.ArgumentDefaultsHelpFormatter is backwards for action='store_false'

2016-05-29 Thread Colin Morris

New submission from Colin Morris:

Small example:

import argparse
parser = 
argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--no-foo', dest='foo', action='store_false', 
help="Suppress foo")
args = parser.parse_args()
print('foo = {}'.format(args.foo))

Output with "-h":

optional arguments:
  -h, --help  show this help message and exit
  --no-fooSuppress foo (default: True)

A reasonable person reading that would think that we suppress foo by default. 
But actually, foo is True by default - "--no-foo" is off by default. I would 
suggest that if action='store_false', the default value reported by the 
formatter should be flipped.

--
components: Library (Lib)
messages: 266602
nosy: Colin Morris
priority: normal
severity: normal
status: open
title: Default value shown by argparse.ArgumentDefaultsHelpFormatter is 
backwards for action='store_false'
type: behavior
versions: Python 2.7, Python 3.2, 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



[issue27117] turtledemo does not work with IDLE's new dark theme.

2016-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I prepared and tested two slightly different patches for 3.5 and 3.6.  I 
committed the 3.6 patch, then the 3.5 patch, and prepared a null merge (in 
default), but did not hit the commit button before pushing.  I just finished 
the null merge, creating two heads (in default), which I merged (after updating 
to Martin's head) and pushed both.  Everything looks good here after 
re-pulling.  One of you could recheck in your clones.
---

turtledemo.__main__ creates a framework for running any of the demo files in 
the package.  There is no test_turtledemo unittest.  The test is to run it, 
either with python -m turtledemo in the console or Help => Turtle Demo in IDLE. 
 Two summers ago, before adding the IDLE menu item, I loaded and ran each of 
the demos, patched a few, as well as .__main__, and re-ran, more than once.

For this issue, I only needed to load one demo with the IDLE Dark theme, or a 
custom version thereof, as the current theme.  If someone has not customized 
the theme selection in IDLE, the default IDLE Classic, black on white, will be 
used.

Testing this issue also required running IDLE and loading a file to be sure the 
the revised editor still worked, and loading and running the colorizer file, to 
run its htest (which previously had the same problem as turtledemo).

--

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't see how this is a simplification.   The additional /2 and *2 on the 
affected lines makes the code a little harder to reason about and it loses some 
of the cleanness achieved by the last patch.   To me, it also increases 
conceptual complexity because INSTR_OFFSET() no longer gives the byte address 
adjustment.

--
nosy: +rhettinger

___
Python tracker 

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



[issue27125] Typo in Python 2 multiprocessing documentation

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Lib/tkinter/tix.py:

-and a label into one mega widget. It can beused be used to simplify
+and a label into one mega widget. It can be used be used to simplify

Isn't "be used" duplicated?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread Alexey Borzenkov

New submission from Alexey Borzenkov:

There's a regression in file.writelines behavior for binary files when writing 
unicode strings, which seems to have first appeared in Python 2.7.7. The 
problem is that when writing unicode strings the internal representation (UCS2 
or UCS4) is written instead of the actual text, which also directly contradicts 
documentation, which states "This is equivalent to calling write() for each 
string". However on Python 2.7.7+ they are no longer equivalent:

>>> open('testfile.bin', 'wb').writelines([u'Hello, world!'])
>>> open('testfile.bin', 'rb').read()
'H\x00e\x00l\x00l\x00o\x00,\x00 \x00w\x00o\x00r\x00l\x00d\x00!\x00'
>>> open('testfile.bin', 'wb').write(u'Hello, world!')
>>> open('testfile.bin', 'rb').read()
'Hello, world!'

This code worked correctly no Python 2.7.6.

--
components: IO
messages: 266605
nosy: snaury
priority: normal
severity: normal
status: open
title: Regression in file.writelines behavior
type: behavior
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



[issue16500] Add an 'atfork' module

2016-05-29 Thread A. Jesse Jiryu Davis

Changes by A. Jesse Jiryu Davis :


--
nosy: +emptysquare

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Attached is the larger potential change of replacing GET_ITER/FOR_ITER with 
FOR_BEGIN/FOR_ITER. I took awhile to getting this put together due to missing 
that CONTINUE_LOOP was jumping to the top of the loop, skipping past FOR_ITER

--
Added file: http://bugs.python.org/file43048/forbegin.patch

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Oops wrong issue, sorry. Please delete?

--

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Attached is the larger potential change of replacing GET_ITER/FOR_ITER with 
FOR_BEGIN/FOR_ITER. I took awhile to getting this put together due to missing 
that CONTINUE_LOOP was jumping to the top of the loop, skipping past FOR_ITER

--
Added file: http://bugs.python.org/file43049/forbegin.patch

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Emanuel Barry

Changes by Emanuel Barry :


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

___
Python tracker 

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



[issue27150] PEP446 (CLOEXEC by default) violation with fcntl.fcntl(..., fcntl.F_DUPFD)

2016-05-29 Thread Марк Коренберг

Марк Коренберг added the comment:

OK, it will be consistent, if docs mention that F_DUPFD will not set O_CLOEXEC 
automatically, mentiont that F_DUPFD_CLOEXEC should be used for that, and also 
mention PEP446 somewhere.

--

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Demur Rumed

Changes by Demur Rumed :


Removed file: http://bugs.python.org/file43048/forbegin.patch

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Emanuel Barry

Changes by Emanuel Barry :


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

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread Марк Коренберг

Changes by Марк Коренберг :


--
nosy: +mmarkk

___
Python tracker 

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



[issue27129] Wordcode, part 2

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

word-jump-offsets.patch doesn't simplify the code, but rather complicates it, 
because this is minimal patch that doesn't include the refactoring. The main 
benefit of this patch is that it extends the range addressed by short jump 
instruction. The other benefit is that the target of jump instruction is now 
always point at instruction boundary.

wordcode2.patch includes refactoring and other changes:

* Changes jump offsets. This extends addressed range and can make co_code more 
compact.
* Changes co_lnotab. This can make co_lnotab more compact.
* Changes f_lasti.
* Changes the disassembler.
* Refactors the C code (makes it codeunit-oriented instead of byte-oriented). 
Simplifies the code complicated by other changes.

I can provide these steps by separate patches (word-jump-offsets.patch is the 
first of them), but every separate patch can temporary complicate the code. 
Three of these changes (except the disassembler changing and refactoring) break 
the compatibility of pyc-files and need incrementing the magic number.

--

___
Python tracker 

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



[issue27073] redundant checks in long_add and long_sub

2016-05-29 Thread Oren Milman

Oren Milman added the comment:

I agree. This assert only indirectly verifies that something bad doesn't 
happen. 

The bad thing that might happen is an in-place negating of an element of 
small_ints, so the most direct assert should be 'assert(Py_REFCNT(z) == 1);'.
This is exactly what Victor did in long_lshift back in revision 84698...

What do you think?

--

___
Python tracker 

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



[issue27149] Implement socket.sendmsg() for Windows

2016-05-29 Thread Марк Коренберг

Марк Коренберг added the comment:

https://github.com/pauldotknopf/WindowsSDK7-Samples/blob/master/netds/winsock/sendmsg/SendMsg.cpp

Seems, supported since Vista

--

___
Python tracker 

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



[issue27155] '-' sign typo in example

2016-05-29 Thread Ben Kane

New submission from Ben Kane:

On page https://docs.python.org/3/library/subprocess.html#replacing-os-system

it looks like the code in the realistic example has a spurious '-' sign.
The line:

print("Child was terminated by signal", -retcode, file=sys.stderr)

shouldn't have the minus sign negating the retcode:

print("Child was terminated by signal", retcode, file=sys.stderr)

Full code in the example:

try:
retcode = call("mycmd" + " myarg", shell=True)
if retcode < 0:
print("Child was terminated by signal", -retcode, file=sys.stderr)
else:
print("Child returned", retcode, file=sys.stderr)
except OSError as e:
print("Execution failed:", e, file=sys.stderr)

should be:

try:
retcode = call("mycmd" + " myarg", shell=True)
if retcode < 0:
print("Child was terminated by signal", retcode, file=sys.stderr)
else:
print("Child returned", retcode, file=sys.stderr)
except OSError as e:
print("Execution failed:", e, file=sys.stderr)

Thanks, and apologies if I erred somewhere in this report.

--
assignee: docs@python
components: Documentation
messages: 266614
nosy: Ben Kane, docs@python
priority: normal
severity: normal
status: open
title: '-' sign typo in example
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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Interesting.

How it works with continue?

for x in a:
if x: continue
f()

In this case we can use new FOR_ITER instead of JUMP_ABSOLUTE. I would rename 
FOR_ITER to something more appropriate (maybe containing NEXT or CONTINUE).

How it works with continue in the try block?

for x in a:
try:
if x: continue
f()
except Error:
e()

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27155] '-' sign typo in example

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

A negative return code generally means an error occurred. Negating retcode here 
is equivalent to abs(retcode), which shows you want a positive integer to 
appear in the message - it's not an error.

Could replace '-retcode' with 'abs(retcode)' to be more clear. Possibly also 
add a comment in the code example body to further clarify this.

--
nosy: +ebarry

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Currently it'll work since in an except it'll generate a CONTINUE_LOOP that'll 
jump to the end of the loop & either jump back to the start or to the end

Your example is incorrect. If the continue's JUMP_ABS were a FOR_ITER then if 
we were on the last iteration of the loop we would end up executing the loop 
body with an invalid stack. So you'd have to follow the FOR_ITER with a 
JUMP_ABS past the loop. Not sure if there's a speed advantage worth 
complexity/larger wordcode

--

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ah, sorry. You are right.

Do you have any microbenchmarks that shows the benefit?

--
stage:  -> patch review

___
Python tracker 

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



[issue27149] Implement socket.sendmsg() for Windows

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Would you like to propose a patch?

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Why a mixin?

(As an aside, there is a proposal to move all assert methods to a place where 
they can be accessed outside test cases.)

--

___
Python tracker 

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



[issue27149] Implement socket.sendmsg() for Windows

2016-05-29 Thread Марк Коренберг

Марк Коренберг added the comment:

No, I hate Windows, Winapi and so on.

But I have problems in patching asyncio 
https://github.com/python/asyncio/pull/339

Since greate optimisation may be acheived using sendmsg()

--

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Pretty small perf increase:

timeit("for a in range(256):pass", number=10)
Without patch: ~2.1
With patch: ~1.84

pybench is 1-2% faster. Would prefer others' results. Especially a benchmark 
where it doesn't wrap payloads in for loops

--

___
Python tracker 

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



[issue27153] Default value shown by argparse.ArgumentDefaultsHelpFormatter is backwards for action='store_false'

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

The message is correct.  The default value of foo is True.  It would be just as 
misleading to say default: False, since that would imply the default value of 
foo was false.  It also makes no sense to think it would mean the default value 
of 'no-foo' is False.

Instead, if you want to use ArgumentDefaultsHelpFormatter instead of 
controlling when defaults are displayed, change your help string to read 
something like: "Set foo to False".

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Microbenchmark of continue regression: timeit("for a in range(256):\n\tif 
a:continue",number=10)
Without patch: ~3.57
With patch: ~3.64

--

___
Python tracker 

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



[issue27151] multiprocessing.Process leaves read pipes open (Process.sentinel)

2016-05-29 Thread Марк Коренберг

Changes by Марк Коренберг :


--
nosy: +mmarkk

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you for your review David. Updated patch addresses your doc comments.

As for bool calls, I think there are reasons to do this.

--
Added file: http://bugs.python.org/file43050/smtpd_decode_data_false_doc2.patch

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Addressed other David's comment.

--
Added file: http://bugs.python.org/file43051/smtpd_decode_data_false_doc3.patch

___
Python tracker 

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



[issue27152] Additional assert methods for unittest

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I have this proposal (issue19645) in mind. We can add these method just in 
TestCase.

In any case I'm going to add the ExtraAssertions mixin in test.support in 
maintained versions to help keeping branches in sync.

--

___
Python tracker 

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



[issue27156] IDLE: remove unused code

2016-05-29 Thread Terry J. Reedy

New submission from Terry J. Reedy:

With 3.6 not bound by compatibility with external imports, dead code can go.  
It is an annoying distraction.  The resource saved is space in package and 
module content listings and maintainer time and attention.  

1. module idlever.py.  It is obsolete at least since 2.6 and deprecated in 
2.7.11 and 3.4.4+ in #24199.  If  IDLE is ever separately versioned again, 
idlever should be an attribute in idlelib.__init__.

2. file help.txt and its dedicated viewer editor.HelpDialog.  help.txt is 
out-of-date and not maintained, as it was replaced years ago by 
Docs/library/idle.rst.  Since Fall 2015, IDLE uses help.py to display help.html 
with formatting and index. See #16893.

3. stackviewer.StackBrowser.keys.  I removed this trivial and no-longer used 
method in #24790, and then restored it in the face of an objection and the lack 
of overt criteria for such removals.  I expect the class to get far more 
drastic changes than this.

Note: 'unused' is determined by grepping the name in consideration in 
.../idlelib/*.py, where ... == /Lib.  IDLE => Edit => Find in 
Files, Alt-F3.

--
assignee: terry.reedy
messages: 266629
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: remove unused code
type: resource usage
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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Any chance you could bisect to figure out which changeset caused the problem?  
I'm surprised that something like this would happen, we aren't in general 
making changes at that level to python2 any more.

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Summer heat is getting to me. Please ignore this issue until I've uploaded a 
fixed patch

--

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread Alexey Borzenkov

Alexey Borzenkov added the comment:

Didn't need to bisect, it's very easy to find the problematic commit, since 
writelines doesn't change that often:

https://hg.python.org/releases/2.7.11/rev/db842f730432

The old code was buggy in a sense that it always called PyObject_AsCharBuffer 
due to the way the condition is structured, but this bugginess was what allowed 
it to work correctly with unicode objects. After the commit unicode objects are 
treated like any other buffer, and that's why internal UCS2 or UCS4 
representation gets written to the file.

--

___
Python tracker 

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



[issue27155] '-' sign typo in example

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

The negative return code indicates the child was terminated by a signal, 
exactly as the example error message says.  The signal number is the positive 
value of the return code.  It makes more sense to negate it than it does to 
call abs, since we *know* it is negative.

IMO the example is correct as written.

--
nosy: +r.david.murray
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Oh, I forgot to say that the revisions look good to me.

--

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

What reasons?  It's not a big deal, but like I say it isn't our normal style.

--

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Thanks.

--
nosy: +pitrou

___
Python tracker 

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



[issue21350] bug in file.writelines accepting buffers

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Unfortunately this caused a regression in unicode handling.  See issue 27154.

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since these arguments are saved for multiple testing, it is worth to ensure 
that every test returns consistent result. For public attribute there is 
additional benefit, it looks as boolean.

--

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9abde519cc1e by Serhiy Storchaka in branch 'default':
Improved docs for issue27033. Based on comments by R. David Murray.
https://hg.python.org/cpython/rev/9abde519cc1e

--

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Python uses duck typing, though.  Maybe someone is depending on those public 
attributes not getting coerced to boolean.  Probably not, granted, since they 
are newish, but a python programmer might expect the value to get passed 
through.  I'm of two minds about the advisability of that, but given that 
someone *could* be depending on it, I think it would be better to not do the 
bool call, since there is no bug fixed by doing the bool call, making it an 
unnecessary change in behavior.

--

___
Python tracker 

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



[issue27033] Change the decode_data default in smtpd to False

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 71813a05e488 by Serhiy Storchaka in branch 'default':
Issue #27033: Removed unnecessary the bool calls.
https://hg.python.org/cpython/rev/71813a05e488

--

___
Python tracker 

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



[issue27154] Regression in file.writelines behavior

2016-05-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue5252] 2to3 should detect and delete import of removed statvfs module

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Closing based on Benjamin's comments.

--
nosy: +r.david.murray
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue10908] Improvements to trace._Ignore

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

SilentGhost: I don't see any discussion leading to closure here.  Did you just 
give up on getting a review, or was the rejection discussed somewhere else?  
Since you have 10896 marked as being superceded by this, I'd like to know what 
you think we should do to resolve that issue, if you are still interested.

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



[issue27157] Unhelpful error message when one calls a subclass of type

2016-05-29 Thread ppperry

New submission from ppperry:

>>>class x(type):pass
>>> x(x)
Traceback (most recent call last):
  File "", line 1, in 
x(x)
TypeError: type() takes 1 or 3 arguments

I am giving it one argument, and yet it's complaining that `type` expects one 
or three arguments. How unhelpful.

--
components: Interpreter Core
messages: 266643
nosy: ppperry
priority: normal
severity: normal
status: open
title: Unhelpful error message when one calls a subclass of type
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue27158] `isnstance` builtin does not handle types that are their own type

2016-05-29 Thread ppperry

Changes by ppperry :


--
type:  -> behavior

___
Python tracker 

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



[issue27158] `isnstance` function does not handle types that are their own type

2016-05-29 Thread ppperry

Changes by ppperry :


--
title: `isnstance` builtin does not handle types that are their own type -> 
`isnstance` function does not handle types that are their own type

___
Python tracker 

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



[issue27158] `isnstance` builtin does not handle types that are their own type

2016-05-29 Thread ppperry

New submission from ppperry:

If one executes the following statements:

>>> class metatype(type):pass
>>> class x(type,metaclass=metatype):pass
>>> x.__class__ = x

, one gets a type that is it's own type: (`type(x) is x`). However, 
`isinstance(x,x)` unexpectedly returns False. How is my `x` type not an 
instance of itself.

--
components: Interpreter Core
messages: 266644
nosy: ppperry
priority: normal
severity: normal
status: open
title: `isnstance` builtin does not handle types that are their own type
versions: Python 3.4

___
Python tracker 

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



[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread ppperry

Changes by ppperry :


--
title: `isnstance` function does not handle types that are their own type -> 
`isinstance` function does not handle types that are their own type

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

Works for me:

>>> class X(type): pass
...
>>> X(X)


--
nosy: +ebarry
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

Works for me:

>>> class meta(type): pass
...
>>> class X(type, metaclass=meta): pass
...
>>> X.__class__ = X
>>> type(X) is X
True
>>> isinstance(X, X)
True

--
nosy: +ebarry
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

This seems as though you might be using an older version of the interpreter (I 
tested in 3.4.3, 3.5.1 and 3.6.0a1+). Where did you get your interpreter? The 
official releases are on https://www.python.org/downloads/ - if you got it 
somewhere else, that might be something for whoever packaged your installer to 
fix.

--

___
Python tracker 

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



[issue27158] `isinstance` function does not handle types that are their own type

2016-05-29 Thread ppperry

ppperry added the comment:

Never mind this issue, I was confused when reporting.

--

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread ppperry

ppperry added the comment:

This issue only happens when the type in question has a custom metaclass:

>>> class meta(type):pass
>>> class X(type,metaclass=meta):pass
>>> X(X)
[Same unhelpful TypeError]

--
resolution: works for me -> 
status: closed -> open
title: Unhelpful error message when one calls a subclass of type -> Unhelpful 
error message when one calls a subclass of type with a custom metaclass

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread ppperry

ppperry added the comment:

Also happens on 2.7, although you have to declare the metaclass using  
`__metaclass__ = meta` instead.

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

In Objects/typeobject.c#L2290, the code checks that the (meta?)class is exactly 
`type` and that there's one argument, then returns `Py_TYPE(x)`. Subclasses of 
`type` allowing a single argument is a side-effect of not overriding __new__, 
not a documented feature.

Changing the call from `PyType_CheckExact` to `PyType_Check` makes it work, but 
I'm assuming there may be something I didn't think of. Or maybe there isn't, 
but either way, I don't consider that this is worth fixing -- if you want to 
call your subclass with only one argument, override __new__ and do the logic in 
there. And if you want the type of an object, use type directly.

Also, there may be performance concerns here. `type` is heavily optimized in 
many places; I thought that `PyType_Check` called Python code, but after 
checking the macro definitions and testing a bit, it turns out I'm wrong. But 
if there *is* a negative performance impact, this probably can't go in -- this 
check runs everytime that type() is called, no matter how many arguments, and 
including in class creation; that's also probably why `PyType_CheckExact` was 
chosen to begin with.

--

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls an instance of a subclass of type

2016-05-29 Thread ppperry

ppperry added the comment:

Further testing reveals that this issue has nothing to do with metaclasses:

>>>class X(type):pass
>>>X()(X)

raises the same TypeError.
Even if the possibly dubious feature of being able to call instances of 
subclasses of type with one argument is rejected, the error message should 
definitely be improved. It is ridiculously unhelpful.

--
title: Unhelpful error message when one calls a subclass of type with a custom 
metaclass -> Unhelpful error message when one calls an instance of a subclass 
of type

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread ppperry

ppperry added the comment:

Ignore the first part of my previous comment; I improperly tested that.

--
title: Unhelpful error message when one calls an instance of a subclass of type 
-> Unhelpful error message when one calls a subclass of type with a custom 
metaclass

___
Python tracker 

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



[issue27043] Describe what ‘inspect.cleandoc’ does to synopsis line.

2016-05-29 Thread R. David Murray

Changes by R. David Murray :


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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Emanuel Barry

Emanuel Barry added the comment:

Yes, that would be preferable. The error message is at 
Objects/typeobject.c#l2301, but keep in mind that this message is shown for 
both faulty calls to type() as well as any of its subclasses that don't 
override __new__, and I'm lukewarm on adding e.g. a PyType_Check call before 
that; might as well replace the PyType_CheckExact call and make this work. I'm 
not knowledgeable enough in that field though, you'll need a core dev's advice.

--
stage: resolved -> 

___
Python tracker 

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



[issue18478] Class bodies: when does a name become local?

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

As far as I can see this has been fixed by explaining the special rules for 
class definitions at the end of the section.  Do you think there is anything 
left to do here, Terry?  Perhaps a 2.7 backport of some of the clarifications?

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



[issue24647] Document argparse.REMAINDER as being equal to "..."

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

I would say nargs='...' is borderline...it's meaning is *fairly* intuitive, but 
unlike the other three it does not, as paul.j3 points out, have a regex (or 
shell) counterpart.

I think we should respect the original author's decision in this case and leave 
well enough alone.

--
nosy: +r.david.murray
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27127] Never have GET_ITER not followed by FOR_ITER

2016-05-29 Thread Demur Rumed

Demur Rumed added the comment:

Two issues:

One: `a = (i for i in 6)` does not throw until calling next(a). This applies to 
the first patch. If it's unacceptable to defer the throw then this whole issue 
should be closed unless there's interest in having a GET_ITER, FOR_ITER, 
FOR_BEGIN, FOR_NEXT set of opcodes between comprehensions & for loops. That 
seems excessive

Two: tracing is getting a bit confused by FOR_ITER being at the end of the loop 
body. The clearest example is that in test_pdb's 
test_pdb_until_command_generator it needs 3 steps instead of 2 to trace 
`print(i)` after the 'until 4' because whereas currently it traces the `for i 
in test_gen()` before calling into the iterator, it now calls into the iterator 
first & traces `for i in test_gen()` only after returning. Additionally it 
doesn't trace `for i in test_gen()` at the end of iteration, instead tracing 
the last line

It seems fragile to try fix this up by having the FOR_ITER tail receive a 
negative lnotab line offset to place it on the same line as the loop heading. 
My own research of the code base has been trying to determine if I can manually 
emit a trace in the FOR_ITER opcode, but I'd rather not muck with the frame to 
carry out this façade

--

___
Python tracker 

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



[issue26589] Add HTTP Response code 451

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Looks good to me.

--
nosy: +r.david.murray
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



[issue18478] Class bodies: when does a name become local?

2016-05-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The new language *and* organization introduced sometime during 3.4 is good 
enough for me. " with an exception that unbound local variables are looked up 
in the global namespace." covers my example. Thanks for the pointer.

--
resolution:  -> out of date
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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I am unable to replicate this in Python 2.7, 3.3 or 3.6. I haven't bothered to 
test against other versions, because I think that this is a PyShell issue, not 
a Python issue. (I think you are using PyShell, based on the traceback given.)

Before reporting bugs in the interpreter, please test using the vanilla Python 
interactive interpreter, and not in an enhanced shell or IDE (iPython, PyShell, 
Spyder, etc).

I'm closing the task, please don't re-open unless you can demonstrate the issue 
in the plain Python interpreter. But please do report it to the PyShell 
maintainers.

--
nosy: +steven.daprano
resolution:  -> works for me
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread ppperry

ppperry added the comment:

steven.daprano, you don't appear to have properly read the issue comments. I 
originally underspecified the conditions necessary to reproduce this, producing 
Emanuel Barry's closure. I then added a proper reproducer in the third comment, 
which does work in the vanilla python interpreter.

--
resolution: works for me -> 
status: closed -> open

___
Python tracker 

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



[issue26667] Update importlib to accept pathlib.Path objects

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

Brett, is this made obsolete by PEP 519, or is its implementation informed by 
that PEP?

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread R. David Murray

R. David Murray added the comment:

When I hit this recently I assumed that that error message meant I'd screwed up 
the metaclass definition.  But if there's a way to improve the error message 
that would be great.

I'll add this to the list of bugs I'm making for the sprints, perhaps one of 
the sprinters can convince a knowlegable core dev to look at it and render an 
opinion :)

--
nosy: +r.david.murray
stage: resolved -> 

___
Python tracker 

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



[issue27113] sqlite3 connect parameter "check_same_thread" not documented

2016-05-29 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Thank you for the patch, Dave.

Following the language style of rest of the docs, check_same_thread, should be 
explained in a passive voice.

Also, mentioning the version requirement at this place, does not seem suitable 
to me. When we provide this feature, it assumed that the underlying sqlite 
linked has the support for it.

Also, (3.3.1 alpha) of sqlite was released in 2006-01-16 
Database connections can now be used by multiple threads, not just the thread 
in which they were created.

Here is a modified patch which captures the main idea from your patch. Please 
review this and share your suggestions.

--
nosy: +orsenthil
Added file: http://bugs.python.org/file43052/issue27113-rev1.patch

___
Python tracker 

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



[issue26589] Add HTTP Response code 451

2016-05-29 Thread Martin Panter

Martin Panter added the comment:

It seems like this code does get used, so I agree to add it.

I think the table in the RST documentation should also be updated, possibly 
with a versionadded/versionchanged notice.

--
nosy: +martin.panter

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Steven D'Aprano

Steven D'Aprano added the comment:

On Mon, May 30, 2016 at 01:43:22AM +, ppperry wrote:
> steven.daprano, you don't appear to have properly read the issue 
> comments.

Ack; I saw your comment about the metaclass, then saw your retraction 
of the metaclass issue, then misinterpreted your retraction of the 
retraction.

--

___
Python tracker 

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



[issue26526] In parsermodule.c, replace over 2KLOC of hand-crafted validation code, with a DFA

2016-05-29 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
nosy: +giampaolo.rodola

___
Python tracker 

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



[issue27157] Unhelpful error message when one calls a subclass of type with a custom metaclass

2016-05-29 Thread Eryk Sun

Eryk Sun added the comment:

All types are instances of `type`, so the single argument case makes sense to 
me as a 'constructor'. It always returns an instance of `type`, just not a new 
instance. 

>>> X = type('X', (type,), {})
>>> type(X)

>>> isinstance(type(X), type)
True

OTOH, implementing this for subclasses of `type` doesn't generally make sense 
to me. That this is allowed (sometimes) is I think a mistake:

>>> X(X)

>>> isinstance(X(X), X)
False

PyType_CheckExact(metatype) isn't checking that metatype is `type`. It's 
checking that the type of metatype is exactly `type`, which is true for `type` 
and immediate instances of type, i.e. normal metaclasses. But it's not the case 
for a metaclass that's an instance of another metaclass:

>>> Y = X('Y', (X,), {})
>>> Y(Y)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type() takes 1 or 3 arguments

Maybe I'm missing something, but it makes more sense to me if metatype is 
required to be *exactly* `type`, i.e. metatype == &PyType_Type, and that this 
check is used to gate the entire special case:

/* Special case: type(x) should return x->ob_type */
if (metatype == &PyType_Type) {
const Py_ssize_t nargs = PyTuple_GET_SIZE(args);
const Py_ssize_t nkwds = kwds == NULL ? 0 : PyDict_Size(kwds);

if (nargs == 1 && nkwds == 0) {
PyObject *x = PyTuple_GET_ITEM(args, 0);
Py_INCREF(Py_TYPE(x));
return (PyObject *) Py_TYPE(x);
}

/* SF bug 475327 -- if that didn't trigger, we need 3
   arguments. but PyArg_ParseTupleAndKeywords below may give
   a msg saying type() needs exactly 3. */
if (nargs + nkwds != 3) {
PyErr_SetString(PyExc_TypeError,
"type() takes 1 or 3 arguments");
return NULL;
}
}

This change yields the following behavior:

>>> X = type('X', (type,), {})

>>> type(X)


>>> type(1, 2)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type() takes 1 or 3 arguments

>>> X()
Traceback (most recent call last):
  File "", line 1, in 
TypeError: Required argument 'name' (pos 1) not found

>>> X(X)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: type() argument 1 must be str, not type

--
nosy: +eryksun

___
Python tracker 

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



[issue27125] Typo in Python 2 multiprocessing documentation

2016-05-29 Thread Martin Panter

Martin Panter added the comment:

Indeed it is duplicated! I must have read this in my head many times before 
pushing it, and never picked it up.

--

___
Python tracker 

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



[issue27043] Describe what ‘inspect.cleandoc’ does to synopsis line.

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c1eb32e183fd by Senthil Kumaran in branch '3.5':
issue27043 - Explain the inspect.cleandoc behavior on synopsis line and other 
lines.
https://hg.python.org/cpython/rev/c1eb32e183fd

New changeset 4d5a5d4e731d by Senthil Kumaran in branch 'default':
[merge from 3.5] issue27043 - Explain the inspect.cleandoc behavior on synopsis 
line and other lines.
https://hg.python.org/cpython/rev/4d5a5d4e731d

--
nosy: +python-dev

___
Python tracker 

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



[issue27043] Describe what ‘inspect.cleandoc’ does to synopsis line.

2016-05-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8f841baa0e06 by Senthil Kumaran in branch '2.7':
issue27043 - Explain the inspect.cleandoc behavior on synopsis line and other 
lines.
https://hg.python.org/cpython/rev/8f841baa0e06

--

___
Python tracker 

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



  1   2   >