[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

> @haypo, suppose, one thread wants file with permissions A, and other thread 
> wants permissions B. If they will "set" them through umask(), race condition 
> may occur.

Ok, let's say thta you want file "x" with permission A=0o777 and file "y" with 
permission B=0b700.

You start with os.umask(0o077), as suggested by Christian.

>>> import os
>>> os.umask(0o077)
2
>>> x=open("x", "w")
>>> y=open("y", "w")
>>> os.system("ls -l x y")
-rw---. 1 haypo haypo 0 11 janv. 08:48 x
-rw---. 1 haypo haypo 0 11 janv. 08:48 y
0
>>> os.fchmod(x.fileno(), 0o777)
>>> os.system("ls -l x y")
-rwxrwxrwx. 1 haypo haypo 0 11 janv. 08:48 x
-rw---. 1 haypo haypo 0 11 janv. 08:48 y
0

This is a time window where the file "x" has the permission -rw--- instead 
of the expected -rwxrwxrwx. Ok, it's expected. But it's not an easy since 
initial permissions are are more strict that expected permisions.

The race condition only occurs if you work the other way, start with 
os.umask(0777) (default umask) and then change permissions of the file "x" to 
stricter. In this specific case, you *already* have two ways to do that in 
Python 3 (no change needed):

  fp = open("x", opener=partial(os.open, mode=0o700))
or:
  fd = os.open("x", os.O_WRONLY | os.O_CREAT, 0o700)
  fp = open(fd, "wb")

--

About documenting the default mode: the problem is that I'm not sure that *all* 
functions in Python, especially when using third party libraries, use the same 
default mode. Morever, the mode on Windows has a very different meaning. 
Permission per group is handled by ACLs, not with the integer "mode":
https://msdn.microsoft.com/en-us/library/z0kc8e3z.aspx

On Windows, pmode of _open() only contains read and write permissions of the 
file, for everyone.

For all these reasons, I close the issue.

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



[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If you needs non-default permission for particular file, you can use one of 
available ways mentioned above.

I think this issue can be closed. The original issues are resolved:

1. os.open() (corresponding to syscall open()) allows this.
2. There are other ways to create Python file with specific permissions (pass 
fd or use opener).

--

___
Python tracker 

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



[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread Марк Коренберг

Марк Коренберг added the comment:

@haypo, suppose, one thread wants file with permissions A, and other thread 
wants permissions B. If they will "set" them through umask(), race condition 
may occur.

--

___
Python tracker 

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



[issue29220] Python 3.6 regression/change using logging.addLevelName() to clear a name

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As for the patch itself, I would add an indentation for the second "if":

result = _levelToName.get(level)
if result is None:
result = _nameToLevel.get(level)
if result is None:
result = "Level %s" % level
return result

or even use multiple returns for the sake of microoptimization:

result = _levelToName.get(level)
if result is not None:
return result
result = _nameToLevel.get(level)
if result is not None:
return result
return "Level %s" % level

But I'm not sure that empty name is valid. It can cause problems when parse a 
configuration file or logs.

I don't understand the use of _nameToLevel. getLevelName('CRITICAL') returns 
50, that even is not a string.

--

___
Python tracker 

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



[issue29220] Python 3.6 regression/change using logging.addLevelName() to clear a name

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could you provide a working example of using your trick Mark? I think that even 
with empty name the output contains extra separators.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> I am not sure what "Shouldn't the ZipFile.filename attribute be converted to 
> str?" means, can you elaborate?

If you pass a Path object to ZipFile constructor, should the filename attribute 
be a Path object or a str?

--

___
Python tracker 

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



[issue29220] Python 3.6 regression/change using logging.addLevelName() to clear a name

2017-01-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 99ad6e871459 by Vinay Sajip in branch 'default':
Closes #29220: Fixed regression in logging.getLevelName().
https://hg.python.org/cpython/rev/99ad6e871459

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



[issue29125] Shell injection via TIX_LIBRARY when using tkinter.tix

2017-01-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +terry.reedy, zach.ware

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Awesome! You are great Victor!

--

___
Python tracker 

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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

What is a stack usage effect of disabling inlining _PyStack_AsTuple()? Does it 
impact performance? Should inlining _PyStack_AsDict() be disabled too? Is it 
worth to extract slow paths of _PyObject_FastCallDict() and 
_PyObject_FastCallKeywords() into separate non-inlined functions?

--

___
Python tracker 

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



[issue27603] Migrate IDLE context menu items to shell extension

2017-01-10 Thread Vedran Čačić

Vedran Čačić added the comment:

Even worse: I had both 3.5 and 3.6 installed, and then uninstalled 3.5 when 3.6 
was final (I suppose I'm not the only one). Now I have the nested menu with 
only one item, Open with IDLE 3.6. :-\

--
nosy: +veky

___
Python tracker 

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



[issue29221] ABC Recursion Error on isinstance() with less than recursion limit class hierarchy depth

2017-01-10 Thread Anthony Scopatz

Anthony Scopatz added the comment:

It certainly seems related. Attached is an image that displays the scaling of 
the cache example.  The full notebook that generated this image is at [1]. The 
notebook shows that it does seem to converge towards a value of 1/6th. 

1. https://gist.github.com/scopatz/29b94326ec1f10056d27e9d9434b240a

--
Added file: http://bugs.python.org/file46252/fibo.png

___
Python tracker 

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



[issue29006] 2.7.13 _sqlite more prone to "database table is locked"

2017-01-10 Thread Larry Hastings

Larry Hastings added the comment:

Ping.  Hoping to resolve this in time for 3.5.3, which I tag in about four days.

--

___
Python tracker 

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



[issue29125] Shell injection via TIX_LIBRARY when using tkinter.tix

2017-01-10 Thread Larry Hastings

Larry Hastings added the comment:

Well, clearly I'm not qualified to review the patch.  Could someone please 
review it?  I want to cherry-pick the fix for this issue for 3.5.3 final, which 
I tag in about four days.

--

___
Python tracker 

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



[issue29215] pyport.h uses non C90-style comment

2017-01-10 Thread Xiang Zhang

Xiang Zhang added the comment:

About the comment style confliction, I opened an issue on Github and assigned 
to you Benjamin. https://github.com/python/peps/issues/176

--

___
Python tracker 

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



[issue29221] ABC Recursion Error on isinstance() with less than recursion limit class hierarchy depth

2017-01-10 Thread Raymond Hettinger

Changes by Raymond Hettinger :


Added file: http://bugs.python.org/file46251/cache_example.py

___
Python tracker 

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



[issue29221] ABC Recursion Error on isinstance() with less than recursion limit class hierarchy depth

2017-01-10 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Not sure if this is related, but I have a simple Cache class that gets a 
recursion error at a depth of about 166 calls (a sixth of the expected 1000).  
I suspect that the reason is the many of the steps individually add to the 
recursion depth causing the recursion limit to be reached at some integer 
multiple faster than would be expected.

--
nosy: +rhettinger

___
Python tracker 

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



[issue29238] Add more kwargs to cProfile's print_stats

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



[issue29235] Allow profile/cProfile to be used as context managers

2017-01-10 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy: +ethan.furman
stage:  -> needs patch

___
Python tracker 

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



[issue28231] zipfile does not support pathlib

2017-01-10 Thread Jeremy Freeman

Jeremy Freeman added the comment:

I have reviewed the code and docs for the public API that should take a 
pathlib.Path object:

- zipfile.is_zipfile(filename)
  - filename
- zipfile.ZipFile(file)
  - file
- ZipFile.extract(member, path=None)
  - path
- ZipFile.extractall(path=None)
  - path
- ZipFile.write(filename)
  - filename
- zipfile.PyZipFile(file)
  - file
- PyZipFile.writepy(pathname)
  - pathname
- ZipInfo.from_file(filename, arcname=None)
  - filename

Does this appear complete?

Working on tests that probe each of these API points with pathlib.Path objects.

I am not sure what "Shouldn't the ZipFile.filename attribute be converted to 
str?" means, can you elaborate?

--

___
Python tracker 

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



[issue29238] Add more kwargs to cProfile's print_stats

2017-01-10 Thread Thane Brimhall

New submission from Thane Brimhall:

Using the pstats class to print off profiler results is helpful when you want 
to filter, order, and limit the number of returned lines. I'd rather see the 
most commonly-used subset of pstats functionality included in the profiler's 
print_stats implementation directly.


# The current way

pstats.Stats(profiler).strip_dirs().sort_stats('cumulative').reverse_order().print_stats(10)

# Proposed way
profiler.print_stats(strip_dirs=False, sort='cumulative', reverse=True, 
limit=10)


Currently only the `sort` kwarg is available. To me this implies that some 
level of control was originally intended to be available in the print_stats 
method anyway. I also feel like the proposed API is more readable and explicit.

Note that for complex situations you'd still need to use the pstats class 
directly, eg. substituting a different stream implementation or 
filtering/sorting by multiple values.

This would be a backwards-compatible patch and would be implemented something 
like this:


def print_stats(self, sort=-1, limit=None, strip_dirs=True, reverse=True):
import pstats
stats = pstats.Stats(self)
if strip_dirs:
stats = stats.strip_dirs()
stats = stats.sort_stats(sort)
if reverse:
stats = stats.reverse_order()
stats.print_stats(limit)

--
components: Library (Lib)
messages: 285183
nosy: Thane Brimhall
priority: normal
severity: normal
status: open
title: Add more kwargs to cProfile's print_stats
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-01-10 Thread Steve Dower

Steve Dower added the comment:

I'm fairly sure dllexport implies noinline, and it certainly does for the 
exported function (but maybe PGO will inline it within the module? hard to 
know). In any case, I agree with keeping it private as it's purely about 
optimization.

Do you have a test that can run against the released build? That will be the 
easiest way to tell whether it matters at all.

--

___
Python tracker 

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-10 Thread Thomas Nyberg

Thomas Nyberg added the comment:

Now that I look over this thread again, I realize that my patch ended up 
basically evolving to being extremely similar to Mark Haase's. The only thing 
that I don't understand though is that he says that his shebangs are somehow 
messed up. For me the shebangs are all fine with my patch. Possibly this is 
difference between his system (OSX) and mine (debian 8)? In any case, I'm 
afraid I may have re-engineered almost the same solution as him (and therefore 
that it doesn't work right), but I guess I needed to go through the process to 
familiarize myself with the problem.

Mark if you're still listening to this thread, maybe you could test this out 
and see if you're still having the same shebang problems? I can't reproduce 
your issue.

--

___
Python tracker 

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



[issue24875] pyvenv doesn´t install PIP inside a new venv with --system-site-package

2017-01-10 Thread Thomas Nyberg

Thomas Nyberg added the comment:

I'm attaching a small patch (against the current hg master branch) that I 
believe solves the problem, however, I think it was quite hacky.

Here is a walk-through of the logic.

1) If '--system-site-packages' is requested, then it is overrided initially in 
the process when creating the config file. I.e. it is hard-coded to 'false' in 
the pyvenv.cfg file.
2) Next ensurepip is run. This is being run in the same state as it would be if 
no '--system-site-packages' flag were passed, so this time it installs some 
packages to the venv's site-packages.
3) If necessary, the config file is regenerated without over-riding the 
system-site-packages flag.
4) If necessary, all packages installed in site-packages are removed and a new 
empty site-packages folder is regenerated.

The logic here is pretty horrid, but it seems to be functioning correctly. 
There are a couple possible issues here:

1) I assume that on all platforms the site-packages folder will always end up 
empty when the no '--system-site-packages' flag is passed.
2) I also assume that on all platforms there are no differences in the venv 
that is produced with or without this option except for the packages installed 
in the system-site-packages folder.

