[issue29642] Why does unittest.TestLoader.discover still rely on existence of __init__.py files?

2017-02-27 Thread INADA Naoki

INADA Naoki added the comment:

When using import, (namespace) package name is explicitly specified.
Only specified name is searched.

In test loader's case, there are no such limit.
Loader may search millions of completely unrelated directories.
It may include directories in NFS or samba over slow network.

--

___
Python tracker 

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



[issue29642] Why does unittest.TestLoader.discover still rely on existence of __init__.py files?

2017-02-27 Thread INADA Naoki

INADA Naoki added the comment:

I'm afraid this change makes testloader searches unrelated directory contains 
massive files (like node_modules).

I don't think loading all tests from whole namespace package is not usual use 
case.

--
nosy: +inada.naoki

___
Python tracker 

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



[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2017-02-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks Raymond. I would like to keep the example style another issue, not this 
one. :-) And I hope someone is willing to review the PR.

--
assignee:  -> xiang.zhang
stage: needs patch -> patch review
versions: +Python 3.7 -Python 3.6

___
Python tracker 

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



[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Is 2.7 free from this bug?

--

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

But it is *very easy* to fix this bug in 2.7.

--
keywords: +patch
resolution: fixed -> 
stage: resolved -> patch review
status: closed -> open
versions: +Python 2.7 -Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46678/issue29655-2.7.patch

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The patch is backported to 3.6.1.

--
versions: +Python 3.6
Added file: http://bugs.python.org/file46677/zipfile-pathlib-3.6.1.patch

___
Python tracker 

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




[issue7769] SimpleXMLRPCServer.SimpleXMLRPCServer.register_function as decorator

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 for the decorator idea.  It feels very natural.

A little off topic, I do not like the with-statement example that we currently 
have in the docs.  I think it is bad design to put some much code inside 
with-block.  In the micro-webframeworks, we register functions separately from 
launching the server.  The same practice should apply here as well.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29669] Missing import of bisect in the documentation examples

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry, but I think this is a waste.  A number of the example sections presume 
that the module under discussion has been imported.   Also, these docs have 
been around for a long time without the slightest indication of confusion.

--
nosy: +rhettinger
resolution:  -> rejected
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



[issue17894] Edits to descriptor howto

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

I will work on it thank you.

--
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Ned Deily

Ned Deily added the comment:

> Note that Ned gave us a permission to get this into 3.6.1.

I may have although I don't remember specifically discussing zipfile.  In any 
case, I'm willing to consider it.  I think you can make good arguments for and 
against.  Yes, it could smell like adding a feature but, on the other add, one 
of the implicit goals of 3.6.0 was to make Path objects supported across the 
standard library as much as possible, so the lack of support in zipfile (and a 
few other similar modules) could be viewed as bug.  Also, as far as I can tell, 
this should be a totally upwards-compatible change except in the presumably 
unlikely case something is counting on getting an exception when passing a Path 
object to zipfile.  I say we invoke "practicality beats purity" for this as 
long as Serhiy is OK with having it cherry-picked to 3.6 and as long as no 
other core developer here has a strong objection.

--

___
Python tracker 

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



