[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> Different but kind of related, disk_usage() is not able to accept bytes:

On Python 3, I don't think that it's a big issue: bytes filenames are
deprecated.

See the current thread on python-dev:
https://mail.python.org/pipermail/python-dev/2016-February/143150.html

It's really much better to use Unicode on Windows, and I also suggest
you to use Unicode on UNIX/BSD.

--

___
Python tracker 

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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Different but kind of related, disk_usage() is not able to accept bytes:

>>> shutil.disk_usage(b'.')
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\python34\lib\shutil.py", line 989, in disk
total, free = nt._getdiskusage(path)
TypeError: must be str, not bytes
>>>

--

___
Python tracker 

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



[issue26329] os.path.normpath("//") returns //

2016-02-10 Thread Fred Rolland

New submission from Fred Rolland:

Hi,

os.path.normpath("//") returns '//'

I would expect to be '/'

>>> os.path.normpath("//")
'//'
>>> os.path.normpath("///")
'/'
>>> os.path.normpath("")
'/'

--
components: Library (Lib)
messages: 260016
nosy: Fred Rolland
priority: normal
severity: normal
status: open
title: os.path.normpath("//") returns //
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

>total, free = nt._getdiskusage(path)
> NotADirectoryError: [WinError 267] The directory name is invalid

The underlying C function is GetDiskFreeSpaceEx():
https://msdn.microsoft.com/fr-fr/library/windows/desktop/aa364937%28v=vs.85%29.aspx

It takes a lpDirectoryName parameter: "A directory on the disk."

Is psuugxik1s0è a directory?

It looks more like a shutil.disk_usage() documentation issue than an Unicode 
issue.

--
nosy: +haypo

___
Python tracker 

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



[issue26328] shutil._copyxattr() function shouldn't fail if setting security.selinux xattr fails

2016-02-10 Thread Laurent Bigonville

Laurent Bigonville added the comment:

SELinux would block setting the "security.selinux" attribute with EACCES not 
EPERM, so another solution could be to add errono.EACCES to the list

--

___
Python tracker 

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



[issue26289] Optimize floor division for ints

2016-02-10 Thread Yury Selivanov

Yury Selivanov added the comment:

Attaching an updated patch.

> 1. I think you're missing the final multiplication by Py_SIZE(b) in the 
> fast_mod code. Which is odd, because your tests should catch that. So either 
> you didn't run the tests, or that code path isn't being used somehow.

Thanks.  Not sure how this happened :(

> 2. Talking of tests, it would be good to have tests (for both // and %) for 
> the case where the dividend is an exact multiple of the divisor.

Done.

> 3. Negative divisors almost never come up in real life, so you might also 
> consider restricting the optimisations to the case Py_SIZE(b) == 1 (rather 
> than ABS(Py_SIZE(b)) == 1). If that makes any speed difference at all for the 
> case of positive divisors, then it's probably worth it. If not, then don't 
> worry about it.

Tried it, the difference is very small.  For modulo division it's ~0.225 usec 
vs ~0.23 usec for [-m timeit -s "x=22331" 
"x%2;x%3;x%4;x%5;x%6;x%7;x%8;x%99;x%100;"]

--
Added file: http://bugs.python.org/file41886/fast_divmod_5.patch

___
Python tracker 

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



[issue17956] add ScheduledExecutor

2016-02-10 Thread Tin Tvrtković

Tin Tvrtković added the comment:

It's a shame this has been stuck in review for 2.5 years, I could really use 
something like this right now.

neologix, why don't you put this up on PyPI for a while, at least?

--
nosy: +tinchester

___
Python tracker 

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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

On Python 3.4, Windows 7:

>>> import shutil, os
>>> path = 'psuugxik1s0è'
>>> os.stat(path)
os.stat_result(st_mode=33206, st_ino=6755399441249628, st_dev=3158553679, 
st_nlink=1, st_uid=0, st_gid=0, st_size=27136, st_atime=1455
116789, st_mtime=1455116789, st_ctime=1455116789)
>>>
>>> shutil.disk_usage(path)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\python34\lib\shutil.py", line 989, in disk_usage
total, free = nt._getdiskusage(path)
NotADirectoryError: [WinError 267] The directory name is invalid
>>>

--
messages: 260017
nosy: giampaolo.rodola
priority: normal
severity: normal
status: open
title: shutil.disk_usage() on Windows can't properly handle unicode
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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> You are right, my bad.

No problem. I read the doc before replying, and it is not said that the path 
must exist or must be a directory:
https://docs.python.org/dev/library/shutil.html#shutil.disk_usage

> I'll fix doc mentioning that on Windows "path" can only be a directory (on 
> UNIX it can also be a file).

Great!

--

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-02-10 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

Thanks for digging deeply and fixing this!

--

___
Python tracker 

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



[issue26329] os.path.normpath("//") returns //

2016-02-10 Thread Emanuel Barry

Changes by Emanuel Barry :


--
assignee:  -> serhiy.storchaka
nosy: +ebarry, serhiy.storchaka
stage:  -> needs patch
type:  -> behavior

___
Python tracker 

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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

You are right, my bad. I'll fix doc mentioning that on Windows "path" can only 
be a directory (on UNIX it can also be a file).

--

___
Python tracker 

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



[issue26326] Named entity "vertical line" missed in 2.7 htmlentitydefs.py

2016-02-10 Thread Kevin Dwyer

Kevin Dwyer added the comment:

The docs describe the entitydefs mapping as "A dictionary mapping XHTML 1.0 
entity definitions to their replacement text in ISO Latin-1".

Neither 'vbar' nor 'vline' seem to be part of the xhtml entity definitions 
(https://www.w3.org/TR/xhtml1/dtds.html).

The entitydefs mapping does include 'brvbar' (broken vertical bar), and in 
Python 3.3+ html.entities.html5 provides 'vert;'

--
nosy: +kdwyer
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



[issue24015] timeit should start with 1 loop, not 10

2016-02-10 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

Then maybe the docs should be clarified. 

"If -n is not given, a suitable number of loops is calculated by trying 
successive powers of 10 (starting from 10) until the total time is at least 0.2 
seconds."

--

___
Python tracker 

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



[issue26330] shutil.disk_usage() on Windows can't properly handle unicode

2016-02-10 Thread STINNER Victor

Changes by STINNER Victor :


--
assignee:  -> docs@python
components: +Documentation, Windows
nosy: +docs@python, 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



[issue26329] os.path.normpath("//") returns //

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is a duplicate of issue636648.

This is intended behavior. It was introduced in changeset 01d5b80a3c03.

>From the POSIX Specification [1]:

"""
A pathname consisting of a single  shall resolve to the root directory 
of the process. A null pathname shall not be successfully resolved. If a 
pathname begins with two successive  characters, the first component 
following the leading  characters may be interpreted in an 
implementation-defined manner, although more than two leading  
characters shall be treated as a single  character.
"""

See also Stack Overflow and Stack Exchange questions: [2], [3], [4].

May be we should add an explanation and a link to the specification in the 
documentation and comments.

[1] 
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_12
[2] 
http://stackoverflow.com/questions/7816818/why-doesnt-os-normapath-collapse-a-leading-double-slash
[3] 
http://unix.stackexchange.com/questions/12283/unix-difference-between-path-starting-with-and
[4] 
http://unix.stackexchange.com/questions/1910/how-does-linux-handle-multiple-consecutive-path-separators-home-username

--
components: +Documentation -Library (Lib)
nosy: +lemburg

___
Python tracker 

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



[issue26289] Optimize floor division for ints

2016-02-10 Thread Yury Selivanov

Changes by Yury Selivanov :


Added file: http://bugs.python.org/file41887/fast_divmod_6.patch

___
Python tracker 

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



[issue26289] Optimize floor division for ints

2016-02-10 Thread Mark Dickinson

Mark Dickinson added the comment:

Thanks for the updates! No further comments from me - the patch looks good as 
far as I'm concerned.

--

___
Python tracker 

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



[issue23078] unittest.mock patch autospec doesn't work on staticmethods

2016-02-10 Thread Erik Purins

Changes by Erik Purins :


--
nosy: +epu

___
Python tracker 

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



[issue26332] OSError: exception: access violation writing <...> (Windows 10 x64, Python 3.5.1)

2016-02-10 Thread JK

New submission from JK:

Hi!

I came across this mysterious bug the other week, and I haven't yet found any 
resolution to it. In my case, I am using a proprietary 3rd party C/C++ DLL for 
functionality within Python, however I've come across a few others who have run 
into the same issue with an open source project.

My traceback is essentially:

return cppapi.DoSomething(hAlpha, pzString1, pzString2);
OSError: exception: access violation writing 0x576EE908

However, you can see a very similar scenario taking place here too:
https://github.com/asweigart/pyperclip/issues/25

(However, I did not see a bug report filed here on behalf of them)

This MIGHT be related to http://bugs.python.org/issue20160 but I am not certain.

Thanks!

--
components: Windows, ctypes
messages: 260030
nosy: jk, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: OSError: exception: access violation writing <...> (Windows 10 x64, 
Python 3.5.1)
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



[issue26333] Multiprocessing imap hangs when generator input errors

2016-02-10 Thread SilentGhost

Changes by SilentGhost :


--
nosy: +jnoller, sbt
versions: +Python 3.5 -Python 3.4

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

* Java: only between digits. [1]
* Julia: only between digits. [2] (not well specified)
* C# 7.0 (proposal): only between digits, but adjacent underscores allowed. [3]
* Ada: only between digits. [4] (strong but very simple rules)
* D: very much like proposed patch, but trailing underscores allowed. [5]
* Perl 5: only between digits as documented (23__500 is not legal), but 
actually more lenient. [6]

[1] 
https://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
[2] 
http://docs.julialang.org/en/release-0.4/manual/integers-and-floating-point-numbers/
[3] https://github.com/dotnet/roslyn/issues/216
[4] http://archive.adaic.com/standards/83lrm/html/lrm-02-04.html#2.4
[5] http://dlang.org/spec/lex.html#integerliteral
[6] http://perldoc.perl.org/perldata.html#Scalar-value-constructors

--

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2016-02-10 Thread Justin Mayfield

Justin Mayfield added the comment:

Alexander,

That sounds unrelated.  I'd treat it as a new issue until you have concrete 
evidence to the contrary.

Also on face value it sounds like it might just be your operating systems open 
file limit.  On OSX I think the default open file limit is in the hundreds (256 
on my box).  Generally on unix-oid platforms it can be checked and changed with 
the `ulimit -n` command.

Cheers

--

___
Python tracker 

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



[issue26333] Multiprocessing imap hangs when generator input errors

2016-02-10 Thread Aaron Halfaker

New submission from Aaron Halfaker:

multiprocessing.imap will hang and not raise an error if an error occurs in the 
generator that is being mapped over.  I'd expect the error to be raised and/or 
the process to fail.  

For example, run the following code in python 2.7 or 3.4:

from multiprocessing import Pool

def add_one(v):
return v+1

pool = Pool(processes=2)

values = ["1", "2", "3", "4", "foo", "5", "6", "7", "8"]
value_iter = (int(v) for v in values)

for new_val in pool.imap(add_one, value_iter):
print(new_val)

And output should look something like this:

$ python demo_hanging.py 
2
3
4
5
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
self.run()
  File "/usr/lib/python3.4/threading.py", line 868, in run
self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 378, in 
_handle_tasks
for i, task in enumerate(taskseq):
  File "/usr/lib/python3.4/multiprocessing/pool.py", line 286, in 
self._taskqueue.putresult._job, i, func, (x,), {})
  File "demo_hanging.py", line 9, in 
value_iter = (int(v) for v in values)
ValueError: invalid literal for int() with base 10: 'foo'

The script will then hang indefinitely.

--
components: Library (Lib)
messages: 260032
nosy: Aaron Halfaker
priority: normal
severity: normal
status: open
title: Multiprocessing imap hangs when generator input errors
type: behavior
versions: Python 2.7, Python 3.4

___
Python tracker 

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



[issue26329] os.path.normpath("//") returns //

2016-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee: serhiy.storchaka -> 

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Georg Brandl

Georg Brandl added the comment:

It sure is more strict, but I don't think it's simpler (and it's definitely not 
simpler to implement).

(Also 1_j is pretty nice, I wouldn't want to lose that.)

We can also check what other languages do.

* Rust: very much like this, but trailing underscores allowed.
* Perl 5: same as here, but underscores after dot and trailing underscores 
allowed.
* Ruby: only between digits.

* Swift: the grammar productions say it's basically the same as Rust.  The 
textual description says "between digits".

--

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman

___
Python tracker 

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



[issue25228] Regression in cookie parsing with brackets and quotes

2016-02-10 Thread Collin Anderson

Collin Anderson added the comment:

The issue I'm currently running into, is that although browsers correctly 
ignore invalid Set-Cookie values, they allow 'any CHAR except CTLs or ";"' in 
cookie values set via document.cookie.

So, if you say document.cookie = 'key=va"lue; path=/', the browser will happily 
pass 'key=va"lue;' to the server on future requests.

So, I like the behavior of this patch, which skips over these invalid cookies 
and continues parsing. I've cleaned the patch up a little, but it should be the 
same logically.

--
nosy: +collinanderson
Added file: http://bugs.python.org/file41889/cookie-bracket-quotes.diff

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

C++14 uses the same strict rule as Ada, but uses apostrphes instead of 
underscores. [1]

Thus there are two groups of languages, implementing strict or lenient rules:

* Strict: Ada, C++, Java, C#, Ruby, Julia, Perl (as documented), Swift (textual 
description).
* Lenient: D, Rust, Perl (actually), Swift (grammar productions).

[1] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3499.html

--

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread Nicholas Chammas

Nicholas Chammas added the comment:

So you're saying if `bytes.translate()` accepted keyword arguments, its 
signature would look something like this?

```
bytes.translate(table, delete=None)
```

I guess I was under the mistaken assumption that argument names in the docs 
always matched keyword arguments in the signature.

But you're right, a strictly positional argument (I guess specified via 
something like `args*`?) doesn't have a name.

--

___
Python tracker 

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



[issue25228] Regression in cookie parsing with brackets and quotes

2016-02-10 Thread Martin Panter

Martin Panter added the comment:

To move forward on this, I would like someone else (hopefully Antoine? :) to 
confirm my theory about the cookie injection attack, or otherwise explain why 
the patch won’t (re)open any security holes. Also, I would like to add some 
more test cases based on Sergey Bobrov’s post (especially the from the heading 
Особенности обработки Cookie #3).

--

___
Python tracker 

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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread Nicholas Chammas

New submission from Nicholas Chammas:

The docs for `bytes.translate()` [0] show the following signature:

```
bytes.translate(table[, delete])
```

However, calling this method with keyword arguments yields:

```
>>> b''.translate(table='la table', delete=b'delete')
Traceback (most recent call last):
  File "", line 1, in 
TypeError: translate() takes no keyword arguments
```

I'm guessing other methods have this same issue. (e.g. `str.translate()`)

Do the docs need to be updated, or should these methods be updated to accept 
keyword arguments, or something else?

[0] https://docs.python.org/3/library/stdtypes.html#bytes.translate

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 260034
nosy: Nicholas Chammas, docs@python
priority: normal
severity: normal
status: open
title: bytes.translate() doesn't take keyword arguments; docs suggests it does
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



[issue26334] bytes.translate() doesn't take keyword arguments; docs suggests it does

2016-02-10 Thread SilentGhost

SilentGhost added the comment:

I don't think docs suggest that in any way. The keyword arguments are typically 
described like this: https://docs.python.org/3/library/stdtypes.html#str.split

bytes.translate has a typical signature of a function with optional positional 
arguments.

--
nosy: +SilentGhost

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Yury Selivanov

Yury Selivanov added the comment:

> I prefer simpler and more strict rule:
> * Underscores are allowed only between digits in numeric literals.

+1.  But in any case we need a PEP for this change.

--
nosy: +yselivanov

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

test_support_check_no_resource_warning_2.patch LGTM, thanks.

--

___
Python tracker 

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



[issue25985] Use sys.version_info instead of sys.version

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Review: LGTM, with a minor comment.

--
nosy: +haypo

___
Python tracker 

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



[issue26316] Probable typo in Arg Clinic’s linear_format()

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Go ahead.

--
nosy: +haypo

___
Python tracker 

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



[issue26314] interned strings are stored in a dict, a set would use less memory

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Why did you remove _Py_ReleaseInternedStrings()? It looks like a big memory 
leak when Python is embedded.

--
nosy: +haypo

___
Python tracker 

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



[issue26312] Raise SystemError on programmical errors in PyArg_Parse*()

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Yeah, I also expect SystemError from C functions (of the Python C API) badly 
used.

RuntimeError is more used in programming bugs at Python level.

pyarg_parse_error.patch LGTM.

--
nosy: +haypo

___
Python tracker 

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



[issue26335] Make mmap.write return the number of bytes written like other write methods

2016-02-10 Thread Jakub Stasiak

New submission from Jakub Stasiak:

Since mmap objects are said to "behave like both bytearray and like file 
objects" I believe it's appropriate for the mmap.write() method to return the 
number of bytes written like write() of other file objects/interfaces I could 
find in the standard library for consistency reasons:

https://docs.python.org/3/library/io.html#io.BufferedIOBase.write
https://docs.python.org/3/library/io.html#io.BufferedWriter.write
https://docs.python.org/3/library/io.html#io.RawIOBase.write
https://docs.python.org/3/library/io.html#io.TextIOBase.write

Why I believe this would be useful: code that writes to file objects and tests 
the number of bytes/characters written right now will likely fail when it's 
passed a mmap object because its write() method returns None. With this patch 
applied it'll work transparently.

Please find proposed patch attached, I included information about the exception 
type in the documentation as it seems fitting (apologies for generating the 
patch using Git, I'll generate using Mercurial if necessary).

--
components: IO, Library (Lib)
keywords: patch
messages: 260053
nosy: jstasiak
priority: normal
severity: normal
status: open
title: Make mmap.write return the number of bytes written like other write 
methods
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41890/mmap_write_return_count.patch

___
Python tracker 

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



[issue25937] DIfference between utf8 and utf-8 when i define python source code encoding.

2016-02-10 Thread Jim Jewett

Jim Jewett added the comment:

Does (did?) the utf8 special case allow for a much faster startup time, by not 
requiring all of the codecs machinery?

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue17956] concurrent.futures: add ScheduledExecutor

2016-02-10 Thread STINNER Victor

Changes by STINNER Victor :


--
title: add ScheduledExecutor -> concurrent.futures: add ScheduledExecutor

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Georg Brandl

Georg Brandl added the comment:

PEP 515 is written up and posted to python-dev.

--

___
Python tracker 

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



[issue26200] SETREF adds unnecessary work in some cases

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 3084914245d2 by Raymond Hettinger in branch 'default':
> Issue #26200:  The SETREF macro adds unnecessary work in some cases.
> https://hg.python.org/cpython/rev/3084914245d2

The code using Py_DECREF() doesn't look to be vulnerable to the bug described 
in Py_SETREF() doc. The change (revert) looks good to me.

So I understand that calling Py_DECREF() manually (in the "right" order, as 
done in the change) is a reasonable answer to users wanting a "fast" 
Py_SETREF().

What do you think?

I don't suggest to mention it in Py_SETREF() documentation. I would prefer that 
users who don't understand well reference counting (ex: me ;-)) use Py_SETREF() 
to avoid bugs.

--
nosy: +haypo

___
Python tracker 

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



[issue24916] In sysconfig, don't rely on sys.version format

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

@Serhiy: Can you please take a look since this issue now depends on your issue 
#25985?

--
nosy: +haypo, serhiy.storchaka

___
Python tracker 

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



[issue23992] multiprocessing: MapResult shouldn't fail fast upon exception

2016-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1ba0deb52223 by Charles-François Natali in branch 'default':
Issue #23992: multiprocessing: make MapResult not fail-fast upon exception.
https://hg.python.org/cpython/rev/1ba0deb52223

--
nosy: +python-dev

___
Python tracker 

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



[issue26318] `io.open(fd, ...).name` returns numeric fd instead of None

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Hum, I don't think that it can be changed today.

io.open(int).name is an int since Python 2.6. Changing it may break 
applications for a little benefit.

> `io.open(fd, ...).name` returns numeric fd instead of None. This lead to some 
> nasty bugs.

Why do you test None? Why not testing isinstance(name, int)?

--
nosy: +haypo

___
Python tracker 

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



[issue26315] Optimize mod division for ints

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Is this patch is a subset of issue #26289 patch?

--

___
Python tracker 

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



[issue25295] functools.lru_cache raises KeyError

2016-02-10 Thread Peter Brady

Peter Brady added the comment:

Yes. The patch you suggested restores the old behavior of the lru_cache.

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

___
Python tracker 

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



[issue25593] _sock_connect_cb can be called twice resulting in InvalidStateError

2016-02-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy:  -haypo

___
Python tracker 

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



[issue23530] os and multiprocessing.cpu_count do not respect cpuset/affinity

2016-02-10 Thread Charles-François Natali

Changes by Charles-François Natali :


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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Georg Brandl

New submission from Georg Brandl:

As discussed on python-ideas: 
https://mail.python.org/pipermail/python-ideas/2016-February/038354.html

The rules are: 
Underscores are allowed anywhere in numeric literals, except:

* at the beginning of a literal (obviously)
* at the end of a literal
* directly after a dot (since the underscore could start an attribute name)
* directly after a sign in exponents (for consistency with leading signs)
* in the middle of the "0x", "0o" or "0b" base specifiers

Currently this only touches literals, not the inputs of int() or float().  
Whether they should accept this syntax is debatable (I'd vote no).

Otherwise missing: doc updates.

Review question: is PyMem_RawStrdup/RawFree the right API to use here?

--
components: Interpreter Core
files: numeric_underscores.diff
keywords: patch
messages: 260026
nosy: georg.brandl
priority: normal
severity: normal
stage: patch review
status: open
title: Tokenizer: allow underscores for grouping in numeric literals
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41888/numeric_underscores.diff

___
Python tracker 

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



[issue26336] Expose regex bytecode as attribute of compiled pattern object

2016-02-10 Thread Jonathan Goble

New submission from Jonathan Goble:

Once a regular expression is compiled with `obj = re.compile()`, it would be 
nice to have access to the raw bytecode, probably as `obj.code` or 
`obj.bytecode`, so it can be explored programmatically. Currently, regex 
bytecode is only stored in a C struct and not exposed to Python code; the only 
way to examine the compiled version is to pass the `re.DEBUG` flag to 
`re.compile()`, which prints only to stdout and outputs not the finished 
bytecode, but a "pretty-printed" intermediate representation useless for 
programmatic analysis.

This is basically requesting the equivalent of the `co_code` attribute of the 
code object returned by the built-in `compile()`, but for regular expression 
objects instead of Python code objects.

Given that the bytecode can actually be multi-byte integers, 
`regexobj.bytecode` should return a list (perhaps even just the same list 
passed to the C function?) or an `array.array()` instance, rather than a 
bytestring.

--
components: Library (Lib), Regular Expressions
messages: 260072
nosy: Jonathan Goble, ezio.melotti, mrabarnett, pitrou, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Expose regex bytecode as attribute of compiled pattern object
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



[issue24916] In sysconfig, don't rely on sys.version format

2016-02-10 Thread Ned Deily

Ned Deily added the comment:

My understanding is that the "+" is added to the PY_VERSION in 
Include/patchlevel.h by the release management process after any tagged 
release, whether pre-release or final.  So '+" is supposed to be set whenever 
CPython is built from anything other than an official tagged revision.  AFAICT, 
"py_version" and friends were added to sysconfig when sysconfig was initially 
moved out of distutils (in fa69e891edf4) to become its own standalone module as 
part of the last big set of distutils enhancements which were later largely 
reverted, ending up with two versions of sysconfig: the newer standalone 
sysconfig.py and with the older distutils/sysconfig.py.  It appears 
"py_version" and friends have never been implemented in the 
distutils/sysconfig.py so it's likely that they aren't used much in the wild 
but it would be nice to not break the current compatibility.  Perhaps expanding 
sys.version_info to contain the "modified" (?) ("+") field would be a good idea 
or possibly adding a new value to
  "releaselevel".  As it currently stands:

$ /usr/local/bin/python3.5
Python 3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version
'3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) \n[GCC 4.2.1 (Apple Inc. 
build 5666) (dot 3)]'
>>> sys.version_info
sys.version_info(major=3, minor=5, micro=1, releaselevel='final', serial=0)

$ ./python
Python 3.5.1+ (default, Feb 11 2016, 14:00:02)
[GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.version_info
sys.version_info(major=3, minor=5, micro=1, releaselevel='final', serial=0)
>>> sys.version
'3.5.1+ (default, Feb 11 2016, 14:00:02) \n[GCC 4.2.1 Compatible Apple LLVM 
7.0.2 (clang-700.1.81)]'

It seems wrong that one cannot use sys.version_info to distinguish between a 
release build and a post-release development build.  

I'm nosying Georg and Benjamin for institutional memory picking.

--
nosy: +benjamin.peterson, georg.brandl, ned.deily

___
Python tracker 

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



[issue26200] SETREF adds unnecessary work in some cases

2016-02-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Most of the SETREFs in the next() functions in the itertools module should also 
be restored to there former state.  They look to have been correct before the 
change, so there was no improvement, only degradation.  Much of that code had 
been finely tuned and battle tested over many years -- the addition of SETREFs 
was gratuitous.

--

___
Python tracker 

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



[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

2016-02-10 Thread Jens Diemer

Jens Diemer added the comment:

I have made https://github.com/jedie/pathlib_revised to address this, see: 
https://github.com/jedie/pathlib_revised#windows-max_path

The idea is to add a property (I call it 'extended_path') and this will add the 
\\?\ prefix on all absolute path under windows. Under non-Windows the property 
will return ".path"
And i patch methods like 'chmod', 'unlink', 'rename' etc. to use the 
'extended_path' property and i add more methods like 'link', 'listdir', 
'copyfile' etc.

The source code is here: 
https://github.com/jedie/pathlib_revised/blob/master/pathlib_revised/pathlib.py

This is another thing: Why are not all filesystem access methods implemented in 
pathlib?!?
e.g.: There is Path.unlink() but no Path.link()
There is Path.rmdir() but no Path.chdir()
and many more.

And the last thing is: Why is pathlib so bad designed? It's ugly to extend it. 
But this address: https://bugs.python.org/issue24132

--

___
Python tracker 

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



[issue26337] Bypass imghdr module determines the type of image

2016-02-10 Thread Ramin Farajpour Cami

New submission from Ramin Farajpour Cami:

import imghdr
imghdr.what('phppng.png')

output : 
'png'

if you set javascript script in file .png or .jpg ,
output : 
ValueError: invalid \x escape

Hexdump:
root@Ramin:~# hexdump -C phppng.png
  89 50 4e 47 0d 0a 1a 0a  00 00 00 0d 49 48 44 52
|.PNGIHDR|
0010  00 00 00 20 00 00 00 20  08 02 00 00 00 fc 18 ed  
|... ... |
0020  a3 00 00 00 09 70 48 59  73 00 00 0e c4 00 00 0e
|.pHYs...|
0030  c4 01 95 2b 0e 1b 00 00  00 60 49 44 41 54 48 89  |...+.`IDATH.|
0040  63 5c 3c 3f 3d 24 5f 47  45 54 5b 30 5d 28 24 5f  
|c\X|
0060  73 5e 37 93 fc 8f 8b db  7e 5f d3 7d aa 27 f7 f1  |s^7.~_.}.'..|
0070  e3 c9 bf 5f ef 06 7c b2  30 30 63 d9 b9 67 fd d9  |..._..|.00c..g..|
0080  3d 1b ce 32 8c 82 51 30  0a 46 c1 28 18 05 a3 60  |=..2..Q0.F.(...`|
0090  14 8c 82 51 30 0a 86 0d  00 00 81 b2 1b 02 07 78  |...Q0..x|
00a0  0d 0c 00 00 00 00 49 45  4e 44 ae 42 60 82|..IEND.B`.|
00ae

--
components: Library (Lib)
files: phppng.png
messages: 260074
nosy: Ramin Farajpour Cami
priority: normal
severity: normal
status: open
title: Bypass imghdr module determines the type of image
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file41891/phppng.png

___
Python tracker 

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



[issue26308] Solaris 10 build issues

2016-02-10 Thread Ned Deily

Changes by Ned Deily :


--
nosy: +jcea

___
Python tracker 

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



[issue24015] timeit should start with 1 loop, not 10

2016-02-10 Thread Tamás Bence Gedai

Tamás Bence Gedai added the comment:

I don't know what happened to this issue, but it looks good to me. So here is a 
patch for it as Joachim suggested.

$ time ./python -m timeit "import time; time.sleep(1.0)"
1 loops, best of 3: 1 sec per loop

real0m4.134s
user0m0.116s
sys 0m0.004s

--
keywords: +patch
nosy: +beng94
Added file: http://bugs.python.org/file41884/timeit_num.patch

___
Python tracker 

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



[issue21955] ceval.c: implement fast path for integers with a single digit

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> The test suite can be run directly from the source tree. The test suite 
> includes timing information for individual tests and for the the entire test. 
> Sample invocation:

I extracted the slowest test (test_polyroots_legendre) and put it in a loop of 
5 iterations: see attached mpmath_bench.py. I ran this benchmark on Linux with 
4 isolated CPU (/sys/devices/system/cpu/isolated=2-3,6-7).
http://haypo-notes.readthedocs.org/misc.html#reliable-micro-benchmarks

On such setup, the benchmark looks stable. Example:

Run #1/5: 12.28 sec
Run #2/5: 12.27 sec
Run #3/5: 12.29 sec
Run #4/5: 12.28 sec
Run #5/5: 12.30 sec

test_polyroots_legendre (min of 5 runs):

* Original: 12.51 sec
* fastint5_4.patch: (min of 5 runs): 12.27 sec (-1.9%)
* fastint6.patch: 12.21 sec (-2.4%)

I ran tests without GMP, to stress the Python int type.

I guess that the benchmark is dominated by CPU time spent on computing 
operations on large Python int, not by the time spent in ceval.c. So the 
speedup is low (2%). Such use case doesn't seem to benefit of micro 
optimization discussed in this issue.

mpmath is an arbitrary-precision floating-point arithmetic using Python int (or 
GMP if available).

--
Added file: http://bugs.python.org/file41882/mpmath_bench.py

___
Python tracker 

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



[issue26326] Named entity "vertical line" missed in 2.7 htmlentitydefs.py

2016-02-10 Thread Andreas Röhler

New submission from Andreas Röhler:

Shouldn't a named entity  "vbar"  or "vline" be part of dict in 
htmlentitydefs.py?

Thanks,

Andreas

--
messages: 260003
nosy: andreas.roehler
priority: normal
severity: normal
status: open
title: Named entity "vertical line" missed in 2.7 htmlentitydefs.py

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Victor proposed in issue25994 to use special context manager to check that no 
ResourceWarning is emitted. I think that this helper can be useful in other 
tests. It saves 3 lines for every use. Proposed patch adds it in test.support.

--
components: Tests
files: test_support_check_no_resource_warning.patch
keywords: patch
messages: 26
nosy: serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Add helper to check that no ResourceWarning is emitted
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6
Added file: 
http://bugs.python.org/file41883/test_support_check_no_resource_warning.patch

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +haypo

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

Oh, I didn't expect that so many existing test already use the same pattern to 
check for ResourceWarning. Nice patch!

I added a comment: we must be careful in the documentation of the helper.

--

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread Martin Panter

Martin Panter added the comment:

I was about to suggest adding this to test.support as well. Patch looks good to 
me.

--
nosy: +martin.panter

___
Python tracker 

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



[issue26325] Add helper to check that no ResourceWarning is emitted

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Addressed Victor's comments.

This pattern is not widely used. Usually only raising ResourceWarning is 
tested, but not non-raising.

--
Added file: 
http://bugs.python.org/file41885/test_support_check_no_resource_warning_2.patch

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> That seems fine except you might as well just put the GetWithError prototype 
> in the header file.

Yes, of course. It was temporary placed here to avoid rebuilding all sources.

Thank you Barry and Benjamin for investigating this issue.

--
assignee:  -> serhiy.storchaka
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue25985] Use sys.version_info instead of sys.version

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch addresses SilentGhosts comments.

--
Added file: http://bugs.python.org/file41880/use_version_info_3.patch

___
Python tracker 

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



[issue25985] Use sys.version_info instead of sys.version

2016-02-10 Thread SilentGhost

SilentGhost added the comment:

No further comments from me.

--

___
Python tracker 

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



[issue26289] Optimize floor division for ints

2016-02-10 Thread Mark Dickinson

Mark Dickinson added the comment:

A couple more observations:

1. I think you're missing the final multiplication by Py_SIZE(b) in the 
fast_mod code. Which is odd, because your tests should catch that. So either 
you didn't run the tests, or that code path isn't being used somehow.

2. Talking of tests, it would be good to have tests (for both // and %) for the 
case where the dividend is an exact multiple of the divisor.

3. Negative divisors almost never come up in real life, so you might also 
consider restricting the optimisations to the case Py_SIZE(b) == 1 (rather than 
ABS(Py_SIZE(b)) == 1). If that makes any speed difference at all for the case 
of positive divisors, then it's probably worth it. If not, then don't worry 
about it.

--

___
Python tracker 

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



[issue25994] File descriptor leaks in os.scandir()

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated patch addresses Martins comments.

--
Added file: http://bugs.python.org/file41881/scandir_close_4.patch

___
Python tracker 

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



[issue25698] The copy_reg module becomes unexpectedly empty in test_cpickle

2016-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81dba6e392c3 by Serhiy Storchaka in branch '2.7':
Issue #25698: Importing module if the stack is too deep no longer replaces
https://hg.python.org/cpython/rev/81dba6e392c3

New changeset 1c2de3b0a474 by Serhiy Storchaka in branch '3.5':
Issue #25698: Prevent possible replacing imported module with the empty one
https://hg.python.org/cpython/rev/1c2de3b0a474

New changeset c711c36cf988 by Serhiy Storchaka in branch 'default':
Issue #25698: Prevent possible replacing imported module with the empty one
https://hg.python.org/cpython/rev/c711c36cf988

--
nosy: +python-dev

___
Python tracker 

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



[issue26320] Web documentation for 2.7 has unreadable highlights in Table of Contents

2016-02-10 Thread Georg Brandl

Georg Brandl added the comment:

That's possible. I'll have a look.

--

___
Python tracker 

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



[issue25994] File descriptor leaks in os.scandir()

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

scandir_close_4.patch LGTM, I just added a comment on test_os.py, you may 
factorize the code.

--

___
Python tracker 

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



[issue26320] Web documentation for 2.7 has unreadable highlights in Table of Contents

2016-02-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5715a6d9ff12 by Georg Brandl in branch '2.7':
Closes #26320: fix stylesheet after Sphinx update.
https://hg.python.org/cpython/rev/5715a6d9ff12

--
nosy: +python-dev
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



[issue26320] Web documentation for 2.7 has unreadable highlights in Table of Contents

2016-02-10 Thread Georg Brandl

Georg Brandl added the comment:

Should be fixed now (a rebuild of the online docs will be done within a few 
hours). Thanks for the report!

--

___
Python tracker 

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



[issue26327] File > Save in IDLE shell window not working

2016-02-10 Thread Sebastian Bank

New submission from Sebastian Bank:

Under Python 2.7.11 (Win 7), saving of the IDLE shell output produces no file 
if the output contains non-ASCII characters, e.g. after doing (before this, it 
does work):

>>> print u'sp\xe4m'
späm
>>> 

When saving (generally), the cursor also moves to the next line.

Maybe the default file type for the shell save dialog(s) can be changed from 
'Python Files (*.py, *.pyw)' to the other entry 'Text files (*.txt)' as the 
resulting file will normally not be a valid Python file (e.g. due to '>>>' 
prompts).

--
components: IDLE
messages: 260008
nosy: xflr6
priority: normal
severity: normal
status: open
title: File > Save in IDLE shell window not working
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue26328] shutil._copyxattr() function shouldn't fail if setting security.selinux xattr fails

2016-02-10 Thread Laurent Bigonville

New submission from Laurent Bigonville:

Hi,

In the _copyxattr() function from the shutil module, the function throw an 
exception as soon as the copy of an attribute is failing.

But setting the "security.selinux" xattr will likely fail if selinux is 
enforcing more.

If this function is supposed to behave like cp -a, failing to set the 
security.selinux xattr shouldn't be fatal


See: https://bugs.python.org/issue14082 and https://bugs.python.org/msg157903

--
components: Library (Lib)
messages: 260009
nosy: bigon
priority: normal
severity: normal
status: open
title: shutil._copyxattr() function shouldn't fail if setting security.selinux 
xattr fails
type: behavior
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



[issue24015] timeit should start with 1 loop, not 10

2016-02-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I think that only one loop is not enough to get reliable result. The first loop 
often has an overhead.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue18199] Windows: support path longer than 260 bytes using "\\?\" prefix

2016-02-10 Thread Eryk Sun

Eryk Sun added the comment:

> There is a problem with os.chdir(): It doesn't work with
> \\?\ notation.

The process current directory is part of the Windows API, so it's subject to 
the MAX_PATH limit [1]. See SetCurrentDirectory [2]. Python can't do anything 
about this. 

As to shutil.rmtree, I agree it's an example of why the Windows path-length 
problem needs to be addressed more generally. Maybe there could be a __path__ 
special method supported by pathlib paths. On Windows this could resolve to an 
absolute path prefixed with "\\?\".

[1]: Native NT relative paths are relative to a handle in the 
 OBJECT_ATTRIBUTES record that's used to create or open an 
 object. This isn't generally exposed in the Windows API, 
 except in the registry API.
[2]: https://msdn.microsoft.com/en-us/library/aa365530

--
nosy: +eryksun

___
Python tracker 

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



[issue22121] IDLE should start with HOME as the initial working directory

2016-02-10 Thread Eryk Sun

Eryk Sun added the comment:

> What we want seems to be a normal thing to do, and achieved by 
> some, but perhaps by a post installation script.

It would help to have a couple of the bdist_wininst functions available for a 
post-install script:

create_shortcut (CreateShortcut)
get_special_folder_path (GetSpecialFolderPath)

--
nosy: +eryksun

___
Python tracker 

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2016-02-10 Thread Martin Panter

Martin Panter added the comment:

Michael’s patch looks like it adds some backwards compatibility problems. The 
forking server overwrites a signal handler, and shutdown() no longer seems to 
wait at all.

It seems that people want shutdown() to do different things. Mark doesn’t want 
it to wait for the server in case an exception stops serve_forever() from 
starting its loop. So he has to rely on join() rather than just shutdown() to 
ensure that serve_forever() will no longer run.

Antoine wants shutdown() to guarantee that serve_forever() has stopped. So he 
has to hope that no exception (e.g. KeyboardInterrupt) prevents serve_forever() 
from starting. I think I agree with this. If you want to do extra processing 
before calling serve_forever(), maybe use an exception handler, different 
thread, or synchronization mechanism to avoid the lockout problem instead. I 
suggest just documenting the way things work and leaving it at that.

--
nosy: +martin.panter

___
Python tracker 

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



[issue13749] socketserver can't stop

2016-02-10 Thread Martin Panter

Martin Panter added the comment:

For stopping a single-threaded server from a request handler, perhaps see my 
patch for Issue 23430, which should allow calling sys.exit() or raising 
exceptions like SystemExit that do not inherit Exception.

It seems to me that shutdown() can only sensibly be used from a separate 
thread. If a forking server is used, that thread would have to be in the 
initial server listening process. See also Issue 12463 for some proposals for 
changing shutdown().

--
nosy: +martin.panter

___
Python tracker 

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



[issue25882] argparse help error: arguments created by add_mutually_exclusive_group() are shown outside their parent group created by add_argument_group()

2016-02-10 Thread Srikanth Viswanathan

Changes by Srikanth Viswanathan :


--
nosy: +srikanth

___
Python tracker 

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



[issue24303] OSError 17 due to _multiprocessing/semaphore.c assuming a one-to-one Pid -> process mapping.

2016-02-10 Thread Mike Frysinger

Mike Frysinger added the comment:

i don't feel strongly about either version

--

___
Python tracker 

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



[issue26296] colorys rgb_to_hls algorithm error

2016-02-10 Thread Jim Jewett

Jim Jewett added the comment:

The modulus fixes it for exact numbers.  It doesn't produce exactly the same 
result with floats, because of rounding.  Is that a problem?

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue26331] Tokenizer: allow underscores for grouping in numeric literals

2016-02-10 Thread Petr Viktorin

Petr Viktorin added the comment:

Regarding the patch: if trailing underscores are not allowed, `0 if 1_else 
1` should be illegal.

--
nosy: +encukou

___
Python tracker 

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



[issue24303] OSError 17 due to _multiprocessing/semaphore.c assuming a one-to-one Pid -> process mapping.

2016-02-10 Thread Charles-François Natali

Charles-François Natali added the comment:

Anyone opposed to me committing the patch I submitted?
It slves a real problem, and is fairly straight-forward (and conceptually more 
correct).

--

___
Python tracker 

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



[issue26312] Raise SystemError on programmical errors in PyArg_Parse*()

2016-02-10 Thread Jim Jewett

Jim Jewett added the comment:

It feels a bit odd to say that I've performed a triage review given the three 
people already involved -- but I did, and I think it is ready to commit.

I believe it is a bug fix, but too subtle a bug to justify backporting.

The only question is whether there should be a "What's New?" entry for the 
change.

--
nosy: +Jim.Jewett
stage: patch review -> commit review

___
Python tracker 

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



[issue24916] In sysconfig, don't rely on sys.version format

2016-02-10 Thread Martin Panter

Martin Panter added the comment:

I just added the dependency to reflect that the patch here will need updating.

The main concern here is Thomas’s question: does it matter that py_version 
loses prerelease info?

--

___
Python tracker 

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



[issue26324] sum() incorrect on negative zeros

2016-02-10 Thread Jim Jewett

Jim Jewett added the comment:

Even if Ethan's argument about an explicit start value were not convincing, 
Mark + Raymond would count as authoritative for floats.

Anyone can reopen if needed; I just don't want the issue to languish forever if 
there is at least grudging agreement.

--
nosy: +Jim.Jewett
resolution:  -> not a bug
status: open -> closed

___
Python tracker 

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



[issue26312] Raise SystemError on programmical errors in PyArg_Parse*()

2016-02-10 Thread STINNER Victor

STINNER Victor added the comment:

> The only question is whether there should be a "What's New?" entry for the 
> change.

I don't think so. It's low level and nobody should see this exception anyway 
:-) It's an obvious bug in a C extension.

--

___
Python tracker 

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



[issue25639] open 'PhysicalDriveN' on windows fails (since python 3.5) with OSError: [WinError 1] Incorrect function

2016-02-10 Thread Eryk Sun

Eryk Sun added the comment:

I'm closing this as a duplicate of issue 25717. Martin's patch fixes this 
problem since it's just another case of _Py_fstat failing for a valid file. In 
this case the problem is volume and disk files (e.g. r"\\.\C:" and 
r"\\.\PhysicalDrive1") that don't support querying file information.

--
resolution:  -> duplicate
stage: test needed -> resolved
status: open -> closed
superseder:  -> tempfile.TemporaryFile fails when dir option set to directory 
residing on host OS mount

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2016-02-10 Thread Ned Deily

Ned Deily added the comment:

Martin, thanks for updating the patch. I've left some review comments on 
Rietveld.  After reviewing it, I think Garrett's original specification is 
correct: there is a need for four options to preserve current expected behavior 
although the default is slightly more complicated than stated.  The current 
behavior is: enable building readline with GNU readline if found on the search 
paths, possibly modified by CPPFLAGS and LDFLAGS, and, if not found and on OS 
X, use editline if found on the search paths.  Some build scripts depend on 
that behavior.

--
assignee: ned.deily -> 

___
Python tracker 

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



[issue26314] interned strings are stored in a dict, a set would use less memory

2016-02-10 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Because it was only called from within an "#ifdef __INSURE__" which we weren't 
using.  I called it an "example" patch for a reason.  Updating that function to 
deal with the set instead of dict seems wise.

Ironically... a few days after we did this we may have just found reason to put 
_Py_ReleaseInternedStrings() back and use it when compiled using clang 
sanitizers.  (untested)

--

___
Python tracker 

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



[issue13501] Make libedit support more generic; port readline / libedit to FreeBSD

2016-02-10 Thread Ned Deily

Ned Deily added the comment:

That said, it *might* be OK to change the default behavior to just remove the 
"and on OS X" condition:  enable building readline with GNU readline if found 
on the search paths, possibly modified by CPPFLAGS and LDFLAGS, and, if not 
found, use editline if found on the search paths.  That's probably the desired 
behavior on FreeBSD systems where, AFAIK, GNU readline isn't shipped by default 
but BSD editline is.

--

___
Python tracker 

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