[issue29650] abstractmethod does not work when deriving from Exception

2017-02-25 Thread Xiang Zhang

Xiang Zhang added the comment:

Yes. This is the case for builtin types which usually get their own __new__ 
methods. See #5996.

--
dependencies: +abstract class instantiable when subclassing dict
nosy: +xiang.zhang
versions: +Python 3.5, Python 3.7

___
Python tracker 

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2017-02-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka
priority: normal -> low
stage: needs patch -> patch review

___
Python tracker 

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



[issue29648] Missed reference to create_module() in versionadded (import.rst)

2017-02-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The new GitHub PR workflow still looks cumbersome and unclear to me. It needs 
using a lot of git commands different for different branches (and some command 
are failed or don't work as I expected when I try to repeat sequences from the 
devguide). How to convert a patch to a pull request? How to get a list of added 
and modified files? What is the best way to revert all changes and changes in 
selected files? How to retrieve changes from pull request for local testing? Is 
there a way to edit otherpeople's pull request (add an entry in Misc/NEWS, etc) 
before merging it in the main repository? I wait until the devguide be more 
comprehensive.

--

___
Python tracker 

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



[issue29656] Change "make patchcheck" to be branch aware

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


--
pull_requests: +268

___
Python tracker 

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



[issue29656] Change "make patchcheck" to be branch aware

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


--
title: Change "make patchcheck" to be branch aware? -> Change "make patchcheck" 
to be branch aware

___
Python tracker 

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



[issue29656] Change "make patchcheck" to be branch aware?

2017-02-25 Thread Nick Coghlan

New submission from Nick Coghlan:

With the switch to a PR based workflow, I'm finding the current incarnation of 
"make patchcheck" less helpful than it used to be, as it only checks 
uncommitted changes, rather than all changes relative to the base branch.

Looking at Tools/scripts/patchcheck.py, it seems like it should be possible to 
use sys.version_info to calculate a suitable base branch ('master' if the 
release is alpha, '{major}.{minor}' otherwise), but things get a bit trickier 
from there:

- the local branches may not be up to date if the PR branch is based directly 
on a remote branch, so we can't rely on those
- figuring out which remote to use isn't immediately obvious, but we could 
probably go with an approach of using "upstream/{branch}" if an "upstream" 
remote is defined, and "origin/{branch}" otherwise
- once we have a base branch to use, then `git diff --name-status {branch}` 
should give us the file list in a similar format to the current `git status 
--porcelain`

I'll put together a PR for this approach.

--
assignee: ncoghlan
messages: 288588
nosy: brett.cannon, ncoghlan
priority: normal
severity: normal
status: open
title: Change "make patchcheck" to be branch aware?
type: enhancement

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Patch LGTM.

Serhiy, did you want to take this as a chance to run through the new GitHub PR 
workflow?

Current details are at https://docs.python.org/devguide/pullrequest.html

--

___
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-25 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
pull_requests: +267

___
Python tracker 

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



[issue19903] Idle: Use inspect.signature for calltips

2017-02-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Several builtin functions have recently gotten the Arg clinic treatment.  So I 
think it is now time to switch.  Before closing #29653 as a duplicate, I 
discovered that inspect.signature also handles functools.partials correctly, 
while the other inspect functions do not.

--
versions: +Python 3.6, Python 3.7 -Python 3.5

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Added tests.

--
Added file: 
http://bugs.python.org/file46670/webbrowser-delayed-initialization-2.patch

___
Python tracker 

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



[issue29653] IDLE - call tips show wrapper's argpsec instead of wrapped

2017-02-25 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We usually prefer diffs rather than revised files, but I know not everyone can 
provide them.  Did you change anything other than add the following?
elif hasattr(ob, '__wrapped__') and callable(ob.__wrapped__):
fob = ob.__wrapped__
 
I am all for accurate calltips.  However, your patch will not work for the 
stdlib wrapper functools.partial.  It does not add a __wrapped__ attribute.  
Instead it had args, func, and kwargs attributes.