I don't really have any way to verify either of those assumption experimentally 
and I'm not familiar enough with ensurepip/pip to know that way either. I've 
only tested this on my debian system so it could very well not be portable.

Regardless of my misgivings of the quality of this patch, I think a solution to 
this problem is totally essential. The '--system-site-packages' flag is a great 
way to let your distro's package manager install most packages you need while 
allowing you then to install whatever others your distro does not provide. I 
use this all the time to simplify/decrease maintenance complexity. Without this 
fix, the --system-site-packages flag is essentially equivalent to a read-only 
environment and in that case, there's no point in using it at all.

--
nosy: +thomas.nyberg
versions: +Python 3.7 -Python 3.4, Python 3.5
Added file: http://bugs.python.org/file46250/venv_site_packages.patch

___
Python tracker 

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



[issue29237] Create enum for pstats sorting options

2017-01-10 Thread Ethan Furman

Ethan Furman added the comment:

To keep backwards compatibility and lesson the burden on new code, simply make 
the value of the duplicate names be the same:

cumulative = 'cumulative'
cumtime = 'cumulative'

This way the standard name is 'cumulative' but 'cumtime' works as well.

--
nosy: +ethan.furman
stage:  -> needs patch

___
Python tracker 

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



[issue29237] Create enum for pstats sorting options

2017-01-10 Thread Thane Brimhall

New submission from Thane Brimhall:

When using the cProfile and pstats modules, I often forget which string keys 
are available for sorting. It would be nice to add an enum for these so a user 
could have their linter and IDE check that value pre-runtime.

By subclassing both `str` and `Enum` this proposal would be 
backwards-compatible with all existing code.

The patch for such a change would be trivial:


1. Add a new Sort class to the pstats module:

class Sort(str, enum.Enum):
calls = 'calls'  # call count
cumulative = 'cumulative'  # cumulative time
cumtime = 'cumtime'  # cumulative time
file = 'file'  # file name
filename = 'filename'  # file name
module = 'module'  # file name
ncalls = 'ncalls'  # call count
pcalls = 'pcalls'  # primitive call count
line = 'line'  # line number
name = 'name'  # function name
nfl = 'nfl'  # name/file/line
stdname = 'stdname'  # standard name
time = 'time'  # internal time
tottime = 'tottime'  # internal time


2. Change the print_stats method signature on the profiler base and subclasses 
to look like this:

def print_stats(self, sort: Sort=Sort.stdname):


Optionally, you could build the Sort enum like below to remove redundant 
options and increase explicitness:

class Sort(str, enum.Enum):
call_count = 'calls'
cumulative_time = 'cumulative'
filename = 'filename'
primitive_call_count = 'pcalls'
line_number = 'line'
function_name = 'name'
name_file_line = 'nfl'
standard_name = 'stdname'
internal_time = 'time'

--
components: Library (Lib)
messages: 285178
nosy: Thane Brimhall
priority: normal
severity: normal
status: open
title: Create enum for pstats sorting options
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Ok, I give up on that one. I don't think that it's worth it.

--
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue29236] 'an ASCII string of one or more PEM-encoded certificates' needs to be unicode

2017-01-10 Thread Maciej Piechorka

New submission from Maciej Piechorka:

In documentation it is specified that cadata parameter in load_verify_locations 
is 'an ASCII string of one or more PEM-encoded certificates'. However the code 
is actually determining it based on PyUnicode_Check function so the 'ASCII 
string' actually needs to be unicode object. In Python 3 it seems to be fixed 
by checking by PyObject_GetBuffer.

