[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

I've updated the PEP with some more permissive language, mentioning Knuth's 
recommendation but allowing the old style because it's been recommended (and 
followed, and enforced) for decades. I've intentionally not updated other 
examples in the PEP to follow suit.

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

> Changing indentation level based on operator precedence is acceptable?

I think that's a matter of personal taste and I don't think the PEP needs to 
have an opinion on it.

--

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2016-04-15 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


--
nosy:  -Ivan.Pozdeev

___
Python tracker 

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



[issue26716] EINTR handling in fcntl

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 2:

* add a comment to explain the C loop retrying on EINTR error
* add an unit test: I checked that the test fails with InterruptedError without 
the fix
* document the change in fcntl documentation

--
Added file: http://bugs.python.org/file42474/fcntl_eintr-2.patch

___
Python tracker 

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



[issue26771] python-config.sh.in INCDIR does not match python version if exec_prefix != prefix

2016-04-15 Thread Benjamin Berg

New submission from Benjamin Berg:

The script contains:

INCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"
PLATINCDIR="-I$includedir/python${VERSION}${ABIFLAGS}"


But looking at the sysconfig module we have:
'include':
'{installed_base}/include/python{py_version_short}{abiflags}',
'platinclude':
'{installed_platbase}/include/python{py_version_short}{abiflags}',

which resolves from:
_CONFIG_VARS['installed_base'] = _BASE_PREFIX
_CONFIG_VARS['platbase'] = _EXEC_PREFIX

So one is based on prefix, and the other on exec_prefix. I am actually not sure 
right now how I could properly reconcile these in the shell script version, but 
if I simply patch the makefile to install the python version, then everything 
works fine.

--
components: Cross-Build
messages: 263505
nosy: Alex.Willmer, benzea
priority: normal
severity: normal
status: open
title: python-config.sh.in INCDIR does not match python version if exec_prefix 
!= prefix
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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Berker Peksag

Berker Peksag added the comment:

Please don't create a pull request on GitHub (python/peps is read-only). 
Attaching wrap-before-binary-operator.patch is enough.

--
nosy: +berker.peksag
stage:  -> patch review

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

I don't like the way "):" is indented in that example. I propose:

if ((width == 0
 and height == 0
 and color == 'red'
 and emphasis == 'strong')
or highlight > 100):

Aren't there many other examples in the PEP that need to be adjusted, since 
we're changing the style not just for 'and' and 'or' but for all binary 
operators?

--

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

> LGTM, please commit.

Ok, done.

> Why the behavior is vary in release and debug builds?

See _PyBytesWriter_Alloc(): the code is designed to detect bugs earlier in 
debug mode, it only uses 10 bytes of the "small buffer" (buffer allocated on 
the stack) rather than the full size of the smaller buffer (512 bytes).

It looks like this hack helped to find a real bug :-)

--

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2016-04-15 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1eb586d5b321 by Victor Stinner in branch 'default':
Issue #26766: Fix _PyBytesWriter_Finish()
https://hg.python.org/cpython/rev/1eb586d5b321

--
nosy: +python-dev

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

@Berker: bytearray_mod.diff LGTM, you can push it.

--

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

Here is a fix for bytearray%args. As expected, it was a bug in the new 
_PyBytesWriter API (introduced in Python 3.6 to implementation optimizations).

--
Added file: http://bugs.python.org/file42473/writer_bytearray_mod.patch

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

I also think the PEP needs some language about the previous style being still 
acceptable as long as it's being used consistently (Knuth notwithstanding), and 
an acceptable compromise style where and/or go at the start of the line but 
other binary operators stay at the end.

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread INADA Naoki

INADA Naoki added the comment:

On Fri, Apr 15, 2016 at 11:31 PM, Guido van Rossum 
wrote:

>
> Guido van Rossum added the comment:
>
> I don't like the way "):" is indented in that example.

Me too.
I haven't know about this PEP8 update.
https://github.com/python/peps/commit/843b7d2cdb954dc0aa5ea70f140db2bd42943e1f

> I propose:
>
> if ((width == 0
>  and height == 0
>  and color == 'red'
>  and emphasis == 'strong')
> or highlight > 100):
>
>
Looks better to me.  But how about this?

if (width == 0
and height == 0
and color == 'red'
and emphasis == 'strong'
or highlight > 100):

Changing indentation level based on operator precedence is acceptable?

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread INADA Naoki

INADA Naoki added the comment:

How about recommend using parentheses to avoid different level operators have 
same indent level?

ok:
if (width == 0
and height == 0
and color == 'red'
and emphasis == 'strong'
or highlight > 100
):
...

better:
if ((width == 0
 and height == 0
 and color == 'red'
 and emphasis == 'strong')
or highlight > 100
):

--

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM, please commit. Why the behavior is vary in release and debug builds?

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah

Stefan Krah added the comment:

Also, I don't understand how the test suite could pass with
these kinds of errors. Are you sure this is the Wind-River
system Python?  Did they run the test suite?

--

___
Python tracker 

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



[issue26772] regex.ENHANCEMATCH crashes interpreter

2016-04-15 Thread SilentGhost

SilentGhost added the comment:

regex module is not part of the standard library and issues with it should be 
reported on its bug tracker https://bitbucket.org/mrabarnett/mrab-regex

--
nosy: +SilentGhost
resolution:  -> third party
stage:  -> resolved
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

OK, maybe @chrisa can fix the typo.

--

___
Python tracker 

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



[issue26739] idle: Errno 10035 a non-blocking socket operation could not be completed immediately

2016-04-15 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Michael, when you open an issue, you need to stay nosy so we can ask questions. 
 This is especially true when the issue involved 3rd party modules, like 
pygame, and even more, when personal files, like the images, are required.  In 
this case:

0. Which patch release of 2.7 are you running?  If not 2.7.11, please upgrade 
and retry.  There was a patch for Error 10035 in March 19, 2013, which would be 
about the time of 2.7.6 or so.
https://hg.python.org/cpython/rev/8ec39bfd1f01 #9090

1.Does your program run correctly when you run it directly with python from the 
console, with "python pathto/Skier"?

2. Were you running it from the IDLE editor?  If so, does it fail immediately? 
or after the game runs a bit?  Does it seem to always fail in exactly the same 
way, at the same time?

[A 'socket' is a class abstraction used to communicate between different 
processes.  It is usually used for processes on different machines, as with the 
browser process on your machine and a server process on another machine, but 
can be used for two processes on the same machine.]

--
This appears to be a socket issue, not an IDLE issue as such, just as #25332 
was not a urllib issue.  This is the 10th issue found searching the tracker for 
'Error 10035', but the first, I think, involving IDLE.  I know essentially 
nothing about the subject.

--
nosy: +MICHAEL JACOBSON, terry.reedy

___
Python tracker 

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



[issue26760] Document PyFrameObject

2016-04-15 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
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



[issue26744] print() function hangs on MS-Windows 10

2016-04-15 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue26773] Shelve works inconsistently when carried over to child processes

2016-04-15 Thread SilentGhost

Changes by SilentGhost :


--
components: +Extension Modules
nosy: +jnoller, sbt

___
Python tracker 

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



[issue26760] Document PyFrameObject

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ba6f4f0fe9ea by Brett Cannon in branch '3.5':
Issue #26760: Minimally document PyFrameObject
https://hg.python.org/cpython/rev/ba6f4f0fe9ea

New changeset 5c18598382e9 by Brett Cannon in branch 'default':
Merge for issue #26760
https://hg.python.org/cpython/rev/5c18598382e9

--
nosy: +python-dev

___
Python tracker 

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



[issue26773] Shelve works inconsistently when carried over to child processes

2016-04-15 Thread Paul Ellenbogen

New submission from Paul Ellenbogen:

If a shelve is opened, then the processed forked, sometime the shelve will 
appear to work in the child, and other times it will throw a KeyError. I 
suspect the order of element access may trigger the issue. I have included a 
python script that will exhibit the error. It may need to be run a few times.

If shelve is not meant to be inherited by the child process in this way, it 
should consistently throw an error (probably not a KeyError) on any use, 
including the first. This way it can be caught in the child, and the shelve can 
potentially be reopened in the child.

A current workaround is to find all places where a process may fork, and reopen 
any shelves in the child process after the fork. This may work for most smaller 
scripts. This could become tedious in more complex applications that fork in 
multiple places and open shelves in multiple places.

---

Running

#!/usr/bin/env python3

import multiprocessing
import platform
import sys

print(sys.version)
print(multiprocessing.cpu_count())
print(platform.platform())


outputs:
3.4.3+ (default, Oct 14 2015, 16:03:50) 
[GCC 5.2.1 20151010]
8
Linux-4.2.0-34-generic-x86_64-with-Ubuntu-15.10-wily

--
components: Interpreter Core
files: shelve_process.py
messages: 263522
nosy: Paul Ellenbogen
priority: normal
severity: normal
status: open
title: Shelve works inconsistently when carried over to child processes
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file42475/shelve_process.py

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Ian Lee

Ian Lee added the comment:

> Aren't there many other examples in the PEP that need to be adjusted, since 
> we're changing the style not just for 'and' and 'or' but for all binary 
> operators?

Admittedly I'd only looked in that one section last night, but I just went 
through the PEP and didn't see any other when I just went through the entire 
PEP now...

> I also think the PEP needs some language about the previous style being still 
> acceptable as long as it's being used consistently (Knuth notwithstanding), 
> and an acceptable compromise style where and/or go at the start of the line 
> but other binary operators stay at the end.

I'd updated my branch on GitHub [1] but Guido, you beat me to the update while 
I was typing this message!