I plan on switching calltips from using inspect.getfullargspec to 
inspect.signature (#19903). The latter defaults to follow_wrapped=True, in 
which case, it should follow callable.__wrapped__.  
https://docs.python.org/3/library/inspect.html#inspect.signature.  It also is 
documented to work with partials and in my test, it indeed followed .func to 
get the original signature and remove the parameters set in the partial call.

So this request is a duplicate in that it will be fixed by the existing issue.

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> Idle: Use inspect.signature for calltips

___
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-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka
stage:  -> needs patch
type: behavior -> resource usage
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



[issue29655] Certain errors during IMPORT_STAR can leak a reference

2017-02-25 Thread Matthias Bussonnier

Changes by Matthias Bussonnier :


--
nosy: +mbussonn

___
Python tracker 

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



[issue28587] list.index documentation missing start and stop arguments

2017-02-25 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

I backported these changes to 3.5 branch.
Please let me know if this is ok.

Thanks.

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



[issue28587] list.index documentation missing start and stop arguments

2017-02-25 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +266

___
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-25 Thread Peter Cawley

New submission from Peter Cawley:

In the implementation of the IMPORT_STAR opcode, if the call to 
PyFrame_FastToLocalsWithError fails, or f_locals is NULL, then control flow 
jumps to the error handler without performing a decref on the "from" variable. 
As the "from" variable is initialised by POPping from the stack, the reference 
is leaked.

--
components: Interpreter Core
messages: 288582
nosy: Peter Cawley
priority: normal
severity: normal
status: open
title: Certain errors during IMPORT_STAR can leak a reference
type: behavior
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



[issue29654] SimpleHTTPRequestHandler should support browser cache

2017-02-25 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +264

___
Python tracker 

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



[issue29654] SimpleHTTPRequestHandler should support browser cache

2017-02-25 Thread Pierre Quentel

New submission from Pierre Quentel:

SimpleHTTPServer send a Last-Modified response header, but doesn't take into 
account the If-Modified-Since header if it was sent by the user agent. 

If a url matches a file and this file was not modified after the value of the 
If-Modified-Since header, the server should return HTTP status 304 (Not 
Modified).

--
components: Library (Lib)
messages: 288581
nosy: quentel
priority: normal
severity: normal
status: open
title: SimpleHTTPRequestHandler should support browser cache
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



[issue29653] IDLE - call tips show wrapper's argpsec instead of wrapped

2017-02-25 Thread assume_away

New submission from assume_away:

Many wrappers use the famous (*args, **kwargs) argspec, which is less than 
helpful for a function that uses some positional arguments and maybe a few 
keyword only arguments, ie (x, y, z=10). Other IDEs have the capability of 
showing the wrapped functions argspec in a calltip, so why shouldn't IDLE?

--
assignee: terry.reedy
components: IDLE
files: calltips.py
messages: 288580
nosy: assume_away, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE - call tips show wrapper's argpsec instead of wrapped
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file46669/calltips.py

___
Python tracker 

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



[issue28279] setuptools failing to read from setup.cfg only in Python 3.6

2017-02-25 Thread Brett Cannon

Brett Cannon added the comment:

Closing as this should be a setuptools issue (if it still is).

--
nosy: +brett.cannon
resolution:  -> third party
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



[issue29652] Fix evaluation order of keys/values in dict comprehensions

2017-02-25 Thread Jim Fasarakis-Hilliard

New submission from Jim Fasarakis-Hilliard:

Reported from [1] and similar to issue11205 

Currently the evaluation order for keys and values in a dictionary 
comprehension follows that of assignments. The values get evaluated first and 
then the keys:

def printer(v):
print(v, end=' ')
return v

d = {printer(i): printer(j) for i, j in [(1, 2), (3, 4)]}
# 2 1 4 3

This seems to conflict with the semantics as described in the Semantics section 
of PEP 274 [2] and according to my interpretation of the reference manual (I'd 
expect the evaluation to be similar to dict-displays).

How should this be addressed? Fix the evaluation order or specify this edge 
case an "Implementation detail" in the reference manual?

I already have a fix for this lying around (changes to 
`compiler_sync_comprehension_generator`, 
`compiler_sync_comprehension_generator` and a switch in `MAP_ADD`) and can make 
a pull request if required.

I'm not sure if this is classified as a bug per-se so I only tagged Py3.7 for 
it.

 [1] 
http://stackoverflow.com/questions/42201932/order-of-operations-in-a-dictionary-comprehension
 [2] https://www.python.org/dev/peps/pep-0274/#semantics

--
components: Interpreter Core
messages: 288578
nosy: Jim Fasarakis-Hilliard
priority: normal
severity: normal
status: open
title: Fix evaluation order of keys/values in dict comprehensions
type: behavior
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



[issue29651] Inconsistent/undocumented urlsplit/urlparse behavior on invalid inputs

2017-02-25 Thread Vasiliy Faronov

New submission from Vasiliy Faronov:

There is a problem with the standard library's urlsplit and urlparse functions, 
in Python 2.7 (module urlparse) and 3.2+ (module urllib.parse).

The documentation for these functions [1] does not explain how they behave when 
given an invalid URL.

One could try invoking them manually and conclude that they tolerate anything 
thrown at them:

>>> urlparse('http:::!!::!!++///')
ParseResult(scheme='http', netloc='', path='//::!!::!!++///',
params='', query='', fragment='')

>>> urlparse(os.urandom(32).decode('latin-1'))
ParseResult(scheme='', netloc='', path='\x7f¼â1gdä»6\x82', params='',
query='', fragment='\n\xadJ\x18+fli\x9cÛ\x9ak*ÄÅ\x02³F\x85Ç\x18')

Without studying the source code, it is impossible to know that there is a very 
narrow class of inputs on which they raise ValueError [2]:

>>> urlparse('http://[')
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python3.5/urllib/parse.py", line 295, in urlparse
splitresult = urlsplit(url, scheme, allow_fragments)
  File "/usr/lib/python3.5/urllib/parse.py", line 345, in urlsplit
raise ValueError("Invalid IPv6 URL")
ValueError: Invalid IPv6 URL

This could be viewed as a documentation issue. But it could also be viewed as 
an implementation issue. Instead of raising ValueError on those square 
brackets, urlsplit could simply consider them *invalid* parts of an RFC 3986 
reg-name, and lump them into netloc, as it already does with other *invalid* 
characters:

>>> urlparse('http://\0\0æí\n/')
ParseResult(scheme='http', netloc='\x00\x00æí\n', path='/', params='',
query='', fragment='')

Note that the raising behavior was introduced in Python 2.7/3.2.

See also issue 8721 [3].


[1] https://docs.python.org/3/library/urllib.parse.html
[2] https://github.com/python/cpython/blob/e32ec93/Lib/urllib/parse.py#L406-L408
[3] http://bugs.python.org/issue8721

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 288577
nosy: docs@python, vfaronov
priority: normal
severity: normal
status: open
title: Inconsistent/undocumented urlsplit/urlparse behavior on invalid inputs
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



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

2017-02-25 Thread Andrei Fokau

Andrei Fokau added the comment:

Removing `--with-pydebug` parameter helped to avoid issue with _crypto 
extension. Testing Django with that build produced result identical to 3.6.0:


Ran 11723 tests in 83.897s
OK (skipped=1149, expected failures=4)


The patch is ready for review.

--

___
Python tracker 

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



[issue28663] Higher virtual memory usage on recent Linux versions

2017-02-25 Thread INADA Naoki

INADA Naoki added the comment:

I close this issue, because there are no enough evidence
it's Python's issue.  When hit ulimit is just a OS's detail.

Please ping or file a new issue when memory usage is really grown.

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



[issue29647] Python 3.6.0

2017-02-25 Thread Guido van Rossum

Changes by Guido van Rossum :


--
nosy:  -gvanrossum

___
Python tracker 

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



[issue29110] [patch] Fix file object leak in `aifc.open` when given invalid AIFF file.

2017-02-25 Thread INADA Naoki

Changes by INADA Naoki :


--
pull_requests: +263

___
Python tracker 

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



[issue27593] Deprecate sys._mercurial and create sys._git

2017-02-25 Thread Brett Cannon

Brett Cannon added the comment:

I purposefully left the tag out because I don't think it's useful (a tag is 
just a conveniently named hash and all of our tags are version numbers and 
that's already available in other parts of the sys module).

--

___
Python tracker 

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



[issue29647] Python 3.6.0

2017-02-25 Thread R. David Murray

R. David Murray added the comment:

Agreed with Christoph.  If the wxPython team finds there really is a bug in 
cpython itself triggering this, they (or you) can open a new issue with 
specifics.

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



[issue29637] ast.get_docstring(): AttributeError: 'NoneType' object has no attribute 'expandtabs'

2017-02-25 Thread INADA Naoki

Changes by INADA Naoki :


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

___
Python tracker 

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



[issue29648] Missed reference to create_module() in versionadded (import.rst)

2017-02-25 Thread Mariatta Wijaya

Mariatta Wijaya added the comment:

Thanks, Marco. Your change looks good to me.
I'm now wondering if this should have been 'versionchanged' instead of 
'versionadded'. Perhaps other core devs can confirm this.

Thanks :)

--
assignee:  -> docs@python
components: +Documentation
nosy: +Mariatta, docs@python
stage:  -> patch review

___
Python tracker 

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



[issue29650] abstractmethod does not work when deriving from Exception

2017-02-25 Thread chrysn

New submission from chrysn:

The "TypeError: Can't instantiate abstract class C with abstract methods x" 
exception does not get raised when when the involved ABCMeta class is derived 
from an Exception.

The attached file shows that a class without an implementation of an 
abstractmethod can get instanciated; replacing the derivation from Exception 
with a derivation from another class (say, A) makes the instanciation throw the 
proper TypeError.

--
files: demo.py
messages: 288571
nosy: chrysn
priority: normal
severity: normal
status: open
title: abstractmethod does not work when deriving from Exception
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file46668/demo.py

___
Python tracker 

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2017-02-25 Thread Louie Lu

Louie Lu added the comment:

> 1. Using global variable doesn't look good to me.

That's true, but I'm not sure if there have other methods to do this.

If not using global variable, we will need to change a bunch of the
function arguments. Since the arguments didn't contain the
information about which item is in the process and raise the error.


> 2. "at offset 1" looks confusing to me. What is offset?

Make the change to: 
>>> struct.pack('hh', , 0x7, 0x8)
struct.error: 'h' format requires -32768 <= number <= 32767, got bad value at 
item 2

(or probably, "got bad value at index 2")

> 3. It is not safe to use the fixed length array for formatting error message. 
> Once the underlying error message can be changed and will overflow the buffer.

Change to snprintf.

> The "%zd" format in sprintf() is not portable.

Change to "%ld"

--

___
Python tracker 

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

1. Using global variable doesn't look good to me.

2. "at offset 1" looks confusing to me. What is offset? Is this an offset of 
packed item in created bytes object? The you shouldn't get the odd number for 
the '!h' format.

I think it would be better to report the number of the packed item. 
struct.pack() already formats similar errors when pass unsuitable number of 
items.

>>> struct.pack('>> struct.pack('

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



[issue26128] Let the subprocess.STARTUPINFO constructor take arguments

2017-02-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Subhendu's PR has been merged.

--
nosy: +ncoghlan

___
Python tracker 

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



[issue26128] Let the subprocess.STARTUPINFO constructor take arguments

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


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



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

2017-02-25 Thread Andrei Fokau

Andrei Fokau added the comment:

Testing with Django seems indicated an issue. I did the following with 3.6 
patch (cherry-pick to bea9d2f64) on macOS with OpenSSL installed via Homebrew:


$ cd /Users/andrei/Python/cpython/
$ export CFLAGS="-I/usr/local/opt/openssl/include"
$ export LDFLAGS="-L/usr/local/opt/openssl/lib"
$ ./configure --with-pydebug --prefix=/Users/andrei/Python/installed/
$ make -j
$ make install


Then in Django (master, b427f0d674):


$ cd /Users/andrei/Python/django/
$ ../../installed/bin/pip3.6 install -r ./requirements/py3.txt
$ PYTHONPATH=.. DJANGO_SETTINGS_MODULE=test_sqlite 
../../installed/bin/python3.6 ./runtests.py


That produced one error:


==
ERROR: auth_tests.test_hashers (unittest.loader._FailedTest)
--
Traceback (most recent call last):
  File "/Users/andrei/Python/installed/lib/python3.6/unittest/case.py", line 
59, in testPartExecutor
yield
  File "/Users/andrei/Python/installed/lib/python3.6/unittest/case.py", line 
601, in run
testMethod()
  File "/Users/andrei/Python/installed/lib/python3.6/unittest/loader.py", line 
34, in testFailure
raise self._exception
ImportError: Failed to import test module: auth_tests.test_hashers
Traceback (most recent call last):
  File "/Users/andrei/Python/installed/lib/python3.6/unittest/loader.py", line 
426, in _find_test_path
module = self._get_module_from_name(name)
  File "/Users/andrei/Python/installed/lib/python3.6/unittest/loader.py", line 
367, in _get_module_from_name
__import__(name)
  File "/Users/andrei/Python/django/tests/auth_tests/test_hashers.py", line 20, 
in 
if crypt.crypt('', '') is None:
  File "/Users/andrei/Python/installed/lib/python3.6/crypt.py", line 47, in 
crypt
return _crypt.crypt(word, salt)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 1: invalid 
start byte

Ran 11695 tests in 259.390s
FAILED (errors=1, skipped=1149, expected failures=4)


Then I ran the same tests in 3.6.0 virtualenv installed via pyenv:


$ pyenv virtualenv 3.6.0 djtest
$ pyenv shell djtest
$ pip install -r ./requirements/py3.txt
$ PYTHONPATH=.. DJANGO_SETTINGS_MODULE=test_sqlite python ./runtests.py


and they went fine:


Ran 11723 tests in 87.369s
OK (skipped=1149, expected failures=4)


So the patch causes 1 error and misses 28 tests. I'll try to figure out the 
problem with failing test and what tests are missing.

--

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Nice, this is much cleaner than the current approach!

The one thing I would suggest is a new test case that:

- asserts webbrowser._tryorder is None
- asserts webbrowser._browsers is empty
- calls webbrowser.get()
- asserts webbrowser._tryorder is non-empty
- asserts webbrowser._browsers is non-empty

I wouldn't worry about explicitly testing the thread safety. That's just a 
normal double-checked locking pattern, so I think code review is sufficient to 
address that - the only way for it to break is for something to go horribly 
wrong in threading.RLock().

--

___
Python tracker 

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2017-02-25 Thread Louie Lu

Louie Lu added the comment:

Adding PyErr_SetString and PyErr_Format wrapper, with a global offset
variable to handle this.

struct.pack('!h', 0x8)
Traceback (most recent call last):
  File "tests.py", line 5, in 
struct.pack('!h', 0x8)
struct.error: Raise at offset 1, 'h' format requires -32768 <= number <= 32767

--
nosy: +louielu

___
Python tracker 

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



[issue23578] struct.pack error messages do not indicate which argument was invalid

2017-02-25 Thread Louie Lu

Changes by Louie Lu :


--
pull_requests: +262

___
Python tracker 

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



[issue29649] struct.pack_into check boundary error message didn't respect offset

2017-02-25 Thread Louie Lu

New submission from Louie Lu:

For this situation, check boundary error message didn't correctly show out.

>>> import struct
>>> import ctypes
>>> byte_list = ctypes.create_string_buffer(1)
>>> struct.pack_into('b', byte_list, 5, 1)
Traceback (most recent call last):
  File "", line 1, in 
struct.error: pack_into requires a buffer of at least 1 bytes

Since offset is setting at 5, it should at least need `offset + soself->s_size` 
bytes to store it.

--
components: Extension Modules
messages: 288564
nosy: louielu
priority: normal
severity: normal
status: open
title: struct.pack_into check boundary error message didn't respect offset
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



[issue29648] Missed reference to create_module() in versionadded (import.rst)

2017-02-25 Thread Marco Buttu

Changes by Marco Buttu :


--
pull_requests: +261

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> What is the different of Cold start and Hot start?

Disk caches are dropped before cold start.

$ echo 3 | sudo tee /proc/sys/vm/drop_caches

--

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
keywords: +patch
Added file: 
http://bugs.python.org/file46667/webbrowser-delayed-initialization.patch

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Following patch makes searching of all platform browsers delayed until it is 
needed. In addition it makes webbrowser.register() thread safe.

Cold start:

$ time ./python -c 'import webbrowser'

real0m2.851s
user0m0.224s
sys 0m0.056s

Hot start:

$ time ./python -c 'import webbrowser'

real0m0.259s
user0m0.232s
sys 0m0.024s

--
nosy: +ncoghlan
stage:  -> patch review

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Louie Lu

Louie Lu added the comment:

What is the different of Cold start and Hot start? It that CPU speed or 
something else.

In Linux 4.9.11 with i7-2k, I can't reproduce the significant real time you 
gave:

# CPU gov powersave
$ time ./python -c 'import webbrowser'
0.16s user 0.02s system 93% cpu 0.200 total

# CPU gov performance
$ time ./python -c 'import webbrowser'
0.08s user 0.00s system 82% cpu 0.093 total

--
nosy: +louielu

___
Python tracker 

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



[issue29648] Missed reference to create_module() in versionadded (import.rst)

2017-02-25 Thread Mariatta Wijaya

Changes by Mariatta Wijaya :


--
pull_requests: +260

___
Python tracker 

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



[issue29648] Missed reference to create_module() in versionadded (import.rst)

2017-02-25 Thread Marco Buttu

New submission from Marco Buttu:

In the first `versionadded` of the Loader section [1] of 
Doc/reference/import.rst, there is no reference to `create_module()`:

.. versionadded:: 3.4
   The create_module() method of loaders.

It should be:

.. versionadded:: 3.4
   The :meth:`~importlib.abc.Loader.create_module` method of loaders.

I will make a PR.

[1] https://docs.python.org/3/reference/import.html#loaders

--
messages: 288560
nosy: marco.buttu
priority: normal
severity: normal
status: open
title: Missed reference to create_module() in versionadded (import.rst)
versions: Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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



[issue29647] Python 3.6.0

2017-02-25 Thread Christoph Reiter

Christoph Reiter added the comment:

That sounds like a problem with wxPython which you should report to them: 
http://trac.wxwidgets.org/

When you do, try to attach a minimal code example with your instructions so 
others can reproduce the error.

--
nosy: +lazka

___
Python tracker 

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



[issue9285] Add a profile decorator to profile and cProfile

2017-02-25 Thread Fred L. Drake, Jr.

Changes by Fred L. Drake, Jr. :


--
nosy:  -fdrake

___
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-25 Thread Andrei Fokau

Andrei Fokau added the comment:

Ok, testing with Django was a bad idea due to compatibility with 3.7. 
I could apply it to 3.6.x and test Django with it. 

Is there a better idea how to trial the test discovery?

--

___
Python tracker 

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



[issue29647] Python 3.6.0

2017-02-25 Thread Boštjan Mejak

New submission from Boštjan Mejak:

I managed to create an app that crashes the latest stable version of Python, 
that is 3.6.0 at the time of this writing.

My application is written in Python using wxPython Phoenix 3rd-party GUI 
library/toolkit. I am running Windows 10 Home 64-bit version OS, the latest 
version of it, the Anniversary Edition with all its updates.

How I did it? Well, I made an event in my GUI app where clicking the X button 
puts up a message dialog to the user, saying "Do you really wanna close this 
app?" and the "Yes" button destroys the whole object, thus exiting the 
application.

But now the catch! I also made a taskbar icon which includes a menu item to 
also exit the application: same message dialog with Yes/No buttons.

Let's crash this baby! If you click the X button and not choosing either "Yes" 
or "No" but instead have this message dialog wait and in the mean time you 
right-click the taskbar icon and choose the "Exit" menu item and choose "Yes". 
Then click another "Yes" of that waiting message dialog and BOOM! Voila, we 
have killed PYthon interpreter.

Is that a bug in my code or does Python have a weakness?

--
components: Interpreter Core
messages: 288557
nosy: Pikec, gvanrossum
priority: normal
severity: normal
status: open
title: Python 3.6.0
type: crash
versions: Python 3.6

___
Python tracker 

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



[issue29646] ast.parse parses string literals as docstrings

2017-02-25 Thread ProgVal

ProgVal added the comment:

Indeed, thanks.

I should have done that when I migrated from compiler.parse.

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



[issue29646] ast.parse parses string literals as docstrings

2017-02-25 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If someone wants to parse a simple expression that may be a string he should 
use the "eval" mode.

>>> ast.dump(ast.parse("'test'"))
"Module(body=[], docstring='test')"
>>> ast.dump(ast.parse("'test'", mode='eval'))
"Expression(body=Str(s='test'))"

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29646] ast.parse parses string literals as docstrings

2017-02-25 Thread ProgVal

ProgVal added the comment:

(Oops, submitted too soon.)

I understand the rational of this change, so I am not sure if this is actually 
a bug.

However, if someone wants to parse a simple expression that may be a string, 
they need to add a special handling in case it's a string interpreted as a 
module docstring.

--

___
Python tracker 

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



[issue29646] ast.parse parses string literals as docstrings

2017-02-25 Thread ProgVal

New submission from ProgVal:

Since commit cb41b2766de646435743b6af7dd152751b54e73f (Python 3.7a0), string 
literals are not parsed the same way.

ast.parse("'test'").body used to be a list with one item containing 'test'; but 
now it is an empty list:


Python 3.5.2+ (default, Dec 13 2016, 14:16:35) 
[GCC 6.2.1 20161124] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> print(ast.parse("'test'"))
<_ast.Module object at 0x7fa37ae4c630>
>>> print(ast.parse("'test'").body)
[<_ast.Expr object at 0x7fa37ae4c630>]
>>> print(ast.parse("'test'").docstring)
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: 'Module' object has no attribute 'docstring'





Python 3.7.0a0 (default, Feb 24 2017, 21:38:30) 
[GCC 6.3.0 20170205] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> print(ast.parse("'test'"))
<_ast.Module object at 0x7fe2aa415eb8>
>>> print(ast.parse("'test'").body)
[]
>>> print(ast.parse("'test'").docstring)
test

--
components: Interpreter Core
messages: 288553
nosy: Valentin.Lorentz, inada.naoki
priority: normal
severity: normal
status: open
title: ast.parse parses string literals as docstrings
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



[issue29644] Importing webbrowser outputs a message on stderr

2017-02-25 Thread Nick Coghlan

Nick Coghlan added the comment:

The specific problem reported has been resolved, so closing this one.

If anyone's able to figure out a way to defer this to post-import somehow, I 
think that would make a good enhancement proposal.

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

___
Python tracker 

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



[issue29645] webbrowser module import has heavy side effects

2017-02-25 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

`import webbrowser` has heavy side effects. It searches a number of 
executables. On X Window it also runs external program xdg-settings.

Cold start:

$ time ./python -c ''

real0m1.719s
user0m0.088s
sys 0m0.036s

$ time ./python -c 'import webbrowser'

real0m5.713s
user0m0.308s
sys 0m0.196s

Hot start:

$ time ./python -c ''

real0m0.094s
user0m0.072s
sys 0m0.020s

$ time ./python -c 'import webbrowser'

real0m1.026s
user0m0.284s
sys 0m0.100s

--
components: Library (Lib)
messages: 288551
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: webbrowser module import has heavy side effects
type: performance
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



[issue16285] Update urllib quoting to RFC 3986

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


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



[issue16285] Update urllib quoting to RFC 3986

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


--
assignee:  -> ncoghlan

___
Python tracker 

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



[issue16285] Update urllib quoting to RFC 3986

2017-02-25 Thread Nick Coghlan

Changes by Nick Coghlan :


--
stage: needs patch -> patch review

___
Python tracker 

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



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

2017-02-25 Thread Nick Coghlan

Nick Coghlan added the comment:

Second PR merged with the missing test case.

--
stage: test needed -> 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