[issue13359] urllib2 doesn't escape spaces in http requests

2017-06-02 Thread Martin Panter

Martin Panter added the comment:

I think this could be merged with Issue 14826. Maybe it is sensible to handle 
all control characters the same way.

--
nosy: +martin.panter
resolution:  -> duplicate
superseder:  -> urlopen URL with unescaped space

___
Python tracker 

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



[issue30535] Explicitly note that meta_path is not empty

2017-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:

s/Warn/Explicitly note/ in the issue title :)

I think this is actually both important enough and subtle enough to warrant a 
".. note::" callout in the docs.

In Python 3, it would say to use `sys.meta_path.insert(0, finder)` if you want 
your finder to take precedence over the default search locations, and 
`sys.meta_path.append(finder)` if you only want it handle cases that aren't 
already handled by the default machine.

In Python 2, it would say that custom finders on `sys.meta_path` will always 
take precedence over the default machinery, and if you want to do otherwise, 
you'll need to use `importlib2` and install its loaders into `sys.meta_path` 
ahead of your own.

--
title: Warn that meta_path is not empty -> Explicitly note that meta_path is 
not empty

___
Python tracker 

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



[issue30558] [Suggestion] Improve documentation for set() API

2017-06-02 Thread Jacob Pratt

New submission from Jacob Pratt:

While going through the documentation, I found that set() has surprisingly 
little documentation, not even a list of built-in methods.

I'm not sure exactly what is missing, but I know that issubset and issuperset 
isn't in there (that's what I was looking for, specifically).

Thanks!

--
messages: 295064
nosy: Jacob Pratt
priority: normal
severity: normal
status: open
title: [Suggestion] Improve documentation for set() API
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



[issue30510] c_bool type not supported for BigEndianStructure on little-endian machine

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Please post or upload minimal code that reproduces the problem for you.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30509] Optimize calling type slots

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I believe Rietveld does not work with git-format patches.  I don't know if git 
can produce the format hg did.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30498] Run Python's slowest tests in the first 3/4 of tests when using -r

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Starting longer running tests sooner only make sense if one runs them in 
parallel with -jn.  I just tried installed 64 bit 3.6.1 with -r -j12 (forgot 
-ugui).  Total duration: 108 seconds.  The last to finish was 
test_multiprocessing_spawn after 84 seconds, 5 seconds after the 2nd last.  So 
it started at 24 seconds, when about 150 of 405 tests had finished.  To not be 
a blocker, it needed to start at about 19 seconds, when 120 tests had finished.

I re-ran with 32 bit repository debug build and was not so lucky.  Test 404 
finished at 3:24.  Test_multiprocessing_spawn finished 1:33 later at 4:57, 
after 121 seconds.  It started at 2:57, when about 352 of 405 had finished.  
Test 303 (3/4the) finished at 2:41, 16 seconds earlier.

