[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Sergey Shashkov added the comment:

OK,

then we should not change numbers.py.

And in fractions.py:

def __floordiv__(a, b):
"""a // b"""
if isinstance(b, numbers.Complex) or hasattr(b, '__rtruediv__'):
fr = a / b
if fr != NotImplemented:
return math.floor(a / b)
else:
return NotImplemented
else:
return NotImplemented

--

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Sergey Shashkov added the comment:

Bad idea, just


def __floordiv__(a, b):
"""a // b"""
if isinstance(b, numbers.Complex):
return math.floor(a / b)
else:
return NotImplemented

If b is inherited from number, real, complex, Fraction and etc, then a of type 
Fraction knows, how do make a division.
Otherwise may be b has __rfloordiv__, that khows how to be divided by Fraction.

--

___
Python tracker 

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



[issue25426] Deprecate the regex_compile benchmark

2015-10-16 Thread Brett Cannon

New submission from Brett Cannon:

Turns out it relies on internal APIs that either don't exist on other 
interpreters (e.g., IronPython), or they change which leads to breakage of the 
benchmark (e.g., already changed for Python 3.2 and 3.3). Probably best to 
retire it rather than continuing to try and prop it up.

--
components: Benchmarks
messages: 253091
nosy: brett.cannon, pitrou
priority: normal
severity: normal
status: open
title: Deprecate the regex_compile benchmark

___
Python tracker 

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



[issue25424] Deprecate older versions of benchmarks

2015-10-16 Thread Brett Cannon

New submission from Brett Cannon:

The django, json_dump, and mako benchmarks all have v2 versions and have had 
such versions for quite some time. Perhaps it's time to retire them?

--
components: Benchmarks
messages: 253079
nosy: brett.cannon, pitrou
priority: normal
severity: normal
status: open
title: Deprecate older versions of benchmarks

___
Python tracker 

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



[issue25234] test_eintr.test_os_open hangs under Xcode 7

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

This is still an intermittent problem for me. Maybe it's related to issue 
#25122 ?

--
nosy: +haypo
resolution: not a bug -> 
status: closed -> open

___
Python tracker 

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



[issue25423] Deprecate benchmarks that execute too quickly

2015-10-16 Thread Brett Cannon

New submission from Brett Cannon:

I have seen both silent_logging and unpack_sequence reliably complete so 
quickly in fast mode as to be measured at 0 time. That indicates to me that the 
benchmarks are no longer measuring something of consequence.

--
components: Benchmarks
messages: 253078
nosy: brett.cannon, pitrou
priority: normal
severity: normal
status: open
title: Deprecate benchmarks that execute too quickly

___
Python tracker 

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



[issue25424] Deprecate older versions of benchmarks

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2dfb8e568d93 by Brett Cannon in branch 'default':
Issue #25424: Deprecate benchmarks with newer versions
https://hg.python.org/benchmarks/rev/2dfb8e568d93

--
nosy: +python-dev

___
Python tracker 

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



[issue25424] Deprecate older versions of benchmarks

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the input, Antoine!

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



[issue23735] Readline not adjusting width after resize with 6.3

2015-10-16 Thread John Morrissey

Changes by John Morrissey :


--
nosy: +johnmorr

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Oscar Benjamin

Oscar Benjamin added the comment:

You should test the change with number types that don't use the number tower 
e.g. Decimal, sympy, gmpy2, mpf, numpy arrays etc. Few non stdlib types use the 
number ABCs so testing against numbers.Complex may cause a change in behaviour.

--
nosy: +oscarbenjamin

___
Python tracker 

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



[issue25425] white-spaces encountered in 3.4

2015-10-16 Thread pavan kumar Dharmavarapu

New submission from pavan kumar Dharmavarapu:

need to resolved some white spaces that are encountered in this problem
where it need to be resolved by writing patch

--
components: Windows
messages: 253082
nosy: paul.moore, pavan kumar Dharmavarapu, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: white-spaces encountered in 3.4
type: performance
versions: Python 3.4

___
Python tracker 

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



[issue25424] Deprecate older versions of benchmarks

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

Another option is to make it so that we add an "old" group of tests and make 
negation by group work, e.g., `-b 2n3,-old`.

--

___
Python tracker 

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



[issue25407] Update PEP 4 to keep modules in Python 3

2015-10-16 Thread Brett Cannon

Changes by Brett Cannon :


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



[issue25423] Deprecate benchmarks that execute too quickly

2015-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I haven't seen that:

$ ./perf.py -f -b silent_logging `which python2.7` `which python3.4`
INFO:root:Automatically selected timer: time
Running silent_logging...
INFO:root:Running `/home/antoine/.local/bin/python3.4 
./performance/bm_logging.py -n 5 --timer time no_output`
INFO:root:Running `/usr/bin/python2.7 ./performance/bm_logging.py -n 5 --timer 
time no_output`

Report on Linux fsol 3.19.0-30-generic #34-Ubuntu SMP Fri Oct 2 22:08:41 UTC 
2015 x86_64 x86_64
Total CPU cores: 4

### silent_logging ###
Min: 0.056003 -> 0.075588: 1.35x slower
Avg: 0.056043 -> 0.076493: 1.36x slower
Significant (t=-38.61)
Stddev: 0.3 -> 0.00118: 47.2238x larger


In any case, if it runs too fast, we should simply increase the number of 
iterations.

--

___
Python tracker 

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



[issue25407] Update PEP 4 to keep modules in Python 3

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bcee1364e2dc by Brett Cannon in branch '3.5':
Issue #25407: Drop the mention of the formatter module being removed
https://hg.python.org/cpython/rev/bcee1364e2dc

New changeset 9a0d367b8dd3 by Brett Cannon in branch 'default':
Merge for issue #25407
https://hg.python.org/cpython/rev/9a0d367b8dd3

--
nosy: +python-dev

___
Python tracker 

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



[issue25424] Deprecate older versions of benchmarks

2015-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

As you prefer. The modern equivalents should be good replacements anyway, so 
there's not much need in keeping the old ones.

--

___
Python tracker 

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



[issue25234] test_eintr.test_os_open hangs under Xcode 7

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

I can't get your testing program to compile, Victor, so if I run into it again 
I will add a skip to the test (harder to detect that it's the same test since 
test_eintr runs another test suite as if it's a single test).

--

___
Python tracker 

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



[issue25008] Deprecate smtpd (based on deprecated asyncore/asynchat): write a new smtp server with asyncio

2015-10-16 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

This has come along pretty well.  The project is managed here:

https://gitlab.com/python-smtpd-hackers/aiosmtpd

and documentation here:

http://aiosmtpd.readthedocs.org/en/latest/

--

___
Python tracker 

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



[issue25234] test_eintr.test_os_open hangs under Xcode 7

2015-10-16 Thread STINNER Victor

STINNER Victor added the comment:

Hi Brett, if you are motivated, you can try the C program that I wrote to 
reproduce the bug on FreeBSD. It's attached to #25122. If the C program hangs 
too, it would mean that Darwin has also a bug (same bug??) in its code to 
handle signals in the code handling FIFO devices.

Or you can just add a skip mentioning this issue.

On my FreeBSD VM, it took a few minutes and multiples instances of the C 
program to reproduce the bug. On physical machines, other reported that a 
seconds and a single instance is enough. Well, see the FreeBSD bug report for 
more information ;-)

--

___
Python tracker 

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



[issue25426] Deprecate the regex_compile benchmark

2015-10-16 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon

___
Python tracker 

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



[issue25188] regrtest.py improvement for Profile Guided Optimization builds

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cc42700abb8e by Brett Cannon in branch '2.7':
Issue #25188: Clean up code to pass the --pgo flag to subprocesses
https://hg.python.org/cpython/rev/cc42700abb8e

--

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Changes by Sergey Shashkov :


--
hgrepos:  -320

___
Python tracker 

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



[issue25426] Deprecate the regex_compile benchmark

2015-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The public API for cache clearing is re.purge().

> It's a pity there isn't an official way to compile without caching.

See issue17441.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue25188] regrtest.py improvement for Profile Guided Optimization builds

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

