[issue24526] Exponent function bug

2015-06-29 Thread bhaskar

Changes by bhaskar b.bhaskar.n...@gmail.com:


Added file: http://bugs.python.org/file39830/pythonabc.png

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



[issue24526] Exponent function bug

2015-06-29 Thread bhaskar

New submission from bhaskar:

the value of a -ve number when raised by a power of even number always results 
in a +ve number. I tried it with -1**10 , -1**2, -9**4

these all are resulting in -ve numbers which is mathematically incorrect.

ps. the same example is in the attachment

--
components: IDLE
files: pythonabc.png
messages: 245928
nosy: bhaskar
priority: normal
severity: normal
status: open
title: Exponent function bug
type: compile error
versions: Python 3.6
Added file: http://bugs.python.org/file39829/pythonabc.png

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



[issue24514] tarfile fails to extract archive (handled fine by gnu tar and bsdtar)

2015-06-29 Thread Tal Einat

Tal Einat added the comment:

The patch is very simple, but this needs tests. At the very least, a simple tar 
file which reproduces this issue could be added to the tests.

Taking this a step further would be writing some unit tests for the internal 
nti() and itn() functions, and perhaps also stn() and nts().

--
nosy: +taleinat

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



[issue24528] Misleading exeption for await in comprehensions.

2015-06-29 Thread Yury Selivanov

Changes by Yury Selivanov yseliva...@gmail.com:


--
assignee:  - yselivanov

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-06-29 Thread Ryan Gonzalez

Ryan Gonzalez added the comment:

You compiled with -fPIE and GCC, right? I know the Android Clang seems broken.

On June 29, 2015 7:09:25 AM CDT, Cyd Haselton rep...@bugs.python.org wrote:

Cyd Haselton added the comment:

FYI, Figured out that running ./configure with --with-pydebug does NOT
define Py_DEBUG in pyconfig.h.

Defining it in pyconfig.h got me past the undefined reference to
`_PyUnicode_CheckConsistency' error, but i'm now getting this:

if test $? -ne 0 ; then \
echo generate-posix-vars failed ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Debug memory block at address p=0x90b7b0: API ''
2416312320 bytes originally requested
The 3 pad bytes at p-3 are not all FORBIDDENBYTE (0xfb):
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
 Because memory is corrupted at the start, the count of bytes requested
   may be bogus, and checking the trailing pad bytes may segfault.
The 4 pad bytes at tail=0x9096b7b0 are Segmentation fault
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1

Will re-check patch application and try again

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

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



[issue24420] Documentation regressions from adding subprocess.run()

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

New patch dropping the [, input] parameter from the signature. I also removed 
the bit about *stdout*, since it should be obvious from the equivalent run() 
call given, and equally applies to *check*.

--
Added file: http://bugs.python.org/file39831/high-args.v2.patch

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



[issue24514] tarfile fails to extract archive (handled fine by gnu tar and bsdtar)

2015-06-29 Thread Lars Gustäbel

Lars Gustäbel added the comment:

I think a simple addition to the existing unittest for nti() will be enough. 
itn() seems well-tested, and nts() and stn() are not affected, because they 
don't operate on numbers.

--
Added file: http://bugs.python.org/file39832/issue24514.diff

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



[issue24483] Avoid repeated hash calculation in C implementation of functools.lru_cache()

2015-06-29 Thread Tal Einat

Tal Einat added the comment:

With clru_cache_known_hash_4.patch on the current default branch, the entire 
test suite passes here (OSX 10.10).

--
nosy: +taleinat

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



[issue5945] PyMapping_Check returns 1 for lists

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue24527] The MimeTypes class cannot ignore global files per instance

2015-06-29 Thread Sebastian Noack

New submission from Sebastian Noack:

In order to prevent the mimetypes module from considering global files and 
registry entries, you have to call mimetypes.init([]). However, this will 
enforce that behavior globally, and only works if the module wasn't initialized 
yet.

There is also a similar argument in the mimetypes.MimeTypes() constructor, 
however the list of files passed there are considered additionally. But there 
is no way to prevent an individual MinmeTypes instance to consider global files.

Adding a ignore_global_types option would be trivial too add to the MimeTypes 
constructor, and would be extremely useful.

--
components: Library (Lib)
messages: 245930
nosy: Sebastian Noack
priority: normal
severity: normal
status: open
title: The MimeTypes class cannot ignore global files per instance
type: behavior

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



[issue24528] Misleading exeption for await in comprehensions.

2015-06-29 Thread Ivan Levkivskyi

New submission from Ivan Levkivskyi:

The following code:

async def foo():
lst = [await coro(i) for i in range(10)]
return lst

gives

SyntaxError: 'await' outside async function

I understand that this is because the comprehensions are implemented using a 
function scope (see also #10544), but such behavior is unintuitive.

IMO there are two possibilities here:
1) make comprehensions behave more like a for loop;
2) change the exception text to something like SyntaxError: 'await's in 
comprehensions are not supported.

I understand that the first option is probably not for 3.5 (it is beta 
already), but I will be happy if the second option will be implemented in 3.5

--
components: Interpreter Core, asyncio
messages: 245931
nosy: gvanrossum, haypo, levkivskyi, yselivanov
priority: normal
severity: normal
status: open
title: Misleading exeption for await in comprehensions.
type: behavior
versions: Python 3.5, Python 3.6

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-06-29 Thread Cyd Haselton

Cyd Haselton added the comment:

FYI, Figured out that running ./configure with --with-pydebug does NOT define 
Py_DEBUG in pyconfig.h.

Defining it in pyconfig.h got me past the undefined reference to 
`_PyUnicode_CheckConsistency' error, but i'm now getting this:

