[issue22395] test_pathlib error for complex symlinks on Windows

2016-08-13 Thread Justin Foo

Justin Foo added the comment:

This is no longer a problem for me and I can't reproduce why it was even a 
problem in the first place.

--
status: open -> closed

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash

2016-08-13 Thread wevsty

wevsty added the comment:

To Decorater
If you are found to have crashes, I'm sorry, you can follow the previous 
suggestion to use python_d.exe then open a new issue uploading crash dump.
It would be better.

About the multiprocessing question,I would like to add some information.

My code uses a multiprocessing Pool,I used multiprocessing.util.debug opened 
the debug information.debug information is as follows.

[DEBUG/SpawnPoolWorker-7] thread 'MainThread' does not own a connection
[DEBUG/SpawnPoolWorker-7] making connection to manager
[DEBUG/SyncManager-2] starting server thread to service 'SpawnPoolWorker-7'
[INFO/SpawnPoolWorker-4] test:lock:token: Token(typeid='Lock', 
address='.\\pipe\\pyc-3816-0-95051ql_', id='e44c9bc720')
[INFO/SpawnPoolWorker-4] test:lock:handle: 712
[INFO/SpawnPoolWorker-7] test:lock:token: Token(typeid='Lock', 
address='.\\pipe\\pyc-3816-0-95051ql_', id='e44c9bc720')
[INFO/SpawnPoolWorker-7] test:lock:handle: 768
[DEBUG/SpawnPoolWorker-7] DECREF 'e44c9bc720'
[INFO/SpawnPoolWorker-4] leave:lock:token: Token(typeid='Lock', 
address='.\\pipe\\pyc-3816-0-95051ql_', id='e44c9bc720')
[DEBUG/SpawnPoolWorker-7] thread 'MainThread' has no more proxies so closing 
conn
[DEBUG/SpawnPoolWorker-7] DECREF 'b0182059f8'
[DEBUG/SyncManager-2] got EOF -- exiting thread serving 'SpawnPoolWorker-7'
[DEBUG/SpawnPoolWorker-4] INCREF 'e44c9bc720'
handle is closed
'ForkAwareLocal' object has no attribute 'connection'
[DEBUG/SpawnPoolWorker-7] thread 'MainThread' has no more proxies so closing 
conn
Traceback (most recent call last):
  File "C:/Users/Administrator/Desktop/Monitor_URL\Monitor_SQL.py", line 51, in 
execute_select_command
conn.close()
  File 
"C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\managers.py",
 line 949, in __exit__
return self._callmethod('release')
  File 
"C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\managers.py",
 line 716, in _callmethod
conn.send((self._id, methodname, args, kwds))
  File 
"C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\connection.py",
 line 204, in send
self._check_closed()
  File 
"C:\Users\Administrator\AppData\Local\Programs\Python\Python35\lib\multiprocessing\connection.py",
 line 136, in _check_closed
raise OSError("handle is closed")
OSError: handle is closed
[INFO/SpawnPoolWorker-7] Exception:lock:token: Token(typeid='Lock', 
address='.\\pipe\\pyc-3816-0-95051ql_', id='e44c9bc720')
[INFO/SpawnPoolWorker-7] Exception process:lock:token: Token(typeid='Lock', 
address='.\\pipe\\pyc-3816-0-95051ql_', id='e44c9bc720')
[DEBUG/SyncManager-1] got EOF -- exiting thread serving 'SpawnPoolWorker-7'
[DEBUG/SpawnPoolWorker-4] INCREF 'b0182059f8'
[DEBUG/SpawnPoolWorker-4] DECREF 'b0182059f8'
[DEBUG/SpawnPoolWorker-7] INCREF 'e44c9bc720'

This time the message and not the same,From the information looks like two 
processes simultaneously locking the same lock object, and then release 
happened the problems.I do not know if this is correct,
But i will continue to follow the issue.

--

___
Python tracker 

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



[issue21417] Compression level for zipfile

2016-08-13 Thread Justin Foo

Justin Foo added the comment:

I thought about that, but:

1. compresslevel=None might make look like no compression was being done at all
2. The current default is not 9 for all backends

--

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2016-08-13 Thread Martin Panter

Martin Panter added the comment:

For compatibility, I think it may be good to add custom implementations of the 
buffer attribute and detach() method to stdin/out. They should be able to at 
least read and write ASCII bytes. It might be easiest to keep them as the 
current BufferedReader/Writer objects. Probably also make stdin/out.fileno() 
defer to the buffer attribute.

With the current patch that only allows reading and writing in UTF-16 pairs, I 
forsee a few problems:

* I assume stdin.buffer.raw.readline() will try to read one byte at a time, and 
will therefore always indicate EOF.
* Incompatibility with using stdin/out.buffer for ASCII character input and 
output. I suggest testing the patch with “python -m base64”, a use case 
mentioned earlier in this thread.

--
nosy: +martin.panter
stage: needs patch -> patch review

___
Python tracker 

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



[issue27205] Failing doctests in Library/collections.rst

2016-08-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FYI, this should have been assigned to me (the author of the examples being 
modified).

--
assignee: zach.ware -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue26823] Shrink recursive tracebacks

2016-08-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy on PowerPC

2016-08-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

You can do no better than to consult with Uncle Timmy.

--
nosy: +rhettinger, tim.peters

___
Python tracker 

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



[issue26823] Shrink recursive tracebacks

2016-08-13 Thread Emanuel Barry

Emanuel Barry added the comment:

Is it possible to get this in in time for 3.6.0a4? The feature itself hasn't 
been touched in about 4 months, only tests have been tweaked since.

--

___
Python tracker 

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



[issue27762] ConfigParser ignores in-line comments for lines with semi-colons

2016-08-13 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +lukasz.langa

___
Python tracker 

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



[issue27762] ConfigParser ignores in-line comments for lines with semi-colons

2016-08-13 Thread Joshua Haas

New submission from Joshua Haas:

According to the 2.7 docs at 
https://docs.python.org/2/library/configparser.html, you can create in-line 
comments using ";" if it is preceded by white space.

However, if the value of a config option contains a semi-colon, for example 
"password=my;pass123", then only the first colon will be checked by the parser.

In the config file:
password=my;pass123 ;expires in 2018

Expected value:
my;pass123

Returned value:
my;pass123 ;expires in 2018

This is easily remedied with a while loop, lines 525-529 in the attached patch. 
Otherwise the docs should be changed to reflect this behavior, but a patch 
definitely seems more appropriate to me. Python 3.5 gives the expected value 
when using inline_comment_prefixes=';'.

