[issue27525] Wrong OS header on file created by gzip module

2016-07-16 Thread Dor Dankner

Dor Dankner added the comment:

I'm convinced.
Thank you all for your comments :)

--
status: open -> closed

___
Python tracker 

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



[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-16 Thread Vedran Čačić

Changes by Vedran Čačić :


--
type: performance -> behavior

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-16 Thread Александр Карпинский

Александр Карпинский added the comment:

@serhiy.storchaka

Any filters not solves the problem because warnings module SAVES EVERY WARNING 
MESSAGE for further duplication checks.

Yes, the file name is helpful for determining the source of the POSSIBLE leak. 
While file name in error message IS SOURCE OF THE LEAK. When you aware about 
not closed files, you can log file names. You have a way to do that. But if you 
want to ignore the warning, the memory will leak. Not because of not closed 
files, but because of warning itself.

I do want to close files in my script, but in Pillow, it is not so easy due to 
backward compatibility.

--

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The file name is helpful for determining the source of the leak. If you don't 
want to close files in your script, set an appropriate warning filter to 
silence this kind of warnings.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27525] Wrong OS header on file created by gzip module

2016-07-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This byte identifies the type of file system. How can you determine it? Note 
that different filesystems can be used on the same OS. FAT still widely used on 
Windows (and what about exFAT, should it be considered as a flavour of FAT or 
separate type?), virtually any file system can be mounted on Linux.

See 2.3.1.2 in RFC 1952:

 A compliant compressor must produce files with correct ID1,
 ID2, CM, CRC32, and ISIZE, but may set all the other fields in
 the fixed-length part of the header to default values (255 for
 OS, 0 for all others).

 [...] a decompressor may ignore FTEXT and OS
 and always produce binary output, and still be compliant.

Since the gzip module never sets the FTEXT flag, the value of the OS field is 
useless.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue27536] Convert readme to reStructuredText

2016-07-16 Thread Louis Taylor

Changes by Louis Taylor :


--
title: Convert readme to markdown -> Convert readme to reStructuredText

___
Python tracker 

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



[issue27536] Convert readme to markdown

2016-07-16 Thread Louis Taylor

Louis Taylor added the comment:

Oh, that's a very good point. Patch updated.

--
Added file: http://bugs.python.org/file43764/readme-to-rst.patch

___
Python tracker 

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



[issue27536] Convert readme to markdown

2016-07-16 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue27536] Convert readme to markdown

2016-07-16 Thread Ned Deily

Ned Deily added the comment:

Thanks for the patch.  If we do want to use a markup language for the README, 
we would want to use reStructuredText, the standard markup language for 
CPython, rather than Markdown, which we currently don't use at all.  Github 
supports both, doesn't it?  And, for simple documents, like the README, the 
differences between the two shouldn't be that big.

--
nosy: +ned.deily

___
Python tracker 

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



[issue27536] Convert readme to markdown

2016-07-16 Thread Louis Taylor

New submission from Louis Taylor:

Since the move to github is happening, the readme should probably be changed to 
markdown in order to render nicer on the github web interface. Issue 27476 
introduced a .github folder, so it seems that preemptive changes for the 
migration are okay.

--
files: readme-to-markdown.patch
keywords: patch
messages: 270604
nosy: louis.taylor
priority: normal
severity: normal
status: open
title: Convert readme to markdown
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43763/readme-to-markdown.patch

___
Python tracker 

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