Thanks for the patch, Arfrever. Although next time you don't need to unset 
every field of the issue since the issue was still fixed, just in a suboptimal 
fashion that didn't impact performance.

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Changes by Sergey Shashkov :


--
hgrepos: +320

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Sergey Shashkov added the comment:

...
def forward(a, b):
if isinstance(b, (int, Fraction)):
return monomorphic_operator(a, b)
elif isinstance(b, float):
return fallback_operator(float(a), b)
elif isinstance(b, complex):
return fallback_operator(complex(a), b)
else:
return NotImplemented
forward.__name__ = '__' + fallback_operator.__name__ + '__'
forward.__doc__ = monomorphic_operator.__doc__

def reverse(b, a):
if isinstance(a, numbers.Rational):
# Includes ints.
return monomorphic_operator(a, b)
elif isinstance(a, numbers.Real):
return fallback_operator(float(a), float(b))
elif isinstance(a, numbers.Complex):
return fallback_operator(complex(a), complex(b))
else:
return NotImplemented
...
so division is possible only with int, Fraction, float, complex, 
numbers.Rational, numbers.Real, numbers.Complex.
For all of them "isinstance(b, numbers.Complex)" is true

--

___
Python tracker 

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



[issue25017] htmllib deprecated: Which library to use? Missing sane default in docs