--
assignee: docs@python
components: Documentation, SSL
messages: 285176
nosy: docs@python, uzytkownik
priority: normal
severity: normal
status: open
title: 'an ASCII string of one or more PEM-encoded certificates' needs to be 
unicode
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



[issue29235] Allow profile/cProfile to be used as context managers

2017-01-10 Thread Thane Brimhall

New submission from Thane Brimhall:

The `enable` and `disable` methods on the profilers fit the description of a 
context manager very well. The following code:

pr = cProfile.Profile()
pr.enable()
# ... do something ...
pr.disable()
pr.print_stats()

Would turn into something like this:

with cProfile.Profile() as pr:
# ... do something ...
pr.print_stats()

The patch for this code would be trivial and backwards-compatible: simply add 
something like the following lines to the _lsprof.Profiler base class:

def __enter__(self):
self.enable()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
self.disable()

--
components: Library (Lib)
messages: 285175
nosy: Thane Brimhall
priority: normal
severity: normal
status: open
title: Allow profile/cProfile to be used as context managers
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()

2017-01-10 Thread Jason Curtis

Jason Curtis added the comment:

sounds right; closing as a duplicate of issue20804

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

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Result of attached bench_recursion-2.py comparing before/after the 3 changes 
reducing the stack consumption:

test_python_call: Median +- std dev: [a30cdf366c02] 512 us +- 12 us -> 
[6478e6d0476f] 467 us +- 21 us: 1.10x faster (-9%)
test_python_getitem: Median +- std dev: [a30cdf366c02] 485 us +- 26 us -> 
[6478e6d0476f] 437 us +- 18 us: 1.11x faster (-10%)
test_python_iterator: Median +- std dev: [a30cdf366c02] 1.15 ms +- 0.04 ms -> 
[6478e6d0476f] 1.03 ms +- 0.06 ms: 1.12x faster (-10%)

At least, it doesn't seem to be slower. Maybe the speedup comes from 
call_function() inlining. This function was probably already inlined when using 
PGO build.

The script was written by Serhiy in the issue #29227, I modified it to use the 
Runner.timeit() API for convenience.

--
Added file: http://bugs.python.org/file46249/bench_recursion-2.py

___
Python tracker 

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



[issue2771] Test issue

2017-01-10 Thread Brett Cannon

Changes by Brett Cannon :


--
pull_requests: +14

___
Python tracker 

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



[issue2771] Test issue

2017-01-10 Thread Brett Cannon

Changes by Brett Cannon :


--
pull_requests: +13

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8481c379e2da by Victor Stinner in branch 'default':
Inline call_function()
https://hg.python.org/cpython/rev/8481c379e2da

--
nosy: +python-dev

___
Python tracker 

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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-01-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6478e6d0476f by Victor Stinner in branch 'default':
Disable _PyStack_AsTuple() inlining
https://hg.python.org/cpython/rev/6478e6d0476f

--
nosy: +python-dev

___
Python tracker 

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



[issue2771] Test issue

2017-01-10 Thread Brett Cannon

Changes by Brett Cannon :


--
pull_requests: +12

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread STINNER Victor

Changes by STINNER Victor :


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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

noinline_msvs.patch: implement _Py_NO_INLINE for Microsoft Visual Studio

#elif defined(_MSC_VER)
#  define _Py_NO_INLINE __declspec(noinline)

I didn't push this change because I don't have access to a Windows VM yet.

@Steve: Does noinline_msvs.patch look good to you?

I decided to make the macro private because I don't know if _Py_NO_INLINE can 
be combined with PyAPI_FUNC() which also uses __declspec(): 
__declspec(dllexport).

Is it possible to use __declspec() multiple times per function declaration?

--
keywords: +patch
nosy: +steve.dower
Added file: http://bugs.python.org/file46248/noinline_msvs.patch

___
Python tracker 

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



[issue2771] Test issue

2017-01-10 Thread Brett Cannon

Changes by Brett Cannon :


--
pull_requests: +11

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

I pushed 3 changes:

* rev b9404639a18c: Issue #29233: call_method() now uses _PyObject_FastCall()
* rev 8481c379e2da: Issue #29227: inline call_function()
* rev 6478e6d0476f: Issue #29234: disable _PyStack_AsTuple() inlining


Before (rev a30cdf366c02):

test_python_call: 7175 calls before crash, stack: 1168 bytes/call
test_python_getitem: 6235 calls before crash, stack: 1344 bytes/call
test_python_iterator: 5344 calls before crash, stack: 1568 bytes/call

=> total: 18754 calls, 4080 bytes


With these 3 changes (rev 6478e6d0476f):

test_python_call: 8587 calls before crash, stack: 976 bytes/call
test_python_getitem: 9189 calls before crash, stack: 912 bytes/call
test_python_iterator: 7936 calls before crash, stack: 1056 bytes/call

=> total: 25712 calls, 2944 bytes


The default branch is now as good as Python 3.4, in term of stack consumption, 
and Python 3.4 was the Python version which used the least stack memory 
according to my tests.

I didn't touch _PY_FASTCALL_SMALL_STACK value, it's still 5 arguments (40 
bytes). So my changes should not impact performances.

--

___
Python tracker 

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



[issue29234] Disable inlining of _PyStack_AsTuple() to reduce the stack consumption

2017-01-10 Thread STINNER Victor

New submission from STINNER Victor:

While working on the issue #28870, I noticed that _PyStack_AsTuple() is 
inlined. Compared to Python 3.5 which didn't have this function, it seems like 
_PyStack_AsTuple() is responsible for an increase of the stack consumption.

--
components: Interpreter Core
messages: 285168
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Disable inlining of _PyStack_AsTuple() to reduce the stack consumption
type: enhancement
versions: Python 3.7

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Full commit message:

changeset:   106081:b9404639a18c
tag: tip
user:Victor Stinner 
date:Wed Jan 11 00:07:40 2017 +0100
files:   Include/abstract.h Objects/abstract.c Objects/typeobject.c
description:
call_method() now uses _PyObject_FastCall()

Issue #29233: Replace the inefficient _PyObject_VaCallFunctionObjArgs() with
_PyObject_FastCall() in call_method() and call_maybe().

Only a few functions call call_method() and call it with a fixed number of
arguments. Avoid the complex and expensive _PyObject_VaCallFunctionObjArgs()
function, replace it with an array allocated on the stack with the exact number
of argumlents.

It reduces the stack consumption, bytes per call, before => after:

test_python_call: 1168 => 1152 (-16 B)
test_python_getitem: 1344 => 1008 (-336 B)
test_python_iterator: 1568 => 1232 (-336 B)

Remove the _PyObject_VaCallFunctionObjArgs() function which became useless.
Rename it to object_vacall() and make it private.

--

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b9404639a18c by Victor Stinner in branch 'default':
call_method() now uses _PyObject_FastCall()
https://hg.python.org/cpython/rev/b9404639a18c

--
nosy: +python-dev

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread STINNER Victor

Changes by STINNER Victor :


--
components: +Interpreter Core
type:  -> performance
versions: +Python 3.7

___
Python tracker 

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



[issue29233] call_method(): call _PyObject_FastCall() rather than _PyObject_VaCallFunctionObjArgs()

2017-01-10 Thread STINNER Victor

New submission from STINNER Victor:

Recently, I modified call_method() and call_maybe() of Objects/typeobject.c to 
avoid the creation of a temporary tuple: replace 
Py_VaBuildValue()+PyObject_Call() with the new 
_PyObject_VaCallFunctionObjArgs().