Conclusion: the 3/4 restriction will help, but is insufficient to really 
balance process loads.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue30542] [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

2017-06-02 Thread Milan Oberkirch

Milan Oberkirch added the comment:

I tried to pin this leak down and got to the point where I suspect the compile 
call:

def check_roundtrip(self, code1, filename="internal"):
ast1 = compile(code1, filename, "exec", ast.PyCF_ONLY_AST)

the leaks occur with only that line in the function and do not occur without it.

To me it looks like a direct result of some leak somewhere in the tested code?

Garrett: I'm happy for you to take over (please leave a comment if you do)!

--
nosy: +zvyn

___
Python tracker 

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



[issue30489] Add CmdLineTest to standard library

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Santiago, an idea like this (one that requests a reversal of previous 
decisions) should be discussed first on the python-ideas list.  Such a 
discussion would need to result in a specific proposal of what to extract from 
test_cmd_line_script.py and where to put it.  test_cmd_line_script.py itself 
cannot be moved.  If you get a positive response there, you can re-open this or 
open a new issue.

The test utilities in test/ are already 'in' the stdlib, in that one can  
import and use them.  However, doing so is at one's own risk of API change.  
They are declared private and kept in test/ so that we can freely change them 
as needed for their primary purpose -- testing cpython.

--
nosy: +terry.reedy
resolution:  -> rejected
stage:  -> resolved
status: open -> closed
versions:  -Python 2.7, 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



[issue30486] Allow setting cell value

2017-06-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

There's already a documentation change to the PR, you can leave your comments 
there.

--

___
Python tracker 

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



[issue30486] Allow setting cell value

2017-06-02 Thread Terry J. Reedy

Terry J. Reedy added the comment:

A possible counter-indication would be if setting a cell could cause a crash, 
as opposed to a mysterious exception.  Since 3.x already allows writing any 
object to a cell from python code,
 
def outer():
cell = None
def inner(ob):
nonlocal cell
cell = ob  # rebinds .cell_contents
return inner

set_cell = outer()
print(set_cell.__closure__[0].cell_contents)  # None
set_cell('something')
print(set_cell.__closure__[0].cell_contents)  # 'something'

making "cell.cell_contents = 'something'" legal should not enable more crashes.

I think that "function.__closure__[i].cell_contents = object" is perhaps not a 
good idea for production code, but I think it falls within the realm of 
'consenting adults code' for the other uses suggested above.  How should it be 
documented?

--
nosy: +terry.reedy
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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Steve Dower

Changes by Steve Dower :


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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Steve Dower

Steve Dower added the comment:


New changeset c63ae1122f84d4188ffadfd1454902093eb10be1 by Steve Dower in branch 
'3.6':
bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when 
WriteConsoleW fails (#1912) (#1925)
https://github.com/python/cpython/commit/c63ae1122f84d4188ffadfd1454902093eb10be1


--

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Steve Dower

Changes by Steve Dower :


--
pull_requests: +2005

___
Python tracker 

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



[issue30557] faulthandler does not correctly filter fatal exceptions on Windows

2017-06-02 Thread Steve Dower

Changes by Steve Dower :


--
pull_requests: +2004

___
Python tracker 

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



[issue30557] faulthandler does not correctly filter fatal exceptions on Windows

2017-06-02 Thread Steve Dower

Steve Dower added the comment:

Also, it displays exception codes as decimal, but should be hex. I'll fix that 
too

--

___
Python tracker 

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



[issue30557] faulthandler does not correctly filter fatal exceptions on Windows

2017-06-02 Thread Steve Dower

New submission from Steve Dower:

faulthandler adds a structured exception handler on Windows so we can dump a 
Python traceback before crashing. This should only be done for fatal 
exceptions, but is currently done for some non-fatal exceptions.

The current test is `flags & EXCEPTION_NONCONTINUABLE`, which is incorrect (as 
evidenced by the fact that the check is wrong in its current context and should 
be `!(flags & EXCEPTION_NONCONTINUABLE)`).

Instead, `code & 0x8000` determines whether the exception is an error. If 
not, we should skip logging any info.

--
assignee: steve.dower
components: Windows
messages: 295054
nosy: haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
stage: patch review
status: open
title: faulthandler does not correctly filter fatal exceptions on Windows
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread R. David Murray

R. David Murray added the comment:

Thank you for linking to that Xiang.  I had a vague memory of that discussion 
but couldn't find it.

No, there is no bug here, but there is a question of whether or not there 
*should* be a bug here (that is, is there a design bug) and if so how/where to 
fix it :)

This issue isn't the place to have that discussion.

--

___
Python tracker 

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



[issue21878] wsgi.simple_server's wsgi.input read/readline waits forever in certain circumstances

2017-06-02 Thread Dom Cote

Dom Cote added the comment:

Just bumped into this issue today using bobo.

On the first attempt to load a page, it's OK, because there is something to 
read. But if you hit the "reload" button on the browser, for some reason, it 
will connect with the server a second time after the request is completed, and 
but there nothing is being sent, so readline() never comes back.

However, the documentation says that if the underlying object is set as 
non-blocking, then it shouldn't block.

So I first inspected the timeout value on the request's socket, and it comes 
back 0.0, which according to the sockets doc, should mean non blocking. That's 
weird.

So I decided to go ahead and call the setblocking(False) on the socket anyway, 
and this time, readline() came back with no data. The rest took care of itself.

This is my debug traces as well as a small patch to show the workaround.

Notice how the timeout is comes back as 0.0 despite the fact that the socket 
will block.

Also, notice the second connection request being '' after putting in the fix.

==

>  laddr=('192.168.1.113', 8085), raddr=('192.168.1.6', 59194)> 0.0
7> b'GET / HTTP/1.1\r\n'
192.168.1.6 - - [02/Jun/2017 16:01:39] "GET / HTTP/1.1" 200 690
5>  0.0
6>  0.0
7> b''

diff --git a/simple_server.py b/simple_server.py
index 7fddbe8..3df4ffa 100644
--- a/simple_server.py
+++ b/simple_server.py
@@ -115,9 +115,13 @@ class WSGIRequestHandler(BaseHTTPRequestHandler):

 def handle(self):
 """Handle a single HTTP request"""
-
+print("5>",self.connection,self.connection.gettimeout())
+self.connection.setblocking(False)
 self.raw_requestline = self.rfile.readline(65537)
-if len(self.raw_requestline) > 65536:
+print("6>",self.connection,self.connection.gettimeout())
+print("7>",str(self.raw_requestline))
+
+if False and len(self.raw_requestline) > 65536:
 self.requestline = ''
 self.request_version = ''
 self.command = ''

--
nosy: +buzdelabuz2

___
Python tracker 

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



[issue30541] Add restricted mocks to the python unittest mocking framework

2017-06-02 Thread Mario Corchero

Changes by Mario Corchero :


--
pull_requests: +2003

___
Python tracker 

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



[issue24899] Add an os.path <=> pathlib equivalence table in pathlib docs

2017-06-02 Thread Brett Cannon

Changes by Brett Cannon :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue24899] Add an os.path <=> pathlib equivalence table in pathlib docs

2017-06-02 Thread Brett Cannon

Brett Cannon added the comment:


New changeset ae8750bca8234a9af9382b9d7e457b57f810ad64 by Brett Cannon (Jamiel 
Almeida) in branch 'master':
bpo-24899: Add comparison table for os.path -> pathlib (GH-1753)
https://github.com/python/cpython/commit/ae8750bca8234a9af9382b9d7e457b57f810ad64


--
nosy: +brett.cannon

___
Python tracker 

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



[issue30534] error message for incorrect call degraded in 3.7

2017-06-02 Thread Brett Cannon

Brett Cannon added the comment:

> Note that some error messages are "takes no keyword arguments", but others 
> are "does not take keyword arguments" or "doesn't take keyword arguments". 
> They should be unified. What wording is better?

I vote for "takes no keyword arguments".

--
nosy: +brett.cannon

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Brett Cannon

Brett Cannon added the comment:

Yeah, there's actually a specific 'warning' directive which puts text in the 
docs in a red box to make it a full-blown warning which is what I thought you 
wanted, having it say "this is different than Python 2!". Having a sentence 
that just states how things are without referring to Python 2 is totally fine.

--

___
Python tracker 

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread Xiang Zhang

Xiang Zhang added the comment:

Looking at the code and doc it seems it's by design. But it's good or not 
remains in question. The related discussion about the more general problem 
behind this issue is 
https://groups.google.com/d/msg/python-ideas/Kou5cYGjGQ8/oXEixwgiDwAJ. There is 
a workaround and a proposed general resolution. But it's hard for me now to 
treat the current OSError behaviour as a *bug*.

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
pull_requests: +2002

___
Python tracker 

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



[issue30555] _io._WindowsConsoleIO breaks in the face of fd redirection

2017-06-02 Thread Steve Dower

Steve Dower added the comment:

> We can also switch to calling _get_osfhandle always instead of caching the 
> handle, it will break when the fd is redirected to a non-console. But so does 
> _WindowsConsoleIO in general since it will try to continue writing to the 
> console despite the redirection, meaning that Python code doing redirection 
> has to handle sys.std* anyhow.

This might be the best approach, ultimately. I bet there's an optimization 
here, though it's not obvious.

Probably the main issue here is readline not properly handling sys.std*. If 
that was fixed, I think many of these problems (at least at the interactive 
prompt) would simply go away.

--

___
Python tracker 

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



[issue30518] Import type aliases from another module

2017-06-02 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

> Block = [int, Tuple[int]]
> Blocks = List[Block]

