[issue24914] Python: Not just OO style but this is not mentioned on python.org or in FAQ

2015-08-22 Thread Paddy McCarthy

New submission from Paddy McCarthy:

Just read 
http://www.ibmsystemsmag.com/ibmi/developer/general/different-world-python/?utm_campaign=ibm-enewsutm_medium=emailutm_source=ibmi-jul22-2015?utm_content=exclusive1-headline

It states that they could have had an officially supported version of Python on 
that IBM platform much earlier but for this:

 The second was that everything we read on Python, and all the examples we 
 encountered, led us to believe that it was a completely object oriented (OO) 
 language

They may have used it earlier had they known then that Python can be written in 
a procedural style they having no love of Java's OO, but being able to use PHP 
and access PHP's OO bits.

Looking again on python.org, the examples are not OO, but when you delve down, 
say to the FAQ - it gives the mistaken impression that OO is the _only_ style 
of programming supported: 
https://docs.python.org/2/faq/general.html#what-is-python

Somehow we need to explain that OO is an implementation style, but the language 
allows code to be written in just as much - or as little, of 
proceedural/OO/functional styles as the programmer is comfortable with.

--
assignee: docs@python
components: Documentation
messages: 248987
nosy: Paddy McCarthy, docs@python
priority: normal
severity: normal
status: open
title: Python: Not just OO style but this is not mentioned on python.org or in 
FAQ
type: enhancement

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



[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Alecsandru Patrascu

New submission from Alecsandru Patrascu:

Hi All,

This is Alecsandru from Server Scripting Languages Optimization team at Intel 
Corporation.

I would like to submit a request to turn-on Profile Guided Optimization or PGO 
as the default build option for Python (both 2.7 and 3.6), given its 
performance benefits on a wide variety of workloads and hardware.  For 
instance, as shown from attached sample performance results from the Grand 
Unified Python Benchmark, 20% speed up was observed.  In addition, we are 
seeing 2-9% performance boost from OpenStack/Swift where more than 60% of the 
codes are in Python 2.7. Our analysis indicates the performance gain was mainly 
due to reduction of icache misses and CPU front-end stalls.

Attached is the Makefile patches that modify the all build target and adds a 
new one called disable-profile-opt. We built and tested this patch for Python 
2.7 and 3.6 on our Linux machines (CentOS 7/Ubuntu Server 14.04, Intel Xeon 
Haswell/Broadwell with 18/8 cores).  We use regrtest suite for training as it 
provides the best performance improvement.  Some of the test programs in the 
suite may fail which leads to build fail.  One solution is to disable the 
specific failed test using the -x  flag (as shown in the patch)

Steps to apply the patch: 
1.  hg clone https://hg.python.org/cpython cpython 
2.  cd cpython 
3.  hg update 2.7 (needed for 2.7 only) 
4.  Copy *.patch to the current directory 
5.  patch  python2.7-pgo.patch (or patch  python3.6-pgo.patch)
6.  ./configure 
7.  make

To disable PGO
7b. make disable-profile-opt

In the following, please find our sample performance results from latest XEON 
machine, XEON Broadwell EP.  
Hardware (HW):  Intel XEON (Broadwell) 8 Cores

BIOS settings:  Intel Turbo Boost Technology: false
Hyper-Threading: false

Operating System:   Ubuntu 14.04.3 LTS trusty

OS configuration:   CPU freq set at fixed: 2.6GHz by
echo 260  
/sys/devices/system/cpu/cpu*/cpufreq/scaling_min_freq
echo 260  
/sys/devices/system/cpu/cpu*/cpufreq/scaling_max_freq
Address Space Layout Randomization (ASLR) disabled (to 
reduce run to run variation) by
echo 0  /proc/sys/kernel/randomize_va_space

GCC version:gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)

Benchmark:  Grand Unified Python Benchmark (GUPB)
GUPB Source: https://hg.python.org/benchmarks/  
  

Python2.7 results:
Python source: hg clone https://hg.python.org/cpython cpython
Python Source: hg update 2.7
hg id: 0511b1165bb6 (2.7)
hg id -r 'ancestors(.) and tag()': 15c95b7d81dc (2.7) v2.7.10
hg --debug id -i: 0511b1165bb6cf40ada0768a7efc7ba89316f6a5