2015-10-16 Thread Nan Wu

Nan Wu added the comment:

Added a small patched for this change.

--
keywords: +patch
nosy: +Nan Wu
Added file: http://bugs.python.org/file40796/htmllib_deprecation_warning.patch

___
Python tracker 

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



[issue25426] Deprecate the regex_compile benchmark

2015-10-16 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That sounds reasonable to me. It's a pity there isn't an official way to 
compile without caching.

--

___
Python tracker 

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



[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I'm reviewing the patch, but it will take a time.

Wouldn't be simpler to use regular expressions instead of tokenizer?

For now Completer doesn't depends on the readline module, nor other global 
state. It can be used for completing in other environment, for example to 
complete words in IDE. Patched Completer retrieves additional information from 
the readline module. This can break existing code. It would be nice to decouple 
Completer from readline. In contrary to user .pythonrc.py file, we are free to 
invent new interfaces. May be add methods to the Completer class that provides 
needed additional information (nothing by default), and add Completer's 
subclass ReadlineCompleter that implements these methods using readline?

Found presumable bugs:

"import sy" doesn't suggest completion "sys".

"import os.p" doesn't suggest completion "os.path".

--

___
Python tracker 

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



[issue25412] __floordiv__ in module fraction fails with TypeError instead of returning NotImplemented

2015-10-16 Thread Sergey Shashkov

Changes by Sergey Shashkov :


--
hgrepos: +321
keywords: +patch
Added file: http://bugs.python.org/file40797/fractions_truediv_fix.patch

___
Python tracker 

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



[issue25414] Bypass unnecessary size limit test from deques on builds with 64-bit numbers

2015-10-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file40793/deque_limit_remove.diff

___
Python tracker 

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



[issue25418] Minor markup issue in reference/datamodel docs

2015-10-16 Thread TAKASE Arihiro

New submission from TAKASE Arihiro:

https://docs.python.org/3/reference/datamodel.html#object.__hash__

The closing parenthesis of "isinstance(obj, collections.Hashable)" is outside 
the markup.

The attached patch fixes it.

--
assignee: docs@python
components: Documentation
files: datamodel.patch
keywords: patch
messages: 253068
nosy: artakase, docs@python
priority: normal
severity: normal
status: open
title: Minor markup issue in reference/datamodel docs
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40792/datamodel.patch

___
Python tracker 

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



[issue23735] Readline not adjusting width after resize with 6.3

2015-10-16 Thread Martin Panter

Martin Panter added the comment:

One idea might be to synchronously poll the screen size each time before 
Readline is invoked. Would doing this be such a burden? The polling could be 
limited to once every 0.1 s or so if it was a big burden. These ways would 
avoid interfering with signal handlers entirely.

--
components: +Extension Modules
nosy: +martin.panter
stage:  -> needs patch

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Eric V. Smith

Eric V. Smith added the comment:

Avoid truncating the expected results when the tokens are long.

--
Added file: http://bugs.python.org/file40799/issue-25422-1.diff

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Eric V. Smith

Eric V. Smith added the comment:

Removed the truncation of tokens. There's really no point to it, and it could 
be hiding bugs.

Also removed the truncation of token names, although none were ever truncated.

--
Added file: http://bugs.python.org/file40800/issue-25422-2.diff

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 91c44dc35dfd by Eric V. Smith in branch 'default':
Issue 25422: Add tests for multi-line string tokenization. Also remove 
truncated tokens.
https://hg.python.org/cpython/rev/91c44dc35dfd

--
nosy: +python-dev

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Eric V. Smith

Changes by Eric V. Smith :


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



[issue25311] Add f-string support to tokenize.py

2015-10-16 Thread Eric V. Smith

Eric V. Smith added the comment:

Multi-line string tests were added in changeset 91c44dc35dfd. That will make 
changes for this issue safer. Updated patch to come.

--

___
Python tracker 

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



[issue25410] Clean up and fix OrderedDict

2015-10-16 Thread Eric Snow

Eric Snow added the comment:

Thanks for working on this, Serhiy.  I've left a review.

As to the points you outlined, I have concerns with the impact of #3 and #5 on 
subclasses.  Notably od.__class__ is not necessarily the same as type(od).  
Also #7 may introduce an unhandled re-entrancy, causing potentially incorrect 
outcomes.

Also note that I was extremely careful to (almost) exactly match the pure 
Python implementation.  Not only did this guarantee equivalent behavior, but it 
simplified the porting effort.  I'm not opposed to deviating from the pure 
Python implementation as long as the behavior remains exactly the same.  So if 
you want to change the behavior of OrderedDict you must be sure to make the 
equivalent change in the pure Python implementation (with the associated 
backward-compatibility constraints).  Thanks again for working on this though.

--

___
Python tracker 

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



[issue25427] Remove the pyvenv script in Python 3.8

2015-10-16 Thread Brett Cannon

Changes by Brett Cannon :


--
dependencies: +Drop the pyvenv script

___
Python tracker 

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



[issue25427] Remove the pyvenv script in Python 3.8

2015-10-16 Thread Brett Cannon

New submission from Brett Cannon:

Title explains it all.

--
assignee: brett.cannon
components: Demos and Tools
messages: 253103
nosy: brett.cannon
priority: normal
severity: normal
status: open
title: Remove the pyvenv script in Python 3.8

___
Python tracker 

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



[issue25154] Drop the pyvenv script

2015-10-16 Thread Brett Cannon

Changes by Brett Cannon :


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

___
Python tracker 

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



[issue25154] Drop the pyvenv script

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6ab285820db2 by Brett Cannon in branch 'default':
Issue #25154: Deprecate the pyvenv script.
https://hg.python.org/cpython/rev/6ab285820db2

--
nosy: +python-dev

___
Python tracker 

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



[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Is there a reason ipython's import completer couldn't be borrowed in its 
entirety? At work, I use a lightly adapted version of the code from ipython to 
do completion when I'm using the plain interactive interpreter (for whatever 
reason), and it works just fine.

--
nosy: +josh.r

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Eric V. Smith

Changes by Eric V. Smith :


--
keywords: +patch
stage: needs patch -> patch review
Added file: http://bugs.python.org/file40798/issue-25422.diff

___
Python tracker 

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



[issue25428] Have `datetime` understand integer arguments for timezones

2015-10-16 Thread leewz

New submission from leewz:

Current: If I want to create a datetime object with a particular timezone 
offset, I have to do this:

import datetime
mytime = datetime.datetime(2015, 10, 16, 9, 13, 0, 
tzinfo=datetime.timezone(datetime.timedelta(hours=-7)))

Or with imports:

from datetime import datetime, timezone, timedelta
mytime = datetime(2015, 10, 16, 9, 13, 0, 
tzinfo=timezone(timedelta(hours=-7)))

That's two extra imports and two extra objects created.


Requested way:
mytime = datetime(2015, 10, 16, 9, 13, 0, tzinfo=-7)
# mytime.tzinfo == -7

Or if someone doesn't like the `tzinfo` keyword:
mytime = datetime(2015, 10, 16, 9, 13, 0, tzhours=-7)
# mytime.tzinfo == timezone(timedelta(-7))


For timezones, hours are the normal unit of time. At least, I think about time 
zones in hours, and I don't know who would think about them in minutes. There 
are half-hour offsets, so floats make sense to have.

Imagine you have about a year of experience dabbling in Python, and you're 
trying to do a relatively simple task, like reading PDT times and converting 
them to local time. You would go to the datetime docs, see that you need to 
pass in a tzinfo object. You look that up, and run into this:
"""tzinfo is an abstract base class, meaning that this class should not be 
instantiated directly. You need to derive a concrete subclass, and (at least) 
supply implementations of the standard tzinfo methods needed by the datetime 
methods you use."""

Well, great. If you want to convert times, you'll have to subclass an abstract 
base class, and implement five methods. You'd probably have to read the whole 
docs for this class, too. (The docs for tzinfo take nine Page Downs for me to 
scroll past.)

If you're not frightened off by the first two sentences, you'll see that 
there's the concrete subclass `datetime.timezone`. We're two levels down, now. 
Going there, you'll see that you need to pass in a timedelta object. Three 
levels. You need to learn about three classes just to specify an hour offset.

Timezones are something that many non-programmers understand, and the rules are 
pretty simple (barring DST, but the library doesn't really deal with it 
anyway). Ideally, it should be simple to do simple things.


PS: There seems to be unnecessary inconsistency with `.astimezone`, 
`fromtimestamp`, and `now` taking a `tz` kwarg rather than a `tzinfo` kwarg.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 253111
nosy: docs@python, leewz
priority: normal
severity: normal
status: open
title: Have `datetime` understand integer arguments for timezones
type: enhancement
versions: Python 3.5, Python 3.6

___
Python tracker 

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



[issue25428] Have `datetime` understand integer arguments for timezones

2015-10-16 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +belopolsky, lemburg
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



[issue25381] Doc: Use of old description of raise in Python3

2015-10-16 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
nosy: +terry.reedy

___
Python tracker 

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



[issue25429] Can segfault Python with itertools.chain.from_iterable

2015-10-16 Thread Evan Hubinger

New submission from Evan Hubinger:

The code

import itertools
it = itertools.chain.from_iterable((f() for f in [lambda: it]))
list(it)

definitely segfaults on Python 2.6, 2.7, 3.3, and 3.4, and probably segfaults 
on other versions as well. The code is clearly incorrect in that the lambda 
references the variable being defined, but it seems like it should raise an 
error instead of segfaulting.

--
messages: 253112
nosy: Evan Hubinger
priority: normal
severity: normal
status: open
title: Can segfault Python with itertools.chain.from_iterable
type: crash
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue25415] I can create instances of io.IOBase