These are both invalid type aliases (I have no idea why PyCharm does not flag 
them, you could report this at PyCharm issue tracker). I am not sure what 
exactly you want. If you want a list of either integers or tuples of integers, 
then you should write for example:

Block = Union[int, Tuple[int, ...]]
Blocks = List[Block]

Concerning import, this is definitely not a problem with aliases. What I have 
noticed is that you write "I have a 'base' module ..." and then "from 
base_module import ...", if you have a module named base.py, then you should 
write:

from base import Blocks, Tags

Or maybe you just have an import cycle...

--
nosy: +levkivskyi

___
Python tracker 

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



[issue30556] asyncio.wait very slow with FIRST_COMPLETED

2017-06-02 Thread Samuel Colvin

New submission from Samuel Colvin:

This is best described the script at 
https://gist.github.com/samuelcolvin/00f01793c118bf9aafae886ffbc81a58.

Basically, completing a set of tasks using 
asyncio.wait(...return_when=asyncio.FIRST_COMPLETED) in a loop to wait for them 
to finish is much much slower than completing the same set of tasks using just 
asyncio.wait(pending_tasks, loop=loop, return_when=asyncio.ALL_COMPLETED).

In my example, the ALL_COMPLETED case takes ~5s, but the FIRST_COMPLETED case 
takes 18 - 47s.

The screenshot on the gist shows network usage with a very long tail, in other 
words very few tasks are taking a long time to complete.

This example uses aiohttp get a url as the test case but I'm pretty sure this 
isn't an issue with aiohttp.

I tried the same thing with uvloop but got broadly the same result.

--
components: asyncio
files: asyncio_wait_test.py
messages: 295045
nosy: samuelcolvin, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.wait very slow with FIRST_COMPLETED
type: performance
versions: Python 3.6
Added file: http://bugs.python.org/file46920/asyncio_wait_test.py

___
Python tracker 

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



[issue30505] Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

2017-06-02 Thread Ivan Levkivskyi

Ivan Levkivskyi added the comment:

Thanks for reporting!

The runtime implementation of protocol classes will be thoroughly reworked as a 
part of PEP 544, see also https://github.com/python/typing/pull/417 for a proof 
of concept runtime implementation.

Also, there is another ongoing discussion 
https://github.com/python/typing/issues/432 about a global refactoring of 
typing module that will significantly improve performance.

Therefore, I would wait with any large PRs until these two stories are settled. 
If you still want to propose a small PR, you can do this at the upstream typing 
repo https://github.com/python/typing

--
nosy: +levkivskyi

___
Python tracker 

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread R. David Murray

R. David Murray added the comment:

That's actually a very good question.  hasattr returns False, but is it 
supposed to be an invariant that if dir returns a string hasattr should return 
True and getattr should not return AttributeError?  (Well, it might raise 
AttributeError from inside the attribute, but the attribute itself should be 
"real".)  Or to put it the other way, if hasattr returns False, should it be an 
invariant that dir does not list that attribute name?

This may be a question for python-dev, and the answer may well be that we do 
*not* want to suggest that such an invariant should be expected.  (We of course 
don't enforce such things, but we do make them hold true in the stdlib if we 
establish them).  However, it is certainly a surprising behavior, and Python 
*generally* tries to avoid such surprises.

This may have already been discussed and decided at some previous point, so 
someone should do some docs and archive searching about it first :)

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread Igor Kozyrenko (ikseek)

Igor Kozyrenko (ikseek) added the comment:

So is it by design?
cgitb library fails to create report if there are links to exceptions based on 
OSError on the stack because it tries to enumerate all it's attributes.

--

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Segev Finer

Changes by Segev Finer :


--
type:  -> behavior

___
Python tracker 

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



[issue30555] _io._WindowsConsoleIO breaks in the face of fd redirection

2017-06-02 Thread Segev Finer

Changes by Segev Finer :


--
nosy: +eryksun

___
Python tracker 

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



[issue30555] _io._WindowsConsoleIO breaks in the face of fd redirection

2017-06-02 Thread Segev Finer

New submission from Segev Finer:

_WindowsConsoleIO works by taking the handle out of the file descriptors of the 
stdio handles (get_osfhandle) and reading/writing to it directly using 
ReadConsoleW/WriteConsoleW.

The problem is that some Python code wants to do file descriptor level 
redirection by overwriting the standard file descriptors using dup2. The 
problem is that this is also going to close the handle that Python itself is 
going to use to read/write to the console. Leading to the following:

>>> fd = os.open('stdout.txt', os.O_CREAT | os.O_WRONLY)
>>> os.dup2(fd, 1)
>>> print('spam')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 87] The parameter is incorrect  # "OSError: [WinError 6] 
The handle is invalid" after https://bugs.python.org/issue30544

This manifests itself for example in Pytest which does fd redirection to 
capture test output. See https://github.com/pytest-dev/py/issues/103 for the 
issue. And see https://github.com/pytest-dev/pytest/pull/2462 for an WIP 
attempt to workaround this.

This issue also impacts other code that uses console handles itself like 
colorama: https://github.com/pytest-dev/pytest/issues/2465. Though that code is 
likely going to have to deal with this by itself.

Those file descriptors are an emulation implemented by the Universal CRT and 
you can see their implementation in your copy of the Windows SDK. It's quite 
possible that this doesn't happen in older CRT versions either since colorama 
doesn't seem to break on Python 2.7 for example.

One way I can think working around this is that Python will DuplicateHandle the 
console handles so that even if dup2 closes the original ones it will keep on 
working. We can also switch to calling _get_osfhandle always instead of caching 
the handle, it will break when the fd is redirected to a non-console. But so 
does _WindowsConsoleIO in general since it will try to continue writing to the 
console despite the redirection, meaning that Python code doing redirection has 
to handle sys.std* anyhow. Though I'm not sure about the performance of 
constantly calling _get_osfhandle. And their yet might be other ways to solve 
this.

Also see comment by eryksun https://bugs.python.org/msg294988

Solving this in CPython will remove the need for hacks like the PR I referenced.

--
components: IO, Windows
messages: 295041
nosy: Segev Finer, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: _io._WindowsConsoleIO breaks in the face of fd redirection
type: behavior
versions: Python 3.6, Python 3.7

___
Python tracker 

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



[issue30414] multiprocesing.Queue silently ignore messages after exc in _feeder