[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-16 Thread Decorater

Decorater added the comment:

Only 1 way to find out, test it till it breaks. :P

--

___
Python tracker 

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



[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

Yeah I see your point. Anyway I think the current patch is fine.

--

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Steve Dower

Steve Dower added the comment:

Maybe so. If you find a core developer who cares about performance in 2.7, 
maybe they'll merge it :)

--

___
Python tracker 

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



[issue27535] Memory leaks when opening tons of files

2016-07-16 Thread Александр Карпинский

New submission from Александр Карпинский:

Actually, this issue is related to the warning module. The test script creates 
a lot of files with different names and deletes them. On the first pass the 
scripts calls the `f.close()` method for every file. On the second it doesn't.

As a result, on the first pass, the memory consumption is constant and is about 
3.9 Mb for my environment. For the second pass, the memory consumption 
constantly grows up to 246 Mb for 1 million files. I.e. memory leak is about 
254 bytes for every opened file.

This happens because of warning about not closed files. The memory is consumed 
for storing all possible warning messages generated for different file names to 
prevent further warnings with the same messages. Which is not the case if we 
are always opening new files.

While not calling f.close() **might** lead to memory issues, the warning which 
notifies about this **absolutely guaranteed** leads to memory issue. Although 
f.close() is highly recommended, this is still the issue for code which doesn't 
use it for some reasons and doesn't experience other problems with not closed 
files because files are actually always closed in IOBase.__del__.

This issue was discovered in this report: 
https://github.com/python-pillow/Pillow/issues/2019


The best way to fix this is excluding file name from warning message. As a 
result, the message for every file will be the same and warnings registry will 
not grow. For now, the message looks like this:

./memory.py:23: ResourceWarning: unclosed file <_io.FileIO name='__999.tmp' 
mode='wb' closefd=True>
  open_files(number, close)

It may looks like this:

./memory.py:23: ResourceWarning: unclosed file 
  open_files(number, close)

--
components: IO
files: memory.py
messages: 270600
nosy: Александр Карпинский
priority: normal
severity: normal
status: open
title: Memory leaks when opening tons of files
type: resource usage
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file43762/memory.py

___
Python tracker 

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



[issue27515] Dotted name re-import does not rebind after deletion

2016-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I understand the reluctance to generically encourage something that does not 
always arise.  With Nick's promise to help examine any particular problems with 
deletion of tkinter modules, should they arise, I feel comfortable closing 
this. I already tested and applied double deletion to both 3.5 and 3.6.

The tkinter import example illustrates potential benefits from refactoring 
(which I will continue in #27534).  For me, on Win10, 'import tkinter' in a 
fresh interactive interpreter boosts 'len(sys.modules) from 41 to 65.  Except 
when run cannot start, it only uses tkinter to call 
_tkinter.tkapp().eval('update') in its interactive input loop. Importing 
_tkinter instead (a slight risk) would not import anything else.

Guido: when I need help with some of the more obscure IDLE code, I will ask.

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I am thinking about addin a test.

--
status: closed -> pending

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Eryk Sun

Eryk Sun added the comment:

OK. I thought fixing bugs in 2.7 was at the discretion of core developers, 
including small tweaks for performance -- just not enhancements with 
significant amounts of new code and features.

--

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

PS: the test suite run without error on my Win10, 32bit build.

--

___
Python tracker 

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



[issue25507] IDLE: user code 'import tkinter; tkinter.font' should fail

2016-07-16 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I decided to fix this issue for both 3.5 and 3.6 by deleting the submodules 
both from tkinter and sys.modules (as discussed in #27515).
I used a new version of tkimports.py to check the result of user imports after 
the patch.  When this file loaded into IDLE and run with F5, the dir listing 
for each submodule, after previous import and deletion in run startup, is the 
same as when the file is run with " tkimports".

I opened #27534 to continue run import reduction.  I consider 93d325c64104 and 
run_autocomplete.diff to be part of that issue.

--
resolution:  -> fixed
stage: needs patch -> resolved
status: open -> closed
Added file: http://bugs.python.org/file43761/tkimports.py

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Steve Dower

Steve Dower added the comment:

No, it's not a security fix, so it doesn't go in 2.7.

--

___
Python tracker 

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



[issue27469] Unicode filename gets crippled on Windows when drag and drop

2016-07-16 Thread Steve Dower

Steve Dower added the comment:

Attached my first pass at the shell extension.

As this has the potential to crash Windows Explorer, I want to be _really_ 
thorough, so all reviews and feedback welcomed.

--
keywords: +patch
Added file: http://bugs.python.org/file43760/27469_1.patch

___
Python tracker 

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



[issue27534] IDLE: Reduce number and time for user process imports

2016-07-16 Thread Terry J. Reedy

New submission from Terry J. Reedy:

This issue continues #25507.  I still want to reduce the number of modules 
imported when run.py starts a user process and the time they require.  In the 
process, I expect to reduce the number of tkinter module imports that need to 
be reversed and thereby make parts of the #25507 fix unnecessary.

"New changeset 93d325c64104 by Terry Jan Reedy in branch 'default':
Issue #25507: Move 4 objects from pyshell to run and switch inports.
https://hg.python.org/cpython/rev/93d325c64104;

This commit for #25507 was not needed for the fix I eventually choose, but it 
reduced the size of sys.modules in the user process from 193 to 156.  I have 
since determined that it reduced the time for startup imports on my machine 
from .45 to .25 seconds.  I now regard it as the first patch for this issue.

The attached file was explained in msg270522.  This and similar refactorings 
should be done when or after I have otherwise revised the module and tests in 
question.

For a Windows build of repository 3.6, importing tkinter into a fresh python 
process increases len(sys.modules) from 41 to 65.  But run only imports tkinter 
so it can call _tkinter.tkapp().eval('update') in its interactive input loop.  
If other indirect imports were eliminated, I suspect _tkinter could be imported 
instead.

--
assignee: terry.reedy
components: IDLE
files: run_autocomplete.diff
keywords: patch
messages: 270592
nosy: terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: IDLE: Reduce number and time for user process imports
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file43759/run_autocomplete.diff

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Jeremy Spiegel

Changes by Jeremy Spiegel :


Added file: http://bugs.python.org/file43758/_isdir.2.7.patch

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Jeremy Spiegel

Changes by Jeremy Spiegel :


Removed file: http://bugs.python.org/file43757/_isdir.2.7.patch

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Jeremy Spiegel

Changes by Jeremy Spiegel :


Added file: http://bugs.python.org/file43757/_isdir.2.7.patch

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Eryk Sun

Eryk Sun added the comment:

Should this be backported to 2.7 posix__isdir()?

--
nosy: +eryksun

___
Python tracker 

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread R. David Murray

R. David Murray added the comment:

Please read the referenced issue.  Your points are addressed there.

--

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Steve Dower

Steve Dower added the comment:

LGTM.

This is the kind of patch I can't wait to have a one-click merge button... 
right now it'll have to wait until I have a clean repo. But if anyone else 
wants to get it, go ahead.

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread James Lu

James Lu added the comment:

I think you closed it too quickly. You see, computing the length of
combinations() doesn't require looping all the way through the iterator;
you can compute it quickly. I created a wrapper class just for this purpose.

On Sat, Jul 16, 2016 at 5:24 PM, R. David Murray 
wrote:

>
> R. David Murray added the comment:
>
> If you read issue 24849, you will see that iterators having len was
> rejected by Guido long ago.
>
> --
> nosy: +r.david.murray
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue26974] Crash in Decimal.from_float

2016-07-16 Thread Stefan Krah

Stefan Krah added the comment:

The approaches look good, but for clarity I want to replace all method calls 
that should never be overridden by the plain C functions of their corresponding 
static types.

I have no opinion about the Python version. The diff also "fixes" #26975 for 
the C version, so perhaps the Python version should be in sync. It is an 
academic question, since no one will write a class that triggers it.

Preemptively, I'm aware that long_bit_length() is defined with a single 
argument, then cast to a CFunction, then called with two arguments.

ceval.c does the same. -- We had a discussion about that with MvL a while ago, 
he preferred to define all CFunctions with two arguments. I'd also prefer that, 
but that is another issue.

--
Added file: http://bugs.python.org/file43756/issue26974.diff

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread R. David Murray

Changes by R. David Murray :


--
components: +Windows
nosy: +paul.moore, 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



[issue22246] add strptime(s, '%s')

2016-07-16 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
nosy: +brett.cannon

___
Python tracker 

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread R. David Murray

R. David Murray added the comment:

If you read issue 24849, you will see that iterators having len was rejected by 
Guido long ago.

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread R. David Murray

Changes by R. David Murray :


--
resolution:  -> duplicate
stage:  -> resolved
superseder:  -> Add __len__ to map, everything in itertools

___
Python tracker 

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread R. David Murray

Changes by R. David Murray :


--
status: open -> closed

___
Python tracker 

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread James Lu

James Lu added the comment:

same for itertools iterators -  libraries such as tqdm would benefit from
this

On Sat, Jul 16, 2016 at 3:08 PM, James Lu  wrote:

>
> New submission from James Lu:
>
> This would be useful for libraries like tqdm (progress bar module).
>
> --
> components: Interpreter Core
> messages: 270581
> nosy: James.Lu
> priority: normal
> severity: normal
> status: open
> title: Dictionary iterator has no len()
> type: enhancement
> versions: Python 3.6
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue27533] release GIL in nt._isdir

2016-07-16 Thread Jeremy Spiegel

New submission from Jeremy Spiegel:

In Modules/posixmodule.c, the function os__isdir_impl calls 
GetFileAttributesA/GetFileAttributesW without releasing the GIL. This is 
problematic since it can result in disk or network I/O, depending on the 
filesystem.

--
components: Library (Lib)
files: _isdir.patch
keywords: patch
messages: 270583
nosy: jeremyspiegel
priority: normal
severity: normal
status: open
title: release GIL in nt._isdir
Added file: http://bugs.python.org/file43755/_isdir.patch

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2016-07-16 Thread Antti Haapala

Antti Haapala added the comment:

Gnulib portability library has 
https://www.gnu.org/software/gnulib/manual/html_node/Integer-Range-Overflow.html
 and 
https://www.gnu.org/softwarhe/gnulib/manual/html_node/Integer-Type-Overflow.html
 and even macros for producing well-defined integer wraparound for signed 
integers: 
https://www.gnu.org/software/gnulib/manual/html_node/Wraparound-Arithmetic.html

That code is under GPL but I believe there is no problem if someone just looks 
into that for ideas on how to write similar macros.

--

___
Python tracker 

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



[issue22246] add strptime(s, '%s')

2016-07-16 Thread Mark Lawrence

Changes by Mark Lawrence :


--
nosy:  -BreamoreBoy

___
Python tracker 

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



[issue27532] Dictionary iterator has no len()

2016-07-16 Thread James Lu

New submission from James Lu:

This would be useful for libraries like tqdm (progress bar module).

--
components: Interpreter Core
messages: 270581
nosy: James.Lu
priority: normal
severity: normal
status: open
title: Dictionary iterator has no len()
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2016-07-16 Thread Jeffrey Walton

Jeffrey Walton added the comment:

>  Has this sort of thing been done in other projects?

Yes.

If you are using C, you can use safe_iop. Android uses it for safer
integer operations. If you are using C++, you can use David LeBlanc's
SafeInt class. Microsoft uses it for safer inter operations.

Jeff

--

___
Python tracker 

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



[issue24954] No way to generate or parse timezone as produced by datetime.isoformat()

2016-07-16 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Antti, while I see some convenience in making %z parsing promiscuous, there is 
clear utility in adding %:z to strftime.  If we do that, not allowing the same 
for parsing will be odd.  Let's start with that.  A case for a promiscuous %z 
can be made later.

On a separate issue, note that datetime.isoformat() has recently grown a 
timespec option.  See issue 19475.  I wonder if it would make sense to add a 
tzspec option to control the way timezone is formatted.

--

___
Python tracker 

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



[issue27083] PYTHONCASEOK is ignored on Windows

2016-07-16 Thread Brett Cannon

Brett Cannon added the comment:

Buildbots are green again and I addressed the key type issue. Thanks for 
letting me know about the failure, Martin.

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



[issue27531] Documentation for assert_not_called() has wrong signature

2016-07-16 Thread Michael Killough

New submission from Michael Killough:

The documentation for `Mock.assert_not_called` gives its signature as 
`assert_not_called(*args, **kwargs)`. Since 01ae1ac2daf4, its signature has 
just been `assert_not_called()`.

I've attached a trivial patch that updates the documentation to match the new 
signature.

--
assignee: docs@python
components: Documentation
files: docs-assert_not_called.patch
keywords: patch
messages: 270577
nosy: docs@python, mjkillough
priority: normal
severity: normal
status: open
title: Documentation for assert_not_called() has wrong signature
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43754/docs-assert_not_called.patch

___
Python tracker 

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



[issue27083] PYTHONCASEOK is ignored on Windows

2016-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6b46c1510bfa by Brett Cannon in branch '3.5':
Fix regressions introduced by fixes for issue #27083.
https://hg.python.org/cpython/rev/6b46c1510bfa

New changeset f4c91b883772 by Brett Cannon in branch 'default':
Merge for #27083
https://hg.python.org/cpython/rev/f4c91b883772

--

___
Python tracker 

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



[issue24954] No way to generate or parse timezone as produced by datetime.isoformat()

2016-07-16 Thread Antti Haapala

Antti Haapala added the comment:

Alexander: that is true, because they are *separate* conversion flags. 

However even the POSIX standard strptime has some leniency: '%m` and `%d` 
accept the numbers *without* leading zeroes. This actually also means that one 
cannot use `%Y%m%d` to detect an invalid ISO timestamp:

>>> datetime.datetime.strptime('22', '%Y%m%d')
datetime.datetime(, 2, 2, 0, 0)

The `arrow` library depends on the supposed "strict" behaviour of strptime that 
has never been guaranteed, which often results in very buggy behaviour under 
some conditions.



(Also, it must be noted that GNU date program doesn't use these formats to 
*parse* dates, and POSIX strptime in *C* library outright ignores any timezone 
information)

--

___
Python tracker 

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



[issue24773] Implement PEP 495 (Local Time Disambiguation)

2016-07-16 Thread Alexander Belopolsky

Changes by Alexander Belopolsky :


--
nosy: +haypo
stage: needs patch -> commit review

___
Python tracker 

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



[issue24773] Implement PEP 495 (Local Time Disambiguation)

2016-07-16 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

Submitting the latest Github snapshot as a patch against master for review.  
See issue24773-s3-2.diff.

--
Added file: http://bugs.python.org/file43753/issue24773-s3-2.diff

___
Python tracker 

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



[issue24954] No way to generate or parse timezone as produced by datetime.isoformat()

2016-07-16 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

"Be conservative in what you do, be liberal in what you accept from others"

I would agree to this approach with respect to a proposed fromisoformat() 
method (see issue 15873), but setptime seems to be about specifying an exact 
format.  For example, "%Y%m%d" will not accept "2016-07-16".

--

___
Python tracker 

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



[issue27530] Non-Critical Compiler WARNING: Python Embedding C++11 does not allow non-constant string literals

2016-07-16 Thread Daniel Lord

New submission from Daniel Lord:

ERROR SUMMARY:
abstract.h:1332:60: warning: ISO C++ forbids converting a string constant to 
‘char*’ [-Wwrite-strings]
 #define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)

ISSUE CRITICALITY:
Non-fatal Warning (will become an error eventually when deprecations expire and 
errors are introduced in c++XX or later)

COMPILER:
g++ -std=c++11
g++ 4.2.1

$g++ -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr 
--with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.5.0
Thread model: posix
InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

FILE:
abstract.h

WORKAROUND:
add compiler option: -Wc++11-compat-deprecated-writable-strings and 
-Wwritable-strings. In theory anyway: doesn't seem to work (still get the 
warning) and when I tried g++ 5.3.0, the compiler marks that option as an error 
and unsupported.

g++-5.3.0: error: unrecognized command line option ‘-Wwritable-strings’
g++-5.3.0: error: unrecognized command line option 
‘-Wc++11-compat-deprecated-writable-strings’

ERROR MESSAGE:
warning: ISO C++11 does not allow conversion from string literal to 'char *' 
[-Wwritable-strings]
pList = PyMapping_Keys(pDict);
^
/Users/xx/anaconda/include/python2.7/abstract.h:1332:49: note: expanded 
from macro 'PyMapping_Keys'
#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)
^
1 warning generated.

OFFENDING STATEMNT:
#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL)

PROBLEM:
"keys" is a string literal but not declared as a constant.

COMMENTS:
This is not a big deal...yet.
I can compile with g++ C++11 using the above flag to allow deprecated writeable 
string literals for my application embedding Python 2.7.
However, I assume the embedding code is replete with non-constant string 
literals which eventually need to be fixed though this is the first one I have 
run into.

--
components: Extension Modules
messages: 270572
nosy: Daniel Lord
priority: normal
severity: normal
status: open
title: Non-Critical Compiler WARNING: Python Embedding C++11 does not allow 
non-constant string literals
type: compile error
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



[issue27529] Tkinter memory leak on OS X

2016-07-16 Thread Ned Deily

Changes by Ned Deily :


--
Removed message: http://bugs.python.org/msg270570

___
Python tracker 

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



[issue27529] Tkinter memory leak on OS X

2016-07-16 Thread Ned Deily

Ned Deily added the comment:

tkinter is pretty much just a thin wrapper around the Tcl/Tk C API so suspicion 
for behavior like this should start there.  Usually, the easiest way to confirm 
that is to write an equivalent test in Tcl using its wish shell but, in this 
case, there's an even easier way.  The memory leak is easy to see if you use 
the badly out-of-date and seriously flawed system Tcl/Tk 8.5.x supplied by 
Apple in OS X releases since 10.6.  If tkinter is linked with an up-to-date 
Tcl/Tk, the leak should go away.  At least that's the case when using python3.5 
from python.org 10.6+ installers and with ActiveTcl 8.5.18 installed.  See 
https://www.python.org/download/mac/tcltk/ for more info.

--

___
Python tracker 

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



[issue27529] Tkinter memory leak on OS X

2016-07-16 Thread Ned Deily

Ned Deily added the comment:

tkinter is pretty much just a thin wrapper around the Tcl/Tk C API so suspicion 
for behavior like this start there.  Usually, the easiest way to confirm that 
is to write an equivalent test in Tcl using its wish shell but, in this case, 
there's an even easier way.  The memory leak is easy to see if you use the 
badly out-of-date and seriously flawed system Tcl/Tk 8.5.x supplied by Apple in 
OS X releases since 10.6.  If tkinter is linked with an up-to-date Tcl/Tk, the 
leak should go away.  At least that's the case when using python3.5 from 
python.org 10.6+ installers and with ActiveTcl 8.5.18 installed.  See 
https://www.python.org/download/mac/tcltk/ for more info.

--
resolution:  -> third party
stage:  -> resolved
status: open -> closed
versions:  -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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

I am on Debian 8 "jessie" that only has Python 3.4, so I want to patch 
webbrowser.py in a backward-compatible way.

--

___
Python tracker 

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



[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-16 Thread Xiang Zhang

Xiang Zhang added the comment:

I can't totally agree the point. The code means every time we increase the 
buffer by half the current length. So when the length arrives 2/3 * 
PY_SSIZE_T_MAX it's going to overflow. There is a 1/3 * PY_SSIZE_T_MAX gap 
between the theoretical upper limit. I think leaving such a gap and exiting is 
somewhat too rude. So in such case I make it have a try.

--

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Berker Peksag

Berker Peksag added the comment:

I was talking about webbrowser.py-3.4-newfox.patch

3.4 is now in security-fix-only mode so we can't push the patch to the 3.4 
branch.

--

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

Updated patch for Python 2.7 with subprocess.check_output().

--
Added file: http://bugs.python.org/file43751/webbrowser.py-2.7-newfox.patch

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

Updated patch for Python 3.4+ with subprocess.check_output().

--
Added file: http://bugs.python.org/file43752/webbrowser.py-3.4-newfox.patch

___
Python tracker 

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



[issue27507] bytearray.extend lacks overflow check when increasing buffer

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

Not particularly related, but the special fast case in 
Objects/listobject.c:811, listextend(), also seems to lack an overflow check.

“An alternative would be to raise the error without trying to allocate 
Py_SSIZE_T_MAX first”: what I meant was removing the special case to allocate 
PY_SSIZE_T_MAX. As soon as it attempts to overallocate 2+ GiB of memory it 
fails. Something more like

addition = len >> 1;
if (addition > PY_SSIZE_T_MAX - len - 1) {
/* . . . */
return PyErr_NoMemory();
}
buf_size = len + addition;

Antti: in this case we are allocating an array of _bytes_, not pointers. So 
maybe it is possible to reach the limit with a 32-bit address space.

--

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

Not subprocess.run() as I'm aiming to Python 2.7. Perhaps 
subprocess.check_output(). I'll try it.

--

___
Python tracker 

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



[issue1621] Do not assume signed integer overflow behavior

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

I tried the newer -fsanitize=undefined mode, and it is better than -ftrapv. It 
adds instrumentation that by default nicely reports the errors and continues 
running.

My problem with the large slice step is not restricted to Element Tree; it 
affects list objects too:

>>> "abcdef"[3::sys.maxsize]
Objects/unicodeobject.c:13794:55: runtime error: signed integer overflow: 3 + 
9223372036854775807 cannot be represented in type 'long int'
'd'

Regarding Antti’s overflow macros, I noticed there is already a macro 
_PyTime_check_mul_overflow() in Python/pytime.c which does that kind of thing. 
Maybe it could help, though I am not sure. Has this sort of thing been done in 
other projects? We might need to be careful about the sign, e.g. clarify the 
macro is only for positive values, add an assertion, or handle both positive 
and negative.

--

___
Python tracker 

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



[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-07-16 Thread Martin Panter

Changes by Martin Panter :


--
Removed message: http://bugs.python.org/msg270561

___
Python tracker 

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



[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

I added one comment, but I think this might almost be ready

--

___
Python tracker 

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



[issue27130] zlib: OverflowError while trying to compress 2^32 bytes or more

2016-07-16 Thread Xiang Zhang

Xiang Zhang added the comment:

Upload the v9 version. It applies your last comment and catch up with the hg 
tip.

--
Added file: http://bugs.python.org/file43750/64bit_support_for_zlib_v9.patch

___
Python tracker 

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



[issue27525] Wrong OS header on file created by gzip module

2016-07-16 Thread R. David Murray

R. David Murray added the comment:

This is a harder call than #27521.  There (IUUC), the *wrong* compression level 
was specified.  Here, 'unknown' is a valid value.  The biggest disadvantage of 
changing this is the maintenance burden of keeping it up to date with platform 
changes (eg: we're eventually adding android support, and andriod (may not be?) 
posix.  Without a defined benefit, I'm -0.5 on changing this.

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



[issue27527] Make not yielding from or awaiting a coroutine a SyntaxError

2016-07-16 Thread R. David Murray

R. David Murray added the comment:

Also, fyi it was couterproductive to code this as a Windows issue...that 
alerted the windows experts, but it is not a windows-specific issue, so it just 
pinged them needlessly.  Also FYI, enahancements can only go into the next 
feature release, so the correct versions selection would have been 3.6 only.

--

___
Python tracker 

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



[issue27527] Make not yielding from or awaiting a coroutine a SyntaxError

2016-07-16 Thread R. David Murray

R. David Murray added the comment:

It can't be a syntax error.  There are legitimate reasons for calling a 
coroutine and then passing around the resulting object before awaiting it.

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the patches! Can't you just use a function from the high level 
subprocess API (like subprocess.run()?

--
stage:  -> patch review
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

Patch for Python 3.4 and 3.5 to support Firefox >= 36.0, with version test.

--
Added file: http://bugs.python.org/file43749/webbrowser.py-3.4-newfox.patch

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Oleg Broytman

Oleg Broytman added the comment:

Patch for Python 2.7 to support Firefox >= 36.0, with version test.

--
keywords: +patch
Added file: http://bugs.python.org/file43748/webbrowser.py-2.7-newfox.patch

___
Python tracker 

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



[issue23262] webbrowser module broken with Firefox 36+

2016-07-16 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-16 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

here is the patch, if you want to test it, just use the REPL and add __ltrace__ 
= None in the REPL.

--
Added file: http://bugs.python.org/file43747/issue25571-2.diff

___
Python tracker 

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



[issue25571] Improve the lltrace feature with the Py_Debug mode

2016-07-16 Thread Stéphane Wirtel

Stéphane Wirtel added the comment:

Here is a small example of lltrace when you enable it.

```
stephane@sg1 ~/s/h/cpython> ./python 
Python 3.6.0a3+ (default:0d8f139a6e19+, Jul 16 2016, 11:59:46) 
[GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print

>>> print("hello")
hello
>>> __ltrace__ = None
>>> print("hello")
0: LOAD_NAME, 0
push 
2: LOAD_CONST, 0
push 'hello'
4: CALL_FUNCTION, 1
ext_pop 'hello'
hello
ext_pop 
push None
6: PRINT_EXPR
pop None
8: LOAD_CONST, 1
push None
10: RETURN_VALUE
pop None
>>> del __ltrace__
0: DELETE_NAME, 0
2: LOAD_CONST, 0
push None
4: RETURN_VALUE
pop None
>>> print("hello")
hello
>>> print("hello")
```

--

___
Python tracker 

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



[issue20842] pkgutil docs should reference glossary terms not PEP 302

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

I still think the links are too dense. Three links to the same term in two 
short paragraphs is too much. Do you think it would be okay to just link the 
first occurrence for pkgutil.ImpImporter?

Also, there is still a problem at least the definition of “finder” used by the 
ImpImporter documentation. In PEP 302, “a finder object has a single method: 
finder.find_module(fullname, path=None)”. This seems to be a pretty good 
description of the ImpImporter API. However, by dropping the reference to PEP 
302, and linking to the glossary definition, we are suggesting that ImpImporter 
implements importlib.abc.MetaPathFinder and/or importlib.abc.PathEntryFinder. 
Both these APIs require some sort of find_spec() method, which is not provided 
by ImpImporter.

As I see it, either Python’s “finder” glossary entry should be adjusted to 
accommodate PEP 302, or we should retain the PEP 302 reference and not point at 
the wrong definition of “finder”.

--

___
Python tracker 

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



[issue27529] Tkinter memory leak on OS X

2016-07-16 Thread Mirano Tuk

New submission from Mirano Tuk:

There seems to be a memory leak in tkinter on OSX (Windows and Linux don't seem 
to be affected). Explicitly calling Tk.update() sometimes permanently allocates 
a multiple of 4096 bytes. Allocation happens more frequently if update calls 
are in close succession.

import time
from tkinter import Tk
root = Tk()

while True:
root.update()  # Huge memory leak

while True:
root.update()  # No memory leaks
time.sleep(1)

Issue occurs on python3.3 and above, did not test on older versions.

--
components: Macintosh, Tkinter
messages: 270550
nosy: Mirano Tuk, ned.deily, ronaldoussoren
priority: normal
severity: normal
status: open
title: Tkinter memory leak on OS X
type: resource usage
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue27525] Wrong OS header on file created by gzip module

2016-07-16 Thread Dor Dankner

Dor Dankner added the comment:

It does not seem like a feature after you see this issue #27521.
The OS was just hardcoded, the same way the compression level was hardcoded. 
you may say it's a feature too :P

The way I see it, the gzip module should at least work like the original GNU 
gzip, if not following the RFC (which I believe is even better).

Anyways i verified that OS X fills a UNIX OS header, and fixed my code (patch 
included) :)

--
Added file: 
http://bugs.python.org/file43746/gzip_os_header_fix_and_tests_mac_fix.patch

___
Python tracker 

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



[issue21136] fractions.Fraction.__pow__ does unneeded renormalization

2016-07-16 Thread Vedran Čačić

Vedran Čačić added the comment:

Unfortunately, this introduced a bug. It seems Mark Dickinson should go easier 
on his LGTMs. :-)

>>> import fractions
>>> fractions.Fraction(-1, 2) ** -1
Fraction(2, -1)

That is a really strange object, since it's not normalized, and many functions 
expect all Fractions to be. For example,

>>> _ == -2
False

Of course, the easy fix would be to change line 52 of fractions.py to 
_normalize=True - but that would reintroduce the slowness talked about in the 
original message. Alternative fix would be to be careful about sign of the 
base, which might be messy if we intend to be completely general -- for 
example, in finite quotient rings, fractions don't have well-defined signs. 
[I'm not quite sure why the code in fractions.py is so general, maybe someone 
really wanted such a level of generality. I don't, so I'd be fine with this 
working only on int/int Fractions.]

--
nosy: +Vedran.Čačić
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



[issue27487] -m switch regression in Python 3.5.2 (under rare circumstances)

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

Here is a patch with the proposed warning. I think “Error finding module 
specification” might be a bit better than the current “finding spec”, so I 
included that change. With the patch, this is what the messages look like:

$ ./python -m package.module
/media/disk/home/proj/python/cpython/Lib/runpy.py:125: RuntimeWarning: 
'package.module' found in sys.modules after import of any parent packages, but 
prior to execution; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
/media/disk/home/proj/python/cpython/python: Error while finding module 
specification for 'package.module' (ValueError: package.module.__spec__ is not 
set)
[Exit 1]

The warning also occurs when running toplevel modules that are already imported:

$ ./python -m runpy
/media/disk/home/proj/python/cpython/Lib/runpy.py:125: RuntimeWarning: 'runpy' 
found in sys.modules after import of any parent packages, but prior to 
execution; this may result in unpredictable behaviour
  warn(RuntimeWarning(msg))
No module specified for execution

FWIW, to fully avoid the regression and keep my original bug fixed at the same 
time, I think we would need a way for importlib.util.find_spec() to 
differentiate its own exceptions (the ValueError for missing __spec__, the 
ImportError for nonexistent parent package, etc) from exceptions raised by 
__init__.py code. The exceptions currently raised by find_spec() are not 
flexible enough for the runpy use case.

--
keywords: +patch
stage:  -> patch review
Added file: http://bugs.python.org/file43745/warn-imported.patch

___
Python tracker 

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



[issue27528] Document that filterwarnings(message=...) matches the start of a message

2016-07-16 Thread Martin Panter

New submission from Martin Panter:

I assumed that the “message” parameter could be used to match any substring of 
a warning message, but it turns out it calls regex.match(), which is anchored 
at the beginning of the search string (but is not anchored at the end). I 
propose this patch to clarify the documentation, and add some tests.

--
assignee: docs@python
components: Documentation
files: match-start.patch
keywords: patch
messages: 270546
nosy: docs@python, martin.panter
priority: normal
severity: normal
stage: patch review
status: open
title: Document that filterwarnings(message=...) matches the start of a message
versions: Python 2.7, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file43744/match-start.patch

___
Python tracker 

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



[issue27083] PYTHONCASEOK is ignored on Windows

2016-07-16 Thread Martin Panter

Martin Panter added the comment:

This appears to have broken the tests on Windows:

http://buildbot.python.org/all/builders/x86%20Windows7%203.5/builds/1030/steps/test/logs/stdio
==
FAIL: test_insensitive 
(test.test_importlib.source.test_case_sensitivity.Frozen_CaseSensitivityTestPEP302)
--
Traceback (most recent call last):
  File 
"D:\cygwin\home\db3l\buildarea\3.5.bolen-windows7\build\lib\test\test_importlib\source\test_case_sensitivity.py",
 line 65, in test_insensitive
self.assertIsNotNone(insensitive)
AssertionError: unexpectedly None

(Plus three more failures)

--
nosy: +martin.panter
status: closed -> open

___
Python tracker 

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



[issue27285] Document the deprecation of pyvenv in favor of `python3 -m venv`

2016-07-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0d8f139a6e19 by Martin Panter in branch 'default':
Issue #27285: Cleanup leftover susp-ignored entry after text was changed
https://hg.python.org/cpython/rev/0d8f139a6e19

--

___
Python tracker 

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



[issue24954] No way to generate or parse timezone as produced by datetime.isoformat()

2016-07-16 Thread Antti Haapala

Antti Haapala added the comment:

"Be conservative in what you do, be liberal in what you accept from others" 
they say. Also Z as a timezone designator is also widely used in iso 8601 
timestamps. I believe the effort should be made to *parse* *any/all* of the ISO 
8601 supported time-zone codes with one conversion, the list is not that long, 
just 'Z', HH, HH:MM, HHMM, longest match. Literal 'Z' really does not need to 
be supported for *output* at all, but for input, please.

Otherwise this will still go down the road of iso8601 library, which just tries 
to support all the YYmmddTHHMMSS.FF variants. It uses regular 
expressions to parse the dates as it is faster than trying N different formats 
with `strptime`

--
nosy: +ztane

___
Python tracker 

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



[issue27515] Dotted name re-import does not rebind after deletion

2016-07-16 Thread Nick Coghlan

Nick Coghlan added the comment:

Terry: it's not a 100% guarantee, but it should be sufficient for your purposes 
(the more obscure failure modes mostly relate to C level globals, Python level 
module globals, pickling, and module import having side effects on state in 
other modules, and it's unlikely you'll hit any of those here as long as the 
main "tk" module and any modules it implicitly imports stay loaded. If you do 
end up getting bug reports about this, we can treat those as a bug in the 
affected modules)

As far as the module count goes, a plain "import tkinter" gets the imported 
module count up to 63, so that's presumably an absolute lower bound on your 
efforts.

--

___
Python tracker 

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



[issue27527] Make not yielding from or awaiting a coroutine a SyntaxError

2016-07-16 Thread Decorater

Decorater added the comment:

So to make it Error it must be :

import asyncio

async def SomeCoroutine():
print("test...")

SomeCoroutine()

--

___
Python tracker 

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



[issue27527] Make not yielding from or awaiting a coroutine a SyntaxError

2016-07-16 Thread Decorater

Decorater added the comment:

Oh it does not happen if you use the asyncio.coroutine decorater but it does do 
RuntimeWarning if you use the async def on it.

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