2015-10-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Martin, I agree with changing the doc. Gerrit misunderstood because 'no public 
constructors' is either meaningless or wrong.  We do not usually talk about 
public versus private constructors.  This sounds more like C++ than Python.

For Python namespaces, names that start with '_' are private by convention 
unless documented otherwise.  Special names (__x__) are private in the sense 
that they are not usually used except by methods of the class; special methods 
are usually accessed by syntax or public names.  For class C, the default 
constructor is C.__new__, accessed by calling C.  (Let us not worry about other 
methods here.)  If C is a public name, with no '_', as is 'IOBase', then to me 
it has/is a public constructor.  Like other classes, IOBase has .__new__ and 
calling it produces an instance, as Gerrit discovered.  In that sense, it is 
not truly abstract.

I believe 'has no public constructor' is intended to mean 'has no documented 
signature and should not be *directly* called."  (If subclasses do call the 
base, then the signature should be documented.)

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25429] Can segfault Python with itertools.chain.from_iterable

2015-10-16 Thread Raymond Hettinger

Raymond Hettinger added the comment:

This is a duplicate of Issue #14010.  This issue runs deep and isn't itertools 
specific.  Running infinite chains of iterators pushes a number of CPython 
internals past their limits.  The best solutions are hard (monitoring the 
C-stack or fixing every possible fault at the fracture point).  The simplest 
solution (adding recursion count tracking to every possible iteration)is very 
heavy-handed and would slow-down all of Python in order to spare exotic cases 
that don't seem to arise in practice.