if test $? -ne 0 ; then \
echo generate-posix-vars failed ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Debug memory block at address p=0x90b7b0: API ''
2416312320 bytes originally requested
The 3 pad bytes at p-3 are not all FORBIDDENBYTE (0xfb):
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
Because memory is corrupted at the start, the count of bytes requested
   may be bogus, and checking the trailing pad bytes may segfault.
The 4 pad bytes at tail=0x9096b7b0 are Segmentation fault
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1

Will re-check patch application and try again

--

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



[issue19217] Calling assertEquals for moderately long list takes too long

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue21253] unittest assertSequenceEqual can lead to Difflib.compare() crashing on mostly different sequences

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue21827] textwrap.dedent() fails when largest common whitespace is a substring of smallest leading whitespace

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue24527] The MimeTypes class cannot ignore global files per instance

2015-06-29 Thread Wladimir Palant

Changes by Wladimir Palant t...@adblockplus.org:


--
nosy: +Wladimir Palant

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



[issue24272] PEP 484 docs

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue11352] Update cgi module doc

2015-06-29 Thread Ivan Levkivskyi

Changes by Ivan Levkivskyi levkivs...@gmail.com:


--
nosy: +levkivskyi

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-06-29 Thread Cyd Haselton

Cyd Haselton added the comment:

No...haven't upgraded to Android 5.0 yet.  

On June 29, 2015 9:00:01 AM CDT, Ryan Gonzalez rep...@bugs.python.org wrote:

Ryan Gonzalez added the comment:

You compiled with -fPIE and GCC, right? I know the Android Clang seems
broken.

On June 29, 2015 7:09:25 AM CDT, Cyd Haselton rep...@bugs.python.org
wrote:

Cyd Haselton added the comment:

FYI, Figured out that running ./configure with --with-pydebug does NOT
define Py_DEBUG in pyconfig.h.