But while working on the issue #28870, I noticed that 
_PyObject_VaCallFunctionObjArgs() is not efficient and can be avoided. In 
typeobject.c, the number of arguments is hardcoded, so we don't need complex 
functions to compute the number of arguments and decide to allocate an array on 
the stack or on the heap.

--
messages: 285165
nosy: haypo
priority: normal
severity: normal
status: open
title: call_method(): call _PyObject_FastCall() rather than 
_PyObject_VaCallFunctionObjArgs()

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

I plan to run a benchmark when all my patches to reduce the stack consumption 
will be ready. I'm still trying all the various options to reduce the stack 
consumption. I'm trying to avoid hacks and reduce the number of changes. I'm 
already better than Python 2.7 and 3.5 on my local branch.

--

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I didn't provide results with less_stack.patch because they were almost the 
same, just 1-3% faster. That might be just a random noise or compiler artifact. 
But may be an effect of inlining call_function().

Could you run full Python benchmarks? Decreasing the size of small stack 
doesn't impact a performance in these cases, but may impact a performance of 
calls with larger number of arguments. AFAIK the size of some small stacks 
already was decreased from 8 to 5.

--

___
Python tracker 

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



[issue29113] modulefinder no longer finds all required modules for Python itself, due to use of __import__ in sysconfig

2017-01-10 Thread Matthias Klose

Matthias Klose added the comment:

the idea is that we load a different _sysconfigdata module when we are cross 
building packages.  So we don't know the name in advance.  An ugly alternative 
would be a big if statement with conditional imports for all known cross build 
targets. Not sure if this is the better solution.

--

___
Python tracker 

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



[issue20804] Sentinels identity lost when pickled (unittest.mock)

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, I had wrote this patch for issue29229 and didn't read the above 
discussion.

Copying and pickling preserve identity of some objects: functions, classes, 
enums, builtin singletons (None, False, True, ...). It was not obvious to me 
that this shouldn't work with mock sentinels.

--

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Oh wow! I'm impressed that Python 3 is better at each release! On 2 tests, 
Python 3.7 is faster than Python 2.7, but on test_python_iterator Python 3.7 is 
still slower. It seems like this specific test became much slower (+19%) on 
Python 3.4 compared to 2.7.

I guess that your benchmark is on unpatched Python.

I don't think that less_stack.patch has an impact on performances, but I guess 
because I'm curisous. It seems like it's a little bit faster. At least, it's 
not slower ;-)

test_python_call: Median +- std dev: [ref] 509 us +- 11 us -> [patch] 453 us +- 
49 us: 1.12x faster (-11%)
test_python_getitem: Median +- std dev: [ref] 485 us +- 13 us -> [patch] 470 us 
+- 23 us: 1.03x faster (-3%)
test_python_iterator: Median +- std dev: [ref] 1.15 ms +- 0.05 ms -> [patch] 
1.12 ms +- 0.07 ms: 1.03x faster (-3%)

--

___
Python tracker 

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



[issue29231] Broken MSIs in Python 3.5+

2017-01-10 Thread KeyWeeUsr

Changes by KeyWeeUsr :


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



[issue29232] Quiet Install

2017-01-10 Thread Earl Maier

New submission from Earl Maier:

On quiet and passive Installs of Python 3.6 and 3.5 in windows 7 and 10 (x64), 
Python successfully installs but does not appear in programs and features. It 
would also appear that the append path and python launcher switches do not work 
for quiet install.  If installed manual everything functions as it should.

Quiet installs work just fine with version 2.7 (msi vs exe).

The installers used are the Windows x86-64 executable installer for both python 
3.6.0 and 3.5.2.

--
components: Windows
files: Capture.PNG
messages: 285159
nosy: earl.maier, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Quiet Install
type: behavior
versions: Python 3.5, Python 3.6
Added file: http://bugs.python.org/file46247/Capture.PNG

___
Python tracker 

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