--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

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



[issue25429] Can segfault Python with itertools.chain.from_iterable

2015-10-16 Thread Zachary Ware

Changes by Zachary Ware :


--
assignee:  -> rhettinger
components: +Extension Modules
nosy: +rhettinger
versions: +Python 3.5, Python 3.6 -Python 3.2, Python 3.3

___
Python tracker 

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



[issue25405] User install of 3.5 removes py.exe from C:\Windows

2015-10-16 Thread eryksun

eryksun added the comment:

Setting a new default for py.exe doesn't require admin privileges. You can use 
the PY_PYTHON environment variable:

C:\>py --version
Python 2.7.10

C:\>set PY_PYTHON=3

C:\>py --version
Python 3.5.0

which you can easily persist in the registry using setx.exe:

C:\>setx PY_PYTHON 3

SUCCESS: Specified value was saved.

Check that it was saved:

C:\>reg query HKCU\Environment /v PY_PYTHON

HKEY_CURRENT_USER\Environment
PY_PYTHONREG_SZ3

You can also use %LOCALAPPDATA%\py.ini to set the default:

C:\>py --version
Python 2.7.10

C:\>copy con "%localappdata%\py.ini"
[defaults]
python=3
^Z
1 file(s) copied.

C:\>py --version
Python 3.5.0