--
components: Library (Lib)
files: ConfigParser_patch.py
messages: 272641
nosy: jahschwa
priority: normal
severity: normal
status: open
title: ConfigParser ignores in-line comments for lines with semi-colons
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file44101/ConfigParser_patch.py

___
Python tracker 

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



[issue27181] Add geometric mean to `statistics` module

2016-08-13 Thread Steven D'Aprano

Steven D'Aprano added the comment:

I've created a new issue to track the loss of accuracy on PowerPC: 
http://bugs.python.org/issue27761

--

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy on PowerPC

2016-08-13 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Tests fail on a Power PC buildbot:

http://buildbot.python.org/all/builders/PPC64LE%20Fedora%203.x/builds/1476/steps/test/logs/stdio
==
FAIL: testExactPowers (test.test_statistics.Test_Nth_Root) (i=29, n=11)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/test/test_statistics.py",
 line 1216, in testExactPowers
self.assertEqual(self.nroot(x, n), i)
AssertionError: 29.004 != 29

==
FAIL: testExactPowersNegatives (test.test_statistics.Test_Nth_Root) (i=-29, 
n=11)
--
Traceback (most recent call last):
  File 
"/home/shager/cpython-buildarea/3.x.edelsohn-fedora-ppc64le/build/Lib/test/test_statistics.py",
 line 1228, in testExactPowersNegatives
self.assertEqual(self.nroot(x, n), i)
AssertionError: -29.004 != -29

--

___
Python tracker 

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



[issue27761] Private _nth_root function loses accuracy on PowerPC

2016-08-13 Thread Steven D'Aprano

New submission from Steven D'Aprano:

First reported by Martin Panter here:

http://bugs.python.org/issue27181#msg272488

I'm afraid I don't know enough about PowerPC to suggest a fix other than 
weakening the test on that platform.

--
assignee: steven.daprano
messages: 272638
nosy: martin.panter, steven.daprano
priority: normal
severity: normal
status: open
title: Private _nth_root function loses accuracy on PowerPC
type: behavior
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



