[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you please update the documentation Antoine?

* An entry in the C API section of Misc/NEWS.
* The "What's New" document needs changes in multiple places: the os module 
improvement, C API additions and deprecation, and may be in porting guide.
* Update references to PyOS_AfterFork() in the documentation and comments.

--
status: closed -> open

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
pull_requests: +1928

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Can multiprocessing.util.register_after_fork() be rewritten with using the 
> new API?

It wouldn't benefit much from it, and there might be timing issue given the 
comments in BaseProcess._bootstrap():

old_process = _current_process
_current_process = self
try:
util._finalizer_registry.clear()
util._run_after_forkers()
finally:
# delay finalization of the old process object until after
# _run_after_forkers() is executed
del old_process

--

___
Python tracker 

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



[issue30493] Increase coverage of base64

2017-05-28 Thread Lee Cannon

Lee Cannon added the comment:

Suggested changes have been applied to the PR.

--

___
Python tracker 

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



[issue30495] IDLE: modernize textview module

2017-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:


New changeset 0aa0a06e8b719533aefd175a5716f1698f474052 by terryjreedy 
(csabella) in branch 'master':
bpo-30495: IDLE: Modernize textview.py with docstrings and PEP8 names (#1839)
https://github.com/python/cpython/commit/0aa0a06e8b719533aefd175a5716f1698f474052


--

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In PR 1834 Gregory proposes an alternate API:

os.register_at_fork(*, before=None, after_in_parent=None, 
after_in_child=None)

Maybe open a new issue for this?

--

___
Python tracker 

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



[issue30346] Odd behavior when unpacking `itertools.groupby`

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Raymond, could you please look at these patches? Both are small. What do you 
prefer?

--

___
Python tracker 

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



[issue30496] Incomplete traceback with `exec`

2017-05-28 Thread Stefan Seefeld

New submission from Stefan Seefeld:

The following code is supposed to catch and report errors encountered during 
the execution of a (python) script:

```
import traceback
import sys

try:
env = {}
with open('script') as f:
exec(f.read(), env)
except:
type_, value_, tb = sys.exc_info()
print (traceback.print_tb(tb))
```
However, depending on the nature of the error, the traceback may contain the 
location of the error *within* the executed `script` file, or it may only 
report the above `exec(f.read(), env)` line.

The attached tarball contains both the above as well as a 'script' that exhibit 
the problem.

Is this a bug or am I missing something ? Are there ways to work around this, 
i.e. determine the correct (inner) location of the error ?

(I'm observing this with both Python 2.7 and Python 3.5)

--
files: pyerror.tgz
messages: 294645
nosy: stefan
priority: normal
severity: normal
status: open
title: Incomplete traceback with `exec`
type: behavior
Added file: http://bugs.python.org/file46908/pyerror.tgz

___
Python tracker 

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



[issue11822] Improve disassembly to show embedded code objects

2017-05-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
pull_requests: +1931

___
Python tracker 

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



[issue30300] asyncio.Controller

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think the API is too specific.  Instead of requiring hostname and port, why 
not let the user override setup and teardown coroutines?

In your case, this could be:

async def setup(self):
self.server = await self.loop.create_server(...)

async def teardown(self):
await self.server.wait_closed()

--
nosy: +giampaolo.rodola, pitrou, yselivanov

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
status: open -> closed

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset 4a8bcdf79cdb3684743fe1268de62ee88bada439 by Antoine Pitrou in 
branch 'master':
bpo-16500: Use register_at_fork() in the threading module (#1843)
https://github.com/python/cpython/commit/4a8bcdf79cdb3684743fe1268de62ee88bada439


--

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can threading._after_fork() be rewritten with using the new API?

--

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Can multiprocessing.util.register_after_fork() be rewritten with using the new 
API?

--

___
Python tracker 

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



[issue30177] pathlib.resolve(strict=False) only includes first child

2017-05-28 Thread Richard Cooper

Richard Cooper added the comment:

Pull Request (PR 1649) treats this as a documentation problem. I would argue 
that the documentation is correct and this is a bug in the code.

The `strict` flag was added as a result of issue19717. The decision on what to 
do when strict=False seems to come in 
https://mail.python.org/pipermail/python-ideas/2016-September/042203.html where 
Guido says:

"I would prefer it if Path.resolve() resolved symlinks until it hits
something that doesn't exist and then just keep the rest of the path
unchanged."

The documented behaviour also seems much more useful than the current behaviour.

--
nosy: +richardc

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:


New changeset f7ecfac0c15f0c43ef5e6c0081eb3a059af9f074 by Antoine Pitrou in 
branch 'master':
Doc nits for bpo-16500 (#1841)
https://github.com/python/cpython/commit/f7ecfac0c15f0c43ef5e6c0081eb3a059af9f074


--

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
pull_requests: +1929

___
Python tracker 

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



[issue30248] Using boolean arguments in the _json module

2017-05-28 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
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



[issue11822] Improve disassembly to show embedded code objects

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

PR 1844 implements Nick's suggestion, but I don't like it. This complicates 
both the interface and the implementation.

help() also can produce very noisy output if request the documentation of the 
whole module. But the output of help() usually is piped through a pager. Would 
it help if pipe the output of dis() through a pager if the output file and 
stdin are attached to a terminal?

--

___
Python tracker 

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



[issue30431] input function truncates prompt by NULL byte

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If stdin and stdout are attached to a terminal, input() uses the readline 
library (if it is available) for displaying the prompt and reading user input. 
This is the limitation of the readline library and Python C API that this works 
with null-terminated C strings. You also can't enter the null character.

UnicodeEncodingError is raised if the prompt contains characters not encodable 
with the stdout encoding. Consider ValueError raised if the prompt contains the 
null character as similar restriction.

--

___
Python tracker 

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



[issue13349] Non-informative error message in index() and remove() functions

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I concur with Raymond.

But shouldn't we change error messages that contains the repr of not found 
value? Affected collections are list, deque and range.

>>> [].index('spam')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: 'spam' is not in list
>>> import collections
>>> collections.deque().index('spam')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: 'spam' is not in deque

range.index() raises different error messages depending on the type of the 
value:

>>> range(10).index('spam')
Traceback (most recent call last):
  File "", line 1, in 
ValueError: sequence.index(x): x not in sequence
>>> range(10).index(42)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: 42 is not in range

--

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

This new warning is introducing difficulties for some Cython-compiled modules: 
https://github.com/cython/cython/issues/1720

--
nosy: +pitrou

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 28/05/2017 à 11:22, Serhiy Storchaka a écrit :
> 
> Serhiy Storchaka added the comment:
> 
> Can threading._after_fork() be rewritten with using the new API?

It should be possible indeed. Let me see.

--

___
Python tracker 

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



[issue30495] IDLE: modernize textview module

2017-05-28 Thread Cheryl Sabella

Cheryl Sabella added the comment:

Thanks Terry!

I had done a search in Spyder using "textView" and only found those files that 
I changed, but now I see what I did wrong.  If I do it within a different git 
branch that isn't up to update with the master, it won't show up, but if I do 
it in the proper branch, it does show up.  I'm learning git, so now I know to 
be more careful when searching.  I should grep it too, just to see how git and 
grep work together.

I ran the test on the one file I changed, but now I know to run it on the whole 
test suite.  I should have realized that.  

Thanks again for all your patience.

--

___
Python tracker 

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



[issue30248] Using boolean arguments in the _json module

2017-05-28 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:


New changeset ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1 by Serhiy Storchaka in 
branch 'master':
bpo-30248: Convert boolean arguments only once in _json. (#1423)
https://github.com/python/cpython/commit/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1


--

___
Python tracker 

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



[issue19717] resolve() fails when the path doesn't exist

2017-05-28 Thread Marcel Plch

Changes by Marcel Plch :


--
pull_requests: +1930

___
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-05-28 Thread Brett Cannon

Brett Cannon added the comment:

One way to control this would allow `-r` to take an optional `fast` argument to 
do this selective shuffle of the slowest tests, i.e. `-r fast` would still 
randomize but control for the slowest tests showing up in the first 75% of 
tests.

--

___
Python tracker 

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



[issue11822] Improve disassembly to show embedded code objects

2017-05-28 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> Would it help if pipe the output of dis() through a pager 
> if the output file and stdin are attached to a terminal?

-1 for adding a pager.

--

___
Python tracker 

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



[issue16500] Allow registering at-fork handlers

2017-05-28 Thread Gregory P. Smith

Gregory P. Smith added the comment:

I'll just reuse this issue, I started that work just to try and clean up the 
new API and docs added in this one to be more modern.  Thanks for the code 
review, good suggestions!

--
assignee:  -> gregory.p.smith
stage: resolved -> commit review
status: closed -> open

___
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-05-28 Thread Brett Cannon

New submission from Brett Cannon:

If we guaranteed that the slowest tests in the test suite started early enough 
in the test run to complete before the final test finished, we could shave off 
several minutes worth of time in cases where the slowest tests are the hold-up. 
So perhaps if we randomly inserted the 10 slowest tests in the first 3/4 of the 
complete test list we could make sure they finish early enough?

--
components: Tests
messages: 294658
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: Run Python's slowest tests in the first 3/4 of tests when using -r
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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

AFAICT, Cython simply calls PyModule_Create() on Python 3.

--
nosy: +scoder

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Antoine Pitrou

Antoine Pitrou added the comment:

multidict is a package, the Cython module is multidict._multidict.

Cython translated "import sys" into this:

  __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) 
__PYX_ERR(0, 5, __pyx_L1_error)

And __Pyx_Import is this:
https://gist.github.com/pitrou/9a0d94aba3495ce3eb8630d4797d67bb

Note that __Pyx_MODULE_NAME is defined thusly:
#define __Pyx_MODULE_NAME "multidict._multidict"

So perhaps Cython is indeed attempting a PyImport_ImportModuleLevelObject()
call with a level of 1 for "import sys" before falling back on a level of -1...

Why I don't know.

(also since __Pyx_MODULE_NAME seems known, Cython could actually define 
__package__)

--

___
Python tracker 

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



[issue30495] IDLE: modernize textview module

2017-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I believe you said elsewhere that you would like to try the refactoring that 
splits a window+frame class into a window class and a frame class. It would be 
great if you became good at doing this.

If the current class name is used externally, I might consider reusing it for 
the window class.  But since the external interface for textview is the two 
wrapper functions, 'TextView' is not used externally.

F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 3: Since all methods and 
functions create (or destroy) a TextViewer, which
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 31: # If we call 
TextViewer or wrapper functions with defaults
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 36: class 
TV(tv.TextViewer):  # Used in TextViewTest.
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 73: # Call TextViewer 
with modal=False.
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 88: 
self.assertIsInstance(view, tv.TextViewer)
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 93: 
self.assertIsInstance(view, tv.TextViewer)
F:\dev\cpython\lib\idlelib\idle_test\test_textview.py: 113: # Call TextViewer 
with _utest=True.
F:\dev\cpython\lib\idlelib\pyshell.py: 895: # XXX KBK 27Dec07 use 
TextViewer someday, but must work w/o subproc
F:\dev\cpython\lib\idlelib\textview.py: 11: class TextViewer(Toplevel):
F:\dev\cpython\lib\idlelib\textview.py: 78: """Create TextViewer for given 
text.
F:\dev\cpython\lib\idlelib\textview.py: 87: return TextViewer(parent, 
title, text, modal, _utest=_utest)
F:\dev\cpython\lib\idlelib\textview.py: 91: """Create TextViewer for text 
in filename.
F:\dev\cpython\lib\idlelib\textview.py: 116: run(TextViewer)

So lets try TextviewWindow and TextviewFrame.  Make the obvious substitutions, 
except in the PyShell and line 78 and 91 comments, 'TextViewer' should become a 
generic 'text viewer' that would apply to TextviewFrame if that became the main 
entry point.

If you want to show me an incomplete patch, you can still upload diffs here.

--
stage: patch review -> needs patch

___
Python tracker 

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



[issue30497] Line number of docstring in AST

2017-05-28 Thread Steven Myint

New submission from Steven Myint:

Since #29463, it is no longer obvious how to get the line number of a docstring 
in the AST:

import ast

x = ast.parse('''\
def foo():
"""This is a docstring."""
''')

# In Python 3.6, the docstring and line number would be:
print(x.body[0].body[0].value.s)
print(x.body[0].body[0].value.lineno)

# In Python 3.7, I don't know what the equivalent would be.
print(x.body[0].docstring)
# Line number?

We use this feature in pyflakes (https://github.com/PyCQA/pyflakes/issues/271).

--
components: Interpreter Core
messages: 294654
nosy: myint
priority: normal
severity: normal
status: open
title: Line number of docstring in AST
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



[issue30495] IDLE: modernize textview module

2017-05-28 Thread Terry J. Reedy

Terry J. Reedy added the comment:

What I have learned:
1. As with hg, the local master should be updated at least at the beginning of 
each work session, and python.exe rebuilt.
2. Patches to master should be developed with all 'other' files updated.  For 
completely new branches, this is automatic.  Branches created from PRs start 
out of sync and should be updated.

One can often, perhaps even 'usually', get away with not doing the above, but 
occasional mysterious glitches can occur.  Example: when I created a branch 
from your bdb docstring PR, 9 days later, and did not update, 'import re' 
failed in the new branch.  Problem disappeared after update.

By 'grep', I mean any multi-file search, starting in a specified directory, 
such as IDLE's 'Find in Files', not the specific unix program.  I develop code 
and test for x by repeatedly running just 'test_x', but grepping and running 
test_idle before commit is essential.  As we expand test files, test_idle will 
become more and more useful.

--

___
Python tracker 

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



[issue13349] Non-informative error message in index() and remove() functions

2017-05-28 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Thanks, I understand why this isn't the best idea now.

> shouldn't we change error messages that contains the repr of not found value? 

That is what I was thinking too, apart from removing the repr from other 
messages it will also unify reporting for all these methods.

--

___
Python tracker 

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



[issue29626] Issue with spacing in argparse module while using help

2017-05-28 Thread R. David Murray

R. David Murray added the comment:

If I'm interpreted what the OP wrote correctly, he wanted the help text to not 
show that the option takes an argument, but instead rely on the help text to 
show that.  That works for the option text, but it doesn't work for the 
synopsis (the synopsis is just wrong in that case).

Probably a blank metavar should just be rejected because of the issue with they 
synopsis.  That should only be done in 3.7 if we do it, though.

Perhaps the OP will respond to explain the blank-metavar use case in more 
detail.

--

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Brett Cannon

Brett Cannon added the comment:

Is Cython not defining actual module objects or working around 
types.ModuleType? I'm just trying to figure out how a Cython module is ending 
up in a place where the attributes that are set by PyModule_NewObject() aren't 
there 
(https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Objects/moduleobject.c#L80).

--

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Brett Cannon

Brett Cannon added the comment:

OK, so the warning is triggered if __package is None or __spec__ is None 
(https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Lib/importlib/_bootstrap.py#L1038).
 That's defined in _calc___package__() which is only called if index != 0 when 
calling __import__() 
(https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Lib/importlib/_bootstrap.py#L1062
 or 
https://github.com/python/cpython/blob/ac5bbd43bc7b769c13ae0412cb28a3521f4d4ff1/Python/import.c#L1520).

So the question becomes how is Cython importing modules? This warning should 
only be triggered if you're attempting a relative import from within a package 
(and thus have a level > 0). Based on Antoine's Cython issue, since something 
like multidict isn't a package it would suggest either Cython is setting the 
level > 0 when it doesn't mean to or there's a bug somewhere with level == 0 
and yet Python is still trying to calculate the parent package for no reason.

--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-05-28 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee: docs@python -> rhettinger

___
Python tracker 

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



[issue30500] urllib connects to a wrong host

2017-05-28 Thread Nam Nguyen

New submission from Nam Nguyen:

Reported by Orange Tsai:

==
Hi, Python Security Team

import urllib
from urlparse import urlparse

url = 'http://127.0.0.1#@evil.com/'
print urlparse(url).netloc  # 127.0.0.1
print urllib.urlopen(url).read()# will access evil.com


I have tested on the latest version of Python 2.7.13.
==

--
components: Library (Lib)
messages: 294667
nosy: Nam.Nguyen
priority: normal
pull_requests: 1933
severity: normal
status: open
title: urllib connects to a wrong host
type: security
versions: Python 2.7, Python 3.7

___
Python tracker 

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



[issue25791] Raise an ImportWarning when __spec__.parent/__package__ isn't defined for a relative import

2017-05-28 Thread Nick Coghlan

Nick Coghlan added the comment:

Is it possible Cython is still supporting pre-PEP-328 style implicit relative 
imports, even 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



[issue30500] urllib connects to a wrong host

2017-05-28 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


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



[issue3062] Turtle speed() function has no effect under Mac OS X

2017-05-28 Thread Carol Willing

Carol Willing added the comment:

Turtle speed() functions appropriately on current MacOS 10.12.4. Both Python 
3.1 and 3.2 have reached End of Life. Issue closed as out of date.

--
nosy: +willingc
resolution:  -> out of date
stage: needs patch -> resolved
status: open -> closed

___
Python tracker 

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



[issue7074] Turtle module crashes python

2017-05-28 Thread Carol Willing

Carol Willing added the comment:

Ran the turtlecrash.py example with Python 3.6 on MacOS 10.12.4. I was unable 
to create a crash using keypresses. I recommend closing as 3.2 has reached EOL 
and 3.3 will reach EOL in less than 5 months. I'm going to change status to 
Pending and Resolution to out of date. I will close in 2 weeks if there is no 
further feedback on the issue. Thanks.

--
nosy: +willingc
resolution:  -> out of date
status: open -> pending

___
Python tracker 

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



[issue30500] urllib connects to a wrong host

2017-05-28 Thread Martin Panter

Martin Panter added the comment:

See also Issue 18140, where it looks like people _want_ the hash (#) to be part 
of the username and/or password.

Another option may be to raise an exception.

--
nosy: +martin.panter

___
Python tracker 

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



[issue11978] Report correct coverage.py data for tests that invoke subprocesses

2017-05-28 Thread Brett Cannon

Brett Cannon added the comment:

I learned a few thing trying to make this work.

One is that the COVERAGE_PROCESS_START does need to point to an actual .ini 
file (which includes an empty file).

Two, 
https://bitbucket.org/ned/coveragepy/src/63dfe482a849e9cb0b82214242315a806a6a3d53/coverage/control.py?at=default=file-view-default#control.py-1265
 shows that stdlib coverage is left off by this, so even if you do turn on 
tracing in a subprocess, it will still ignore the stdlib. That means the 
coverage config file must turn on stdlib coverage in order or it to be picked 
up in the subprocesses.

Three, you need to run `coverage combine` to create a unified .coverage file 
for `coverage report` to pick up (I don't know if codecov explicitly needs the 
merge step.

When I have time I'll make a PR to test if this change actually helps speed 
things up.

--

___
Python tracker 

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



[issue11978] Report correct coverage.py data for tests that invoke subprocesses

2017-05-28 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue29626] Issue with spacing in argparse module while using help

2017-05-28 Thread paul j3

paul j3 added the comment:

I don't anticipate  any backward compatibility issues with the proposed patch.  
But at the same time it feels almost too trivial of an issue to merit a patch.  

A short metavar such as `metavar="ID"' or even `metavar="_"' would be nearly as 
compact, and still leave an indicator of the required argument (in usage as 
well as the help).

I'm not even sure if disallowing a blank metavar is worth the change.

As indicated before I've only seen this extra space problem when I or others 
suggest the blank metavar as a way making a more compact help invocation.  That 
has come up frequently on SO, but I can't find a relevant bug/issue.  

https://stackoverflow.com/a/18280876/901925 - here I suggest suppressing the 
help line and putting custom info in the group's description.

https://stackoverflow.com/questions/9642692/argparse-help-without-duplicate-allcaps
 - suggests a help formatter subclass

So maybe the bigger issue is, can we make it easier to customize the the help 
invocation formatting?

Things to consider:

- metavar affects both the help line and usage

- setting help width and indentation is a messy part of the formatter

- there are unittests for long and long-long-longer option names to test these 
indentation issues.

As with some other help formatter issues, we are treading a fine line between 
making trivial patches, and substantive ones that make it cleaner and more 
robust.

--

___
Python tracker 

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



[issue29670] argparse: does not respect required args pre-populated into namespace

2017-05-28 Thread paul j3

paul j3 added the comment:

http://bugs.python.org/issue26394
Have argparse provide ability to require a fallback value be present

is a related issue - getting 'required' values from a config file.

--

___
Python tracker 

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



[issue26394] Have argparse provide ability to require a fallback value be present

2017-05-28 Thread paul j3

paul j3 added the comment:

http://bugs.python.org/issue29670
argparse: does not respect required args pre-populated into namespace

wants to put 'required' values in the Namespace.  That's a similar issue.

An idea that I tried for that (but didn't submit as a patch) is to move the 
tests at the end of _parse_know_args to a separate function that is called by 
parse_known_args.  

In http://bugs.python.org/issue26394#msg261540 I suggested putting the fallback 
in the testing section of _parse_known_args.  If that testing section is in a 
separate method, it would be easier to customize and add such a fallback.

--

___
Python tracker 

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



[issue30499] Deprecated note in set documentation

2017-05-28 Thread Julien Palard

New submission from Julien Palard:

While translating doc to french, I found a surprising comment in stdtypes.html 
about sets, stating:

> To support searching for an equivalent frozenset, the elem set is temporarily 
> mutated during the search and then restored. During the search, the elem set 
> should not be read or mutated since it does not have a meaningful value.

So I searched the equivalent in the code, at least to help me understand it to 
translate it in a proper way, but found it has been deleted in 
51ced7afe72d861b46f069d757f2787f13253d32.

This commit is in branches 2.7 and 3.1 to 3.6 (and master).

--
assignee: docs@python
components: Documentation
messages: 294662
nosy: docs@python, mdk, rhettinger
priority: normal
severity: normal
status: open
title: Deprecated note in set documentation
versions: Python 2.7, 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



[issue30499] Deprecated note in set documentation

2017-05-28 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +1932

___
Python tracker 

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



[issue30300] asyncio.Controller

2017-05-28 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Hi Antoine,

On May 28, 2017, at 11:07 AM, Antoine Pitrou wrote:

>I think the API is too specific.

Can you elaborate?  What's too specific about it?  Do you have in mind a use
case where you wouldn't need to provide hostname and port?

>Instead of requiring hostname and port, why not let the user override setup
>and teardown coroutines?
>
>In your case, this could be:
>
>async def setup(self):
>self.server = await self.loop.create_server(...)
>
>async def teardown(self):
>await self.server.wait_closed()

It's certainly possible to factor those out so they could be overridden, I'm
just not sure why that's needed.

--

___
Python tracker 

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