Note that the environment variable is preferred:

C:\Temp>set PY_PYTHON=2

C:\Temp>py --version
Python 2.7.10

and an active virtual environment is most preferred:

C:\Temp>py -3.5 -m venv testenv

C:\Temp>testenv\Scripts\activate.bat

(testenv) C:\Temp>py --version
Python 3.5.0
(testenv) C:\Temp>py -c "import sys; print(sys.prefix)"
C:\Temp\testenv

--
nosy: +eryksun

___
Python tracker 

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



[issue25414] Bypass unnecessary size limit test from deques on builds with 64-bit numbers

2015-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1733b3bd46db by Raymond Hettinger in branch 'default':
Issue #25414: Remove unnecessary tests that can never succeed.
https://hg.python.org/cpython/rev/1733b3bd46db

--
nosy: +python-dev

___
Python tracker 

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



[issue25428] Have `datetime` understand integer arguments for timezones

2015-10-16 Thread R. David Murray

R. David Murray added the comment:

timezone is relatively new.  Work is in progress to add better timezone support 
to datetime, but it is a complicated subject and may or may not make it into 
3.6.  In any case I think it is too soon to talk about this kind of API change, 
before the other work gets farther along.  That's probably also true for 
changes to the docs, although a concrete proposal there might have some chance.

There's a mailing list for talking specifically about datetime issues, you 
might want to post there (see mail.python.org, datetime-sig).

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



[issue25405] User install of 3.5 removes py.exe from C:\Windows

2015-10-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

In my view, py.exe is a mess.  Steve, I know this is something you just 
inherited.  I have multiple all-user installs.  The first problem I have with 
py.exe is its defaulting to 2.7 instead of latest 3.5, and the impossibility of 
changing this.  The second, given that it does have a default, is its being 
given all the file associations, so one can only 'open with' 2.7 on the context 
menu.  (I know, pydev discussion is needed.)

I have twice changed the default by the cumbersome method given in the Using 
Python  manual, which requires admin privileges, which some people do not have. 
 Yet once again, the default is 2.7.  I am not sure whether this reset behavior 
started with 3.5 or not. I believe not.

In any case, the installer does not say whether one should or should not check 
(or leave checked) "[x] install launcher" when it is already installed.  Has it 
been upgraded ever? Or is the same buggy version just being reinstalled.  Paul, 
it sounds like for your, it did the only the 'delete the old' part of a 
re-install.

Bottom line: it should not be deleted unless re-installed; it should only be 
re-installed if there is an upgrade; and if it is re-installed, the changed 
default should not be disturbed.  If the latter is not possible with the user 
change in /Windows, then the method of changing the default should be changed.  
For instance, "py -default x.y", which would be a good idea anyway.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue25429] Can segfault Python with itertools.chain.from_iterable

2015-10-16 Thread Josh Rosenberg

Josh Rosenberg added the comment:

Also crashes in 3.5.0 (on Windows 7, with 64 bit build).

--
nosy: +josh.r

___
Python tracker 

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



[issue25388] tokenizer crash/misbehavior -- heap use-after-free

2015-10-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

According to 
https://docs.python.org/3/reference/lexical_analysis.html#lexical-analysis, the 
encoding of a sourcefile (in Python 3) defaults to utf-8* and a decoding error 
is (should be) reported as a SyntaxError. Since 
b"\x7f\x00\x00\n''s\x01\xfd\n'S" is not invalid as utf-8, I expect a 
UnicodeDecodeError converted to SyntaxError.

* compile(bytes, filename, mode) defaults to latin1 instead.  It has no 
decoding problem, but quits with "ValueError: source code string cannot contain 
null bytes".  On 2.7, I might expect that as the error.

I expect '''self.assertIn(b"Non-UTF-8", res.err)''' to always fail because 
error messages are strings, not bytes.  That aside, have you ever seen that 
particular text (as a string) in a SyntaxError message?).

Why do you think the crash is during the tokenizing phase?  I could not see 
anything in the AS report.

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