[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Steven D'Aprano

Steven D'Aprano added the comment:

Correction: `importlib.import_module` is also available in Python 2.7.

--

___
Python tracker 

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



[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Steven D'Aprano

Steven D'Aprano added the comment:

That is not a bug, it is a feature. `eval` only evaluates *expressions*, not 
statements, and `import` is a statement. Neither of those is going to change.

Starting in Python 3.1, you could use `import_module`:

https://docs.python.org/3/library/importlib.html#importlib.import_module

There's no really great solution for Python 2, you could use the built-in 
`__import__` function, but being a dunder function it is for Python's internal 
use, not really intended for normal use. Or write a small helper function:

# untested, and beware of security implications!
# don't use this on untrusted input
def import_module(name):
ns = {}
exec("import " + name, ns, ns)
return ns[name]

Now you can use that function in `eval`.

--
nosy: +steven.daprano
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue27760] integer overflow in binascii.b2a_qp

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset af42635b5ed1 by Benjamin Peterson in branch '2.7':
fix possible integer overflow in binascii.b2a_qp (closes #27760)
https://hg.python.org/cpython/rev/af42635b5ed1

New changeset 54c74212db91 by Benjamin Peterson in branch '3.3':
fix possible integer overflow in binascii.b2a_qp (closes #27760)
https://hg.python.org/cpython/rev/54c74212db91

New changeset 9822bf4bcece by Benjamin Peterson in branch '3.4':
merge 3.3 (closes #27760)
https://hg.python.org/cpython/rev/9822bf4bcece

New changeset a277ab6bf66b by Benjamin Peterson in branch '3.5':
merge 3.4 (closes #27760)
https://hg.python.org/cpython/rev/a277ab6bf66b

New changeset 4a00d4ebf60f by Benjamin Peterson in branch 'default':
merge 3.5 (closes #27760)
https://hg.python.org/cpython/rev/4a00d4ebf60f

--
nosy: +python-dev
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



[issue27760] integer overflow in binascii.b2a_qp

2016-08-13 Thread Benjamin Peterson

New submission from Benjamin Peterson:

Thomas E Hybel reports:

This vulnerability resides in /Modules/binascii.c in the function
binascii_b2a_qp_impl. The problem is that the integer variable "odatalen" can
overflow to become a small number.

The function binascii_b2a_qp_impl qp-encodes binary data. First it computes the
output string's length in the variable "odatalen":

/* First, scan to see how many characters need to be encoded */
in = 0;
while (in < datalen) {
if ((databuf[in] > 126) || ... )
{
...
odatalen += 3;
in++;
}
...
}

As we can see, each input character can result in more than three
output-characters. Then we allocate the output string:

odata = (unsigned char *) PyMem_Malloc(odatalen);

And finally we encode the input-string and write the result into odata.

If our string is so large that "odatalen" will wrap around and become a small
number, then the odata buffer will be too small to hold the data. Our input is
then copied into this too-small buffer. So the integer overflow results in a
heap buffer overflow.

Here's a proof-of-concept script:

--- begin script ---

import binascii
binascii.b2a_qp(b"\x80"*0x531dec0e) # this number gives odatalen=2

--- end script ---

Note that this script assumes a 32-bit system where the "odatalen" variable will
be 4 bytes wide. When run on Python-3.5.2, 32-bits, we get a segfault:

(gdb) r ../poc3.py
Starting program: /home/ubuntu32/python3/Python-3.5.2/python ../poc3.py

Breakpoint 1, binascii_b2a_qp_impl (module=module@entry=0xb7c370f4,
data=data@entry=0xb6e4, quotetabs=0x0, istext=0x1, header=0x0)
at /home/ubuntu32/python3/Python-3.5.2/Modules/binascii.c:1448
1448odata = (unsigned char *) PyMem_Malloc(odatalen);
(gdb) p odatalen
$27 = 0x2
(gdb) p datalen
$28 = 0x531dec0e
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0xb7fd1f63 in to_hex (ch=0x80, s=s@entry=0x83c5fff "")
at /home/ubuntu32/python3/Python-3.5.2/Modules/binascii.c:1333
1333s[1] = "0123456789ABCDEF"[uvalue % 16];
(gdb) bt
#0  0xb7fd1f63 in to_hex (ch=0x80, s=s@entry=0x83c5fff "")
at /home/ubuntu32/python3/Python-3.5.2/Modules/binascii.c:1333
#1  0xb7fd22fa in binascii_b2a_qp_impl (module=module@entry=0xb7c370f4,
data=data@entry=0xb6e4, quotetabs=0x0, istext=0x1, header=0x0)
at /home/ubuntu32/python3/Python-3.5.2/Modules/binascii.c:1476
#2  0xb7fd2510 in binascii_b2a_qp (module=module@entry=0xb7c370f4,
args=args@entry=0xb7cbbb5c, kwargs=kwargs@entry=0x0)
at /home/ubuntu32/python3/Python-3.5.2/Modules/clinic/binascii.c.h:510
#3  0x080e0ef4 in PyCFunction_Call (func=func@entry=0xb7c37534,
args=args@entry=0xb7cbbb5c, kwds=kwds@entry=0x0)
at Objects/methodobject.c:98

--
components: Library (Lib)
messages: 272634
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: integer overflow in binascii.b2a_qp
type: security
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Mark Williams

Mark Williams added the comment:

OK!  Sorry for the trouble.

On Sat, Aug 13, 2016 at 6:17 PM, Guido van Rossum 
wrote:

>
> Guido van Rossum added the comment:
>
> Also don't spend more time on this, I found a way to apply the patch
> cleanly.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Also don't spend more time on this, I found a way to apply the patch
cleanly.

--

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Guido van Rossum

Guido van Rossum added the comment:

We only need 3.5; 3.4 is no longer supported.

--

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Mark Williams

Mark Williams added the comment:

Whoops!  I pulled from https://github.com/python/cpython and branched off of 
master.  The previous commit was 
https://github.com/python/cpython/tree/043152b8da83105ff5cba88d4e6ef1d5c64b3602

I can generate new patches using hg.python.org's 3.4 and 3.5 branches.  Please 
stand by.

--

___
Python tracker 

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



[issue27756] Add pyd icon for 3.6

2016-08-13 Thread Ned Deily

Changes by Ned Deily :


--
components: +Windows
nosy: +paul.moore, steve.dower, tim.golden, zach.ware

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Your patch doesn't apply cleanly to the 3.4 or 3.5 branches -- how did you 
generate it?

--

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread Benjamin Peterson

Changes by Benjamin Peterson :


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

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

>>> ... it would be nice if ~ acted as negation on bools (~False being
>>> True and ~True being false) instead of mapping them to -1 and -2 
>>> as it currently does.

I'm strongly against this proposal for several reasons.

1. One way to do it.  We don't need a second way to spell "not x".  As a Python 
teacher, I will find it harder to explain the language with this change 
(sometimes ~ sometimes means bitwise-not and sometimes it means "not").

2. We were supposed to learn from our mistake using "%" for string formatting 
which causes problems because the operator precedence was the same as 
multiplication and division and inappropriate for formatting.   In the case, 
the precedence for the bitwise-and/or/not is very different from 
boolean-and/or/not (the former occur before comparisons and the latter occur 
after comparisons).

3. Not all Liskov violations matter, but it is not uncommon to rely on True and 
False being interchangeable with 1 and 0.  I suspect this change will break 
some existing code in a way that is hard to find and may not be covered by 
existing unit tests.

4. If we care at all about Python 3 adoption, we will stop introducing hundreds 
of little breakages and changes in meaning that add almost no value but do 
increase the difficultly (and cost) of moving to Python 3.  Guido has referred 
to this as "death by a thousand cuts".

So please put me down with R. David Murray as recommending that this proposal 
to be deemed "officially dropped".

--
nosy: +rhettinger

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Unsubscribing from this ridiculous issue. Guido, do your thing.

--

___
Python tracker 

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



[issue27759] selectors incorrectly retain invalid file descriptors

2016-08-13 Thread Mark Williams

New submission from Mark Williams:

Registering a file descriptor with EpollSelector.register that epoll(7) refuses 
results in the selector retaining a SelectorKey for that file descriptor, even 
though it's not monitored.

The following program attempts to register a file on the filesystem with an 
EpollSelector.  epoll_ctl(2) returns EPERM when given a such a file descriptor, 
so it shouldn't be registered with the selector, but it is registered.


import selectors
import tempfile
import traceback

sel = selectors.EpollSelector()

with tempfile.TemporaryFile() as f:
try:
sel.register(f, selectors.EVENT_READ)
except PermissionError:
traceback.print_exc()
print("This should have raised a KeyError:", sel.get_key(f))


It produces this output on Pythons 3.4-3.6:

Traceback (most recent call last):
  File "/tmp/sel.py", line 9, in 
sel.register(f, selectors.EVENT_READ)
  File "/usr/lib/python3.4/selectors.py", line 402, in register
self._epoll.register(key.fd, epoll_events)
PermissionError: [Errno 1] Operation not permitted
This should have raised a KeyError: SelectorKey(fileobj=<_io.BufferedRandom 
name=8>, fd=8, events=1, data=None)

A similar problem exists with KqueueSelector.  Consider the following program:


import selectors
import tempfile
import traceback

sel = selectors.KqueueSelector()

f = tempfile.TemporaryFile()
filedescriptor = f.fileno()
f.close()

try:
sel.register(filedescriptor, selectors.EVENT_READ)
except OSError:
traceback.print_exc()

print("This should have raised a KeyError:", sel.get_key(filedescriptor))


In this case selectors._fileobj_to_fd doesn't detect that the integer file 
descriptor is closed.  

Note that _fileobj_to_fd should not be changed! Attempting to use, say, 
fcntl(fd, fcntl.GET_FD) to detect a closed file descriptor introduces a TOCTTOU 
bug.  Another thread (or another process, if the file descriptor refers to a 
socket shared between two or more processes and one calls shutdown(2) on it) 
can change the state of the file descriptor between the time it's checked and 
the time it's registered.  A new file might even be opened and given the 
previous file descriptor.

The attached patch catches any exception raised by EpollSelector.register or 
KqueueSelector.register, removes the SelectorKey from BaseSelector's table, and 
then re-raises the exception.

Note that I've included asyncio as an affected component, because asyncio wraps 
the selectors module.

--
components: asyncio
files: selectors.patch
keywords: patch
messages: 272626
nosy: Mark.Williams, gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: selectors incorrectly retain invalid file descriptors
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44100/selectors.patch

___
Python tracker 

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



[issue27758] integer overflow in the _csv module's join_append_data function

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset fdae903db33a by Benjamin Peterson in branch '2.7':
check for overflow in join_append_data (closes #27758)
https://hg.python.org/cpython/rev/fdae903db33a

New changeset afa356402217 by Benjamin Peterson in branch '3.3':
check for overflow in join_append_data (closes #27758)
https://hg.python.org/cpython/rev/afa356402217

New changeset 10b89df93c58 by Benjamin Peterson in branch '3.4':
merge 3.3 (#27758)
https://hg.python.org/cpython/rev/10b89df93c58

New changeset 55e8d3e542bd by Benjamin Peterson in branch '3.5':
merge 3.4 (closes #27758)
https://hg.python.org/cpython/rev/55e8d3e542bd

New changeset 609b554dd4a2 by Benjamin Peterson in branch 'default':
merge 3.5 (closes #27758)
https://hg.python.org/cpython/rev/609b554dd4a2

--
nosy: +python-dev
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



[issue27758] integer overflow in the _csv module's join_append_data function

2016-08-13 Thread Benjamin Peterson

New submission from Benjamin Peterson:

Thomas E Hybel on PSRT reports:

This vulnerability is an integer overflow leading to a heap buffer overflow. I
have attached a proof-of-concept script below.

The vulnerability resides in the Modules/_csv.c file, in the join_append and
join_append_data functions.

join_append initially calls join_append_data with copy_phase=0 to compute the
new length of its internal "rec" buffer. Then it grows the buffer. Finally it
calls join_append_data with copy_phase=1 to perform the actual writing.

The root issue is that join_append_data does not check for overflow when
computing the field rec_len which it returns. By having join_append_data called
on a few fields of appropriate length, we can make rec_len roll around and
become a small integer.

Note that there is already a check in join_append for whether (rec_len < 0). But
this check is insufficient as we can cause rec_len to grow sufficiently in a
single call to never let join_append see a negative size.

After the overflow happens, rec_len is a small integer, and thus when
join_append calls join_check_rec_size to potentially grow the rec buffer, no
enlargement happens. After this, join_append_data is called again, now with
copy_phase=1, and with a giant field_len.

Thus join_append_data writes the remaining data out-of-bounds of the self->rec
buffer which is located on the heap. Such a complete heap corruption should
definitely be exploitable to gain remote code execution.


Further details:

Tested version: Python-3.5.2, 32 bits

Proof-of-concept reproducer script (32-bits only):

--- begin script ---

import _csv

class MockFile:
def write(self, _):
pass

writer = _csv.writer(MockFile())
writer.writerow(["A"*0x1, '"'*0x7f00]) 

--- end script ---

Python (configured with --with-pydebug) segfaults when the script is run. A
backtrace can be seen below. Note that the script only crashes on 32-bit
versions of Python. That's because the rec_len variable is an ssize_t, which is
4 bytes wide on 32-bit architectures, but 8 bytes wide on 64-bit arches.


(gdb) r
Starting program: /home/ubuntu32/python3/Python-3.5.2/python ../poc1.py
...
Program received signal SIGSEGV, Segmentation fault.
PyType_IsSubtype (a=0x0, b=b@entry=0x82d9aa0 ) at 
Objects/typeobject.c:1343
1343mro = a->tp_mro;
(gdb) bt
#0  PyType_IsSubtype (a=0x0, b=b@entry=0x82d9aa0 ) at 
Objects/typeobject.c:1343
#1  0x080e29d9 in PyModule_GetState (m=0xb7c377f4) at Objects/moduleobject.c:532
#2  0xb7fd1a33 in join_append_data (self=self@entry=0xb7c2ffac, 
field_kind=field_kind@entry=0x1, field_data=field_data@entry=0x37c2f038,
field_len=field_len@entry=0x7f00, quoted=quoted@entry=0xb710, 
copy_phase=copy_phase@entry=0x1)
at /home/ubuntu32/python3/Python-3.5.2/Modules/_csv.c:1060
#3  0xb7fd1d6e in join_append (self=self@entry=0xb7c2ffac, 
field=field@entry=0x37c2f018, quoted=0x1, quoted@entry=0x0)
at /home/ubuntu32/python3/Python-3.5.2/Modules/_csv.c:1138
...

--
components: Library (Lib)
messages: 272624
nosy: benjamin.peterson
priority: normal
severity: normal
status: open
title: integer overflow in the _csv module's join_append_data function
type: security
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue23369] integer overflow in _json.encode_basestring_ascii

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6fa0ebfdc136 by Benjamin Peterson in branch '2.7':
fix possible overflow in encode_basestring_ascii (#23369)
https://hg.python.org/cpython/rev/6fa0ebfdc136

--

___
Python tracker 

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



[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Decorater

New submission from Decorater:

runnign exec on import lines are fine however if I run the following code in a 
exec:

>>>import py2pycx;py2pycx.api.compress_script(sys.path[0] + 
>>>'\resources\Dependencies', 'six.py')
Traceback (most recent call last):
  File ".\resources\Dependencies\DecoraterBotCore\BotCommands.py", line 261, in 
debug_code
debugcode = eval(debugcode)
  File "", line 1
import py2pycx;py2pycx.api.compress_script(sys.path[0] + 
'\resources\Dependencies\', 'six.py')
 ^
SyntaxError: invalid syntax

It says it is a SyntaxError. It would be nice if eval could support import 
statements as well so I do not have to import the module in the file/package to 
be able to use eval with the functions it has.

--
messages: 272621
nosy: Decorater
priority: normal
severity: normal
status: open
title: eval() does not allow import statements to run.

___
Python tracker 

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



[issue27757] eval() does not allow import statements to run.

2016-08-13 Thread Decorater

Decorater added the comment:

eval*
my typo is OP

--

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

Well, maybe I'm wrong about the 'next feature release' bit, I won't claim to be 
able to read Guido's mind :)

--

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

Well, in this context "in 3.6" means "in the next feature release", so it isn't 
as if the window closes forever.

I'd vote -1 myself.  It doesn't seem like a useful enough feature to be worth 
adding, given that ~x is equivalent to "not x" for booleans, but "not x" 
returns a bool regardless of what x is while ~ doesn't.  In fact, I'd classify 
it as an attractive nuisance.

Note also that & and | return booleans only when both operands are boolean, but 
the value of expression as an integer is the same regardless of the type 
returned.  This would not be true for ~.

So, I vote for "officially dropped".

--

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Stefan Krah

Changes by Stefan Krah :


--
nosy:  -skrah

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Decorater

Decorater added the comment:

not to mention I like to use the following expression myself.

pie = 22 / 7  # because why not?
tau = 2 * pie

--
nosy: +Decorater

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Vedran Čačić

Vedran Čačić added the comment:

As an Easter egg, of course. I'm all for it. But please take a look at 
https://docs.python.org/3.5/search.html?q=antigravity_keywords=yes=default

--

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash

2016-08-13 Thread Decorater

Decorater added the comment:

I do know for sure the crash happens in python.exe and blames ntdll.dll for it.

--

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash

2016-08-13 Thread Decorater

Decorater added the comment:

I can confirm that I also get the same crash.

--
Added file: http://bugs.python.org/file44099/python.exe.8228.dmp

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread Vedran Čačić

Vedran Čačić added the comment:

Ok, so let me try to summarize.

Some people realized that & and | on bools are overridden to return bools 
instead of ints, and thought it would be nice if ~ acted as negation on bools 
(~False being True and ~True being false) instead of mapping them to -1 and -2 
as it currently does.

A (weak, IMO) counterargument is that currently int(a op b) == int(a) op int(b) 
for all ints a and b, even those ints that are also bools. But of course 
str(True) != str(1), so of course _some_ special methods can be overridden with 
a different behavior (returning non-equal things).

A better (again IMO) counterargument is that those (&, |, ~) operators are 
meant to be bitwise, that is, threaded over all the bits in the operands. In 
that case, bool with that ~ implementation should not be looked at as a 
subclass of int* qua long in Py2 (infinite number of bits to the left), but as 
a subclass of "int1" in the sense of Py2 int being int32 (fixed number of 
bits). But if we are to drive this to the natural conclusion, then True == -1 
when upcasted to int, not 1, and that would probably break too much code. Also, 
there are bitwise operators (<<, >>) which don't have a nice analogue on int1 
(except always returning 0, which is not interesting).

Also (wasn't mentioned in the thread, but probably worth mentioning), Python 3 
really tries to not have fixed-length ints anywhere. For example, indexing 
bytes gives ints, and they are not int8, but ordinary int*: ~b'a'[0] is -98, 
not 158. Bools might be special, but they are probably not _that_ special. We 
have worked long and hard to remove fixed-length ints from Python, it would be 
very counterproductive to add them back again.

The only reason I'm bringing this here, is that Guido said at some moment

> So we're either going to introduce it in 3.6 and tell people
about it in case their code might break, or we're never going to do
it.

and I would feel bad to tell future learners of Python "that feature was 
considered, but we simply forgot about it and the opportunity closed". :-O

If the sentiment has really crystallized to "we shouldn't do this" in the 
meantime, no problem. But it seems no pronouncement was made.

--

___
Python tracker 

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



[issue27756] Add pyd icon for 3.6

2016-08-13 Thread Decorater

New submission from Decorater:

I did some working and did a halfed one for pyd's it basically combines it icon 
from python.exe with the DLL "gears" for windows DLL's beig under that. 
Hopefully it will work. (Anyone could use this as a base file and restyle it or 
whatever if they want. At least I tried.

(note: the file would have to go under the PC directory as well. Hopefully 
something from the python installer can associate them with pyd files so that 
way people can distinquish them from any other file type (like pdbs,lib,w/e 
with no icon(s)).

--
files: pyd.ico
messages: 272613
nosy: Decorater
priority: normal
severity: normal
status: open
title: Add pyd icon for 3.6
versions: Python 3.6
Added file: http://bugs.python.org/file44098/pyd.ico

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-13 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch.  FWIW, that does seem to solve the crash. Brett, look 
good to you?  If so, I can push the fix.

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue21417] Compression level for zipfile

2016-08-13 Thread Decorater

Decorater added the comment:

Yes, it would make sence or better yet have a arg that is optional that if not 
set make it = ``9``.

--
nosy: +Decorater

___
Python tracker 

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



[issue21417] Compression level for zipfile

2016-08-13 Thread Justin Foo

Justin Foo added the comment:

Would compresslevel be a suitable argument? All the backend compressors accept 
values from 1 to 9 if I'm not mistaken.

--
nosy: +jfoo

___
Python tracker 

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



[issue27755] Retire DynOptionMenu with a ttk Combobox

2016-08-13 Thread Justin Foo

Changes by Justin Foo :


--
keywords: +patch
Added file: http://bugs.python.org/file44097/issue27755.patch

___
Python tracker 

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



[issue27755] Retire DynOptionMenu with a ttk Combobox

2016-08-13 Thread Justin Foo

New submission from Justin Foo:

One aspect of the IDLE interface that looks extremely old is the the dropdown 
menu. In the patch, I think I've preserved whatever essential functionality 
DynOptionMenu used to have, but I'm relatively unfamiliar with Tk so I'm not 
sure.

--
assignee: terry.reedy
components: IDLE
messages: 272609
nosy: jfoo, terry.reedy
priority: normal
severity: normal
status: open
title: Retire DynOptionMenu with a ttk Combobox
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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

Agreed, the current wording is correct and complete, except for the name vs 
named bit.  I've fixed that.

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b1e4c8a3e786 by R David Murray in branch '2.7':
#27753: fix typo (name->named).
https://hg.python.org/cpython/rev/b1e4c8a3e786

New changeset c1cc1f616285 by R David Murray in branch '3.5':
#27753: fix typo (name->named).
https://hg.python.org/cpython/rev/c1cc1f616285

New changeset dda25c37d02b by R David Murray in branch 'default':
Merge: #27753: fix typo (name->named).
https://hg.python.org/cpython/rev/dda25c37d02b

--
nosy: +python-dev

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

That doesn't look like a thread consensus, nor does the link you provide 
explain what is under discussion.  I'm not going to search the thread myself, 
so my answer right now is "dropped" unless there was actually a positive 
conclusion to that thread for whatever it is :)

--
nosy: +r.david.murray

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2016-08-13 Thread Adam Bartoš

Adam Bartoš added the comment:

Hello Steve, that's great you are working on this!

I've ran through your patch and I have the following remarks:

• Since wide chars have two bytes, there may be problem when someone wants to 
read or write odd number of bytes. If the number is > 1, it's ok since the code 
may read or write less bytes, but when the number is exactly 1, the code should 
maybe raise some exception.

• WriteConsoleW always fails with ERROR_NOT_ENOUGH_MEMORY (8) if we try to 
write more than a certain number of bytes. For me, the number is something like 
41000. Unfortunately, it depends on actual heap usage of the console process. I 
do len = min(len, 32767) in write. The the value chosen comes from issue11395 .

• If someone types something like ^Zfoo, the standard sys.stdin returns '' -- 
it ignores everything after EOF if it is the first byte read. I reproduce the 
bahaviour in win_unicode_console to be compatible.

• There may be some issue when someone hits Ctrl-C on input. It seems that in 
that case, ReadConsoleW fails with ERROR_OPERATION_ABORTED (995) and some 
signal is asynchronously fired. It may happen that the corresponding 
KeyboardInterrupt exception occurs later that it should. In my Python/ctypes 
situation I do an ugly hack – I detect ERROR_OPERATION_ABORTED and in that case 
I sleep for 0.1 seconds to wait for the exception. I understand that the 
situation may me different in C.

--

___
Python tracker 

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



[issue27720] decimal.Context.to_eng_string wrong docstring

2016-08-13 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue27720] decimal.Context.to_eng_string wrong docstring

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset de2a9c98948e by Raymond Hettinger in branch '3.5':
Issue #27720: Fix error in eng_to_decimal docs and add examples from the 
specification.
https://hg.python.org/cpython/rev/de2a9c98948e

--

___
Python tracker 

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



[issue27720] decimal.Context.to_eng_string wrong docstring

2016-08-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 825713d3786a by Raymond Hettinger in branch '2.7':
Issue #27720: Fix error in eng_to_decimal docs and add examples from the 
specification.
https://hg.python.org/cpython/rev/825713d3786a

--
nosy: +python-dev

___
Python tracker 

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



[issue25825] AIX shared library extension modules installation broken

2016-08-13 Thread David Edelsohn

David Edelsohn added the comment:

The second of two patches. This patch changes the definition of LDSHARED for 
AIX in configure to reference the matching installed location as defined in 
Makefile.pre.in by Patch1.  The definition from configure propagates into 
_sysconfigdata.py.

This change will (further) break test_distutils, but the testcase is wrong on 
AIX. And, for AIX, a correct test result clearly does not correspond to correct 
behavior.

The patch affects both configure.ac and configure because the corresponding 
change to configure is obvious. The person who installs the patch may 
regenerate configure, as appropriate.

--
Added file: http://bugs.python.org/file44096/Issue25825-patch2.txt

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread SilentGhost

SilentGhost added the comment:

I don't see how this is an improvement. Before it clearly said that the first 
argument must be file name, now it's an oddly confusing statement. Also, 
typically we don't list all the possibilities of what the arguments must not be.

--

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Georg Brandl

Georg Brandl added the comment:

Please folks. Stop taking this so seriously and remember that this is the 
language where you can type in

>>> import antigravity

and it actually works. (Sort of.)

--

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Decorater

Decorater added the comment:

Ok, file uploaded.

--

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Decorater

Changes by Decorater :


Added file: http://bugs.python.org/file44095/py_compile.rst

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Vedran Čačić

Vedran Čačić added the comment:

> However an honest and non partisan web site would list all the use of pi 
> without 2 where the formula would be more complicated. I don't see that so 
> I'm still not convinced.

"non partisan" is probably hard to find, but if you want to see the other side 
of the story, http://www.thepimanifesto.com/ is probably most accessible.

--

___
Python tracker 

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



[issue27754] Changing the meaning of bool.__invert__

2016-08-13 Thread Vedran Čačić

New submission from Vedran Čačić:

Not that I'm very much for it, but I'd like this not to be forgotten:

https://mail.python.org/pipermail/python-ideas/2016-April/039665.html

Is this going to be done in Py3.6? Or officially dropped?

--
messages: 272597
nosy: veky
priority: normal
severity: normal
status: open
title: Changing the meaning of bool.__invert__

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2016-08-13 Thread Steve Dower

Steve Dower added the comment:

I'm now actively working on this for 3.6.

I've attached my first pass at implementing an alternative raw IO stream that 
uses the *ConsoleW APIs instead of the CRT. It works fine for basic print() and 
input() (including handling redirection "properly", which is a separate issue 
to change the default encoding there, and not issue17620 yet).

I expect there to be many *many* compatibility issues with this change, so we 
really need everyone interested to try it out and see what doesn't work. So far 
I haven't even tried looking at readline hooks or similar (though maybe all 
those issues fall under issue17620?).

Any *specific, technical* information about compatibility issues would be 
appreciated (i.e. enough that I can fix the issue without having to completely 
reproduce your setup - I'll be working on doing those myself anyway, so simply 
saying "X is broken" isn't helpful yet).

It doesn't look like this will be available in 3.6.0a4, but I think I should be 
able to land it by the first beta.

--
assignee:  -> steve.dower
nosy: +ned.deily
versions: +Python 3.6 -Python 3.5
Added file: http://bugs.python.org/file44094/winconsoleio.diff

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread SilentGhost

SilentGhost added the comment:

Do you care to propose an improved wording?

--

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Decorater

Decorater added the comment:

yeah, true and to specify that it cannot be anything but a file.

--

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Xiang Zhang

Xiang Zhang added the comment:

Maybe in the sentence, name should be named?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue12345] Add math.tau

2016-08-13 Thread Xavier Combelle

Xavier Combelle added the comment:

Python will really follow the tau sort joke ? I never saw it mentioned in any 
serious math or programming document. All the github search result looks like 
people who are in this joke (kind of).


The page http://tauday.com/state-of-the-tau list very little use of tau in 
relevant domains, the most relevant to our discussion would be the including of 
tau in modula-2 standard library.

I don't see how the introduction of the unknown tau constant in python programs 
will make them clearer or better to the targeted public who will read them.

I must confess however that 2*pi occurs frequently in formula and these formula 
would be simplified if tau was used. However an honest and non partisan web 
site would list all the use of pi without 2 where the formula would be more 
complicated. I don't see that so I'm still not convinced.

I know that Guido van Rossum is the Benevolent dictator for life of python, but 
as I understand it until this point, the dictator position was used after all 
argument took place and not before.

--
nosy: +xcombelle

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread SilentGhost

SilentGhost added the comment:

It says "The source code is loaded from the file name *file*". That seems 
unambiguous enough to me.

--
nosy: +SilentGhost
type:  -> behavior

___
Python tracker 

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



[issue27753] py_compile.compile() does not specify if it can accept a file like object or a bytes like object with the file's data.

2016-08-13 Thread Decorater

New submission from Decorater:

py_compile.compile() does not specify if it can accept a file like object or a 
bytes like object with the file's data.

Although I need something that can allow me to import byte like objects if the 
object contains valid python script data.
(basically it would have to act as a import unless I have to exec the data in 
it which would be totally bad as it would not be able to retain all of the data.

Long story short I need a way to import the data returned from the dec_script() 
function in this: https://bpaste.net/show/694c231c566c

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 272590
nosy: Decorater, docs@python
priority: normal
severity: normal
status: open
title: py_compile.compile() does not specify if it can accept a file like 
object or a bytes like object with the file's data.
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue27749] python 3.5.2 maybe crash

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

Decorator: In python code you generally want to let the exception bubble up so 
that you can see what the error was.  Sometimes you do want to catch general 
errors, but mostly you don't.

As for C++ try/catch, CPython is written in C, not C++.

So, your comment doesn't really have any relevance to this issue, I'm afraid.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2016-08-13 Thread R. David Murray

R. David Murray added the comment:

No 3.4 can't be patched, this is not a security issue.  A patch to make the 
behvior what we want should be generated against either 3.5 or 3.6, and the 
committer will deal with any issues arising from 3.5 vs 3.6 issues.

--
versions: +Python 3.5, Python 3.6 -Python 2.7, Python 3.2, Python 3.3, Python 
3.4

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-13 Thread Xiang Zhang

Xiang Zhang added the comment:

Try Simon's snippet I think I am right.

With the current code, the result is:

1..1
Segmentation fault (core dumped)

With Py_INCREF:

1..1
ok 1 - was able to loop 100 times

I upload the working patch.

--
keywords: +patch
Added file: http://bugs.python.org/file44093/issue27736.patch

___
Python tracker 

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



[issue27736] repeated Py_Initialize/PyRun_SimpleString/Py_Finalize segfaults

2016-08-13 Thread Xiang Zhang

Xiang Zhang added the comment:

It looks to me from the traceback Simon given that DirEntryType's dealloc 
function is called. From the code, shouldn't we Py_INCREF DirEntryType before 
PyModule_AddObject?

--
nosy: +xiang.zhang

___
Python tracker 

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



[issue16487] Allow ssl certificates to be specified from memory rather than files.

2016-08-13 Thread Jan-Philip Gehrcke

Jan-Philip Gehrcke added the comment:

Hello!

Like everybody in this thread I would love to see this land and have prepared a 
new patch, hoping that we can process this still for 3.6.

Antoine summarized the core task here very well:

> Let's stay focused on what is
> necessary to solve this use case, IMO (i.e. specify non-file-backed data
> as a certification chain or private key).

What follows is what I believe is the consensus in this thread about a minimum
viable solution (points mentioned earlier, enriched with some detail):

- The `certfile` and `keyfile` arguments to `SSLContext.load_cert_chain()` can
  both be either a file path or a file object.

- `str` or `bytes` values to both, `certfile` and `keyfile`, are interpreted
  as paths.

- The `password` behavior must stay as is, independent of `certfile`/`keyfile`
  being file object or path.

- When handing file paths to `load_cert_chain()`, the behavior must stay as is,
  in all detail.

- When handing file objects to `load_cert_chain()`,

  - use the OpenSSL API call `PEM_read_bio_PrivateKey()` for loading the key
data (reading PEM data is what's currently supported).

  - support the case where the `certfile` file object first presents a private
key and then (a) certificate(s), as currently documented:

"""
Often the private key is stored in the same file as the certificate; in
this case, only the certfile parameter to SSLContext.load_cert_chain() and
wrap_socket() needs to be passed. If the private key is stored with the
certificate, it should come before the first certificate in the
certificate chain:
"""

Ref:
  - https://docs.python.org/3/library/ssl.html#combined-key-and-certificate

  - resemble the OpenSSL API call `SSL_CTX_use_certificate_chain_file()`
behavior for loading the certificate data (as this is what's currently
used in the `SSLContext.load_cert_chain()` implementation in _ssl.c. There
is no direct correspondence for this function reading the data directly
from memory BIOs. Relevant documentation for resembling that behavior:

"""
SSL_CTX_use_certificate_chain_file() adds the first certificate found in
the file to the certificate store. The other certificates are added to the
store of chain certificates using SSL_CTX_add1_chain_cert.
"""

"""
For a longer chain, the client must send the complete chain [...]. This
can only be accomplished by either adding the intermediate CA certificates
into the trusted certificate store for the SSL_CTX object [...], or by
adding the chain certificates using the SSL_CTX_add_extra_chain_cert
function,
"""

"""
When building its own certificate chain, an OpenSSL client/server will try
to fill in missing certificates from CAfile/CApath, if the certificate
chain was not explicitly specified (see SSL_CTX_add_extra_chain_cert,
SSL_CTX_use_certificate.
"""

Refs:
  - 
https://github.com/python/cpython/blob/0852878a81edd5c16776a68ce34c45cca233deae/Modules/_ssl.c#L2824
  - https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_use_certificate.html
  - 
https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_set_client_cert_cb.html
  - 
https://www.openssl.org/docs/manmaster/ssl/SSL_CTX_load_verify_locations.html

When inspecting the OpenSSL code for SSL_CTX_use_certificate_chain_file(),
some of the above statements are not entirely correct.

After inspection, to me the safest bet seems to keep the memory/BIO-based
load_cert_chain() implementation as close as possible to

SSL_CTX_use_certificate_chain_file() from OpenSSL 1.0.2h:

  https://fossies.org/dox/openssl-1.0.2h/ssl__rsa_8c_source.html#l00685

use_certificate_chain_file() in OpenSSL 1.1.0-pre6:

  https://fossies.org/dox/openssl-1.1.0-pre6/ssl__rsa_8c_source.html#l00599

Using this as a template (instead of coming up with a solution purely
based on OpenSSL docs) ensures that this part of the current
`SSLContext.load_cert_chain()` docs will be remain correct:

"""
The certfile [...] in PEM format containing the certificate as well as any
number of CA certificates needed to establish the certificate’s
authenticity.
"""


More behavioral detail that I planned with:

- `certfile` and `keyfile`, if given both, must both be a file path or both be
  a file object. A mixture is undefined behavior and leads to an error
  depending on the specifics of the mixture.

- If `certfile` and `keyfile` are not file paths, expect them to have a read()
  method and just call it. Let a TypeError or AttributeError be handled by the
  caller (as done elsewhere in the stdlib).

- Use the existing Python MemoryBIO abstractions introduced by Geert Jansen in 
this
  beautiful patch: 
https://github.com/python/cpython/commit/08802a11fdb844a5aaec3a1dc67d8281d582d22b

  That is, prepare these BIOs in Python code and pass them to an underlying C
  function that 

[issue27749] python 3.5.2 maybe crash

2016-08-13 Thread Decorater

Decorater added the comment:

Crashes also happen from Recursion if not careful. Idk why but it happens. 
Although some of it is probably by not using try / catch probably anywhere in 
the python source code as a safeguard. I always like try / catch even in C++ as 
you never know when crap might happen to make things crash. A Perfect Example 
is a Access violation.

(Yes I have this is a Standard for me and it gets me to great quality code)
(this makes me wonder if Windows does not use try / catch anywhere. It would be 
nice if Microsoft Required try / catch in every function for drivers as well to 
hopefully make them more stable.)

All I know is I like having a lot of Checks (even if not required) that can 
actually prevent any and all exceptions to begin with.

And yes from what I learned from experiance myself. Always use try and catch 
anything before it is to late will help you in the long run.

(not to mention I blame Microsoft for not replacing their current Windows 
Update for when Updates Fail with a Detailed list of the names of the update(s) 
that failed and a description of what the reason is without Error code(s) as 
the Codes does not tell crap about why they failed. So, yeah I point my fingers 
at whoever wrote Windows Update, to fix their crap. As this is a issue in 
windows 7 SP1, 8, 8.1, and 10.)

--
nosy: +Decorater

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2016-08-13 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +Cubky, Devin Jeanpierre, eric.araujo, ezio.melotti, jairotrad, jbitcm-, 
mikehoy, r.david.murray, terry.reedy -lissacoffeyx

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2016-08-13 Thread SilentGhost

Changes by SilentGhost :


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

___
Python tracker 

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



[issue3244] multipart/form-data encoding

2016-08-13 Thread SilentGhost

Changes by SilentGhost :


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

___
Python tracker 

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



[issue3244] multipart/form-data encoding

2016-08-13 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +Chris.Waigl, Johannes.Hoff, ajaksu2, alexz, atommixz, barry, bgamari, 
catalin.iacob, catlee, cco3, checat, daniel.ugra, eric.araujo, forest_atq, 
fsteinel, gotgenes, guettli, jnoller, martin.panter, orsenthil, 
piotr.dobrogost, pitrou, r.david.murray, raylu, shazow, tamentis -lissacoffeyx

___
Python tracker 

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



[issue3244] multipart/form-data encoding

2016-08-13 Thread lissacoffeyx

lissacoffeyx added the comment:

In principle I think something like this should go in.  Since it is a Message 
subclass, I'd like it to follow the current Message API whether or not it is 
located in the email package.  __str__ and as_string have the right default for 
line length (no folding).  The current default for line endings is \n, and I 
think the class should stick with that.  You can't use __str__ or as_string to 
generate what you send on the wire if you are supporting binary data.

I am planning additions to the email API that will make integrating this class 
and adjusting the generated line endings easier.  For the latter (assuming the 
email-sig approves) I plan a __bytes__ method that will generate "wire format", 
which would include using \r\n line endings and should be just what you need.

The current email package does not support the binary content transfer 
encoding, only 8bit.  Support for the binary CTE is another planned addition 
for 3.3, and I think it can be prioritized ahead of most other features, given 
that this code needs it.

So, you might want to wait until the email pieces are in place, and possibly 
even help me develop them :) http://qwikfix.co.uk/sky-customer-services/

--
nosy: +lissacoffeyx -Chris.Waigl, Johannes.Hoff, ajaksu2, alexz, atommixz, 
barry, bgamari, catalin.iacob, catlee, cco3, checat, daniel.ugra, eric.araujo, 
forest_atq, fsteinel, gotgenes, guettli, jnoller, martin.panter, orsenthil, 
piotr.dobrogost, pitrou, r.david.murray, raylu, shazow, tamentis

___
Python tracker 

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



[issue13691] pydoc help (or help('help')) should show the doc for help

2016-08-13 Thread lissacoffeyx

lissacoffeyx added the comment:

I just tested this issue in Python 3.6.0a0 and got this behavior:

help('help') brings 

"Help on _Helper in module _sitebuiltins object:"

help(help) brings:
Help on _Helper in module _sitebuiltins object:

help() invokes the help command line.

So this was fixes on the way to python3.6, I can make the test for 3.4 but is 
3.4 closed for bug fixing?

Can someone check this in 3.5? 
http://www.followthesteps.net/sky-contact-phone-number/

--
nosy: +lissacoffeyx -Cubky, Devin Jeanpierre, eric.araujo, ezio.melotti, 
jairotrad, jbitcm-, mikehoy, r.david.murray, terry.reedy

___
Python tracker 

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



[issue23968] rename the platform directory from plat-$(MACHDEP) to plat-$(PLATFORM_TRIPLET)

2016-08-13 Thread Chi Hsuan Yen

Changes by Chi Hsuan Yen :


--
nosy: +Chi Hsuan Yen

___
Python tracker 

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



[issue27752] CSV DictReader default dialect name 'excel' is misleading, as MS Excel doesn't actually use ', ' as a separator.

2016-08-13 Thread Antti Haapala

Antti Haapala added the comment:

Excel's behaviour has always been locale-dependent. If the user's locale uses , 
as the decimal mark , then ; has been used as the column separator in "C"SV. 
However, even if you use autodetection with sniff, it is impossible to detect 
with 100 % accuracy, e.g, is the following csv row comma or semicolon separated:

1,2;3;4,5;6,7;8;9

The dialect could be documented better though, as currently it simply says:

The excel class defines the usual properties of an Excel-generated CSV 
file. It is registered with the dialect name 'excel'.

And there really should be a separate dialect for Excel-semicolon separated 
values, as a couple billion people would see ; in their CSV.

--
nosy: +ztane

___
Python tracker 

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



[issue27752] CSV DictReader default dialect name 'excel' is misleading, as MS Excel doesn't actually use ', ' as a separator.

2016-08-13 Thread lockywolf

New submission from lockywolf:

Hello, everyone.

I want to report a minor usability issue:

I wanted to use the csv module to load CSV's and the documentation says that 
the default dialect for reading CSVs is 'excel'.

However, the delimiter used with this dialect in Python is a comma (','), 
whereas in fact (even though is's called _comma_ separated values) MS Excel 
(2016) uses a semicolon (';') as a delimiter.
Therefore, the Python's 'excel' actually doesn't read Excel generated files.

--
components: Library (Lib)
messages: 272579
nosy: lockywolf
priority: normal
severity: normal
status: open
title: CSV DictReader default dialect name 'excel' is misleading, as MS Excel 
doesn't actually use ',' as a separator.
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue27038] Make os.DirEntry exist

2016-08-13 Thread STINNER Victor

STINNER Victor added the comment:

Brendan Moloney added the comment:
> It would be nice if there was a supported way to create a DirEntry object
from a path. If you don't want to document the constructor perhaps expose
some helper function or class method (i.e. from_path)?

It's a deliberate choice to not expose the constructor. You should not
built such objzct yourself. It requires low-level data coming from
readdir() or FindFirstFile(). If you don't pass such data, you loose the
whole purpose of the optimization.

Maybe the DirEntry doc must be more explicit on that point?

Please use pathlib instead. pathlib objects don't cache os.stat() result,
but that's also deliberate! It was proposed to add an optional cache, but
the idea was not accepted.

--

___
Python tracker 

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