2017-06-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thomas, thanks for the heads up.  I would suggest something like the following 
patch to multiprocessing.Pool:

$ git diff
diff --git a/Lib/multiprocessing/queues.py b/Lib/multiprocessing/queues.py
index 7f77837..ebbb360 100644
--- a/Lib/multiprocessing/queues.py
+++ b/Lib/multiprocessing/queues.py
@@ -260,8 +260,16 @@ class Queue(object):
 info('error in queue thread: %s', e)
 return
 else:
-import traceback
-traceback.print_exc()
+self._on_queue_thread_error(e)
+
+def _on_queue_thread_error(self, e):
+"""
+Private API called when feeding data in the background thread
+raises an exception.  For overriding by concurrent.futures.
+"""
+import traceback
+traceback.print_exc()
+
 
 _sentinel = object()
 


Then you can write your own Queue subclass in concurrent.futures to handle that 
error and clean up/restart whatever needs to be cleaned up or restarted.  What 
do you think?

--

___
Python tracker 

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



[issue29514] Add a test case that prevents magic number changes in minor releases

2017-06-02 Thread Eric Snow

Eric Snow added the comment:

Sorry I didn't see the just-landed PR earlier, but it may make sense to not 
skip that test under *any* release level for a micro version > 0:

@unittest.skipUnless(
(sys.version_info.micro > 0 or
 sys.version_info.releaselevel in ('final', 'release')),
'only applies to candidate or final python release levels'
)

--

___
Python tracker 

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread Xiang Zhang

Xiang Zhang added the comment:

Actually the docs says "This attribute is available when using the buffered I/O 
classes from the io module", which means it's not always available since it 
depends on an inner field set or not.

It's just like Python code:

>>> class CW:
... def __get__(self, obj, objtype):
... if obj._written:
... return obj._written
... else:
... raise AttributeError("characters_written")
... def __set__(self, obj, val):
... obj._written = val
... 
>>> class MyOSError:
... characters_written = CW()
... def __init__(self):
... self._written = False
... 
>>> dir(MyOSError())
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', 
'__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', 
'__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', 
'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', 
'__str__', '__subclasshook__', '__weakref__', '_written', 'characters_written']
>>> MyOSError().characters_written
Traceback (most recent call last):
  File "", line 1, in 
  File "", line 6, in __get__
AttributeError: characters_written

--
nosy: +xiang.zhang
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Ethan Furman

Ethan Furman added the comment:

If your example code is the same as the code in the SO problem, then my 
previous points stand.

According to the plain-English description you provided the comparison would 
succeed, so if you have example code which:

- doesn't involve ModuleA being the __main__ script module, and
- has the comparison fail, then

please share it.  ;)  (As a comment/message here is fine.)

--
resolution: not a bug -> 
stage: resolved -> test needed

___
Python tracker 

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