Defining it in pyconfig.h got me past the undefined reference to
`_PyUnicode_CheckConsistency' error, but i'm now getting this:

if test $? -ne 0 ; then \
echo generate-posix-vars failed ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Debug memory block at address p=0x90b7b0: API ''
2416312320 bytes originally requested
The 3 pad bytes at p-3 are not all FORBIDDENBYTE (0xfb):
at p-3: 0x00 *** OUCH
at p-2: 0x00 *** OUCH
at p-1: 0x00 *** OUCH
 Because memory is corrupted at the start, the count of bytes
requested
   may be bogus, and checking the trailing pad bytes may segfault.
The 4 pad bytes at tail=0x9096b7b0 are Segmentation fault
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1

Will re-check patch application and try again

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

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



[issue17546] Document the circumstances where the locals() dict get updated

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

I quickly scanned through the email thread from Issue 17960. I guess it makes 
sense to specify that locals() can be used to directly get a class’s namespace. 
Probably doesn’t hurt to say locals() is equivalent to globals() at module 
level, although this seems like a fairly redundant feature.

Here is locals_doc.03.patch, which uses my wording for function namespaces, and 
also adds more for class and global namespaces, as suggested by Nick.

--
Added file: http://bugs.python.org/file39833/locals_doc.03.patch

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



[issue24530] `import..as` fails where `import` does not

2015-06-29 Thread Dustin J. Mitchell

New submission from Dustin J. Mitchell:

Reproduction:

# main.py
import foo.bar

# foo/__init__.py
# (empty)

# foo/bar/__init__.py
import foo.bar.bing as bing

# foo/bar/bing.py
# (empty)

Result:

dustin@euclid ~/tmp $ python3.3 main.py 
Traceback (most recent call last):
  File main.py, line 1, in module
import foo.bar
  File /home/dustin/tmp/foo/bar/__init__.py, line 1, in module
import foo.bar.bing as bing
AttributeError: 'module' object has no attribute 'bar'

dustin@euclid ~/tmp $ python2.7 main.py 
Traceback (most recent call last):
  File main.py, line 1, in module
import foo.bar
  File /home/dustin/tmp/foo/bar/__init__.py, line 1, in module
import foo.bar.bing as bing
AttributeError: 'module' object has no attribute 'bar'

If you remove the `as bing` from `foo/bar/__init__.py`, all is well.  
Similarly, `from foo.bar import bing` works fine, as does `from foo.bar import 
bing as bing`.

I don't see anything in 
https://docs.python.org/3/reference/simple_stmts.html#import that suggests this 
is expected behavior.

--
components: Interpreter Core
messages: 245941
nosy: djmitche
priority: normal
severity: normal
status: open
title: `import..as` fails where `import` does not
type: behavior
versions: Python 2.7, Python 3.3

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



[issue19176] DeprecationWarning for doctype() method when subclassing _elementtree.XMLParser

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

inherit-doctype.v3.patch looks good to me

--

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



[issue24531] please document that no code preceding encoding declaration is allowed

2015-06-29 Thread Jakub Wilk

New submission from Jakub Wilk:

If the encoding is declared on the second line, the first line must not contain 
anything except comments. However, this fact is not documented.

The Python Language reference says only that the encoding declaration must 
appear on a line of its own;
and PEP 263 says only that there must not be any Python statement on the line 
that contains the encoding declaration.

For example, Python ignores this encoding declaration:

spam = True
# encoding=ISO-8859-2

despite the fact that it appears on a line of its own.

--
assignee: docs@python
components: Documentation
messages: 245946
nosy: docs@python, jwilk
priority: normal
severity: normal
status: open
title: please document that no code preceding encoding declaration is allowed

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



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

The idea and patch look reasonable.

Bob, what do you think?

--
assignee:  - bob.ippolito
nosy: +bob.ippolito, rhettinger
versions: +Python 3.6 -Python 3.4

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



[issue22609] Constructors of some mapping classes don't accept `self` keyword argument

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

Patch looks fine to me. I understand Yury withdrew his comment.

--
stage: patch review - commit review

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



[issue24529] Same MemoryError object gets thrown from different places.

2015-06-29 Thread SylvainDe

New submission from SylvainDe:

Disclaimer: This is very minor, impacts only Python 2 and is maybe not even a 
bug.

Context: I was randomly changing attribute of Exception objects when I 
discovered something I did not expect : sometimes when an exception occurs, a 
new object is raised (which is what I expected), sometimes a previously thrown 
exception is re-thrown (which surprised me).

More specifically, MemoryError objects seem to be reused while most of the 
other exceptions I've played with where newly created.

One can easily see this happening in the following piece of code :
 - first a NameError is caught and updated
 - then, we run the same code and print the re-caught exception : it is a new 
one
 - then, a MemoryError is caught and updated
 - then, we run the same code and print the re-caught exception : it is the 
same as previously.


pre
from __future__ import print_function

old_e = None
try:
foobar
except NameError as old_e:
print(old_e:, old_e)
old_e.args = tuple(['NEW VALUE'])
print(old_e:, old_e)
try:
foobar
except NameError as new_e:
print(new_e:, new_e)
print(old_e is new_e)

old_e = None
try:
l = [0] * 99
except MemoryError as old_e:
print(old_e:, old_e)
old_e.args = tuple(['NEW VALUE'])
print(old_e:, old_e)
try:
l = [0] * 99
except MemoryError as new_e:
print(new_e:, new_e)
print(old_e is new_e)
/pre



For the record, I am quite aware that this shouldn't impact anyone using Python 
normally. I was just messing around as part of a toy project where I try to 
enhance exception messages for a better user experience (  
https://github.com/SylvainDe/DidYouMean-Python ).

--
components: Interpreter Core
messages: 245940
nosy: SylvainDe
priority: normal
severity: normal
status: open
title: Same MemoryError object gets thrown from different places.
versions: Python 2.7

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



[issue3353] make built-in tokenizer available via Python C API

2015-06-29 Thread Dustin J. Mitchell

Dustin J. Mitchell added the comment:

This seems to have stalled out after the PyCon sprints.  Any chance the final 
patch can be reviewed?

--

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



[issue24530] `import..as` fails where `import` does not

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

I'm pretty sure this has already been reported, but I have no idea how to 
search for the issue :)  If I remember correctly there's a doc patch, so I 
suppose it hasn't been applied.  But I could be misremembering.

--
nosy: +brett.cannon, eric.snow, r.david.murray

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



[issue24529] Same MemoryError object gets thrown from different places.

2015-06-29 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue24528] Misleading exeption for await in comprehensions.

2015-06-29 Thread Yury Selivanov

Yury Selivanov added the comment:

Thanks for discovering this, Ivan.  The patch is attached.

--
keywords: +needs review, patch
nosy: +ncoghlan
stage:  - patch review
Added file: http://bugs.python.org/file39834/awaitcomp.patch

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



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Bob Ippolito

Bob Ippolito added the comment:

Seems like a good idea to me, I'll make sure this gets in simplejson as well.

--

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



[issue24529] Same MemoryError object gets thrown from different places.

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

If the same memory exception object were not used, we'd have to allocate memory 
for the new one...

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

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



[issue24531] please document that no code preceding encoding declaration is allowed

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

What docs are you looking at? 
https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations?
 I suspect the author thought that If a comment in the first or second 
line... implied both lines needed to be comments, but I agree that the wording 
is not clear.

--
nosy: +r.david.murray
stage:  - needs patch
type:  - behavior
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6

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



[issue24532] asyncio.sock_recv() blocks normal ioloop actions.

2015-06-29 Thread Марк Коренберг

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

Suppose that program:


import asyncio
import socket
def receiver(loop):
(a, b) = socket.socketpair()
loop.call_later(1, lambda: print('Should be called inside the loop'))
end = loop.time() + 3
print('Starting busy receiver')
while loop.time()  end:
a.send(b'test')
yield from loop.sock_recv(b, 65536)
# yield from asyncio.sleep(0) # =
print('Busy receiver complete')
# just not to stop ioloop immediatelly
yield from asyncio.sleep(0.5)
def main():
loop = asyncio.get_event_loop()
loop.run_until_complete(receiver(loop))
loop.close()
if __name__ == '__main__':
main()


Without asyncio.sleep(0) it will not fire time-delayed calls! If I add 
asyncio.sleep(0), everything work right. As I think, It is because recv() 
syscall is always succeeded, and we never return to ioloop (to epoll() I mean).

In other words, it is classical `reader starvation` as mentioned in man epoll.

It is not documented, that this function may block event loop, in spite of it 
returns coroutine! I thought that this function will setup EPOLLIN event for 
socket's FD + call recv() after that. I spent many time to debug program.

--
components: asyncio
messages: 245952
nosy: gvanrossum, haypo, mmarkk, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.sock_recv() blocks normal ioloop actions.
type: behavior
versions: Python 3.4

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



[issue24526] Exponent function bug

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

This bit of python's precedence rules often catches people by surprise.  ** 
binds tighter than -, so what python is evaluating is -(1**10).

--
nosy: +r.david.murray
resolution:  - not a bug
stage:  - resolved
status: open - closed
type: compile error - behavior

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



[issue24532] asyncio.sock_recv() blocks normal ioloop actions.

2015-06-29 Thread STINNER Victor

STINNER Victor added the comment:

You should develop using asyncio debug mode:

https://docs.python.org/dev/library/asyncio-dev.html#asyncio-dev

haypo@selma$ PYTHONASYNCIODEBUG=1 ./python x.py 
Starting busy receiver
Traceback (most recent call last):
  File x.py, line 21, in module
main()
  File x.py, line 18, in main
loop.run_until_complete(receiver(loop))
  File /home/haypo/prog/python/default/Lib/asyncio/base_events.py, line 341, 
in run_until_complete
return future.result()
  File /home/haypo/prog/python/default/Lib/asyncio/futures.py, line 276, in 
result
raise self._exception
  File /home/haypo/prog/python/default/Lib/asyncio/tasks.py, line 238, in 
_step
result = coro.send(value)
  File x.py, line 11, in receiver
yield from loop.sock_recv(b, 65536)
  File /home/haypo/prog/python/default/Lib/asyncio/selector_events.py, line 
316, in sock_recv
raise ValueError(the socket must be non-blocking)
ValueError: the socket must be non-blocking
/home/haypo/prog/python/default/Lib/asyncio/base_events.py:384: 
ResourceWarning: unclosed event loop _UnixSelectorEventLoop running=False 
closed=False debug=True
sys:1: ResourceWarning: unclosed socket object at 0x7f0b03d7d688
sys:1: ResourceWarning: unclosed socket object at 0x7f0b03d7d5f8

--

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



[issue24467] bytearray pop and remove Buffer Over-read

2015-06-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
components: +Interpreter Core
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue24518] json.dumps should accept key function for ``sort_keys``

2015-06-29 Thread Bob Ippolito

Bob Ippolito added the comment:

On further investigation, simplejson has implemented this functionality under a 
different name since 2.5.0 (2012-03-29).


If item_sort_key is a callable (not the default), then the output of 
dictionaries will be sorted with it. The callable will be used like this: 
sorted(dct.items(), key=item_sort_key). This option takes precedence over 
sort_keys.

Changed in version 2.5.0: item_sort_key is new in 2.5.0.


--

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



[issue24467] bytearray pop and remove Buffer Over-read

2015-06-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a887ce8611d2 by Serhiy Storchaka in branch '2.7':
Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray
https://hg.python.org/cpython/rev/a887ce8611d2

New changeset c95d7ffa492e by Serhiy Storchaka in branch '3.4':
Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray
https://hg.python.org/cpython/rev/c95d7ffa492e

New changeset 942860bada14 by Serhiy Storchaka in branch '3.5':
Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray
https://hg.python.org/cpython/rev/942860bada14

New changeset 97a24bc714ec by Serhiy Storchaka in branch 'default':
Issue #24467: Fixed possible buffer over-read in bytearray. The bytearray
https://hg.python.org/cpython/rev/97a24bc714ec

--
nosy: +python-dev

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



[issue24462] bytearray.find Buffer Over-read

2015-06-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch for issue24467 also fixed this issue in different way.

In any case thank you Dmitry for your patches.

--
components: +Interpreter Core
resolution:  - duplicate
stage: patch review - resolved
status: open - closed
superseder:  - bytearray pop and remove Buffer Over-read

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



[issue24533] Increased Test Coverage for Lib/random.py

2015-06-29 Thread Charles Nodell

New submission from Charles Nodell:

This patch just extends test coverage on the random library by a few lines.

--
components: Tests
files: mywork.patch
keywords: patch
messages: 245956
nosy: Charles Nodell
priority: normal
severity: normal
status: open
title: Increased Test Coverage for Lib/random.py
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file39835/mywork.patch

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



[issue24475] The docs never define what a pool task is

2015-06-29 Thread Daniel Neuberger

Daniel Neuberger added the comment:

I second this. I was definitely confused at first and it took me a little while 
of googling to realize that jobs are not what one (at least me) would 
intuitively think they are.

--
nosy: +Daniel Neuberger

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread STINNER Victor

STINNER Victor added the comment:

 The attached patch removes support for executing code in .pth files

This change will basically break all Python applications. Don't do that.

If you believe that we can smoothly move to a world without .pth files, you 
should propose an overall plan, step by step. It implies to add an option to 
Python to disable .pth files. It might be enabled by the -I command line option.

https://docs.python.org/dev/using/cmdline.html#cmdoption-I

--
nosy: +haypo

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



[issue24533] Increased Test Coverage for Lib/random.py

2015-06-29 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +mark.dickinson, rhettinger

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



[issue3530] ast.NodeTransformer doc bug

2015-06-29 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am reopening this as a doc bug because RewriteName is a copy (with 'ast.' 
prefixes added) of a buggy example in the doc. The bug is that the new .value 
Name and Str attributes do not get the required 'lineno' and 'col_offset' 
attributes.  As Armin said, copy_location is not recursive and does not fix 
children of the node it fixes.  Also, the recursive .visit method does not 
recurse into children of replacement nodes (and if it did, the new Str node 
would still not be fixed).

The fix could be to reuse the Name node and add another copy_location call: the 
following works.

def visit_Name(self, node):
return ast.copy_location(
ast.Subscript(
value=node,
slice=ast.Index(value=ast.copy_location(
ast.Str(s=node.id), node)),
ctx=node.ctx),
node)

but I think this illustrates that comment in the fix_missing_locations() entry 
that locations are tedious to fill in for generated nodes.  So I think the 
doc fix should use Armin's version of RewriteName and say to call 
fix_missing_locations on the result of .visit if new nodes are added.  (I 
checked that his code still works in 3.5).

The entry for NodeTransformer might mention that .visit does not recurse into 
replacement nodes.

The missing lineno error came up in this python-list thread:
https://mail.python.org/pipermail/python-list/2015-June/693316.html

--
assignee:  - docs@python
components: +Documentation
nosy: +benjamin.peterson, docs@python, terry.reedy
resolution: not a bug - 
stage:  - needs patch
status: closed - open
title: ast.NodeTransformer bug - ast.NodeTransformer doc bug
type:  - behavior
versions: +Python 2.7, Python 3.4, Python 3.5, Python 3.6 -Python 2.6

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



[issue24531] please document that no code preceding encoding declaration is allowed

2015-06-29 Thread Jakub Wilk

Jakub Wilk added the comment:

Right, I meant 
https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations.

--

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

I'm guessing this feature has been around too long and is used in too many ways 
to remove.  I believe it is effectively disabled by -I (if it is not, that 
would be a valid feature request).  However, since setuptools was the pioneer 
in this area, if setuptools is no longer using it, perhaps a deprecation would 
be possible.  I think it would probably have to happen over more than one 
release, to insure enough time to implement any features needed to replace the 
deprecated functionality.

--
nosy: +r.david.murray

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



[issue19176] DeprecationWarning for doctype() method when subclassing _elementtree.XMLParser

2015-06-29 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 75571407dcd3 by Serhiy Storchaka in branch '3.4':
Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree.
https://hg.python.org/cpython/rev/75571407dcd3

New changeset 6ae8842e9b60 by Serhiy Storchaka in branch '3.5':
Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree.
https://hg.python.org/cpython/rev/6ae8842e9b60

New changeset d792dc240456 by Serhiy Storchaka in branch 'default':
Issue #19176: Fixed doctype() related bugs in C implementation of ElementTree.
https://hg.python.org/cpython/rev/d792dc240456

--
nosy: +python-dev

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +brett.cannon, eric.snow, ncoghlan

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



[issue24530] `import..as` fails where `import` does not

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

Maybe Issue 23203, proposing to fix the compiled bytecode.

--
nosy: +vadmium
resolution:  - duplicate
stage:  - resolved
status: open - closed
superseder:  - Aliasing import of sub-{module,package} from the package raises 
AttributeError on import.

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



[issue24400] Awaitable ABC incompatible with functools.singledispatch

2015-06-29 Thread Stefan Behnel

Stefan Behnel added the comment:

 isawaitable(), however, should continue using abc.Awaitable, since it only 
 checks for __await__ presence on the type (or should we just drop it?)

I'd really remove it. It's not referring to an actual type, so it doesn't fit 
the purpose of the inspect module. The fact that the only place where 
collections.abc is used in this module is in isawaitable() should be a clear 
indication that it's misplaced.

--

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



[issue19176] DeprecationWarning for doctype() method when subclassing _elementtree.XMLParser

2015-06-29 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In 2.7 XMLParser is a function, not a class, and therefore can't be subclassed.

--
resolution:  - fixed
stage: commit review - resolved
status: open - closed
versions:  -Python 2.7

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 29.06.2015 21:30, Min RK wrote:
 
 .pth files currently allow execution of arbitrary code, triggered by lines 
 starting with `import`. This is a rarely understood, and often misbehaving 
 feature. easy_install has used this feature to ensure that its packages are 
 highest priority (even higher than stdlib). This is one of the unfortunate 
 behaviors that pip undoes from easy_install, in part due to the problems it 
 can cause. There is currently a proposal in setuptools to stop using this, 
 even for easy_install.
 
 The attached patch removes support for executing code in .pth files, throwing 
 an ImportWarning if any such attempts at import are seen.

Such a change will require a PEP, since it's an essential feature
that has been documented for a very long time:

https://docs.python.org/3.5/library/site.html

and is used by a lot of existing setuptools installations, which
would break if Python were to remove support for this.

The PEP would also need to address the reasons for removing the
feature, e.g. explain possible attack vectors, confusion caused
by this, etc.

You can then reference this patch in the PEP.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

--
nosy: +lemburg

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



[issue14046] argparse: assertion failure if optional argument has square/round brackets in metavar

2015-06-29 Thread John Jones

John Jones added the comment:

Im kind of surprised this bug has lasted for so many years :)

setting part_regexp to:
r'\(.*?\(.*?\).*?\)+|\[.*?\[.*?\].*?\]+|\S+'
fixes the issue for me, although its not very elegant

--
nosy: +John Jones

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



[issue24530] `import..as` fails where `import` does not

2015-06-29 Thread R. David Murray

R. David Murray added the comment:

Ah, yes, that is the issue I was thinking of.  So, bug, not doc issue :)

--

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread Tim Smith

Tim Smith added the comment:

In Homebrew we occasionally use .pth files to call site.addsitedir. This is 
useful when we want to add a directory to sys.path that contains .pth files 
that also need to be processed (for example, when adding a directory to 
sys.path that contains namespace packages). It would be helpful to retain a 
mechanism for adding site dirs from a .pth file.

Homebrew also writes temporary probe .pths containing import site; 
site.homebrew_was_here = True in order to check whether .pth files are 
processed in a particular path, though we could equivalently write a temporary 
path to a .pth file and verify that it ends up in sys.path.

Finally, Homebrew asks users to write .pth files with imports in some places 
where we could use usercustomize instead.

--
nosy: +tdsmith

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



[issue24525] [doc] missing word

2015-06-29 Thread Vincent Legoll

New submission from Vincent Legoll:

Here is a patch to fix a missing word in the urllib doc

--
assignee: docs@python
components: Documentation
files: python-doc-fix.hgpatch
messages: 245927
nosy: docs@python, vincent-legoll
priority: normal
severity: normal
status: open
title: [doc] missing word
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file39828/python-doc-fix.hgpatch

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



[issue24279] Update test_base64 to use test.support.script_helper

2015-06-29 Thread Martin Panter

Changes by Martin Panter vadmium...@gmail.com:


--
nosy: +vadmium

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



[issue17546] Document the circumstances where the locals() dict get updated

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

Here is another attempt with different words:

'''
.. note::
   The dictionary returned by :func:`locals` is an accurate snapshot of the 
local namespace at the time it is called.  If the namespace changes after the 
call, the dictionary may become out of date, but it may also automatically 
update at any time.  The contents of the dictionary should not be modified by 
the user; it is undefined whether such changes affect the namespace or not.
'''

--

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



[issue17546] Document the circumstances where the locals() dict get updated

2015-06-29 Thread Nick Coghlan

Nick Coghlan added the comment:

I mostly like Martin's suggested wording, but would also note that I filed 
issue 17960 to tighten up the requirements for when we expect assigning to 
locals() to work.

To save folks reading the whole referenced email, I think it would be worth 
defining that modifying the namespace returned by locals() will affect the 
runtime namespace at module and class scope and when using exec, but will have 
no effect at function scope (as locals() returns a copy of the namespace in 
that case).

--

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



[issue18576] Document test.support.script_helper

2015-06-29 Thread Martin Panter

Martin Panter added the comment:

I left some more comments on Reitveld. The main one is I think stderr gets 
stripped with assert_python_ok(), but I don’t think stdout is touched. Correct 
me if I’m wrong though.

--

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



[issue24134] assertRaises can behave differently

2015-06-29 Thread Robert Collins

Robert Collins added the comment:

Hi, catching up (see my mail to -dev about not getting tracker mail). 
Deprecations++. Being nice for folk whom consume unittest2 which I backport to 
everything is important to me :).

--

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



[issue24532] asyncio.sock_recv() blocks normal ioloop actions.

2015-06-29 Thread Марк Коренберг

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

$ PYTHONASYNCIODEBUG=1 ./bug.py
Starting busy receiver
Busy receiver complete
Executing Task pending coro=receiver() running at ./bug.py:16 
wait_for=Future pending cb=[Task._wakeup()] created at 
/usr/lib/python3.4/asyncio/tasks.py:490 cb=[_run_until_complete_cb() at 
/usr/lib/python3.4/asyncio/base_events.py:123] created at 
/usr/lib/python3.4/asyncio/base_events.py:296 took 3.001 seconds
Should be called inside the loop

--

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



[issue24532] asyncio.sock_recv() blocks normal ioloop actions.

2015-06-29 Thread Марк Коренберг

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

Adding of b.setblocking(0) after socketpair() does not help.

--

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



[issue24535] SELinux reporting writes, executes, and dac_overwrites

2015-06-29 Thread Ned Deily

Ned Deily added the comment:

This is not a Python problem; note in particular the blueman references in the 
messages. A quick web searching suggests there is a conflict between blueman 
and SELinux security policies that need to be resolved; see, for example, 
https://bugzilla.redhat.com/show_bug.cgi?id=1198272 that suggests the problem 
has been fixed in Fedora 21.

--
nosy: +ned.deily
resolution:  - third party
stage:  - resolved
status: open - closed

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



[issue24533] Increased Test Coverage for Lib/random.py

2015-06-29 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I don't mind adding a test but would like it to written somewhat differently.  
I'll work something up when I get a chance.  Marking this as a low priority 
because the code is already working fine and this is just a nice addition to 
improve coverage.

--
assignee:  - rhettinger
priority: normal - low

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



[issue24535] SELinux reporting writes, executes, and dac_overwrites

2015-06-29 Thread Nick Levinson

New submission from Nick Levinson:

Suddenly, SELinux in my Fedora 20 Linux laptop is reporting many problems with 
/usr/bin/python2.7 and I don't know if there's a bug in python2.7 or if 
something else is going on. File/s or directory/ies on which writes were 
attempted were on unspecified file/s or drectory/ies. Thirteen alerts occurred 
within the same minute soon after a cold boot, although I at first thought it 
was only one alert until I clicked buttons. Each alert apparently represents 
multiple alert-worthy events. Following are the data reported by SELinux, 
separated by rows of equals signs.

=

Occurred 12  later occurred 7 (I assume 12 and 7 times, respectively, 
unless the numbers mean something else):

=

SELinux is preventing /usr/bin/python2.7 from using the dac_override capability.

*  Plugin dac_override (91.4 confidence) suggests   **

If you want to help identify if domain needs this access or you have a file 
with the wrong permissions on your system
Then turn on full auditing to get path information about the offending file and 
generate the error again.
Do

Turn on full auditing
# auditctl -w /etc/shadow -p w
Try to recreate AVC. Then execute
# ausearch -m avc -ts recent
If you see PATH record check ownership/permissions on file, and fix it, 
otherwise report as a bugzilla.

*  Plugin catchall (9.59 confidence) suggests   **

If you believe that python2.7 should have the dac_override capability by 
default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep python /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Contextsystem_u:system_r:blueman_t:s0-s0:c0.c1023
Target Contextsystem_u:system_r:blueman_t:s0-s0:c0.c1023
Target Objects [ capability ]
Sourcepython
Source Path   /usr/bin/python2.7
Port  Unknown
Host  localhost.localdomain
Source RPM Packages   python-2.7.5-16.fc20.x86_64
Target RPM Packages   
Policy RPMselinux-policy-3.12.1-197.fc20.noarch
Selinux Enabled   True
Policy Type   targeted
Enforcing ModeEnforcing
Host Name localhost.localdomain
Platform  Linux localhost.localdomain 3.19.8-100.fc20.x86_64
  #1 SMP Tue May 12 17:08:50 UTC 2015 x86_64 x86_64
Alert Count   12
First Seen2015-06-28 11:16:53 EDT
Last Seen 2015-06-28 17:04:49 EDT
Local ID  146e4bfb-abdf-44a1-86da-3b538f53fac8

Raw Audit Messages
type=AVC msg=audit(1435525489.77:442): avc:  denied  { dac_override } for  
pid=2232 comm=python capability=1  
scontext=system_u:system_r:blueman_t:s0-s0:c0.c1023 
tcontext=system_u:system_r:blueman_t:s0-s0:c0.c1023 tclass=capability 
permissive=0


type=SYSCALL msg=audit(1435525489.77:442): arch=x86_64 syscall=access 
success=no exit=EACCES a0=7ffcd4229aba a1=2 a2=0 a3=79 items=0 ppid=2231 
pid=2232 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 
fsgid=0 tty=(none) ses=4294967295 comm=python exe=/usr/bin/python2.7 
subj=system_u:system_r:blueman_t:s0-s0:c0.c1023 key=(null)

Hash: python,blueman_t,blueman_t,capability,dac_override

=

Occurred 7:

=

SELinux is preventing /usr/bin/python2.7 from execute access on the file .

*  Plugin catchall (100. confidence) suggests   **

If you believe that python2.7 should be allowed execute access on the  file by 
default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep python /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Contextsystem_u:system_r:blueman_t:s0-s0:c0.c1023
Target Contextsystem_u:object_r:blueman_var_run_t:s0
Target Objects [ file ]
Sourcepython
Source Path   /usr/bin/python2.7
Port  Unknown
Host  localhost.localdomain
Source RPM Packages   python-2.7.5-16.fc20.x86_64
Target RPM Packages   
Policy RPMselinux-policy-3.12.1-197.fc20.noarch
Selinux Enabled   True
Policy Type   targeted
Enforcing ModeEnforcing
Host Name localhost.localdomain
Platform  Linux localhost.localdomain 3.19.8-100.fc20.x86_64
  #1 SMP Tue May 12 17:08:50 UTC 2015 x86_64 x86_64
Alert Count   7
First Seen2015-06-28 11:16:53 EDT
Last Seen 2015-06-28 

[issue24532] asyncio.sock_recv() blocks normal ioloop actions.

2015-06-29 Thread Yury Selivanov

Yury Selivanov added the comment:

 You should develop using asyncio debug mode:

Maybe we should promote this check to the production mode?

--

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



[issue24534] disable executing code in .pth files

2015-06-29 Thread Min RK

New submission from Min RK:

.pth files currently allow execution of arbitrary code, triggered by lines 
starting with `import`. This is a rarely understood, and often misbehaving 
feature. easy_install has used this feature to ensure that its packages are 
highest priority (even higher than stdlib). This is one of the unfortunate 
behaviors that pip undoes from easy_install, in part due to the problems it can 
cause. There is currently a proposal in setuptools to stop using this, even for 
easy_install.

The attached patch removes support for executing code in .pth files, throwing 
an ImportWarning if any such attempts at import are seen.

General question that might result in rejecting this patch:

Are there any good/valid use cases for .pth files being able to execute 
arbitrary code at interpreter start time?

If this is accepted, some implementation questions:

1. if the feature is removed in 3.6, should a DeprecationWarning be added to 
3.5?
2. Is ImportWarning the right warning class (or should there even be a warning)?

--
components: Installation
files: 0001-disable-executing-code-in-.pth-files.patch
keywords: patch
messages: 245959
nosy: minrk
priority: normal
severity: normal
status: open
title: disable executing code in .pth files
versions: Python 3.6
Added file: 
http://bugs.python.org/file39836/0001-disable-executing-code-in-.pth-files.patch

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