Benchmarks  Speedup(%)
simple_logging  20
raytrace20
silent_logging  19
richards19
chaos   16
formatted_logging   16
json_dump   15
hexiom2 13
pidigits12
slowunpickle12
django_v2   12
unpack_sequence 11
float   11
mako11
slowpickle  11
fastpickle  11
django  11
go  10
json_dump_v210
pathlib 10
regex_compile   10
pybench 9.9
etree_process   9
regex_v88
bzr_startup 8
2to38
slowspitfire8
telco   8
pickle_list 8
fannkuch8
etree_iterparse 8
nqueens 8
mako_v2 8
etree_generate  8
call_method_slots   7
html5lib_warmup 7
html5lib7
nbody   7
spectral_norm   7
spambayes   7
fastunpickle6
meteor_contest  6
chameleon   6
rietveld6
tornado_http5
unpickle_list   5
pickle_dict 4
regex_effbot3
normal_startup  3
startup_nosite  3
etree_parse 2
call_method_unknown 2
call_simple 1
json_load   1
call_method 1

Python3.6 results
Python source: hg clone https://hg.python.org/cpython cpython
hg id: 96d016f78726 tip
hg id -r 'ancestors(.) and tag()': 1a58b1227501 (3.5) v3.5.0rc1
hg --debug id -i: 96d016f78726afbf66d396f084b291ea43792af1


Benchmark   Speedup(%)
fastunpickle22.94
fastpickle  21.67
json_load   17.64

[issue24754] argparse add_argument with action=store_true, type=bool should not crash

2015-08-22 Thread Konstantin Molchanov

Konstantin Molchanov added the comment:

Although I agree that specifying type with store_true or store_false is 
unnecessary, this shouldn't really be an error like this. Why not just ignore 
type if it can't be utilized?

The error message implies the usage of add_argument is erroneous, however it is 
fully compatible with the spec give in the docs.

Alternatively, the docs should be updated.

--
nosy: +moigagoo

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-22 Thread Cyd Haselton

Cyd Haselton added the comment:

On August 22, 2015 2:47:42 PM CDT, Ryan Gonzalez rep...@bugs.python.org wrote:

Ryan Gonzalez added the comment:

I'm assuming gdb still doesn't work?

It does. I just don't know it well enough to know if the errors are something 
I'm doing wrong or something the program is doing wrong.

Basically I'm running
gdb
file ./python
set args -m test
set sysroot /path/to/sysroot
run

and examining/posting the results.  Which are confusing to me because, again, 
don't know it well enough.

On August 22, 2015 1:06:41 PM CDT, Cyd Haselton
rep...@bugs.python.org wrote:

Cyd Haselton added the comment:

Update: 
I found this bug report (https://bugs.python.org/issue23786) and
re-compiled python with -mno-unaligned-access as mentioned. test_hash
still throws a bus error.

Back to drawing boardsuggestions welcome.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-22 Thread Ryan Gonzalez

Ryan Gonzalez added the comment:

After typing 'run', enter 'bt' and post the results.

On Sat, Aug 22, 2015 at 3:06 PM, Cyd Haselton rep...@bugs.python.org
wrote:


 Cyd Haselton added the comment:

 On August 22, 2015 2:47:42 PM CDT, Ryan Gonzalez rep...@bugs.python.org
 wrote:
 
 Ryan Gonzalez added the comment:
 
 I'm assuming gdb still doesn't work?

 It does. I just don't know it well enough to know if the errors are
 something I'm doing wrong or something the program is doing wrong.

 Basically I'm running
 gdb
 file ./python
 set args -m test
 set sysroot /path/to/sysroot
 run

 and examining/posting the results.  Which are confusing to me because,
 again, don't know it well enough.
 
 On August 22, 2015 1:06:41 PM CDT, Cyd Haselton
 rep...@bugs.python.org wrote:
 
 Cyd Haselton added the comment:
 
 Update:
 I found this bug report (https://bugs.python.org/issue23786) and
 re-compiled python with -mno-unaligned-access as mentioned. test_hash
 still throws a bus error.
 
 Back to drawing boardsuggestions welcome.
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue23496
 ___
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue23496
 ___

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue23496
 ___


--

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



[issue17781] optimize compilation options

2015-08-22 Thread Antoine Pitrou

Antoine Pitrou added the comment:

LTO (Link-Time Optimization) is not the same as PGO, though I guess it can take 
advantage of PGO for its heuristics.

--

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



[issue4709] Mingw-w64 and python on windows x64

2015-08-22 Thread Steve Dower

Changes by Steve Dower steve.do...@python.org:


--
nosy: +steve.dower

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



[issue17781] optimize compilation options

2015-08-22 Thread Stefan Behnel

Stefan Behnel added the comment:

Issue 24915 suggests PGO and comes with an actual patch. I suggest rejecting 
this ticket as too broad.

--
nosy: +scoder

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



[issue24917] time_strftime() Buffer Over-read

2015-08-22 Thread John Leitch

Changes by John Leitch john.leit...@gmail.com:


Added file: http://bugs.python.org/file40229/time_strftime_Buffer_Over-read.py

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



[issue23972] Asyncio reuseport

2015-08-22 Thread chris laws

chris laws added the comment:

I have updated the patch to address comments raised by haypo. 

An exception is now raised if reuse_port is explicitly used and the platform 
does not support SOREUSEPORT. The docs have also been updated to make it more 
explicit that this feature is not supported on Windows.

--
Added file: http://bugs.python.org/file40230/23972_cjl_v002.patch

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



[issue24914] Python: Not just OO style but this is not mentioned on python.org or in FAQ

2015-08-22 Thread Brett Cannon

Brett Cannon added the comment:

The problem is that technically Python is an object-oriented language as 
everything is a language (which is what makes Python more OO than Java). Having 
said that, you can use other programming styles. I'm fine with clarifying the 
entry in the FAQ that Python can be written in other programming styles such as 
procedural or functional. If you have suggested wording, Paddy, please feel 
free to propose a patch.

--
nosy: +brett.cannon
stage:  - needs patch
versions: +Python 3.6

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-22 Thread Ryan Gonzalez

Ryan Gonzalez added the comment:

I'm assuming gdb still doesn't work?

On August 22, 2015 1:06:41 PM CDT, Cyd Haselton rep...@bugs.python.org wrote:

Cyd Haselton added the comment:

Update: 
I found this bug report (https://bugs.python.org/issue23786) and
re-compiled python with -mno-unaligned-access as mentioned. test_hash
still throws a bus error.

Back to drawing boardsuggestions welcome.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23496
___

--

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



[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Brett Cannon

Changes by Brett Cannon br...@python.org:


--
nosy: +brett.cannon
stage:  - patch review

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



[issue24915] Profile Guided Optimization active by-default

2015-08-22 Thread Stefan Behnel

Stefan Behnel added the comment:

Please upload your patches as separate, uncompressed files for review.

PGO was already proposed here, but nothing came out of it:

https://bugs.python.org/issue17781

I suggest rejecting that old ticket and sticking with this one since it has an 
actual patch.

--
nosy: +scoder

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



[issue24917] time_strftime() Buffer Over-read

2015-08-22 Thread John Leitch

New submission from John Leitch:

Python 3.5 suffers from a vulnerability caused by the behavior of the 
time_strftime() function. When called, the function loops over the format 
string provided, using strchr to search for each instance of '%'. After finding 
a '%', it continues to search two characters ahead, assuming that each instance 
is the beginning of a well formed format string token.

However, if a string ends with '%', this logic will result in a call to strchr 
that reads off the end of the format string buffer:

/* check that the format string contains only valid directives */
for(outbuf = strchr(fmt, '%');  Assuming fmt ends with a '%', this will 
return a pointer to the end of the string.
outbuf != NULL;
outbuf = strchr(outbuf+2, '%'))  Once outbuf is pointing to the end 
of the string, outbuf+2 skips
{past the null terimnator, leading 
to a buffer over-read.
if (outbuf[1]=='#')
++outbuf; /* not documented by python, */
if ((outbuf[1] == 'y')  buf.tm_year  0)
{
PyErr_SetString(PyExc_ValueError,
format %y requires year = 1900 on Windows);
Py_DECREF(format);
return NULL;
}
}

In some applications, it may be possible to exploit this behavior to disclose 
the contents of adjacent memory. The buffer over-read can be observed by 
running the following script:

from time import *
strftime(AA%*0x1)

Which, depending on the arrangement of memory, may produce an exception such as 
this:

0:000 g
(20b8.18d4): Access violation - code c005 (first chance)
First chance exceptions are reported before any exception handling.
This exception may be expected and handled.
eax= ebx=52c1a6a0 ecx= edx=08ef3000 esi=08ec2fe8 edi=08ec2ff8
eip=52d254f3 esp=004cf9d4 ebp=004cfa58 iopl=0 nv up ei pl nz na pe nc
cs=0023  ss=002b  ds=002b  es=002b  fs=0053  gs=002b efl=00010206
python35!strchr+0x33:
52d254f3 f30f6f0amovdqu  xmm1,xmmword ptr [edx] 
ds:002b:08ef3000=
0:000 db edx-0x10
08ef2ff0  41 25 41 41 25 41 41 25-00 d0 d0 d0 d0 d0 d0 d0  A%AA%AA%
08ef3000  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3010  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3020  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3030  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3040  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3050  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
08ef3060  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  
0:000 k5
ChildEBP RetAddr  
004cf9d0 52c1a7f6 python35!strchr+0x33 
[f:\dd\vctools\crt\vcruntime\src\string\i386\strchr_sse.inc @ 75]
004cfa58 52c832d3 python35!time_strftime+0x156 
[c:\build\cpython\modules\timemodule.c @ 615]
004cfa74 52ce442f python35!PyCFunction_Call+0x113 
[c:\build\cpython\objects\methodobject.c @ 109]
004cfaa8 52ce18ec python35!call_function+0x2ff [c:\build\cpython\python\ceval.c 
@ 4651]
004cfb20 52ce339f python35!PyEval_EvalFrameEx+0x232c 
[c:\build\cpython\python\ceval.c @ 3184]

To fix this issue, it is recommended that time_strftime() be updated to check 
outputbuf[1] for null in the body of the format string directive validation 
loop. A proposed patch is attached.

Credit: John Leitch (johnlei...@outlook.com), Bryce Darling 
(darlingbr...@gmail.com)

--
files: time_strftime_Buffer_Over-read.patch
keywords: patch
messages: 248998
nosy: JohnLeitch
priority: normal
severity: normal
status: open
title: time_strftime() Buffer Over-read
type: security
versions: Python 3.5
Added file: 
http://bugs.python.org/file40228/time_strftime_Buffer_Over-read.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24917
___
___
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

2015-08-22 Thread Thomas Kluyver

New submission from Thomas Kluyver:

sysconfig currently calculates various formats of the Python version number by 
chopping up the sys.version string. This has a FIXME by it in the code, because 
the the format of sys.version is not guaranteed.

With this patch, the config variables 'py_version', 'py_version_short' and 
'py_version_nodot' are instead generated from sys.version_info, which has a 
specified structure:
https://docs.python.org/3/library/sys.html#sys.version_info

One piece of information is lost by this change: after a pre-release, a + is 
added to the version string - e.g. '3.5.0b4+' means an unreleased version 
somewhere after 3.5.0b4. I can't find any structured representation of this 
information, so 'py_version' no longer contains it. I'm not sure whether it 
matters: I can't find anything using the 'py_version' config variable.

--
components: Library (Lib)
files: sysconfig-version-fixme.patch
keywords: patch
messages: 248989
nosy: takluyver
priority: normal
severity: normal
status: open
title: In sysconfig, don't rely on sys.version format
Added file: http://bugs.python.org/file40227/sysconfig-version-fixme.patch

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



[issue23496] Steps for Android Native Build of Python 3.4.2

2015-08-22 Thread Cyd Haselton

Cyd Haselton added the comment:

Update: 
I found this bug report (https://bugs.python.org/issue23786) and re-compiled 
python with -mno-unaligned-access as mentioned. test_hash still throws a bus 
error.

Back to drawing boardsuggestions welcome.

--

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