[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread R. David Murray

R. David Murray added the comment:

Can you provide actual code that demonstrates the issue you are talking about?

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread R. David Murray

R. David Murray added the comment:

In other words, this was a major standards screwup and we get to deal with the 
consequences :(

All right, since I'm hardly likely to have time to deal with it anyway, we'll 
just say that email isn't going to handle unicode domain names until *someone* 
figures out how to do this right.  And it sounds like that may be never.  
Because saying that "users that want to make requests to IDNA domains should be 
responsible for the encoding themselves" is, really, a *complete* non-starter 
from any perspective I can think of, and has its own security issues.  If UTF46 
does not do the job, we are just out of luck and the users will pay the price.

--

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Steve Dower

Steve Dower added the comment:

Yeah, make it a separate issue.

This PR fixes an obvious error that we should just fix, so I've merged it. (I 
might get to the backport today, but if someone else submits it then I'll 
merge.)

--

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Steve Dower

Steve Dower added the comment:


New changeset 523776c3419f6795e78173d53c10e35ec4eed48d by Steve Dower (Segev 
Finer) in branch 'master':
bpo-30544: _io._WindowsConsoleIO.write raises the wrong error when 
WriteConsoleW fails (#1912)
https://github.com/python/cpython/commit/523776c3419f6795e78173d53c10e35ec4eed48d


--

___
Python tracker 

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



[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Madhav Datt

Madhav Datt added the comment:

Thanks a lot for those points Ethan. I feel I haven't done a very good job of 
explaining the bug, but let me use an example. Let's say we have an Enum called 
MyEnum, which is in a Python module called ModuleA. ModuleB imports ModuleA, 
and ModuleC imports both, ModuleA and ModuleB. Now, in ModuleC, I have 
ModuleB.some_function() return a MyEnum state, which I pass as a parameter to 
ModuleA.other_function() where it is compared to MyEnum states. Here the 
comparison fails even though it should not have. Obviously, this problem would 
not arise without such imports, and so is pretty specific, but I hope this 
makes explains it a little better.

--
status: closed -> open

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread Paul Kehrer

Changes by Paul Kehrer :


--
nosy:  -reaperhulk

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread Paul Kehrer

Paul Kehrer added the comment:

As someone who built an idna aware API for pyca/cryptography and deeply regrets 
it I'd like to weigh in on the side of saying that IDNA is a presentation issue 
and that supporting it in lower level APIs is the cause of many bugs, some of 
which can potentially be security issues. Users wanting to make requests to 
IDNA domains should be responsible for the encoding themselves so that 
impedance mismatches in encoding version are both discoverable and correctable.

--
nosy: +reaperhulk

___
Python tracker 

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



[issue30554] Inaccessible attribute characters_written on OSError instances

2017-06-02 Thread Igor Kozyrenko (ikseek)

New submission from Igor Kozyrenko (ikseek):

If I enumerate attributes on OSError instance with dir
dir(OSError())
I see an 'characters_written' attribute (which is supposed to be defined on 
BlockingIOError according to docs).
If I try to access it
getattr(OSError(), 'characters_written')
I get an AttributeError

--
components: Library (Lib)
messages: 295030
nosy: Igor Kozyrenko (ikseek)
priority: normal
severity: normal
status: open
title: Inaccessible attribute characters_written on OSError instances
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



[issue30533] missing feature in inspect module: getmembers_static

2017-06-02 Thread Lisa Roach

Lisa Roach added the comment:

+1 to a new getmembers_static(), I don't see why this couldn't be implemented.

--
nosy: +lisroach

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread Christian Heimes

Christian Heimes added the comment:

Adding automatic IDNA decoding is like opening Pandora's box.

uts46 is not necessarily the correct solution. The correct handling of 
internationalized domain names depends on multiple factors: TLD, remote 
application and more. You actually have to know if the remote peer uses 2003 or 
2008. For any user facing application you cannot simply expose all of IDNA to 
the user (homoglypic confusion attacks).

--

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread R. David Murray

R. David Murray added the comment:

The email package currently forces explicit IDNA use currently.  The new 
policies are supposed to support it automatically but I they currently don't.  
I'm not sure we should add it to the old interface (parseaddr/formataddr) any 
longer, but I don't object to doing it, either.

Not handling idna automatically would go against the entire design of the new 
email policies, which is to produce unicode from the wire encoding for programs 
to work with, and convert back to wire protocol on output.

The work on resolving the idna2008 issue belongs in issue #17305, where MvL 
(who wrote the original idna codec) points to IMO the correct solution (a uts46 
codec) in msg217218.

--
versions: +Python 3.7 -Python 3.5

___
Python tracker 

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



[issue30458] CRLF Injection in httplib

2017-06-02 Thread Xiang Zhang

Xiang Zhang added the comment:

Looking at the code and the previous issue #22928, CRLF immediately followed by 
a tab or space (obs-fold: CRLF 1*( SP / HTAB )) is a valid part of a header 
value so the regex deliberately ignore them.

So it looks right to me the url given doesn't raise the same exception as the 
url without spaces, though the given url seems malformed.

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

___
Python tracker 

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



[issue30545] Enum equality across modules: comparing objects instead of values

2017-06-02 Thread Ethan Furman

Ethan Furman added the comment:

Two points:

- Python 2.7 was the version marked, but 2.7 does not come with Enum
  (wasn't introduced until 3.4 -- the third-party backport does work
  on 2.7)

- the problem in the SO question is not caused by Enum, but by
  re-importing a module under a different name which results in two
  different Enum classes that happen to look identical, but are not --
  so the change you propose would not help; also, since Enum members
  with the same value are mapped to the same member your change does not
  provide any new behavior.

So, in summary, the bug here is in the user's code.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed
versions: +Python 3.7

___
Python tracker 

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



[issue30536] [EASY] SubinterpThreadingTests.test_threads_join_2() of test_threading leaks references

2017-06-02 Thread Sayan Chowdhury

Sayan Chowdhury added the comment:

I replicated the issue. Starting to work on the issue.

--
nosy: +sayanchowdhury

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread Christian Heimes

Christian Heimes added the comment:

We can't replace IDNA-2003 with IDNA-2008 either. Some applications / protocols 
/ TLDs still use IDNA-2003. I see two options, (1) make encoding configurable 
somehow, (2) drop implicit IDNA encoding/decoding and force applications to 
perform explicit IDNA.

--

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Eric Snow

Changes by Eric Snow :


--
keywords: +easy

___
Python tracker 

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



[issue30414] multiprocesing.Queue silently ignore messages after exc in _feeder

2017-06-02 Thread Thomas Moreau

Changes by Thomas Moreau :


--
pull_requests: +2001

___
Python tracker 

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



[issue30414] multiprocesing.Queue silently ignore messages after exc in _feeder

2017-06-02 Thread Thomas Moreau

Thomas Moreau added the comment:

This fix, while preventing the Queue to crash, does not give any way to  
programatically detect that the message was dropped. This is a problem as we 
can no longer assume that the Queue will not drop messages. For instance, we 
can no longer detect deadlocks in concurrent.futures.ProcessPoolExecutor as 
done in https://github.com/python/cpython/pull/1013 where the crashed 
QueueFeederThread was used to monitor the working state of the executor.

We could either:
- Put a flag highlighting the fact that some messages where dropped.
- Add an argument to the Queue to close on pickling errors.

I'd be happy to work on a PR to implement any solution that you think is 
reasonable.

--
nosy: +tomMoral

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> enumerate was described with one argument, but it takes two.
> Should I update that as well?

Yes please.

--

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Not your fault, Cheryl! I unfortunately got distracted and didn't follow up on 
the backports for several PRs I merged a while back. Mariatta has been 
graciously cleaning some of those up rather than leaving them lingering the way 
I had been :)

I also just noticed that I never merged the PR to always regenerate the 
cross-references, so I went ahead and did that, and also submitted the 
corresponding 3.6 backport PR.

--

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-02 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +1999

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:


New changeset 7a82f9c2b94d31c8f4cc8bb8e3151765d8b148d7 by Nick Coghlan in 
branch 'master':
bpo-30052: Always regenerate cross-references (#1339)
https://github.com/python/cpython/commit/7a82f9c2b94d31c8f4cc8bb8e3151765d8b148d7


--

___
Python tracker 

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



[issue15216] Support setting the encoding on a text stream after creation

2017-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Antoine posted a simpler reconfiguration RFE over in 
https://bugs.python.org/issue30526 (for setting line buffering).

While technically orthogonal to this RFE, we're thinking it might be possible 
to expose them to users as a common "reconfigure()" API, rather than as 
independent methods.

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks. I'll produce an updated PR using reconfigure() for line_buffering and 
write_through.

--

___
Python tracker 

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



[issue30526] Allow setting line_buffering on existing TextIOWrapper

2017-06-02 Thread Nick Coghlan

Nick Coghlan added the comment:

Right, the request/requirement for in-place configuration changes arise from 
the fact the underlying buffer objects can't readily be shared, while makes 
swapping out the wrapper problematic if others may already have references to 
the original.

The "Don't do this implicitly in a library" admonition is then really the same 
one that applies to any unusual tinkering with global state (e.g. 
monkeypatching): you can definitely break things if you do it carelessly, so 
let the main application decide if and when global state updates are 
appropriate.


I do like "reconfigure()" as the API name, since that's then nicely amenable to 
expanding to all the settings supported by `open()` as concrete use cases 
arise. One thing we'll need to watch out for is the difference between "Leave 
this setting alone" and "Revert this setting to the global default".

--

___
Python tracker 

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



[issue30052] URL Quoting page links to function Bytes instead of defintion

2017-06-02 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Sorry, Mariatta.  I didn't realize this was waiting for a backport.

--

___
Python tracker 

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



[issue27318] Add support for symlinks to zipfile

2017-06-02 Thread Mathieu Bridon

Mathieu Bridon added the comment:

Do note that extracting a zipfile with symlinks might lead to unexpected 
results, for example if the path pointed to is outside of the extract dir.

Maybe the behaviour introduced in this patch should not be the default, but 
instead `extract` and `extractall` could take a new flag `preserve_symlinks` 
which would default to False? (to keep the same default as today)

--
nosy: +bochecha

___
Python tracker 

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



[issue30553] Add HTTP Response code 421

2017-06-02 Thread Julien

New submission from Julien:

The `http.HTTPStatus` class provides constants for most of the HTTP status 
codes.
Status code 421 was added by the RFC 7540 (HTTP/2), and is not part of this 
class. It is described as follows:

> The 421 (Misdirected Request) status code indicates that the request
> was directed at a server that is not able to produce a response.
> This can be sent by a server that is not configured to produce
> responses for the combination of scheme and authority that are
> included in the request URI.

Would it be possible to create the corresponding constant in `http.HTTPStatus`?

For reference:
* Status code 421 in the RFC 7540:
https://tools.ietf.org/html/rfc7540#section-9.1.2
* Documentation on the HTTPStatus class in python 3.6:
https://docs.python.org/3/library/http.html#http-status-codes
* Another opened issue relative to the status code 451 currently pending review:
https://bugs.python.org/issue26589

--
components: Library (Lib)
messages: 295013
nosy: julienc
priority: normal
severity: normal
status: open
title: Add HTTP Response code 421
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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel

Xavier Morel added the comment:

> Fair enough. So we can just add a sentence informing readers that
`meta_path`, by default, holds entries to handle the standard kinds of
modules (.py files, extension modules…).

Yeah that's basically what I meant, talking about a "warning" in python 3 may 
have been the wrong wording or given an incorrect impression, sorry about that.

--

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-02 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Submitted a PR, thank you.

I changed added the argument for count().  Also I noticed that the link to 
accumulate() was broken, so I fixed that and I added a link to functools in the 
references at the end of the page.

One other thing I noticed was that enumerate was described with one argument, 
but it takes two.  Should I update that as well?

Thanks!

--

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-02 Thread Cheryl Sabella

Changes by Cheryl Sabella :


--
pull_requests: +1998

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 02/06/2017 à 13:21, Xavier Morel a écrit :
> 
> I spent a few hours trying to understand why our import hooks did not work 
> correctly anymore in 3.5, and I never even considered printing sys.meta_path 
> in an open interpreter, I realised the behavioural change because I ended up 
> printing meta_path after the addition of our custom hooks to make sure they 
> were actually there.

Fair enough. So we can just add a sentence informing readers that
`meta_path`, by default, holds entries to handle the standard kinds of
modules (.py files, extension modules...).

--

___
Python tracker 

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



[issue30537] Using PyNumber_AsSsize_t in itertools.islice

2017-06-02 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1997

___
Python tracker 

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



[issue30552] Bugs

2017-06-02 Thread Mahira

Changes by Mahira :


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



[issue30551] Attribute Error

2017-06-02 Thread Mahira

Mahira added the comment:

hey issue Cleared

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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel

Xavier Morel added the comment:

> A warning is probably too strong.  Also, it's easy to check sys.meta_path at 
> the interpreter prompt, so I'm not sure it's worth mentioning at all.

It's easy if you think of it and did not miss a small bit of the Python 3.3 
release note indicating that the *documented guarantees* of Python 2.x, 3.0, 
3.1 and 3.2 had been dropped, even as they were incorrectly still present in 
the official documentation itself.

I spent a few hours trying to understand why our import hooks did not work 
correctly anymore in 3.5, and I never even considered printing sys.meta_path in 
an open interpreter, I realised the behavioural change because I ended up 
printing meta_path after the addition of our custom hooks to make sure they 
were actually there.

--

___
Python tracker 

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



[issue30535] Warn that meta_path is not empty

2017-06-02 Thread Xavier Morel

Xavier Morel added the comment:

> I'm fine with adding a note to the Python 2 docs, but putting it in Python 3 
> seems to be going in the wrong direction as having sys.meta_path not be empty 
> is how Python will be going forward.

I don't think putting a note is any hint that the Python 3 behaviour (which I 
appreciate) would change, it would simply tell the reader that the list is not 
empty by default and they ought decide whether they want their finders to take 
precedence over (and insert at head) or be fallback to (and append) the builtin 
finders.

It could also link to the standard/builtin finders.

--

___
Python tracker 

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



[issue30547] [EASY][Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references

2017-06-02 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

this issue can be executed on Linux, I think I am going to work on this one.

--
nosy: +matrixise

___
Python tracker 

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



[issue30552] Bugs

2017-06-02 Thread Mahira

New submission from Mahira:

Hai Python Team,

Am very new to programming

Am facing following error in python

Traceback (most recent call last):
  File
"C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup/Shape
Gra Ex.py", line 6, in 
circle.draw("win")
  File
"C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup\graphics.py",
line 482, in draw
if graphwin.isClosed(): raise GraphicsError("Can't draw to closed
window")
AttributeError: 'str' object has no attribute 'isClosed

My Program is:

from graphics import *
win=GraphWin('Shapes')
center=Point(100,100)
circle=Circle(center,30)
circle.setFill('red')
circle.draw("win")
label=Text(center,"Red Circle")
label.draw(win)
rect=Rectangle(Point(30,30),Point(70,70))
r.draw(win)
line=Line(Point(20,30),Point(180,199))
line.draw(win)
oval=Oval(Point(20,150),Point(180,199))
oval.draw(win)

Kindly help me to solve this issue

--
messages: 295005
nosy: Mahira
priority: normal
severity: normal
status: open
title: Bugs

___
Python tracker 

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



[issue30551] Attribute Error

2017-06-02 Thread Mahira

New submission from Mahira:

Hai, I am New to python and I am training with some open source projects now am 
Practising GUI
I get the Error Message 
 
Traceback (most recent call last):
  File 
"C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup/Shape
 Gra Ex.py", line 6, in 
circle.draw("win")
  File 
"C:/Users/Mahira/AppData/Local/Programs/Python/Python36/Lib/graphics_setup\graphics.py",
 line 482, in draw
if graphwin.isClosed(): raise GraphicsError("Can't draw to closed window")
AttributeError: 'str' object has no attribute 'isClosed'

And my Program is Following below:
from graphics import *
win=GraphWin('Shapes')
center=Point(100,100)
circle=Circle(center,30)
circle.setFill('red')
circle.draw("win")
label=Text(center,"Red Circle")
label.draw(win)
rect=Rectangle(Point(30,30),Point(70,70))
r.draw(win)
line=Line(Point(20,30),Point(180,199))
line.draw(win)
oval=Oval(Point(20,150),Point(180,199))
oval.draw(win)

--
messages: 295004
nosy: Mahira
priority: normal
severity: normal
status: open
title: Attribute Error
type: compile error
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



[issue30542] [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

2017-06-02 Thread STINNER Victor

STINNER Victor added the comment:

> Haypo: How do you know that this is leaked at test_files() of 
> test_tools.test_unparse.DirectoryTestCase? The result of your command didn't 
> reveal that is leaked at which test case or function.

Using the script I wrote which is attached to issue29512.

--

___
Python tracker 

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



[issue30542] [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

2017-06-02 Thread Louie Lu

Louie Lu added the comment:

Haypo: How do you know that this is leaked at test_files() of 
test_tools.test_unparse.DirectoryTestCase? The result of your command didn't 
reveal that is leaked at which test case or function.

--
nosy: +louielu

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in son

2017-06-02 Thread Eric O. LEBIGOT

Changes by Eric O. LEBIGOT :


--
title: Document order-preserving dictionary output -> Document order-preserving 
dictionary output in son

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in json

2017-06-02 Thread Eric O. LEBIGOT

Changes by Eric O. LEBIGOT :


--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output in json

2017-06-02 Thread Eric O. LEBIGOT

Changes by Eric O. LEBIGOT :


--
title: Document order-preserving dictionary output in son -> Document 
order-preserving dictionary output in json

___
Python tracker 

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



[issue30537] Using PyNumber_AsSsize_t in itertools.islice

2017-06-02 Thread Will Roberts

Will Roberts added the comment:

Note that this issue also seems to affect other methods in the itertools 
package, such as permutations.

--
nosy: +Will Roberts

___
Python tracker 

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



[issue30550] Document order-preserving dictionary output

2017-06-02 Thread Eric O. LEBIGOT

New submission from Eric O. LEBIGOT:

The JSON encoder for dictionaries preserves the order of the items in a 
dictionary: it would be useful to document this behavior, so that users can 
rely on it.

While JSON itself does not have ordered key/value pairs, this feature can be 
useful (for modifying the original JSON document while maintaining as much of 
it untouched, for manipulating our own extension of JSON with ordered 
dictionaries, etc.).

The documentation could also usefully mention that _reading_ sets of key/value 
pairs can also be done in an order-preserving way with 
`object_pairs_hook=OrderedDict`.

Reference: the json module does not alter the order of the dictionary items 
upon encoding: 
https://github.com/python/cpython/blob/aacd53f6cb96fe8c4fe9ce894f22e25f356a97c3/Lib/json/encoder.py#L355.

--
components: Library (Lib)
messages: 295001
nosy: lebigot
priority: normal
severity: normal
status: open
title: Document order-preserving dictionary output
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



[issue30549] ProcessPoolExecutor hangs forever if the object raises on __getstate__

2017-06-02 Thread Roberto Martínez

New submission from Roberto Martínez:

Hi, I detected that a ProcessPoolExecutor hangs if the object fails to 
picklelize.

I attached the simplest code to reproduce the behavior. Note that the 
interpreter should exit after the exception but it doesn't and hangs forever.

I tested with python 3.4, 3.5 and 3.6 with the same results.

--
files: test_noshutdown.py
messages: 294999
nosy: Roberto Martínez
priority: normal
severity: normal
status: open
title: ProcessPoolExecutor hangs forever if the object raises on __getstate__
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file46919/test_noshutdown.py

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Segev Finer

Segev Finer added the comment:

We might want to open a separate issue for the FD redirection issue since this 
one was really about the _io._WindowsConsoleIO.write GetLastError() issue.

Also see https://github.com/pytest-dev/pytest/pull/2462 where I discuss this 
more.

Still not sure why it's random in Pytest. I can only guess it's due to another 
console handle getting opened with the same number or something.

--

___
Python tracker 

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



[issue30542] [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase leaks references

2017-06-02 Thread STINNER Victor

STINNER Victor added the comment:

I tagged this issue as easy. I consider that it's a good exercice for new 
contributors. Core developers: please let new contributors try to fix it since 
this issue is not critical, try to explain how to fix it rather than writing 
the fix ;-)

--
keywords: +easy (C)
title: test_files() of test_tools.test_unparse.DirectoryTestCase leaks 
references -> [EASY] test_files() of test_tools.test_unparse.DirectoryTestCase 
leaks references

___
Python tracker 

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



[issue30536] [EASY] SubinterpThreadingTests.test_threads_join_2() of test_threading leaks references

2017-06-02 Thread STINNER Victor

STINNER Victor added the comment:

I tagged this issue as easy. I consider that it's a good exercice for new 
contributors. Core developers: please let new contributors try to fix it since 
this issue is not critical, try to explain how to fix it rather than writing 
the fix ;-)

--
keywords: +easy (C)
title: SubinterpThreadingTests.test_threads_join_2() of test_threading leaks 
references -> [EASY] SubinterpThreadingTests.test_threads_join_2() of 
test_threading leaks references

___
Python tracker 

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



[issue30546] [EASY][Windows] test_uname_win32_ARCHITEW6432() of test_platform leaks references

2017-06-02 Thread STINNER Victor

STINNER Victor added the comment:

I tagged this issue as easy. I consider that it's a good exercice for new 
contributors. Core developers: please let new contributors try to fix it since 
this issue is not critical, try to explain how to fix it rather than writing 
the fix ;-)

--
keywords: +easy (C)
title: [Windows] test_uname_win32_ARCHITEW6432() of test_platform leaks 
references -> [EASY][Windows] test_uname_win32_ARCHITEW6432() of test_platform 
leaks references

___
Python tracker 

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



[issue30547] [EASY][Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references

2017-06-02 Thread STINNER Victor

STINNER Victor added the comment:

I tagged this issue as easy. I consider that it's a good exercice for new 
contributors. Core developers: please let new contributors try to fix it since 
this issue is not critical, try to explain how to fix it rather than writing 
the fix ;-)

--
keywords: +easy (C)
title: [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks 
references -> [EASY][Windows] SubinterpreterTest.test_callbacks_leak() of 
test_atexit leaks references

___
Python tracker 

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



[issue30548] typo in documentation for create_autospec

2017-06-02 Thread Erik Byström

New submission from Erik Byström:

"a class" should most probably be replaced by "an instance" in the 
documentation for create_autospec.

"You can use a class as the spec for an instance object by passing 
instance=True. The returned mock will only be callable if instances of the mock 
are callable."

https://docs.python.org/3/library/unittest.mock.html#unittest.mock.create_autospec

--
assignee: docs@python
components: Documentation
messages: 294993
nosy: Erik Byström, docs@python
priority: normal
severity: normal
status: open
title: typo in documentation for create_autospec
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



[issue21783] smtpd.py does not allow multiple helo/ehlo commands

2017-06-02 Thread Milan Oberkirch

Milan Oberkirch added the comment:

*Barry :P

--

___
Python tracker 

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



[issue21783] smtpd.py does not allow multiple helo/ehlo commands

2017-06-02 Thread Milan Oberkirch

Milan Oberkirch added the comment:

Thanks for pointing me at this, Berry! I added a PR for aiosmtpd at 
https://github.com/aio-libs/aiosmtpd/pull/106

--

___
Python tracker 

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



[issue30546] [Windows] test_uname_win32_ARCHITEW6432() of test_platform leaks references

2017-06-02 Thread STINNER Victor

Changes by STINNER Victor :


--
title: test_uname_win32_ARCHITEW6432() of test_platform leaks references -> 
[Windows] test_uname_win32_ARCHITEW6432() of test_platform leaks references

___
Python tracker 

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



[issue30547] [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks references

2017-06-02 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/15/steps/test/logs/stdio

0:02:58 [ 28/405/2] test_atexit failed
..
beginning 6 repetitions
123456

test_atexit leaked [12, 12, 12] references, sum=36
test_atexit leaked [4, 4, 4] memory blocks, sum=12


Code of of the test:

def test_callbacks_leak(self):
# This test shows a leak in refleak mode if atexit doesn't
# take care to free callbacks in its per-subinterpreter module
# state.
n = atexit._ncallbacks()
code = r"""if 1:
import atexit
def f():
pass
atexit.register(f)
del atexit
"""
ret = support.run_in_subinterp(code)
self.assertEqual(ret, 0)
self.assertEqual(atexit._ncallbacks(), n)


Hum, I don't understand: the test leaks references on purpose?


To reproduce the bug, use the command:

python -m test -R 3:3 -m test_callbacks_leak test_atexit


Note: Leak isolated my bisect_test.py of bpo-29512.

--
components: Tests, Windows
messages: 294990
nosy: eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: [Windows] SubinterpreterTest.test_callbacks_leak() of test_atexit leaks 
references
type: resource usage
versions: Python 3.7

___
Python tracker 

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



[issue30546] test_uname_win32_ARCHITEW6432() of test_platform leaks references

2017-06-02 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20Windows8.1%20Refleaks%203.6/builds/15/steps/test/logs/stdio

0:00:17 [  4/405/1] test_platform failed
..
beginning 6 repetitions
123456

test_platform leaked [12, 12, 12] references, sum=36
test_platform leaked [4, 4, 4] memory blocks, sum=12


To reproduce the bug, use the command:

python -m test -R 3:3 -m test_uname_win32_ARCHITEW6432 test_platform


Note: Leak isolated my bisect_test.py of bpo-29512.

--
components: Windows
messages: 294989
nosy: eryksun, haypo, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: test_uname_win32_ARCHITEW6432() of test_platform leaks references
type: resource usage
versions: Python 3.7

___
Python tracker 

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



[issue30544] _io._WindowsConsoleIO.write raises the wrong error when WriteConsoleW fails

2017-06-02 Thread Eryk Sun

Eryk Sun added the comment:

The following is an example of the problem, right?

>>> fd = os.open('stdout.txt', os.O_CREAT | os.O_WRONLY)
>>> os.dup2(fd, 1)
>>> print('spam')
Traceback (most recent call last):
  File "", line 1, in 
OSError: [WinError 87] The parameter is incorrect

Code like this used to work, so possibly this needs to be addressed more 
generally. I have a couple ideas, but they're major changes. It's simpler to 
require code that pulls the rug out from under _WindowsConsoleIO to rebind 
sys.std*. 

For a counterexample, PyOS_StdioReadline always checks for a console and falls 
back on the old my_fgets function for a non-console. For example:

>>> open('stdin.txt', 'w').write('x=42; os.dup2(oldfd, 0)\n')
24
>>> fd = os.open('stdin.txt', os.O_RDONLY)
>>> oldfd = os.dup(0); os.dup2(fd, 0)
>>> Breakpoint 0 hit
python36!my_fgets:
`66e98318 488bc4  mov rax,rsp
0:000> g
>>> x
42

--
keywords: +3.2regression
nosy: +eryksun

___
Python tracker 

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



[issue11783] email parseaddr and formataddr should be IDNA aware

2017-06-02 Thread Milan Oberkirch

Milan Oberkirch added the comment:

I see your point, but I'm not fully convinced it relates to this PR directly: 
the code here just uses the standard interface to use an 'idna' codec. If that 
codec is buggy that is a different issue.

If it's so buggy that using it is absolutely pointless, it should not exist in 
the first place IMHO. But if we need to keep a useless codec for compabilety 
reasons and you prefer adding a now codec (e.g. 'idna-2008') I agree that we 
should put this PR on hold until a codec it could use exists.

--

___
Python tracker 

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



[issue30538] Functional Programming HOWTO describes one argument itertools.count()

2017-06-02 Thread Raymond Hettinger

Raymond Hettinger added the comment:

If you would like, go ahead an submit a PR.

--
assignee: docs@python -> rhettinger
nosy: +rhettinger
priority: normal -> low

___
Python tracker 

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



  1   2   >