[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Thanks Raymond!

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



[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-27 Thread Xiang Zhang

Changes by Xiang Zhang :


--
pull_requests: +302

___
Python tracker 

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



[issue29673] Some gdb macros are broken in 3.6

2017-02-27 Thread Skip Montanaro

Skip Montanaro added the comment:

Note that these macros were always expected to be fragile. They depend to a 
great extent on the layout of the functions in Python/ceval.c. I've had to 
tweak them a couple times over the years.

I'm pretty sure the gdb instance I have available to me at work wasn't 
configured --with-python, and corporate policies would prevent me from 
downloading the source and building my own private version. For me, 
Misc/gdbinit is likely to be the best I can do for the foreseeable future. 

If the layout of ceval.c has changed sufficiently between Python 2.x and 3.x, 
perhaps two versions of gdbinit are warranted, with the version delivered for 
Python 3 being appropriate for the current release.

--
nosy: +skip.montanaro

___
Python tracker 

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



[issue29573] NamedTemporaryFile with delete=True should not fail if file already deleted

2017-02-27 Thread Jakub Wilk

Jakub Wilk added the comment:

Deleting non-existent files in /tmp is an indicator of a security hole.
This kind of error must never pass silently.

--
nosy: +jwilk

___
Python tracker 

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



[issue29673] Some gdb macros are broken in 3.6

2017-02-27 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

I tried to simply replace  _PyUnicode_AsString with PyUnicode_AsUTF8, but it 
looks like code structure has changed and the pyframe and pystack macros don't 
work anymore.

--

___
Python tracker 

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



[issue29673] Some gdb macros are broken in 3.6

2017-02-27 Thread Alexander Belopolsky

New submission from Alexander Belopolsky:

Some gdb macros defined in Misc/gdbinit got broken when _PyUnicode_AsString was 
renamed to PyUnicode_AsUTF8.

(gdb) pystack
No symbol "_PyUnicode_AsString" in current context.

--
messages: 288684
nosy: belopolsky
priority: normal
severity: normal
status: open
title: Some gdb macros are broken in 3.6
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



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

2017-02-27 Thread paul j3

Changes by paul j3 :


--
status: closed -> open

___
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-02-27 Thread paul j3

paul j3 added the comment:

Sorry, I missed that.  For some reason I looking something bigger.

That's coming from the `metavar=""'.

If I specify `metavar="xxx" that help line will have

-p xxx, --projectid xxx

Replace the 'xxx` with '', and you still have space between '-p' and ','.

Now that I see it, it looks familiar.  I noted it in passing in StackOverflow 
answer, http://stackoverflow.com/a/40497623/901925

I can't find a related bug/issue.  

It's a natural consequence of the formatting in 
HelpFormatter._format_action_invocation

# if the Optional takes a value, format is:
#-s ARGS, --long ARGS
parts.append('%s %s' % (option_string, args_string))

There's no special handling for the case where ARGS is blank.

That formatter method could be customized as suggested in 

http://stackoverflow.com/a/23941599/901925

Often people want a more compact invocation like:

  -s, --long ARGhelp

Usage gets that space between option_string and args_string, but it gets 
striped out later.

So the fix (not tested) would something like:

  def _format_action_invocation(self, action):
   
   for option_string in action.option_strings:
   if len(args_string)>0:
parts.append('%s %s' % (option_string, args_string))
   else:
parts.append('%s' % option_string)
   

--

___
Python tracker 

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-02-27 Thread Gregory P. Smith

Gregory P. Smith added the comment:

great! that makes me feel much less bad about fixing this in the way i desire. 
:)

--

___
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-02-27 Thread Falguniben Jhaveri

Falguniben Jhaveri added the comment:

There is an extra spacing here if you look carefully. I have commented
above the code. Similarly it happens for "-o" too but not for other
alphabets.

1427:~/mypy/argdev$ python3 issue29626.py delete -h
usage: cli delete [-h] [-p] userid

Deletes a user in your organization.

positional arguments:
  userid The userid of user.

optional arguments:
  -h, --help show this help message and exit
// extra space after p and ",".
  -p , --projectid   Specify the project ID of project from where you want
to
 delete the user or else user will be deleted from
 organization.

I saw this issue as I use argparse for my CLI usecase which has nested
commands.

On Mon, Feb 27, 2017 at 2:39 PM, paul j3  wrote:

>
> paul j3 added the comment:
>
> This help looks normal:
>
> 1427:~/mypy/argdev$ python3 issue29626.py delete -h
> usage: cli delete [-h] [-p] userid
>
> Deletes a user in your organization.
>
> positional arguments:
>   userid The userid of user.
>
> optional arguments:
>   -h, --help show this help message and exit
>   -p , --projectid   Specify the project ID of project from where you want
> to
>  delete the user or else user will be deleted from
>  organization.
>
> So does this help for the nested subparser:
>
> 1430:~/mypy/argdev$ python3 issue29626.py nodes list -h
> usage: cli nodes list [-h] [-p] [-o]
>
> Lists nodes in your current project
>
> optional arguments:
>   -h, --help   show this help message and exit
>   -p, --projectid
>   -o, --org(For administrators only) Lists all the nodes in
>
> This double layered subparsers is not common, and might not even be
> included in the unittest file.  But provided you don't try anything too
> tricky it does work.  I've seen a few questions along this line on
> StackOverflow.
>
> Note that the help line for '-p' in the second case is empty because you
> did not specify any help string (as you did for 'delete').
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue29672] `catch_warnings` context manager causes warnings to be reprinted

2017-02-27 Thread Gerrit Holl

Gerrit Holl added the comment:

To clarify, this behaviour crosses module boundaries.  So even if some piece of 
code many layers deep buried in a module uses this context manager, it has 
global consequences.

--

___
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-02-27 Thread paul j3

paul j3 added the comment:

This help looks normal:

1427:~/mypy/argdev$ python3 issue29626.py delete -h
usage: cli delete [-h] [-p] userid

Deletes a user in your organization.

positional arguments:
  userid The userid of user.

optional arguments:
  -h, --help show this help message and exit
  -p , --projectid   Specify the project ID of project from where you want to
 delete the user or else user will be deleted from
 organization.

So does this help for the nested subparser:

1430:~/mypy/argdev$ python3 issue29626.py nodes list -h
usage: cli nodes list [-h] [-p] [-o]

Lists nodes in your current project

optional arguments:
  -h, --help   show this help message and exit
  -p, --projectid
  -o, --org(For administrators only) Lists all the nodes in

This double layered subparsers is not common, and might not even be included in 
the unittest file.  But provided you don't try anything too tricky it does 
work.  I've seen a few questions along this line on StackOverflow.

Note that the help line for '-p' in the second case is empty because you did 
not specify any help string (as you did for 'delete').

--

___
Python tracker 

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



[issue29672] `catch_warnings` context manager causes warnings to be reprinted

2017-02-27 Thread Gerrit Holl

Gerrit Holl added the comment:

I suppose this is a consequence of the change in:

http://bugs.python.org/issue4180

and although I can see why the warnings filter would be reset when entering the 
context manager, I don't think it is desirable to have side effects for modules 
that are entirely unrelated.

--

___
Python tracker 

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



[issue29672] `catch_warnings` context manager causes warnings to be reprinted

2017-02-27 Thread Gerrit Holl

New submission from Gerrit Holl:

Entering the `catch_warnings` context manager is causing warnings to be printed 
over and over again, rather than just once as it should.   Without such a 
context manager, the behaviour is as expected:

$ cat ./mwe.py 
#!/usr/bin/env python3.5

import warnings