[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread Christian Heimes

Christian Heimes added the comment:

Victor, you are correct. That was exactly my point.

The most secure way is to tighten security and set umask to 0o077. It's 
basically a white list or locked down approach. With umask 0o077 all subsequent 
files, directories and other resources will be created without any permission 
for group and others. This is even true for operations that create a Unix 
socket.

You have to change the permission of files to a more permissive mode 
explicitly. Any mistake is easy to spot (access denied) and not catastrophic.

By the way fchmod() isn't necessarily the optimal way to change permission by 
file descriptor. The behavior of fchmod() isn't well defined for socket files. 
On Linux fchmod() of a Unix socket file does not alter the permission bits of 
the socket device file.

--

___
Python tracker 

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



[issue29231] Broken MSIs in Python 3.5+

2017-01-10 Thread KeyWeeUsr

New submission from KeyWeeUsr:

In versions _lower_ than 3.5.0 there was a `.MSI` installer for Windows, which 
had a really nice hidden option. That option looked like this:

msiexec.exe /a "file.msi" /qb /L*V "file.log" ALLUSERS=0 TARGETDIR="target" 
CURRENTDIRECTORY="%cd%" 

which basically allows me to ignore admin rights, because the MSI turns to some 
kind of installer for whole network, thus the permission workaround for older 
Python versions.

With Python 3.5.0 was introduced a new `.EXE` installer, which has `.MSI` files 
packed in itself, you can get them out with:

python-3.5.0.exe /layout [optional target directory]

yet there's a really annoying thing going around with this solution. When I do 
this, the `.MSI` files have a `-d.msi` suffix and when I manually unpack it 
with the `msiexec` command above, **every file** has that suffix too, which 
makes it a _completely damaged_ installation. Renaming the files isn't really 
an option as each file has `-d.`, not `-d.msi.` suffix, so 
it's too hard to rename it in a simple way with tools such as Batch, unless I 
want to check for multiple cases (e.g. folders).

Is there any way how to extract the content of the installer to a separate 
folder, like it was possible before **without** any additional stuff put into 
`Programs and features`, such as `Python 3.5.0 (64bit)` or similar?

Or other question - is there any way how to forbid the installer to access 
`Programs and features`, shut it from asking admin privileges and registry at 
all?

It's quite useful if I want to have multiple python fresh installations not 
bound to anything at all with testing as its main purpose. Note, that I have no 
intention to use python launcher (that `py.exe` thing), virtualenv or any other 
alternative "solution" as every of them allows me to install only a one 
**global** Python installation of the same version and/or is too big for quick 
usage and at the same time I need to have an option for testing on a fresh 
interpreter not modified by anything and completely cut off from the OS stuff.

Any ideas how can I achieve the same behavior even on newer Python versions 
with the EXE installer?

--
components: Installation, Windows
messages: 285157
nosy: KeyWeeUsr, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Broken MSIs in Python 3.5+
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



[issue20804] Sentinels identity lost when pickled (unittest.mock)

2017-01-10 Thread Davin Potts

Davin Potts added the comment:

Serhiy: The above discussion seemed to converge on the perspective that object 
identity should not survive pickling and that the point of a sentinel is object 
identity.  While your proposed patch may mechanically work, I believe it is in 
conflict with the outcome of the thoughtful discussion above.

--
nosy: +davin

___
Python tracker 

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



[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

I don't understand the problem with umask(). It's standard and affect all
code even C extension calling directly or indirectly open(). It is more
secure to use umask() than setting mode on a few Python open() calls no?

For example, Python creates .pyc files. You cannot (easily) modify the
open() call to set mode, whereas it is affected by umask().

If you call umask() at startup, it affects all threads, there is no race
condition like open()+fchmod().

--

___
Python tracker 

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



[issue29219] TracebackException(capture_locals=True) may fail with RecursionError

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch fixes an infinite recursion in a repr of uninitialized CDLL 
instance.

--
keywords: +patch
stage:  -> patch review
Added file: 
http://bugs.python.org/file46246/ctypes_cdll_uninitialized_repr.patch

___
Python tracker 

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



[issue29230] Segfault in sqlite3

2017-01-10 Thread Ned Deily

Ned Deily added the comment:

Thanks for the report.  From a quick look at the macOS crash report, I'm 
guessing you are running with the Apple-supplied system Python 2.7 but with a 
virtualenv.  In any case, the Apple-supplied libsqlite3 is in use and there are 
previously reported problems using it with multiple threads, possibly multiple 
processes, accessing the same database file; see for example Issue27126.  
Suggest you try using a Python instance that is linked with its own version of 
a current libsqlite3, rather than with the system one: Pythons installed from 
current python.org macOS installers, from Macports, or (probably) Homebrew 
should all fit the bill and see if the problems go away.

--
nosy: +ned.deily
resolution:  -> third party
status: open -> pending

___
Python tracker 

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



[issue20804] Sentinels identity lost when pickled (unittest.mock)

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Proposed patch makes mock sentinels supporting pickling and copying. This 
allows passing them in multiprocessing.

I'm not sure whether this is a bug fix or a new feature.

The patch works only with 3.5+. Older versions need more complex solution.

--
keywords: +patch
nosy: +serhiy.storchaka
stage:  -> patch review
versions: +Python 3.5, Python 3.6, Python 3.7 -Python 3.3, Python 3.4
Added file: http://bugs.python.org/file46245/mock_sentinel_pickle.patch

___
Python tracker 

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



[issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()

2017-01-10 Thread Davin Potts

Davin Potts added the comment:

I think this should be regarded as a duplicate of issue20804 though discussion 
in issue14577 is also related/relevant.

--
superseder:  -> Sentinels identity lost when pickled (unittest.mock)

___
Python tracker 

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



[issue29230] Segfault in sqlite3

2017-01-10 Thread Daniel Fackrell

New submission from Daniel Fackrell:

This crash occurs while running some unittests in one of our Django apps.

It duplicates on all three versions I've tried (2.7.10, 2.7.12, and 2.7.13). I 
don't have a Python3-capable code to test against at present.

It fails on my Mac OS system, and we can't duplicate the issue on an Ubuntu 
system. There's one particular test that consistently triggers it, but only if 
most of the other tests for the same file run first.

I've attached the .crash file (with Python 2.7.13), and included pip freeze and 
uname -a output below. Please let me know if I can provide more info to help 
with debugging this.

$ uname -a
Darwin c02pwm27g8wn.corp.verisys.com 15.6.0 Darwin Kernel Version 15.6.0: Wed 
Nov  2 20:30:56 PDT 2016; root:xnu-3248.60.11.1.2~2/RELEASE_X86_64 x86_64

$ pip freeze
coverage==4.3.1
Django==1.8.17
django-nose==1.4.4
funcsigs==1.0.2
lxml==3.4.4
mock==2.0.0
model-mommy==1.3.1
MySQL-python==1.2.5
nose==1.3.7
pbr==1.10.0
pycrypto==2.6.1
pytz==2016.10
requests==2.12.4
six==1.10.0
suds==0.4

--
files: python_2017-01-09-152821_C02PWM27G8WN.crash
messages: 285150
nosy: intchanter
priority: normal
severity: normal
status: open
title: Segfault in sqlite3
type: crash
versions: Python 2.7
Added file: 
http://bugs.python.org/file46244/python_2017-01-09-152821_C02PWM27G8WN.crash

___
Python tracker 

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



[issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()

2017-01-10 Thread Davin Potts

Davin Potts added the comment:

This arises from the behavior of pickle (which is used by default in 
multiprocessing to serialize objects sent to / received from other processes in 
data exchanges), as seen with Python 3.6:

>>> import pickle
>>> x = pickle.dumps(mock.sentinel.foo)
>>> x
b'\x80\x03cunittest.mock\n_SentinelObject\nq\x00)\x81q\x01}q\x02X\x04\x00\x00\x00nameq\x03X\x03\x00\x00\x00fooq\x04sb.'
>>> pickle.loads(x)
sentinel.foo
>>> pickle.loads(x) == mock.sentinel.foo
False

--
nosy: +davin

___
Python tracker 

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



[issue29219] TracebackException(capture_locals=True) may fail with RecursionError

2017-01-10 Thread Ilya Kulakov

Ilya Kulakov added the comment:

I was not able to reproduce it.

The origin "unhandeled" exception happens after ctypes.cdll.LoadLibrary fails 
to load a library:

Traceback (most recent call last):
  File "...", line 852, in ...
  File ":/ctypes/__init__.py", line 425, in LoadLibrary
  File ":/ctypes/__init__.py", line 347, in __init__
OSError: [WinError 126] 找不到指定的模組

Then we raise our own exception.

--

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

$ ./python -m perf timeit -s "from bench_recursion import test_python_call as 
test" -- "test(1000)"
Python 2.7:  5.10 ms +- 0.37 ms
Python 3.4:  4.38 ms +- 0.28 ms
Python 3.5:  4.19 ms +- 0.26 ms
Python 3.6:  3.93 ms +- 0.32 ms
Python 3.7:  3.26 ms +- 0.27 ms

$ ./python -m perf timeit -s "from bench_recursion import test_python_getitem 
as test" -- "test(1000)"
Python 2.7:  4.09 ms +- 0.26 ms
Python 3.4:  4.60 ms +- 0.23 ms
Python 3.5:  4.35 ms +- 0.28 ms
Python 3.6:  4.05 ms +- 0.34 ms
Python 3.7:  3.23 ms +- 0.23 ms

$ ./python -m perf timeit -s "from bench_recursion import test_python_iterator 
as test" -- "test(1000)"
Python 2.7:  7.85 ms +- 0.66 ms
Python 3.4:  9.31 ms +- 0.55 ms
Python 3.5:  9.83 ms +- 0.71 ms
Python 3.6:  8.99 ms +- 0.66 ms
Python 3.7:  8.58 ms +- 0.73 ms

--
Added file: http://bugs.python.org/file46243/bench_recursion.py

___
Python tracker 

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



[issue29229] incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()

2017-01-10 Thread Jason Curtis

New submission from Jason Curtis:

When a sentinel object from unittest.mock.sentinel is passed through a 
multiprocessing.Pool.map, I expect it to still be comparable. 

As a user, I'd like to be able to write a unit test using sentinels on my 
unparallelized code, and then see that the test still passes after I 
parallelize the code using multiprocessing, so that I can make use of sentinels 
in regression testing.


Example:
```
from unittest import mock
import multiprocessing


def identity(x):
return x

with multiprocessing.Pool() as pool:
multiprocessed = list(pool.map(identity, [mock.sentinel.foo]))

assert identity(mock.sentinel.foo) == mock.sentinel.foo  # Passes
assert multiprocessed[0] == mock.sentinel.foo  # Fails
```

--
components: Library (Lib)
messages: 285146
nosy: Jason Curtis
priority: normal
severity: normal
status: open
title: incompatible: unittest.mock.sentinel and multiprocessing.Pool.map()
type: behavior
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



[issue29113] modulefinder no longer finds all required modules for Python itself, due to use of __import__ in sysconfig

2017-01-10 Thread Brett Cannon

Brett Cannon added the comment:

The limitation is unavoidable as modulefinder inspects bytecode for its 
inferencing, so any code that calls __import__() or importlib.import_module() 
will simply not work. So unless sysconfig can be updated reasonably back to a 
statically defined import this is just how it will be (I'll let doko comment on 
whether updating is possible and thus close this issue).

--
nosy: +brett.cannon

___
Python tracker 

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



[issue29214] Standard open() does not allow to specify file permissions.

2017-01-10 Thread Brett Cannon

Brett Cannon added the comment:

The point Serhiy is trying to make is that not everyone needs or cares about 
setting specific file permissions. Python's built-in open() function has not 
supported this for 26 years and so there's obviously not that much of a need if 
this has not consistently come up as a shortcoming.

Two, you say to "just pass" something like "0o644" as the mode. OK, but what 
does that even mean? As a Linux user you may know thanks to chmod usage, but a 
Windows user or someone who doesn't use a Linux shell won't have any idea what 
that octal constant represents. So how do you propose to help people set the 
proper mode? If you say "use os.O_CREAT" then you just made open() have 
functionality depend on the os module which no other built-in directly does for 
their API.

In other words you might call this simple, but I call it an advanced feature 
that's supported by os.fdopen(os.open()) already. So when I say a "clear 
design" I mean addressing the fact that it's non-obvious for beginners on how 
to use and something not everyone needs.

--

___
Python tracker 

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



[issue28885] Python 3.5.2 strange-behavior issues (from PyPy)

2017-01-10 Thread Brett Cannon

Brett Cannon added the comment:

I think if you're up for doing individual issues, Armin, that's preferred. But 
if it's too much work we will take it all in this single issue instead of 
risking the loss of the information. And if you want to use this issue as a 
meta one to track everything you report that's obviously fine.

--

___
Python tracker 

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



[issue29228] sqlite3 OperationalError on changing into WAL transaction mode

2017-01-10 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report. This is a duplicate of issue 28518.

--
components: +Library (Lib)
nosy: +berker.peksag
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> execute("begin immediate") throwing OperationalError
type:  -> behavior

___
Python tracker 

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



[issue29228] sqlite3 OperationalError on changing into WAL transaction mode

2017-01-10 Thread yadayada

New submission from yadayada:

Running

sqlite3.connect('foo.db').execute("PRAGMA journal_mode = WAL")

will throw

sqlite3.OperationalError: cannot change into wal mode from within a transaction

on Python 3.6.0, but not with older versions.

--
messages: 285141
nosy: yadayada
priority: normal
severity: normal
status: open
title: sqlite3 OperationalError on changing into WAL transaction mode
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



[issue29225] distutils.command.install_lib.get_outputs() wrong with extensions built inplace

2017-01-10 Thread Elvis Stansvik

Elvis Stansvik added the comment:

Not really related to this fix, but a colleague also prudently pointed out that 
perhaps an

   assert file[:prefix_len] == build_dir + os.sep

before the

   outputs.append(os.path.join(self.install_dir,
file[prefix_len:]))

in the helper for pure modules (_pure_outputs after my patch is applied) would 
be in order, to assert that what is cut away is what was intended. 

That sounds like a good idea to me, but could it give false negatives on 
Windows (case-insensitive file systems? or file systems where both / and \ are 
allowed?).

--

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Simon Grantham

Simon Grantham added the comment:

My googling skills are a bit amiss too.  I searched for some kind of 
encoding pragma before reporting.  Perhaps just a footnote in the basic 
documentation of a python comment is the easiest solution.

Simon

On 1/10/2017 12:58 PM, Ammar Askar wrote:
> Ammar Askar added the comment:
>
> Thanks for the link Jim, looks like my googling skills are a bit amiss.
>
> I believe the reason the matching allows "encoding" is because a recommended 
> format in the documentation is:
>
> # vim:fileencoding=
>
> I think changing the behavior of the matching to be stricter and only match 
> on "coding:" could result in breakages of such lines. Instead I think the 
> error thrown could be more descriptive since I don't think it's too helpful.
>
> --
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Ammar Askar

Ammar Askar added the comment:

Thanks for the link Jim, looks like my googling skills are a bit amiss.

I believe the reason the matching allows "encoding" is because a recommended 
format in the documentation is:

# vim:fileencoding=

I think changing the behavior of the matching to be stricter and only match on 
"coding:" could result in breakages of such lines. Instead I think the error 
thrown could be more descriptive since I don't think it's too helpful.

--

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

It seems like subfunc.patch approach using the "no inline" attribute helps.

--

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

I created the issue #29227 "Reduce C stack consumption in function calls" which 
contains a first simple patch with a significant effect on the C stack.

--

___
Python tracker 

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



[issue29227] Reduce C stack consumption in function calls

2017-01-10 Thread STINNER Victor

New submission from STINNER Victor:

Attached patch reduce C stack consumption in function calls. It's the follow-up 
of the issue #28870.


Reference (rev a30cdf366c02):

test_python_call: 7175 calls before crash, stack: 1168 bytes/call
test_python_getitem: 6235 calls before crash, stack: 1344 bytes/call
test_python_iterator: 5344 calls before crash, stack: 1568 bytes/call

=> total: 18754 calls, 4080 bytes


With "Inline call_function() in ceval.c":

test_python_call: 7936 calls before crash, stack: 1056 bytes/call
test_python_getitem: 6387 calls before crash, stack: 1312 bytes/call
test_python_iterator: 5755 calls before crash, stack: 1456 bytes/call

=> total: 20078 calls, 3824 bytes


With inline and "_PY_FASTCALL_SMALL_STACK: 5 arg (40 B) => 3 arg (24 B)":

test_python_call: 8058 calls before crash, stack: 1040 bytes/call
test_python_getitem: 6630 calls before crash, stack: 1264 bytes/call
test_python_iterator: 5952 calls before crash, stack: 1408 bytes/call

=> total: 20640 calls, 3712 bytes


I applied testcapi_stack_pointer.patch and run stack_overflow_28870-sp.py of 
the issue #28870 to produce these statistics.

With the patch, Python 3.7 is still not as good as Python 3.5 (msg285109), but 
it's a first enhancement.

--
components: Interpreter Core
files: less_stack.patch
keywords: patch
messages: 285135
nosy: haypo, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Reduce C stack consumption in function calls
type: performance
versions: Python 3.7
Added file: http://bugs.python.org/file46242/less_stack.patch

___
Python tracker 

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



[issue22107] tempfile module misinterprets access denied error on Windows

2017-01-10 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Library (Lib)
resolution: fixed -> 
stage: resolved -> 
versions: +Python 3.7 -Python 3.4

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Simon Grantham

Simon Grantham added the comment:

Thanks Ammar.  Curiously, the comment I had put in my code was a note 
regarding usage and actually didn't contain the word "coding:" but the 
word "encoding:".

# curl -v --header "Transfer-Encoding: chunked" -d @somefile.txt 
"http://localhost:80/;

Perhaps this is a slightly different kind of bug in that the interpreter 
doesn't regex /[^a-zA-Z]coding:/ .  Or a documentation bug. ;)

Simon

On 1/10/2017 11:44 AM, Ammar Askar wrote:
> Ammar Askar added the comment:
>
> This is because the "coding:" in a comment is a special syntax used to define 
> the encoding of the file. The only documentation I could find for it on the 
> official docs is a brief mention here: 
> https://docs.python.org/3/howto/unicode.html#the-string-type
>
> More details can be found on the PEP for it:
> https://www.python.org/dev/peps/pep-0263/
>
> The SyntaxError itself is not a bug, though I think the documentation for 
> this feature is certainly a little sparse.
>
> --
> nosy: +ammar2
> resolution:  -> not a bug
> stage:  -> resolved
> status: open -> closed
>
> ___
> Python tracker 
> 
> ___

--
title: encoding comment generates a SyntaxError -> Comment generates syntax 
error

___
Python tracker 

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



[issue29226] encoding comment generates a SyntaxError

2017-01-10 Thread Jim Fasarakis-Hilliard

Jim Fasarakis-Hilliard added the comment:

If you use an encoding declaration the encoding must be recognized by Python. 

This is clearly stated in the documentation: 
https://docs.python.org/3/reference/lexical_analysis.html#encoding-declarations

--
nosy: +Jim Fasarakis-Hilliard
title: Comment generates syntax error -> encoding comment generates a 
SyntaxError

___
Python tracker 

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



[issue22107] tempfile module misinterprets access denied error on Windows

2017-01-10 Thread Rocco Matano

Rocco Matano added the comment:

I just experienced the described problem using Python 3.6.0 (Python 3.6.0 
(v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)] on 
win32), but i do not understand the current status of this issue: On the one 
hand it is marked as 'open', which seems to imply that is still not resolved. 
On the other hand the resolution was set to 'fixed' in May 2015. Should i open 
a new issue for Python 3.6?

--
nosy: +rocco.matano
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



[issue28885] Python 3.5.2 strange-behavior issues (from PyPy)

2017-01-10 Thread Armin Rigo

Armin Rigo added the comment:

> Armin, it would help if you report all cases as separate issues.

I asked on python-dev before creating these three issues, and got the opposite 
answer.  If you decide it was a bad idea after all, I will open separate issues 
in the future.

--

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Ammar Askar

Ammar Askar added the comment:

This is because the "coding:" in a comment is a special syntax used to define 
the encoding of the file. The only documentation I could find for it on the 
official docs is a brief mention here: 
https://docs.python.org/3/howto/unicode.html#the-string-type

More details can be found on the PEP for it:
https://www.python.org/dev/peps/pep-0263/

The SyntaxError itself is not a bug, though I think the documentation for this 
feature is certainly a little sparse.

--
nosy: +ammar2
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Simon Grantham

Changes by Simon Grantham :


--
type:  -> compile error

___
Python tracker 

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



[issue29226] Comment generates syntax error

2017-01-10 Thread Simon Grantham

New submission from Simon Grantham:

Placing the word "coding:" in a hash tag comment in a file causes a syntax 
error.  Eg:

~ $ cat tst.py

# coding: Wow! How odd!

~ $ python tst.py
  File "tst.py", line 2
SyntaxError: encoding problem: Wow
~ $

--
components: Interpreter Core
messages: 285129
nosy: sgrantham
priority: normal
severity: normal
status: open
title: Comment generates syntax 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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Stack used by each C function of test_python_call.

3.4:

(a) method_call: 64

(b) PyObject_Call: 48
(b) function_call: 160
(b) PyEval_EvalCodeEx: 176

(c) PyEval_EvalFrameEx: 256
(c) call_function: 0
(c) do_call: 0
(c) PyObject_Call: 48

(d) slot_tp_call: 64
(d) PyObject_Call: 48

=> total: 864


default:

(a) method_call: 80

(b) _PyObject_FastCallDict: 64
(b) _PyFunction_FastCallDict: 208
(b) _PyEval_EvalCodeWithName: 176

(c) _PyEval_EvalFrameDefault: 320
(c) call_function: 80
(c) _PyObject_FastCallKeywords: 80

(d) slot_tp_call: 64
(d) PyObject_Call: 48

=> total: 1120


Groups of functions, 3.4 => default:

(a) 64 => 80 (+16)
(b) 384 => 448 (+64)
(c) 304 => 480 (+176)
(d) 112 => 112 (=)


I used gdb:

(gdb) set $last=0
(gdb) define size
> print $last - (uintptr_t)$rsp
> set $last = (uintptr_t)$rsp
> down
(gdb) up
(gdb) up
(gdb) up
(... until a first method_call ...)
(gdb) size
(gdb) size
...

--

___
Python tracker 

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



[issue29225] distutils.command.install_lib.get_outputs() wrong with extensions built inplace

2017-01-10 Thread Elvis Stansvik

Changes by Elvis Stansvik :


--
versions: +Python 3.7

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2017-01-10 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



[issue29225] distutils.command.install_lib.get_outputs() wrong with extensions built inplace

2017-01-10 Thread Elvis Stansvik

Changes by Elvis Stansvik :


--
keywords: +patch
Added file: 
http://bugs.python.org/file46241/fix-install-lib-with-inplace-ext.patch

___
Python tracker 

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



[issue29225] distutils.command.install_lib.get_outputs() wrong with extensions built inplace

2017-01-10 Thread Elvis Stansvik

New submission from Elvis Stansvik:

I noticed the following strange behavior:

estan@newton:~/testdist$ find
.
./testext.c
./setup.cfg
./setup.py
estan@newton:~/testdist$ cat setup.py 
from distutils.core import setup, Extension

setup(
name='testdist',
version='1.0.0',
ext_modules = [Extension('testext', ['testext.c'])]
)
estan@newton:~/testdist$ cat setup.cfg
[build_ext]
inplace=1
estan@newton:~/testdist$ ~/cpython/python setup.py install --prefix=~/prefix 
--record record.txt 
running install
running build
running build_ext
building 'testext' extension
creating build
creating build/temp.linux-x86_64-3.7-pydebug
gcc -pthread -Wno-unused-result -Wsign-compare -g -Og -Wall -Wstrict-prototypes 
-fPIC -I/home/estan/cpython/Include -I/home/estan/cpython -c testext.c -o 
build/temp.linux-x86_64-3.7-pydebug/testext.o
gcc -pthread -shared build/temp.linux-x86_64-3.7-pydebug/testext.o -o 
/home/estan/testdist/testext.cpython-37dm-x86_64-linux-gnu.so
running install_lib
warning: install_lib: 'build/lib.linux-x86_64-3.7-pydebug' does not exist -- no 
Python modules to install

running install_egg_info
Creating /home/estan/prefix/lib/python3.7/site-packages/
Writing 
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
writing list of installed files to 'record.txt'
estan@newton:~/testdist$ cat record.txt 
/home/estan/prefix/lib/python3.7/site-packages/n-37dm-x86_64-linux-gnu.so
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
estan@newton:~/testdist$ find ~/prefix
/home/estan/prefix
/home/estan/prefix/lib
/home/estan/prefix/lib/python3.7
/home/estan/prefix/lib/python3.7/site-packages
/home/estan/prefix/lib/python3.7/site-packages/testdist-1.0.0-py3.7.egg-info
estan@newton:~/testdist$

Notice how in the written record.txt, the path to the extension is wrong 
("testext.cpytho" is missing), and the extension is not installed.

I did a little digging and found that the reason is install_lib.get_outputs() 
returns the wrong result for extensions that are built inplace: It assumes they 
are built in the build directory.

The attached patch fixes the problem. The failure of the included test case 
without the change to install_lib is:

==
FAIL: test_get_outputs_inplace_ext 
(distutils.tests.test_install_lib.InstallLibTestCase)
--
Traceback (most recent call last):
  File "/home/estan/cpython/Lib/distutils/tests/test_install_lib.py", line 91, 
in test_get_outputs_inplace_ext
self.assertEqual(expected, actual)
AssertionError: Lists differ: 
['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'] != 
['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so']

First differing element 0:
'/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so'
'/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so'

- ['/tmp/tmptt4nhzgi/foo.cpython-37dm-x86_64-linux-gnu.so']
?--

+ ['/tmp/tmptt4nhzgi/dm-x86_64-linux-gnu.so']

--

Notice the missing "foo.cpython-37". With the change to install_lib, the test 
passes.

--
components: Distutils
messages: 285127
nosy: Elvis Stansvik, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: distutils.command.install_lib.get_outputs() wrong with extensions built 
inplace
type: behavior

___
Python tracker 

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



[issue1294959] Problems with /usr/lib64 builds.

2017-01-10 Thread jan matejek

jan matejek added the comment:

at this again, when porting SUSE patches to 3.6.0 :) ( :( )

Last time there was a discussion, Barry suggested using sysconfig variables to 
find the proper libdir. Trouble is, to fill out the variables, sysconfig itself 
uses two sources:
a) compiled-in information from the binary, and
b) Makefile items
Makefile seems an obvious location for storing the libdir info, except, well, 
to FIND the makefile in the first place, we are using sysconfig variables 
you see where this is heading.

So, given that sysconfig is the correct Primary Source for libdir info, we have 
three options to get it there:
1. compile it into the binary. sys.implementation.platlibdir seems as good as 
any -- i'm not completely convinced that this is a property of the 
_implementation_, but, well.
2. modify sysconfig.py at build time
3. guess it from the environment

And options (2) and (3) seem wrong, so i'm going with (1) for now

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



[issue29208] BlockingIOError during system startup

2017-01-10 Thread Dustin Spicuzza

Dustin Spicuzza added the comment:

I'm able to confirm that the patch does indeed fix the problem. Thanks everyone!

--

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

> no_small_stack-2.patch decreases it only by 6% (with possible performance 
> loss).

Yeah, if we want to come back to Python 3.4 efficiency, we need to find the 
other functions which now uses more stack memory ;-) The discussed "small 
stack" buffers are only responsible of 96 bytes, not a big deal compared to the 
total of 4080 bytes.