[issue25419] Readline completion of module names in import statements

2015-10-16 Thread Martin Panter

Martin Panter added the comment:

Josh: Thanks for pointing out I Python. I haven’t used it much myself, but it 
does seem to do a similar thing to my proposal. Looks like the relevant code 
may be around module_completion() at 
.

The “sys” module is one of the builtin modules that I mentioned above. I plan 
to discuss changing pkgutil.iter_modules() to include it, in a separate bug 
report.

The “os.path” case is more awkward. The “os” module is not actually a package. 
I believe “import os.path” only works because executing the “os” module 
modifies sys.modules. My code currently avoids importing non-packages, because 
I thought it would be annoying to accidentally run a script via tab completion 
(anything not protected by ‘if __name__ == "__main__" ’). On the other hand, I 
Python happily completes “os.path” (and many more non-submodule names). It also 
can be tricked into running scripts, e.g. if you do “import idlelib.__main__.” 
and press Tab. But maybe this is not a real problem, and I should stop being 
paranoid.

I tend to avoid regular expressions if practical. But Serhiy you may be right 
that some simple string matching rules would reduce the need for tokenizing. It 
looks like I Python only has a few simple rules for the entire input line being 
“import x” and “from x import y”. The disadvantage is less accurate 
understanding of more complicated syntax, like “from x import y; from z import 
(a, bb as b, . . .”. It is a tradeoff between simpler code that only supports 
basic functionality versus complex code that supports more complete 
functionality.

I hear your points about decoupling from Readline and backwards compatibility. 
I will consider the overall architecture more in a future update. It would be 
good to allow this stuff to be used in e.g. Idle (though I wouldn’t know where 
to wire it in myself).

--

___
Python tracker 

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



[issue25421] Make __sizeof__ for builtin types more subclass friendly

2015-10-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +pitrou

___
Python tracker 

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



[issue25421] Make __sizeof__ for builtin types more subclass friendly

2015-10-16 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Default __sizeof__() implementation uses tp_basicsize. This makes it to work 
correctly with most builtin types and types with __slots__ (using __slots__ 
increases tp_basicsize). But special implementations of __sizeof__() use static 
object size ('sizeof(XXXObject)'), and return incorrect result for subclasses 
that increase tp_basicsize. Proposed patch makes __sizeof__() for all 
subclassable builtin type that support changing object size (i.e. tp_itemsize 
== 0) to use dynamic size _PyObject_SIZE(Py_TYPE(self)).

Example (with patched code):
>>> class D(dict):
... __slots__ = 'a', 'b', 'c'
... 
>>> sys.getsizeof({})
144
>>> sys.getsizeof(D())
156

In unpatched Python sys.getsizeof(D()) returns 144.

--
components: Extension Modules, Interpreter Core
files: sizeof_dynamic.patch
keywords: patch
messages: 253074
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Make __sizeof__ for builtin types more subclass friendly
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40795/sizeof_dynamic.patch

___
Python tracker 

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



[issue25422] tokenize: add tests for multi-line strings

2015-10-16 Thread Eric V. Smith

Changes by Eric V. Smith :


--
title: tokenize: add test for multi-line strings -> tokenize: add tests for 
multi-line strings

___
Python tracker 

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



[issue25422] tokenize: add test for multi-line strings

2015-10-16 Thread Eric V. Smith

New submission from Eric V. Smith:

As part of fixing issue 25311, I'm going to change how the string pattern 
recognition works. I want to make sure I don't break anything that currently 
works, but there are no tests for multi-line strings. I'll add those first, 
under this issue.

I'm not positive that the multi-line string behavior is correct or makes sense, 
but that's not the point: I just want to first add tests for the existing 
functionality to make sure I don't break it.

--
assignee: eric.smith
components: Library (Lib)
messages: 253075
nosy: eric.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: tokenize: add test for multi-line strings
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue25408] Consider dropping html5lib and spambayes from the default benchmark set

2015-10-16 Thread Brett Cannon

Brett Cannon added the comment:

Fixed in changeset 22a5da25fa4e .

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



[issue25425] white-spaces encountered in 3.4

2015-10-16 Thread R. David Murray

R. David Murray added the comment:

You are going to have to explain more about what your issue is, there isn't 
enough information here to even start to guess.

--
nosy: +r.david.murray

___
Python tracker 

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