for i in range(3):
try:
print(i, __warningregistry__)
except NameError:
print(i, "first warning")
warnings.warn("I don't like this.", UserWarning)
print(i, __warningregistry__)
#with warnings.catch_warnings():
#pass
print(i, __warningregistry__)
warnings.warn("I don't like this.", UserWarning)
$ ./mwe.py 
0 first warning
./mwe.py:10: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
0 {'version': 0, ("I don't like this.", , 10): True}
0 {'version': 0, ("I don't like this.", , 10): True}
./mwe.py:15: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
1 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
1 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
1 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
2 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
2 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
2 {'version': 0, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}

Uncommenting the context manager causes the warning to be printed every time:

$ ./mwe.py 
0 first warning
./mwe.py:10: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
0 {'version': 0, ("I don't like this.", , 10): True}
0 {'version': 0, ("I don't like this.", , 10): True}
./mwe.py:15: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
1 {'version': 2, ("I don't like this.", , 15): True}
./mwe.py:10: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
1 {'version': 2, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
1 {'version': 2, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
./mwe.py:15: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
2 {'version': 4, ("I don't like this.", , 15): True}
./mwe.py:10: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)
2 {'version': 4, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
2 {'version': 4, ("I don't like this.", , 15): True, 
("I don't like this.", , 10): True}
./mwe.py:15: UserWarning: I don't like this.
  warnings.warn("I don't like this.", UserWarning)

I think this is undesirable.  There is code deep inside a module that I'm using 
that is using the context manager, and as a consequence, I get warnings printed 
every time that should be printed only once.

See also on Stack Overflow: http://stackoverflow.com/q/42496579/974555

--
messages: 288677
nosy: Gerrit.Holl
priority: normal
severity: normal
status: open
title: `catch_warnings` context manager causes warnings to be reprinted
versions: Python 3.5

___
Python tracker 

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



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

2017-02-27 Thread Falguniben Jhaveri

Falguniben Jhaveri added the comment:

Sample code to repro this:

import argparse

parser = argparse.ArgumentParser(prog='cli')
subparsers = parser.add_subparsers(dest="command")

subparsers_user_delete = subparsers.add_parser("delete", help="Deletes a 
user in your organization.",
description="Deletes a 
user in your organization.")
subparsers_user_delete.add_argument("userid", help="The userid of user.", 
default=None, type=int)
subparsers_user_delete.add_argument("-p", "--projectid", metavar="",
help="Specify the project ID of project 
from where you want to delete"
 " the user or else user will be 
deleted from organization.", type=int,
default=None)

parser_nodes = subparsers.add_parser('nodes')
sp = parser_nodes.add_subparsers()
p1 = sp.add_parser('list', description='Lists nodes in your current 
project')
p1.add_argument('-p', '--projectid', action='store_true')
p1.add_argument('-o', '--org', action='store_true', help=' (For 
administrators only) Lists all the nodes in')
parser.parse_args()

Please run following command:
$issue.py delete -h

--

___
Python tracker 

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



[issue28791] update sqlite to 3.17.0

2017-02-27 Thread Big Stone

Big Stone added the comment:

python-3.7 should include the latest stable sqlite, at the time of last alpha.

--
title: update sqlite to 3.15.2 -> update sqlite to 3.17.0

___
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-02-27 Thread paul j3

paul j3 added the comment:

With this setup

import argparse
parser=argparse.ArgumentParser(prog='cli')
parser.add_argument('nodes')
sp=parser.add_subparsers()
p1 = sp.add_parser('list', description='Lists nodes in your current project')
p1.add_argument('-p','--projectid', action='store_true')
p1.add_argument('-o', '--org', action='store_true', help=' (For administrators 
only) Lists all the nodes in')
parser.parse_args()


this help looks normal

1354:~/mypy/argdev$ python3 issue29626.py nodes list -h
usage: cli nodes list [-h] [-p] [-o]

Lists nodes in your current project

optional arguments:
  -h, --help   show this help message and exit
  -p, --projectid
  -o, --org(For administrators only) Lists all the nodes in

Without further feedback this issue should be closed

--

___
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-02-27 Thread paul j3

Changes by paul j3 :


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



[issue26389] Expand traceback module API to accept just an exception as an argument

2017-02-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Comments probably apply to format_exception and in part, format_exception_only 
(both also patched in PR237) but I have not checked behavior or code at all.

--

___
Python tracker 

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



[issue29671] Add function to gc module to check if any reference cycles have been reclaimed.

2017-02-27 Thread Kevin Mills

Kevin Mills added the comment:

gc.disable() at the beginning and then analyzing the results of gc.collect() 
actually does do what I was wanting, thank you.

Reference cycles in and of themselves aren't the problem. It's only a problem 
if garbage contains reference cycles. In a normal program, a class wouldn't 
generally ever become garbage, so it wouldn't be a problem.

--

___
Python tracker 

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



[issue26389] Expand traceback module API to accept just an exception as an argument

2017-02-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The print_exception API goes back to when exception values were (or at least, 
could be) strings.  Its doc is incomplete as to the requirements on the args 
and, at least by 3.5, erroneous.  To modify it, we need to understand how it 
actually works now.

In 2.7, 'etype' can apparently by anything with an __str__ method.  (Someone 
could check the 2.7 code.) At least Exception, 'abc', and None result in 
'Exception', 'abc' or 'None' leading the last line.  Example:
>>> try: 1/0
except Exception as e:
tb.print_exception(None, e, None)

None: integer division or modulo by zero

By at least 3.5, the etype arg can definitely be anything, because it is 
ignored.  The printed exception type is already grabbed from the exception. Any 
patch should not change this.  Note that this 3.x change already introduced an 
incompatibility.  In 3.5, the above prints 'ZeroDivisionError' instead of 
'None'.

This holdover line in the doc "prints the exception etype and value after the 
stack trace" is wrong and should be corrected with a 'changed in 3.x' note if 
done after 3.0.  

In 2.7, value can at least be an exception, a string, or None (not documented). 
 (Ditto for checking the code.)

>>> try: 1/0
except Exception as e:
tb.print_exception(None, 'zero-divive', tb=None)

None: zero-divive
>>> try: 1/0
except Exception as e:
tb.print_exception(None, None, None)

None

In 3.?, value must be an exception instance (or compatible duck) (not 
documented).
...
  File "C:\Programs\Python36\lib\traceback.py", line 465, in __init__
if (exc_value and exc_value.__cause__ is not None
AttributeError: 'str' object has no attribute '__cause__'

So, more potential incompatibilities with 2.x.

In 2.7, tb is needed to supply the traceback, or to suppress it.  As a separate 
parameter, it allows a traceback to be modified before printing.*  The option 
of a modified or omitted traceback (the ultimate modification) should be kept.

*IDLE edits tracebacks before printing to delete artifacts introduced by IDLE 
internals.  The attempt is to print what the console interpreter would.  I 
don't currently know whether it replaces the original on the exception or not.  
There is also a proposal for the standard interpreter to edit tracebacks after 
recursion limit exceptions.  So traceback editing is useful, and I see no need 
to force replacement of the semi-private e.__traceback__.


My suggestions:

tb: In 3.7, in the API, change 'tb' to 'tb=True'.  If tb is left True, grab it 
from the exception.  If tb is explicitly supplied, use it.  If tb is set to 
False or (for back compatibility) None, suppress it. 

value: In 3.5+ document that it must be an exception.
(Optional) Change 'value' to 'exc' in the API to reflect the 3.x restriction. 
Document 'value' as a deprecated synonym for keyword usage. Keep the synonym 
until after 2.7. 

etype: In 3.5+ document that it is an ignored dummy argument and that one can 
just pass 0, '', or None.
(Optional) Deprecate the parameter and make it optional.  This can be handled* 
in the code and would be like range having option 'start'.  This is messy but 
would be temporary.  Remove after 2.7.

* 1 arg = exc/value, 3 args are etype, value, tb, 2 args are exc, tb or etype, 
exc depending on whether the type(first) is BaseException.


I am inclined to go with both options, but even if the 3 of us agree, I might 
be inclined to post our intention on pydev.

--

___
Python tracker 

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



[issue29671] Add function to gc module to check if any reference cycles have been reclaimed.

2017-02-27 Thread Mark Dickinson

Mark Dickinson added the comment:

An addendum: I'd note that avoiding reference cycles altogether is hard in 
modern-day Python. For example, any dynamically-created class creates a 
reference cycle between the class and its MRO:

>>> import gc
>>> gc.disable()
>>> gc.collect()
0
>>> class A(object):
... pass
... 
>>> del A
>>> gc.collect()
6

--

___
Python tracker 

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



[issue29671] Add function to gc module to check if any reference cycles have been reclaimed.

2017-02-27 Thread Mark Dickinson

Mark Dickinson added the comment:

If I understand correctly, you can already achieve what you want by:

1. Disabling gc (with gc.disable()) at the beginning of your code, and possibly 
adding a `gc.collect()` immediately afterwards for good measure.
2. Doing a gc.collect() (and taking note of the return value) at the end of 
your code.
3. To be on the safe side, also check whether there's anything in `gc.garbage`.

If no reference cycles were created, `gc.collect()` will return `0`, and 
`gc.garbage` will be empty.

--
nosy: +mark.dickinson

___
Python tracker 

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



[issue29671] Add function to gc module to check if any reference cycles have been reclaimed.

2017-02-27 Thread Kevin Mills

New submission from Kevin Mills:

The intro paragraph for the gc module's documentation says:

> Since the collector supplements the reference counting already used in 
> Python, you can disable the collector if you are sure your program does not 
> create reference cycles.

How would you ever be sure of that?

While you can prevent reference cycles in your own code, what about your 
dependencies? You'd have to look through the code of all of your dependencies 
and transitive dependencies (including the standard library) to verify that 
none introduce reference cycles. And then you'd have to redo that work when 
upgrading any of them.

I propose adding a function to the gc module that returns True if the gc has 
reclaimed at least one reference cycle in the course of the current program's 
execution.

With that, it would be possible to, a program could, before it exits, force a 
collection and then check if any reference cycles were found over the program's 
lifetime, and then the programmer could use that information to decide whether 
they can safely turn off the gc or not.

Obviously that wouldn't guarantee that you could safely turn of the gc (it's 
possible that garbage with reference cycles is created on other runs of the 
program) it would at least be some information.

--
messages: 288668
nosy: Kevin Mills
priority: normal
severity: normal
status: open
title: Add function to gc module to check if any reference cycles have been 
reclaimed.
type: enhancement
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



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

2017-02-27 Thread Matthew Hall

New submission from Matthew Hall:

I have some Python code which takes advantage of the ability to prepopulate the 
argparse Namespace before passing it to argparse. This allows me to read 
sensitive settings such as usernames and passwords from DBs, environment 
variables, etc. in addition to the CLI for security so they don't appear as 
process arguments anyone could see.

Some of these scripts have usernames and passwords as required arguments since 
they cannot function without them. Unfortunately you hit this bug when you load 
them into the namespace yourself from some secure place of your choice and then 
pass them in:

args = parser.parse_args(argv, namespace)

The following argparse code which doesn't respect that they were present 
already and throws a fatal error. In addition, the parse_known_args function is 
246 lines of code which uses ugly nested cheater functions, and the 
seen_actions variable is in the stack of the function not a member variable, so 
there is no way you can cleanly override or work around the behavior with a 
subclass, either by replacing the function (too massive) or by fixing up the 
seen_actions variable (can't get to it on the stack from outside).

So, I suggest that this code should to be fixed so that it will respect any 
existing values in the Namespace if they are present:

# make sure all required actions were present, and convert defaults.
for action in self._actions:
if action not in seen_actions:
if action.required:
name = _get_action_name(action)
self.error(_('argument %s is required') % name)

--
components: Library (Lib)
messages: 288667
nosy: mhcptg
priority: normal
severity: normal
status: open
title: argparse: does not respect required args pre-populated into namespace
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue17894] Edits to descriptor howto

2017-02-27 Thread Ned Batchelder

Ned Batchelder added the comment:

I'm still interested in moving this forward. I can make a GitHub pull request 
if that would help.

--

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Berker Peksag

Berker Peksag added the comment:

I ignored 2.7 because you know... it's 2.7 :) And you said [1] that it doesn't 
have a big effect on real applications.

[1] https://github.com/python/cpython/pull/301#issuecomment-282789185

--
nosy: +berker.peksag

___
Python tracker 

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



[issue29659] Expose the `length` arg from shutil.copyfileobj for public use

2017-02-27 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
components: +Library (Lib)

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

It looks to me that 2.7 has this bug.

--

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +ned.deily

___
Python tracker 

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



[issue29669] Missing import of bisect in the documentation examples

2017-02-27 Thread Marco Buttu

New submission from Marco Buttu:

There is no import of bisect.bisect() and bisect.bisect_left() in the 
documentation. IMHO the examples are clearer and more complete if we import 
these functions, as in the attached patch.

--
assignee: docs@python
components: Documentation
files: import_bisect.patch
keywords: patch
messages: 288663
nosy: docs@python, marco.buttu
priority: normal
severity: normal
status: open
title: Missing import of bisect in the documentation examples
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7
Added file: http://bugs.python.org/file46676/import_bisect.patch

___
Python tracker 

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



[issue28791] update sqlite to 3.15.2

2017-02-27 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Is this something we want to include for the upcoming 3.6.1 release?
The latest sqlite version is 3.17.0.

--
nosy: +Mariatta

___
Python tracker 

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



[issue24700] array compare is hideously slow

2017-02-27 Thread lou1306

lou1306 added the comment:

I noticed the issue is still there in Python 3.6.
But I can't see why array subclasses should be the reason for this 
implementation.
By looking at getarrayitem, it looks like __getitem__ does not play any role in 
how the elements are accessed.
Consider the attached example, where SubclassedArray.__getitem__ is overridden 
to always return 0: nonetheless, equality checks with an array.array containing 
the same elements always succeed.

> For cases where the signedness and element size are identical, it's trivial 
> to acquire readonly buffers for both arrays and directly compare the memory

I would argue that _integerness_ sholud also be identical: otherwise
array("l", range(10)) == array("f", range(10))
would evaluate to False, while it is True in the current implementation.

--
nosy: +Luca Di Stefano
Added file: http://bugs.python.org/file46675/subclass_test.py

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
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



[issue26389] Expand traceback module API to accept just an exception as an argument

2017-02-27 Thread Brett Cannon

Brett Cannon added the comment:

I don't think supporting both approaches is worth it; we should just choose one 
of them. As for which one, I'm torn. The single argument one is the most 
pragmatic, but changing types like has always bugged me. But as Martin points 
out, the `raise` syntax supports the class or an instance so there's precedent 
in regards to exceptions themselves. The parameter name is poorly named if we 
take it in for the first argument which is unfortunate.

Basically I can't decide. :)

--

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Rafael Capucho

Rafael Capucho added the comment:

Serhiy Storchaka,

Thank you for your explanation.

--

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The expression is a concatenation of f-string expression f"SELECT COUNT(*) " 
and three string literals. If you want to substitute the "a" value, convert 
string literals into f-string expressions:

query = (f"SELECT COUNT(*) "
 f"FROM `{a}` entry "
 f"WHERE entry.type == 'device' "
 f"AND entry.instance == {a}")

or

query = ("SELECT COUNT(*) "
 f"FROM `{a}` entry "
 "WHERE entry.type == 'device' "
 f"AND entry.instance == {a}")

But be aware that using f-string expressions for formatting SQL queries is not 
safe in general case. Instead, use the DB-API’s parameter substitution.

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Rafael Capucho

Rafael Capucho added the comment:

I got:

SELECT COUNT(*) FROM `{a}` entry WHERE entry.type == 'device' AND 
entry.instance == {a}

I expect the value of `{a}` changed, like:

SELECT COUNT(*) FROM `some_underscored_value` entry WHERE entry.type == 
'device' AND entry.instance == some_underscored_value

--

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Berker Peksag

Berker Peksag added the comment:

Note that Ned gave us a permission to get this into 3.6.1.

--

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What you get? What you expect?

--

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Steve Dower

Steve Dower added the comment:

Why can't we fix this in 3.6? We were meant to support pathlike in that 
version, and this is an oversight, not a new feature.

--

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Rafael Capucho

Rafael Capucho added the comment:

```
a = "some_underscored_value"


u = (f" hello `{a}` cruel world"
 " hi")

print(u)

query = (f"SELECT COUNT(*) "
 "FROM `{a}` entry "
 "WHERE entry.type == 'device' "
 "AND entry.instance == {a}")

print(query)
```

--
Added file: http://bugs.python.org/file46674/file.py

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I consider this a new feature.

Some modules got the support of path-like objects for free after implementing 
the support of path-like objects in os, os.path and io modules. But others need 
additional work for implementing it, writing tests and documentation. In case 
of zipfile this work is significant.

--

___
Python tracker 

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-02-27 Thread Steve Dower

Steve Dower added the comment:

As far as I recall, there's a hosts file that resolves localhost to 127.0.0.1 
on Windows, which means a user could break their own configuration if they so 
desired. Definitely on all supported versions we should be able to assume 
localhost can be resolved.

I haven't checked out how it deals with IPv6, but presumably there's a priority 
or another hosts file that will cover it.

--

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Please provide your example as a text.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29668] f-strings don't change the values as expected.

2017-02-27 Thread Rafael Capucho

New submission from Rafael Capucho:

In the attached file, the lines 4 and 6 have the same structure, the line 4 
changes the value of {a} properly, the line 6 didn't.

Thank you.

--
components: Interpreter Core
files: crazy.png
messages: 288649
nosy: Rafael Capucho
priority: normal
severity: normal
status: open
title: f-strings don't change the values as expected.
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file46673/crazy.png

___
Python tracker 

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



[issue29667] socket module sometimes loses response packets

2017-02-27 Thread Bob Kline

New submission from Bob Kline:

The socket module does not always return response packets which are 
successfully delivered to the client host. We ran into this problem with an 
HTTP request for which socket.recv() raised an exception instead of returning 
the 301 redirection response which the web server sent back:

socket.error: [Errno 10054] An existing connection was forcibly closed by the 
remote host

We did some packet tracing, and saw that there were six packets exchanged for 
the connection:

client: [SYN]
server: [SYN,ACK]
client: [ACK]
client: GET /cam HTTP/1.1 ...\r\n\r\n
server: HTTP/1.0 301 Moved Permanently ...\r\n\r\n
server: [RST,ACK]

The failure appears to be timing dependent. If the 301 response is processed 
quickly enough (the usual case), the socket.recv() call returns it successfully 
to the caller. If sufficient delay is introduced, however, the 301 response is 
discarded, and the exception is raised. This can happen, for example, if the 
socket library has to take the time to handle setting up a requested timeout. 
On a slow enough machine, the following code will reproduce the problem:

import socket
s = socket.create_connection(("www.cancer.gov", 80), timeout=5)
s.sendall("GET /cam HTTP/1.1\r\nHost: www.cancer.gov\r\n\r\n")
print s.recv(8192)

You might have to stick a time.sleep(.5) call right in front of the s.recv() 
call if you can't find a slow enough machine to test on.

This appears to be a Windows-specific problem, as I can't reproduce it on a 
Linux or OS X client, no matter how much of a delay is introduced.

Platform: Windows (any version) with Python 2.7 or Python 3.6.

--
components: Library (Lib)
messages: 288648
nosy: bkline
priority: normal
severity: normal
status: open
title: socket module sometimes loses response packets
type: behavior
versions: Python 2.7, Python 3.6

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +301

___
Python tracker 

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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +300

___
Python tracker 

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



[issue29666] Issue in enum documentation

2017-02-27 Thread Ethan Furman

Ethan Furman added the comment:

`Flag` and `IntFlag` are indeed the correct (and missing) names.

--
nosy: +ethan.furman

___
Python tracker 

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



[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Martijn Pieters

Changes by Martijn Pieters :


--
pull_requests: +299

___
Python tracker 

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



[issue29636] Specifying indent in the json.tool command

2017-02-27 Thread Daniel Himmelstein

Daniel Himmelstein added the comment:

For discussion on how to implement this, see 

+ https://github.com/python/cpython/pull/201#discussion_r102146742
+ https://github.com/python/cpython/pull/201#discussion_r102840190
+ https://github.com/python/cpython/pull/201#discussion_r102891428

Implementation now moved to https://github.com/python/cpython/issues/345

--

___
Python tracker 

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



[issue29636] Specifying indent in the json.tool command

2017-02-27 Thread Daniel Himmelstein

Changes by Daniel Himmelstein :


--
pull_requests:  -230

___
Python tracker 

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



[issue26389] Expand traceback module API to accept just an exception as an argument

2017-02-27 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

> Another point is that it may be better to keep the existing parameter name 
> “value”, rather than (eventually?) replacing it with “exc”. I think both of 
> these things could be accomplished by juggling the “value” and “etype” 
> parameters:

I agreed, and that what I would have done outside of CPython, but that felt 
like this kind of juggling was frowned upon. 

> The disadvantage of any of these changes is that we may want to maintain 
> support for the old signature while Python 2 remains alive.

Your example does not seem to break the old signature. Or I fail to see how.

If that way would be accepted I'm happy to implement it.

--

___
Python tracker 

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



[issue29636] Specifying indent in the json.tool command

2017-02-27 Thread Daniel Himmelstein

Changes by Daniel Himmelstein :


--
pull_requests: +298

___
Python tracker 

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



[issue29660] Document that print/format_exception ignore etype

2017-02-27 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +297

___
Python tracker 

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



[issue22594] Add a link to the regex module in re documentation

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue29414] Change 'the for statement is such an iterator' in Tutorial

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
stage:  -> patch review
type:  -> enhancement

___
Python tracker 

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



[issue29455] Mention coverage.py in trace module documentation

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
stage:  -> patch review
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



[issue24241] webbrowser default browser detection and/or public API for _trylist.

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +296

___
Python tracker 

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



[issue28609] argparse claims '*' positional argument is required in error output

2017-02-27 Thread Ben Hoyt

Ben Hoyt added the comment:

I definitely agree with Reuben here -- I just ran into this issue while 
creating a "production quality" tool, and the help message produced by argparse 
with nargs='*' confused me too. It's pretty clear that this is a simple bug in 
argparse's production of that usage message: it says ARGUMENT is required, but 
it isn't.

However, the workaround of specifying an (unused) default is a reasonable 
workaround in the meantime -- thanks Paul.

--

___
Python tracker 

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



[issue27788] platform module's version number doesn't match its docstring

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
pull_requests: +295

___
Python tracker 

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



[issue28609] argparse claims '*' positional argument is required in error output

2017-02-27 Thread Ben Hoyt

Changes by Ben Hoyt :


--
nosy: +benhoyt

___
Python tracker 

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



[issue28598] RHS not consulted in `str % subclass_of_str` case.

2017-02-27 Thread Martijn Pieters

Changes by Martijn Pieters :


--
pull_requests: +294

___
Python tracker 

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



[issue29666] Issue in enum documentation

2017-02-27 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

Yup, `IntFlags` is a typo, that's why the reference to it doesn't show too. 

Also, the fourth enum must be `Flag` which must of been omitted when it was 
added in `3.6`.

--
nosy: +Jim Fasarakis-Hilliard

___
Python tracker 

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



[issue29665] how to edit or delete issues created by me in bug tracker ?!

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


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



[issue29666] Issue in enum documentation

2017-02-27 Thread STINNER Victor

New submission from STINNER Victor:

https://docs.python.org/dev/library/enum.html

"This module defines four enumeration classes that can be used to define unique 
sets of names and values: Enum, IntEnum, and IntFlags"

Enum, IntEnum, IntFlag: I count 3 classes, no 4?

Moreover, the correct class name is IntFlag, not IntFlags. Or did I miss 
something?

haypo@selma$ ./python
Python 3.7.0a0 (default, Feb 25 2017, 04:30:32) 
>>> import enum
>>> enum.IntFlags
...
AttributeError: module 'enum' has no attribute 'IntFlags'

--
assignee: docs@python
components: Documentation
keywords: easy
messages: 288642
nosy: docs@python, haypo
priority: normal
severity: normal
status: open
title: Issue in enum documentation
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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-27 Thread djstrong

djstrong added the comment:

Thank you! I couldn't find information about first forking then launching 
threads.

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-02-27 Thread Brian Curtin

Brian Curtin added the comment:

I echo Paul. I think the last time I would have seen a problem was on Windows 
2000, which is unsupported per PEP-11.

+1 to using localhost

--
nosy: +brian.curtin

___
Python tracker 

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



[issue27840] functools.partial: don't copy keywoard arguments in partial_call()?

2017-02-27 Thread Berker Peksag

Berker Peksag added the comment:

PR 253 has been merged.

--
nosy: +berker.peksag
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-02-27 Thread Paul Moore

Paul Moore added the comment:

I have a vague recollection of once working on a (Windows) system that 
mis-resolved localhost. But it was a long time ago, and I'm 100% OK with 
calling such a system broken.

+1 on using localhost

--

___
Python tracker 

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



[issue28911] Clarify the behaviour of assert_called_once_with

2017-02-27 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy:  -153957
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



[issue25452] Add __bool__() method to subprocess.CompletedProcess

2017-02-27 Thread STINNER Victor

STINNER Victor added the comment:

For all reasons alread given in the previous comment and my comment below, I 
reject the proposed change.


Serhiy> See also issue26748. Classes usually have True boolean value, but empty 
enum classes were False-y by accident. This was considered a bug.

Another example: issue #13936, "RFE: change bool(datetime.time(0, 0, 0)) to 
evaluate as True". datetime.time was changed in Python 3.5 to always be true, 
especially for the time 00:00:00. It's the opposite of the proposed change for 
CompletedProcess.


The problem is also that different users can expect a different answer from 
bool(CompletedProcess): non-zero return code, non-empty stdout, empty stderr, 
etc.

CompleteProcess is a complex object with many attributes, it's not as simple as 
a tuple or a string, where the truthness is obvious.


> Richard Neumann: "A useless use case is attached."

"if subprocess.run(...):"

Sorry, I'm not convinced that the need of breaking the backward compatibility 
for this "useless use case". It's trivial to split it in two lines:

"cmd = subprocess.run(...); if cmd.returncode: (...)"

By the way, it became common that I write such code, and in this case, I need 
the returncode value in the if block:

"cmd = subprocess.run(...); if cmd.returncode: sys.exit(cmd.returncode)".

So I need the CompletedProcess object anyway.

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



[issue29664] zip() python 3 documentation not working at all !

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Your example works for me.

>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> print(zipped)

>>> print(list(zipped))
[(1, 4), (2, 5), (3, 6)]

I guess you have overridden the builtin function "zip" by setting the global 
variable "zip".

>>> zip = (7, 8)
>>> zipped = zip(x, y)
Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'tuple' object is not callable

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



[issue29663] Make collections.deque json serializable

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue20774.

--
nosy: +serhiy.storchaka
resolution:  -> duplicate
stage: needs patch -> resolved
status: open -> closed
superseder:  -> collections.deque should ship with a stdlib json serializer

___
Python tracker 

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



[issue25452] Add __bool__() method to subprocess.CompletedProcess

2017-02-27 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

See also issue26748. Classes usually have True boolean value, but empty enum 
classes were False-y by accident. This was considered a bug.

--

___
Python tracker 

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



[issue29665] how to edit or delete issues created by me in bug tracker ?!

2017-02-27 Thread Muhammad Salem

Changes by Muhammad Salem :


--
title: how to edit or delete issues created by me in bug tracker -> how to edit 
or delete issues created by me in bug tracker ?!

___
Python tracker 

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



[issue29665] how to edit or delete issues created by me in bug tracker

2017-02-27 Thread Muhammad Salem

Changes by Muhammad Salem :


--
nosy: Muhammad Salem
priority: normal
severity: normal
status: open
title: how to edit or delete issues created by me in bug tracker

___
Python tracker 

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



[issue29664] zip() python 3 documentation not working at all !

2017-02-27 Thread Muhammad Salem

Muhammad Salem added the comment:

---
TypeError Traceback (most recent call last)
 in ()
  6 x = [1, 2, 3]
  7 y = [4, 5, 6]
> 8 zip(x, y)

TypeError: 'tuple' object is not callable

--
components:  -Interpreter Core

___
Python tracker 

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



[issue27645] Supporting native backup facility of SQLite

2017-02-27 Thread Lele Gaifax

Lele Gaifax added the comment:

Now that we are is officially on GH, would you welcome a PR rebasing this patch 
on top of the master branch?

--

___
Python tracker 

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



[issue29664] zip() python 3 documentation not working at all !

2017-02-27 Thread Muhammad Salem

New submission from Muhammad Salem:

this code from the python documentation itself not working!

>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)

this code is copied from the python 3 official documentation itself even though 
it is working for me I am using python 3.5.2 on ubuntu 16.04 LTS

--
components: Interpreter Core
messages: 288631
nosy: Muhammad Salem
priority: normal
severity: normal
status: open
title: zip() python 3 documentation not working at all !
type: compile error
versions: Python 3.5

___
Python tracker 

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



[issue29663] Make collections.deque json serializable

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

+1 This isn't really different that how we handle tuples and I can see that it 
would be useful to be able to dump a deque into JSON.  I concur that it is 
reasonable to ignore maxlen because that is primarily a convenience feature 
(auto-popping on overflow) rather than something that is intrinsic to the 
semantics of data itself.

--
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue29663] Make collections.deque json serializable

2017-02-27 Thread Tarek Ziadé

New submission from Tarek Ziadé:

collections.deque could be serialized in JSON as a simple array.

The only thing we can lose in the process is the maxlen value, but I think it's 
a decent behaviour to ignore it when encoding and to set it to None when 
decoding.

--
components: Library (Lib)
messages: 288629
nosy: rhettinger, tarek
priority: normal
severity: normal
status: open
title: Make collections.deque json serializable
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



[issue29639] test suite intentionally avoids referring to localhost, destroying abstraction away from IPv6 vs IPv4

2017-02-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I'm not sure how much of the original analysis was right.  I've just fired up a 
network-less Windows VM and 'localhost' seems to resolve just fine:

>>> socket.gethostbyname('localhost')
'127.0.0.1'
>>> socket.getaddrinfo('localhost', 80, socket.AF_UNSPEC, socket.SOCK_STREAM)

[(,
  ,
  0,
  '',
  ('::1', 80, 0, 0)),
 (,
  ,
  0,
  '',
  ('127.0.0.1', 80))]


But we should defer to our Windows experts on this.

(also, perhaps we should simply mandate that buildbots have at least basic DNS 
functionality. This would lighten the maintenance load on the test suite 
slightly.)

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

___
Python tracker 

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



[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-27 Thread Xiang Zhang

Xiang Zhang added the comment:

Of course that is okay. I didn't do what you propose since I thought it's 
somewhat superfluous, what is returned is mentioned below. I choose 'calculate' 
when I see 'Automatically determine how many times to call timeit()' in the 
documentation.

--

___
Python tracker 

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



[issue25452] Add __bool__() method to subprocess.CompletedProcess

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> The change can break existing code that uses boolean testing 
> instead of checking for None.

For this reason, I think Guido would oppose this proposal.  In the past he has 
objected to iterators having a True boolean value to indicate that there were 
more values available for iteration.  I think similar reasoning applies here.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29661] Typo in the docstring of timeit.Timer.autorange

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

How about:
Return the number of loops and time taken so that total time >= 0.2.

Instead of:
Return the number of loops so that total time >= 0.2.

The proposed "calculate" instead of "return" isn't really correct.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-27 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Unless I'm misreading what you're trying to do, this doesn't seem like a bug to 
me.   In general, when combining threading with multiple processes, the rule is 
to fork first and then launch threads (so that none of the thread ids or locks 
accidentally get shared across processes).

--
assignee:  -> davin
nosy: +davin, rhettinger

___
Python tracker 

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



  1   2   >