--

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thus Python 3.6 stack usage is about 20% larger than Python 3.5 and about 40% 
larger than Python 3.4. This is significant. :-(

no_small_stack-2.patch decreases it only by 6% (with possible performance loss).

--

___
Python tracker 

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



[issue29224] OS related file operations (copy, move, delete, rename...) should be placed into one module

2017-01-10 Thread Eryk Sun

Changes by Eryk Sun :


--
stage:  -> resolved

___
Python tracker 

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



[issue28870] Reduce stack consumption of PyObject_CallFunctionObjArgs() and like

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

no_small_stack-2.patch has a very bad impact on performances:

haypo@speed-python$ python3 -m perf compare_to 
2017-01-04_12-02-default-ee1390c9b585.json 
no_small_stack-2_refee1390c9b585.json -G --min-speed=5

Slower (59):
- telco: 15.7 ms +- 0.5 ms -> 23.4 ms +- 0.3 ms: 1.49x slower (+49%)
- scimark_sor: 393 ms +- 6 ms -> 579 ms +- 10 ms: 1.47x slower (+47%)
- json_loads: 56.9 us +- 0.9 us -> 83.1 us +- 2.4 us: 1.46x slower (+46%)
- unpickle_pure_python: 698 us +- 10 us -> 984 us +- 10 us: 1.41x slower (+41%)
- scimark_lu: 424 ms +- 22 ms -> 585 ms +- 33 ms: 1.38x slower (+38%)
- chameleon: 22.4 ms +- 0.2 ms -> 30.8 ms +- 0.3 ms: 1.38x slower (+38%)
- xml_etree_generate: 212 ms +- 3 ms -> 291 ms +- 4 ms: 1.37x slower (+37%)
- xml_etree_process: 177 ms +- 3 ms -> 240 ms +- 3 ms: 1.35x slower (+35%)
- raytrace: 1.04 sec +- 0.01 sec -> 1.40 sec +- 0.02 sec: 1.35x slower (+35%)
- logging_simple: 27.9 us +- 0.4 us -> 37.4 us +- 0.5 us: 1.34x slower (+34%)
- pickle_pure_python: 1.02 ms +- 0.01 ms -> 1.37 ms +- 0.02 ms: 1.34x slower 
(+34%)
- logging_format: 33.3 us +- 0.4 us -> 44.5 us +- 0.7 us: 1.34x slower (+34%)
- xml_etree_iterparse: 195 ms +- 5 ms -> 259 ms +- 7 ms: 1.32x slower (+32%)
- chaos: 236 ms +- 3 ms -> 306 ms +- 3 ms: 1.30x slower (+30%)
- regex_compile: 380 ms +- 3 ms -> 494 ms +- 5 ms: 1.30x slower (+30%)
- pathlib: 42.3 ms +- 0.5 ms -> 55.0 ms +- 0.6 ms: 1.30x slower (+30%)
- django_template: 364 ms +- 5 ms -> 471 ms +- 4 ms: 1.29x slower (+29%)
- call_method: 11.2 ms +- 0.2 ms -> 14.4 ms +- 0.2 ms: 1.29x slower (+29%)
- hexiom: 18.4 ms +- 0.2 ms -> 23.7 ms +- 0.2 ms: 1.29x slower (+29%)
- call_method_slots: 11.0 ms +- 0.3 ms -> 14.1 ms +- 0.1 ms: 1.28x slower (+28%)
- richards: 147 ms +- 4 ms -> 188 ms +- 5 ms: 1.28x slower (+28%)
- html5lib: 207 ms +- 7 ms -> 262 ms +- 6 ms: 1.27x slower (+27%)
- genshi_text: 71.5 ms +- 1.3 ms -> 90.3 ms +- 1.1 ms: 1.26x slower (+26%)
- deltablue: 14.2 ms +- 0.2 ms -> 17.9 ms +- 0.4 ms: 1.26x slower (+26%)
- genshi_xml: 164 ms +- 2 ms -> 207 ms +- 3 ms: 1.26x slower (+26%)
- sympy_str: 429 ms +- 5 ms -> 539 ms +- 4 ms: 1.25x slower (+25%)
- go: 493 ms +- 5 ms -> 619 ms +- 7 ms: 1.25x slower (+25%)
- mako: 35.4 ms +- 1.5 ms -> 44.2 ms +- 1.2 ms: 1.25x slower (+25%)
- sympy_expand: 959 ms +- 10 ms -> 1.19 sec +- 0.01 sec: 1.24x slower (+24%)
- nqueens: 215 ms +- 2 ms -> 268 ms +- 1 ms: 1.24x slower (+24%)
(...)

Benchmark ran on speed-python with PGO+LTO, Linux configured for benchmarks 
using python3 -m perf system tune.

--

___
Python tracker 

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



[issue29223] Settable defaulting to decimal instead of float

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

Jim is right, I close the bug. The *bug* tracker is not the best place to 
propose ideas: please use the python-ideas mailing list ;-)

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



[issue29224] OS related file operations (copy, move, delete, rename...) should be placed into one module

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

As Jim Fasarakis-Hilliard wrote in msg285117, the *bug* tracker is not the best 
place to propose changes, so I close this issue.

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



[issue29223] Settable defaulting to decimal instead of float

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

> This issue (and your other issue29223) ...

I guess that you mean issue #29224 "OS related file operations (copy, move, 
delete, rename...) should be placed into one module".

--

___
Python tracker 

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



[issue29223] Settable defaulting to decimal instead of float

2017-01-10 Thread STINNER Victor

STINNER Victor added the comment:

You are not the first one to propose the idea.

2012: "make decimal the default non-integer instead of float?"
https://mail.python.org/pipermail/python-ideas/2012-September/016250.html

2014: "Python Numbers as Human Concept Decimal System"
https://mail.python.org/pipermail/python-ideas/2014-March/026436.html


Related discussions:

2008: "Decimal literal?"
https://mail.python.org/pipermail/python-ideas/2008-December/002379.html

2015: "Python Float Update"
https://mail.python.org/pipermail/python-ideas/2015-June/033787.html

PEP 240 "Adding a Rational Literal to Python".

--
nosy: +haypo

___
Python tracker 

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



  1   2   >