> I don't like the way "):" is indented in that example.

Honestly I don't either, I just like it more than artificially pushing the 
other lines forward a space. Personally, I'm not a fan of the current change 
either which puts the raise in line with the condition logic for the `if`::

if (width == 0
and height == 0
and color == 'red'
and emphasis == 'strong'
or highlight > 100):
raise ValueError("sorry, you lose")


My preference is to actually break that logic up and avoid the wrapping in the 
first place, as in [2]. Which in this particular class has the side benefit of 
that value being used again in the same function anyways.

I'm starting to realize that Brandon Rhodes really had a big impact on my ideas 
of styling as I've been learning Python these past few years, as this was 
another one style I'm stealing from that same talk [3].

> I've updated the PEP...

Great, thanks! I've created a ticket in pycodestyle [4] to update the style 
checker, which in turn will fix the flake8 error downstream once I get around 
(hopefully before PyCon) to releasing pycodestyle 1.8.0

[1] https://github.com/python/peps/compare/master...IanLee1521:issue26763
[2] 
https://github.com/python/peps/commit/0c790e7b721bd13ad12ab9e6f6206836f398f9c4
[3] 
http://rhodesmill.org/brandon/slides/2012-11-pyconca/#naming-intermediate-values
[4] https://github.com/PyCQA/pycodestyle/issues/498

--

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 257dd57dd732 by Brett Cannon in branch '3.5':
Issue #25609: Backport typing.ContextManager.
https://hg.python.org/cpython/rev/257dd57dd732

New changeset 14cf0011c5e9 by Brett Cannon in branch 'default':
Merge for issue #25609
https://hg.python.org/cpython/rev/14cf0011c5e9

--

___
Python tracker 

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



[issue26772] regex.ENHANCEMATCH crashes interpreter

2016-04-15 Thread Rex Dwyer

New submission from Rex Dwyer:

regex.findall(r'((brown)|(lazy)){1<=e<=3} ((dog)|(fox)){1<=e<=3}',
  'The quick borwn fax jumped over the lzy hog',
  regex.ENHANCEMATCH)

crashes interpreter.

regex.__version__ =>  2.4.85

python version
'3.4.2 (v3.4.2:ab2c023a9432, Oct  6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)]'

--
components: Regular Expressions
messages: 263515
nosy: Rex Dwyer, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: regex.ENHANCEMATCH crashes interpreter
type: crash

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Raghu

Raghu added the comment:

Hey Guys/Gals, are you still debugging the issue? Do you need more info?

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Guido van Rossum

Guido van Rossum added the comment:

I propose to keep the somewhat questionable examples in the PEP as an
illustration of the idea that style is debatable and cannot be reduced to
fixed rules.

--

___
Python tracker 

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



[issue26716] EINTR handling in fcntl

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Left nitpicks about tests.

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Barry A. Warsaw

Changes by Barry A. Warsaw :


--
nosy: +barry

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah

Stefan Krah added the comment:

An option would be to use the support of the probably commercial

  http://www.windriver.com/products/linux/

and ask them why they're still on Python 2.7.3.  They'll also
have gcc installed and can run the test case proposed in this
issue.

--
nosy: +skrah

___
Python tracker 

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



[issue25609] Add a ContextManager ABC and type

2016-04-15 Thread Brett Cannon

Changes by Brett Cannon :


--
status: open -> closed

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Martín Gaitán

Martín Gaitán added the comment:

There is a typo on "reseach" instead of "research"

--
nosy: +Martín Gaitán

___
Python tracker 

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



[issue26769] Python 2.7: make private file descriptors non inheritable

2016-04-15 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue26535] Minor typo in the docs for struct.unpack

2016-04-15 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



[issue25314] Documentation: argparse's actions store_{true, false} default to False/True (undocumented)

2016-04-15 Thread Martin Panter

Changes by Martin Panter :


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



[issue26774] Elide Py_atomic fences when WITH_THREAD is disabled?

2016-04-15 Thread Larry Hastings

New submission from Larry Hastings:

Right now the atomic access fence macros in pyatomic.h are unconditional.  This 
means that they're active even even when you "./configure --without-threads".  
If Python thread support is disabled, surely we don't need to ensure atomic 
access to variables, because there aren't any other threads to compete with.

Shouldn't we add

#ifdef WITH_THREAD
/* current code goes here */
#else
#define _Py_atomic_load_relaxed(x) (x)
/* etc */
#endif

?

--
messages: 263537
nosy: haypo, jyasskin, larry
priority: low
severity: normal
stage: test needed
status: open
title: Elide Py_atomic fences when WITH_THREAD is disabled?
type: performance
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



[issue26769] Python 2.7: make private file descriptors non inheritable

2016-04-15 Thread Martin Panter

Martin Panter added the comment:

It looks like some of these do make the file descriptor accessible to the 
Python user. The following are from the RST documentation:

oss_audio_device.fileno()
oss_mixer_device.fileno()
epoll.fileno()
kqueue.fileno()
audio device.fileno()

I did not find any documentation for the “linuxaudiodev” module, but it also 
seems to supply a public fileno() method:

$ sudo modprobe snd-pcm-oss
$ python2
Python 2.7.11 (default, Dec  6 2015, 15:43:46) 
[GCC 5.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import linuxaudiodev
>>> a = linuxaudiodev.open("w")
>>> a.fileno()
3

Unless there is demand for making these cases non-inheritable, it might be 
safest to leave them be. However it looks like the mmap file descriptor could 
be internal (though I’m not an expert on that module to be sure). So you might 
be okay with the mmap change.

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Chris Angelico

Chris Angelico added the comment:

Typo fixed in peps repo.

--

___
Python tracker 

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



[issue26535] Minor typo in the docs for struct.unpack

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7889fcb0697b by Martin Panter in branch '3.5':
Issue #26535: Correct docs regarding the struct buffer size
https://hg.python.org/cpython/rev/7889fcb0697b

New changeset 39dc2f39373d by Martin Panter in branch 'default':
Issue #26535: Merge struct doc from 3.5
https://hg.python.org/cpython/rev/39dc2f39373d

--
nosy: +python-dev

___
Python tracker 

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



[issue25702] Link Time Optimizations support for GCC and CLANG

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f16ec63055ad by Gregory P. Smith in branch '3.5':
Issue #25702: A --with-lto configure option has been added that will
https://hg.python.org/cpython/rev/f16ec63055ad

New changeset 3103af76f4c4 by Gregory P. Smith in branch 'default':
Issue #25702: A --with-lto configure option has been added that will
https://hg.python.org/cpython/rev/3103af76f4c4

--
nosy: +python-dev

___
Python tracker 

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



[issue26657] Directory traversal with http.server and SimpleHTTPServer on windows

2016-04-15 Thread Martin Panter

Martin Panter added the comment:

I will try to commit my patch in a couple days if there are no objections.

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



[issue25314] Documentation: argparse's actions store_{true, false} default to False/True (undocumented)

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c42a9233af04 by Martin Panter in branch '2.7':
Issue #25314: Remove confused statement about const argument
https://hg.python.org/cpython/rev/c42a9233af04

New changeset 59b8db278e3c by Martin Panter in branch '3.5':
Issue #25314: Remove confused statement about const argument
https://hg.python.org/cpython/rev/59b8db278e3c

New changeset 7d61a991f405 by Martin Panter in branch 'default':
Issue #25314: Merge argparse doc from 3.5
https://hg.python.org/cpython/rev/7d61a991f405

--

___
Python tracker 

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



[issue25702] Link Time Optimizations support for GCC and CLANG

2016-04-15 Thread Gregory P. Smith

Gregory P. Smith added the comment:

What i committed for 3.5 and 3.6 matches lto-cpython3-v04.patch which just adds 
--with-lto support.  2.7 still needs to be patched.

For reference: Using ubuntu's gcc 5.2.1 i was seeing a 2-3% performance 
increase in the resulting LTO binary vs a plain profile-opt PGO build.  That'll 
vary based on arch and compiler toolchain.

--
assignee:  -> gregory.p.smith

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

> The implementation is outdated: ma_version was renamed to ma_version_tag in 
> the latest version of the PEP 509.

Patch version 7 is updated to the latest PEP (rebased and rename ma_version to 
ma_version_tag).

--
Added file: http://bugs.python.org/file42476/dict_version-7.patch

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the reviews!

--
resolution:  -> fixed
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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Raghu

Raghu added the comment:

Yes, it is a WindRiver linux. I will check if Commercial WindRiver team can 
help me.

Host details:
Linux fpc0 3.10.62-ltsi-WR6.0.0.18_standard #1 SMP PREEMPT Sun Apr 3 23:17:02 
PDT 2016 ppc64 ppc64 ppc64 GNU/Linux



Also is there a protocol followed in this website? If I have done something 
wrong it's because I didn't know I was doing it incorrectly. I ask because, a 
new person replies everyday and they don't even completely tell me the solution 
or what conclusions they have made. I am lost.

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Stefan Krah

Stefan Krah added the comment:

My conclusion is:  The error in msg263292 should have been
caught by the test suite.

I'd ask the WindRiver support if they actually run the test suite
before shipping the binaries.

--

___
Python tracker 

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



[issue26743] Unable to import random with python2.7 on power pc based machine

2016-04-15 Thread Raghu

Raghu added the comment:

Thank you skrah. I raised a support request from WR. I will keep my fingers 
crossed.

--

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b3e3efc5afa4 by Berker Peksag in branch 'default':
Issue #26766: Remove redundant bytearray_format() from bytearrayobject.c
https://hg.python.org/cpython/rev/b3e3efc5afa4

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Chris Angelico

Changes by Chris Angelico :


--
nosy: +Rosuav

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Ian Lee

New submission from Ian Lee:

Following up from discussion on python-ideas [1] about updating PEP-8 regarding 
wrapping lines before rather than after binary operators.

--
files: wrap-before-binary-operator.patch
keywords: patch
messages: 263453
nosy: IanLee1521, gvanrossum
priority: normal
severity: normal
status: open
title: Update PEP-8 regarding binary operators
type: enhancement
Added file: http://bugs.python.org/file42463/wrap-before-binary-operator.patch

___
Python tracker 

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



[issue26535] Minor typo in the docs for struct.unpack

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
assignee: docs@python -> martin.panter
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



[issue26535] Minor typo in the docs for struct.unpack

2016-04-15 Thread Martin Panter

Martin Panter added the comment:

Indeed, let me try again

--
Added file: http://bugs.python.org/file42462/struct-size.v2.patch

___
Python tracker 

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



[issue26359] CPython build options for out-of-the box performance

2016-04-15 Thread Gregory P. Smith

Gregory P. Smith added the comment:

--with-optimizations seems fine.

As does having the final thing the Makefile prints out when run from a 
configuration that did not specify any of --with-pgo, --with-lto, 
--with-pydebug, or --with-optimizations be to echo message reminding people to 
configure --with-optimizations when making a release build.

The default "./configure && make" target needs to remain optimized for CPython 
developer speed.  Not release builds.

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Ian Lee

Ian Lee added the comment:

Discussion link missing from msg263453: 
https://mail.python.org/pipermail/python-ideas/2016-April/039774.html

--

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread Ian Lee

Ian Lee added the comment:

Link to GitHub branch with the patch as a commit [1].

[1] https://github.com/python/peps/compare/master...IanLee1521:issue26763

--

___
Python tracker 

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



[issue26765] Factor out common bytes and bytearray implementation

2016-04-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Proposed patch factors out the implementation of bytes and bytearray by moving 
common code in separate files. This is not new approach, the part of the code 
is already shared.

The patch decreases the size of the source code by 862 lines.

--
components: Interpreter Core
files: bytes_methods.patch
keywords: patch
messages: 263458
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Factor out common bytes and bytearray implementation
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42465/bytes_methods.patch

___
Python tracker 

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



[issue25654] test_multiprocessing_spawn ResourceWarning with -Werror

2016-04-15 Thread STINNER Victor

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



[issue19444] mmap.mmap() allocates a file descriptor that isn't CLOEXEC

2016-04-15 Thread Berker Peksag

Changes by Berker Peksag :


--
assignee: docs@python -> 
components:  -Documentation
versions:  -Python 3.3

___
Python tracker 

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



[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Berker Peksag

New submission from Berker Peksag:

I noticed this while looking at issue 26764.

bytearray_mod() and bytearray_format() both have checks for 
PyByteArray_Check(v). The check in bytearray_format() looks redundant to me.

Here is a patch.

--
components: Interpreter Core
files: bytearray_mod.diff
keywords: patch
messages: 263462
nosy: berker.peksag, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Redundant check in bytearray_mod
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file42466/bytearray_mod.diff

___
Python tracker 

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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

bytes_rmod.patch LGTM (maybe just a minor PEP 7 issue, see my review).

--
nosy: +haypo

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM. But there are other redundant code in _PyObject_GenericSetAttrWithDict(). 
Here is a patch that makes larger refactoring.

--
type:  -> enhancement
Added file: 
http://bugs.python.org/file42467/_PyObject_GenericSetAttrWithDict_2.patch

___
Python tracker 

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



[issue26762] test_multiprocessing_spawn leaves processes running in background

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

Using this patch, I can see the list of "python" processes slowly growing:

diff -r ad5b079565ad Lib/unittest/case.py
--- a/Lib/unittest/case.py  Tue Apr 12 23:15:44 2016 -0700
+++ b/Lib/unittest/case.py  Fri Apr 15 11:06:07 2016 +0200
@@ -10,6 +10,7 @@ import warnings
 import collections
 import contextlib
 import traceback
+import os
 
 from . import result
 from .util import (strclass, safe_repr, _count_diff_all_purpose,
@@ -590,6 +591,7 @@ class TestCase(object):
 expecting_failure = expecting_failure_class or expecting_failure_method
 outcome = _Outcome(result)
 try:
+os.system("ps")
 self._outcome = outcome
 
 with outcome.testPartExecutor(self):
@@ -614,6 +616,7 @@ class TestCase(object):
 self._addUnexpectedSuccess(result)
 else:
 result.addSuccess(self)
+os.system("ps")
 return result
 finally:
 result.stopTest(self)

--

___
Python tracker 

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



[issue26359] CPython build options for out-of-the box performance

2016-04-15 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

That sounds like a good idea and plan, to have everything enabled with just one 
dedicated configure flag.

I can work on this and post the patches as soon as they are done. 

Thank you

--

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-15 Thread Xiang Zhang

Xiang Zhang added the comment:

It's a better work. And the code looks simpler now. I test it with the test 
suite and none fails (though some tests are skipped due to platform).

--

___
Python tracker 

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



[issue26358] mmap.mmap.__iter__ is broken (yields bytes instead of ints)

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Iterating a slice produces ints too (a slice is just a bytes object).

>>> import mmap, sys
>>> with open(sys.executable, 'rb') as f:
... mm = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_READ)
... print(next(iter(mm)))
... print(next(iter(mm[:10])))
... 
b'\x7f'
127

Seems this module taken little love when migrated to 3.0.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26767] Inconsistant error messages for failed attribute modification

2016-04-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

>>> class I(int):
... @property
... def a(self): pass
... @property
... def b(self): pass
... @b.setter
... def b(self, value): pass
... @property
... def c(self): pass
... @c.deleter
... def c(self): pass
... 
>>> obj = I()
>>> del obj.numerator
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> del obj.to_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: to_bytes
>>> del obj.from_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: from_bytes
>>> del obj.a
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't delete attribute
>>> del obj.b
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't delete attribute
>>> del obj.y
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: y
>>> obj.numerator = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> obj.a = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't set attribute
>>> obj.c = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: can't set attribute
>>> 
>>> obj = 1
>>> del obj.numerator
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> del obj.to_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'to_bytes' is read-only
>>> del obj.from_bytes
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'from_bytes' is read-only
>>> del obj.y
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object has no attribute 'y'
>>> obj.numerator = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: attribute 'numerator' of 'int' objects is not writable
>>> obj.to_bytes = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'to_bytes' is read-only
>>> obj.from_bytes = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object attribute 'from_bytes' is read-only
>>> obj.y = 1
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'int' object has no attribute 'y'

Different error messages are used in errors when try to modify non-existing or 
read-only attribute. This depends on the existing __dict__ and the way how the 
attribute is resolved.

* just the attribute name
* "'%.50s' object has no attribute '%U'"
* "'%.50s' object attribute '%U' is read-only"
* "attribute '%V' of '%.100s' objects is not writable"

I think it would be nice to unify error messages and make them more specific.

--
components: Interpreter Core
messages: 263464
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Inconsistant error messages for failed attribute modification
type: enhancement
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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Surprisingly the implementation in 3.5 is correct. But backporting tests 
exposed behavior change in bytearray formatting in 3.6. In 3.5 
bytearray.__mod__ returns bytearray, in 3.6 it returns bytes. Is this 
intentional?

--

___
Python tracker 

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



[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And may be bytearray_mod in 3.6 is not correct. In 3.5 it returns bytearray, in 
3.6 it returns bytes.

--

___
Python tracker 

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



[issue26358] mmap.mmap.__iter__ is broken (yields bytes instead of ints)

2016-04-15 Thread Berker Peksag

Berker Peksag added the comment:

I don't think we can change this in 3.5 since it would break backward 
compatibility.

> Similarly the `in` operator seems to be broken; one could search for space 
> using `32 in bytesobj`, which would work for slices but not for the whole 
> mmap object.

Seems a reasonable request to me. Could you please open a separate issue?

--
components: +Extension Modules
nosy: +berker.peksag
priority: normal -> low
stage:  -> needs patch
type: behavior -> 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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ebece99c0bb6 by Serhiy Storchaka in branch 'default':
Issue #26764: Fixed SystemError in bytes.__rmod__.
https://hg.python.org/cpython/rev/ebece99c0bb6

New changeset 8dee0c09b46e by Serhiy Storchaka in branch '3.5':
Issue #26764: Bacported tests for bytes formatting.
https://hg.python.org/cpython/rev/8dee0c09b46e

--
nosy: +python-dev

___
Python tracker 

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



[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, I noticed this, but left for future (post-issue26765) refactoring.

The patch LGTM, but notice Victor's comment to issue26764.

--
nosy: +ethan.furman, haypo
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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Hmm, looks the result type is very unstable.

On release build:

>>> bytearray(b'hello %b') % b"world"
b'hello world'
>>> bytearray(b'hello %b') % b"wor"
b'hello wor'

On debug build:

>>> bytearray(b'hello %b') % b"world"
bytearray(b'hello world')
>>> bytearray(b'hello %b') % b"wor"
b'hello wor'

And current test_bytes.py is passed on release build, but is failed on debug 
build.

--
priority: normal -> high
stage: commit review -> 
title: Redundant check in bytearray_mod -> The result type of bytearray 
formatting is not stable

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
type: enhancement -> behavior

___
Python tracker 

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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

There is a bug in bytearray formatting. See issue26766.

--
dependencies: +The result type of bytearray formatting is not stable

___
Python tracker 

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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

>>> [] % b''
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/bytesobject.c:2975: bad argument to internal function

Proposed patch fixes bytes.__rmod__ and tests for bytes formatting.

--
components: Interpreter Core
files: bytes_rmod.patch
keywords: patch
messages: 263457
nosy: ethan.furman, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: SystemError in bytes.__rmod__
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file42464/bytes_rmod.patch

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2016-04-15 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2016-04-15 Thread Berker Peksag

Changes by Berker Peksag :


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

___
Python tracker 

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



[issue26769] Python 2.7: make private file descriptors non inheritable

2016-04-15 Thread STINNER Victor

New submission from STINNER Victor:

By default, subprocess.Popen doesn't close file descriptors (close_fds=False by 
default) and so a child process inherit all file descriptors open by the parent 
process. See the PEP 446 for the long rationale.

I propose to partially backport the PEP 446: only make *private* file 
descriptors non-inheritable. The private file descriptor of os.urandom() is 
already marked as non-inheritable.

To be clear: my patch doesn't affect applications using fork(). Only child 
processes created with fork+exec (ex: using subprocess) are impacted. Since 
modified file descriptors are private (not accessible from the Python scope), I 
don't think that the change can cause any backward compatibility issue.

I'm not 100% sure that it's worth to take the risk of introducing bugs 
(backward incompatible change?), since it looks like very few users complained 
of leaked file descriptors. I'm not sure that the modified functions contain 
sensitive file descriptors.

--

I chose to add Python/fileutils.c (and Include/fileutils.h) to add the new 
functions:

   /* Try to make the file descriptor non-inheritable. Ignore errors. */
   PyAPI_FUNC(void) _Py_try_set_non_inheritable(int fd);

   /* Wrapper to fopen() which tries to make the file non-inheritable on 
success.
  Ignore errors on trying to set the file descriptor non-inheritable. */
   PyAPI_FUNC(FILE*) _Py_fopen(const char *path, const char *mode);

I had to modify PCbuild/pythoncore.vcxproj and Makefile.pre.in to add 
fileutils.c/h. I chose to mimick Python 3 Python/fileutils.c. Tell me if you 
prefer to put the new functions in an existing file (I don't see where such 
function should be put).

File descriptors made non inheritable:

* linuxaudiodev.open()
* mmap.mmap(fd, 0): this function duplicates the file descriptor, the 
duplicated file descriptor is set to non-inheritable
* mmap.mmap(-1, ...): on platforms without MAP_ANONYMOUS, the function opens 
/dev/zero, its file descriptor is set to non-inheritable
* ossaudiodev.open()
* ossaudiodev.openmixer()
* select.epoll()
* select.kqueue()
* sunaudiodev.open()

Other functions using fopen() have been modified to use _Py_fopen(): the file 
is closed a few lines below and not returned to the Python scope.

The patch also reuses _Py_try_set_non_inheritable(fd) in Modules/posixmodule.c 
and Python/random.c.

Not modified:

* _hotshot: the file descriptor can get retrieved with 
_hotshot.ProfilerType.fileno().
* find_module() of Python/import.c: imp.find_module() uses the FILE* to create 
a Python file object which is returned

Note: I don't think that os.openpty() should be modified to limit the risk of 
breaking the backward compatibility.

This issue is a much more generic issue than the change #10897.

--
files: set_inheritable.patch
keywords: patch
messages: 263488
nosy: benjamin.peterson, haypo, martin.panter, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Python 2.7: make private file descriptors non inheritable
type: resource usage
versions: Python 2.7
Added file: http://bugs.python.org/file42471/set_inheritable.patch

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread INADA Naoki

INADA Naoki added the comment:

https://github.com/python/peps/compare/master...IanLee1521:issue26763

--
nosy: +naoki

___
Python tracker 

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



[issue26763] Update PEP-8 regarding binary operators

2016-04-15 Thread INADA Naoki

INADA Naoki added the comment:

Roundup doesn't link to Github's branch comparing URL correctly.
How about just create pull request on Github?

--

___
Python tracker 

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



[issue26766] The result type of bytearray formatting is not stable

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

It looks like a bug introduced by me in the issue #25399.

bytearray%args must return a bytearray object.

I understand that test_bytes lacks tests since it missed the bug.

--

___
Python tracker 

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



[issue26770] _Py_set_inheritable(): do nothing if the FD_CLOEXEC close is already set/cleared

2016-04-15 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch is avoids a syscall in os.set_inheritable() if the FD_CLOEXEC 
flag is already set/cleared.

The change only impacts platforms using fcntl() in _Py_set_inheritable(). 
Windows has a different implementation, and Linux uses ioctl() for example.

The same "optimization" is used in socket.socket.setblocking(): see the issue 
#19827.

--
files: set_inheritable_fcntl.patch
keywords: patch
messages: 263493
nosy: haypo
priority: normal
severity: normal
status: open
title: _Py_set_inheritable(): do nothing if the FD_CLOEXEC close is already 
set/cleared
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file42472/set_inheritable_fcntl.patch

___
Python tracker 

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



[issue26770] _Py_set_inheritable(): do nothing if the FD_CLOEXEC close is already set/cleared

2016-04-15 Thread STINNER Victor

STINNER Victor added the comment:

See also the issue #26769: "Python 2.7: make private file descriptors non 
inheritable".

--
nosy: +martin.panter, serhiy.storchaka

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'll defer committing the patch until some progress in issue26767 will be 
reached. May be _PyObject_GenericSetAttrWithDict() will have to rewrite again.

--
assignee:  -> serhiy.storchaka
priority: normal -> low
resolution:  -> remind
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



[issue4709] Mingw-w64 and python on windows x64

2016-04-15 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

Whoops, wrong ticket.

--

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


--
resolution:  -> third party
status: open -> closed

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

I know it's a wiki. But this particular page is marked ImmutablePage and I 
couldn't edit it even after I registered, so I thought It's protected. I'll try 
the e-mail now.

--
resolution: third party -> 
status: closed -> open

___
Python tracker 

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



[issue20699] Document that binary IO classes work with bytes-likes objects

2016-04-15 Thread Martin Panter

Martin Panter added the comment:

Here is an updated patch merged with recent changes. I also added a sentence to 
the RawIOBase.write() and BufferedIOBase.write() documentation about access to 
the buffer after the method returns. And I added tests for this.

--
Added file: http://bugs.python.org/file42470/bytes-like-param.v5.patch

___
Python tracker 

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



[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Berker Peksag

Berker Peksag added the comment:

Do you have an example code? It returns bytearray for me in both 3.5 and 3.6. 
use_bytearray parameter of _PyBytes_FormatEx() is 1 in bytearray_mod().

--

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Ivan Pozdeev

Changes by Ivan Pozdeev :


Added file: http://bugs.python.org/file42469/0002-VS-Express.patch

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Ivan Pozdeev

New submission from Ivan Pozdeev:

Current instructions at https://wiki.python.org/moin/WindowsCompilers for a 
number of items are insufficient to make things work out of the box.
This has lead to widespread confusion and a lot of vastly different and 
invariably hacky/unreliable/unmaintainable "alternative" guides on the Net (see 
e.g. the sheer volume of crappy advice at 
http://stackoverflow.com/questions/2817869/error-unable-to-find-vcvarsall-bat 
and 
http://stackoverflow.com/questions/4676728/value-error-trying-to-install-python-for-windows-extensions).

The first patch fixes that for SDKs 6.1,7.0,7.1 (details are in the patch's 
Subject).
The second one mentions VS Express' limitation that leads to an obscure error 
in distutils which resulted in https://bugs.python.org/issue7511 .

Unlike other (all?) instructions circling around the Net, these are NOT hacks 
and are intended to be official recommendations.

I tested them to work with 2.7 and 3.2 on an x32 with no prior development 
tools installed. I also checked other instructions applicable to these versions 
to be okay.

I didn't touch the ''mingw'' section because, according to 
https://bugs.python.org/issue4709 , it can't really be officially supported as 
it is now.

--
assignee: docs@python
components: Build, Documentation, Windows
files: 0001-fix-winsdk.patch
keywords: patch
messages: 263474
nosy: Ivan.Pozdeev, docs@python, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Fix instructions at WindowsCompilers for MSVC/SDKs
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file42468/0001-fix-winsdk.patch

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Ivan Pozdeev

Ivan Pozdeev added the comment:

I preferred DISTUTILS_USE_SDK to MSSDK because the latter is a hack intended 
for private, advanced use rather than as the standard way: it makes distutils 
stop guessing and rely on the user to set the environment correctly.

--

___
Python tracker 

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



[issue26768] Fix instructions at WindowsCompilers for MSVC/SDKs

2016-04-15 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the detailed report and for the patch, Ivan. But since 
https://wiki.python.org/moin/WindowsCompilers is a wiki document, you can edit 
it yourself. Please send an email to pydotorg-...@python.org with your account 
name. See https://wiki.python.org/moin/FrontPage#use for details.

--
nosy: +berker.peksag
resolution:  -> third party
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



[issue26766] Redundant check in bytearray_mod

2016-04-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Python 3.5:

>>> bytearray(b'%d') % 42
bytearray(b'42')

Python 3.6:

>>> bytearray(b'%d') % 42
b'42'

--

___
Python tracker 

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



[issue26745] Redundant code in _PyObject_GenericSetAttrWithDict

2016-04-15 Thread Martin Panter

Martin Panter added the comment:

Serhiy’s version looks good to me

--

___
Python tracker 

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



[issue26764] SystemError in bytes.__rmod__

2016-04-15 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
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



  1   2   >