[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

Thank you for upstreaming this in both branches of Python!
Do you think that a different version of regrtest.py, that will be used only 
for PGO training, should be better in this case? I mean, by implementing a 
custom version, I think we can control better the output and errors shown on 
screen.

--

___
Python tracker 

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



[issue25106] Hash computation speedup for {buffer, string, unicode}object

2015-09-19 Thread Brett Cannon

Changes by Brett Cannon :


--
status: open -> pending

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Brett Cannon

Brett Cannon added the comment:

A separate issue is fine, Alecsandru, since we can make it a dependency of this 
issue.

--

___
Python tracker 

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



[issue25176] Link to urllib.parse.parse_qsl, not parse_qs, from cgi.parse_qsl doc

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue14586] TypeError: truncate() takes no keyword arguments

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

I agree with Guy’s earlier comments and would prefer this be fixed in the 
documentation. Otherwise, we would end up with third party IOBase 
implementations that use the wrong keyword name, or that don’t accept keywords 
at all. These would no longer be compatible with the new API.

Also the new patch competes with Issue 25057, also proposing keyword arguments 
for seek().

--

___
Python tracker 

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



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

2015-09-19 Thread Alecsandru Patrascu

New submission from Alecsandru Patrascu:

This issue adds improved support for Profile Guided Optimization builds in the 
regression test suite. 

Mainly, we keep the visual progress status in this process and suppress errors 
or any other unnecessary output that can alarm users.

--
components: Library (Lib)
messages: 251140
nosy: alecsandru.patrascu
priority: normal
severity: normal
status: open
title: regrtest.py improvement for Profile Guided Optimization builds
type: performance
versions: Python 2.7, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25185] Inconsistency between venv and site

2015-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Example:

$ LC_ALL=ru_RU.cp1251 ./python -m venv ../vpy×
$ LC_ALL=ru_RU.cp1251 ./python -m venv ../vpyØ
Error: 'charmap' codec can't encode character '\udc98' in position 617: 
character maps to 

The first command is successful, the latter command is failed. 
'Ø'.encode('utf-8') == b'\xc3\x98', and 0x98 is invalid code in CP1251.

--

___
Python tracker 

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



[issue25108] traceback.extract_stack() compatibility break in 3.5

2015-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Arfrever.

--

___
Python tracker 

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



[issue25108] traceback.extract_stack() compatibility break in 3.5

2015-09-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 7e718bbf5152 by Serhiy Storchaka in branch '2.7':
Issue #25108: Fixed test_traceback in the case when this test is run twice.
https://hg.python.org/cpython/rev/7e718bbf5152

--

___
Python tracker 

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



[issue25108] traceback.extract_stack() compatibility break in 3.5

2015-09-19 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

> New changeset f6125114b55f by Serhiy Storchaka in branch '2.7':
> Issue #25108: Backported tests for traceback functions print_stack(),
> https://hg.python.org/cpython/rev/f6125114b55f

The new tests fail on 2.7 branch when Lib/test/test_traceback.pyc is present, 
because __file__ can contain path to *.pyc files in Python 2.
It is sufficient to run test_traceback twice to reproduce problem:

$ LD_LIBRARY_PATH="$(pwd)" ./python -m test.regrtest -v test_traceback
...
$ LD_LIBRARY_PATH="$(pwd)" ./python -m test.regrtest -v test_traceback
== CPython 2.7.10+ (2.7:fe84898fbe98, Sep 20 2015, 06:52:14) [GCC 4.9.3]
==   Linux-4.1.7 little-endian
==   /tmp/cpython/build/test_python_24845
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0, hash_randomization=0)
[1/1] test_traceback
test_bad_indentation (test.test_traceback.TracebackCases) ... ok
test_base_exception (test.test_traceback.TracebackCases) ... ok
test_bug737473 (test.test_traceback.TracebackCases) ... ok
test_caret (test.test_traceback.TracebackCases) ... ok
test_format_exception_only_bad__str__ (test.test_traceback.TracebackCases) ... 
ok
test_nocaret (test.test_traceback.TracebackCases) ... ok
test_string_exception1 (test.test_traceback.TracebackCases) ... ok
test_string_exception2 (test.test_traceback.TracebackCases) ... ok
test_unicode (test.test_traceback.TracebackCases) ... ok
test_without_exception (test.test_traceback.TracebackCases) ... ok
test_format_stack (test.test_traceback.TracebackFormatTests) ... FAIL
test_print_stack (test.test_traceback.TracebackFormatTests) ... FAIL
test_traceback_format (test.test_traceback.TracebackFormatTests) ... ok
test_extract_stack (test.test_traceback.MiscTracebackCases) ... FAIL

==
FAIL: test_format_stack (test.test_traceback.TracebackFormatTests)
--
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 232, in test_format_stack
'return traceback.format_stack()\n' % (__file__, lineno+1),
AssertionError: Lists differ: ['  File "/tmp/cpython/Lib/tes... != ['  File 
"/tmp/cpython/Lib/tes...

First differing element 0:
  File "/tmp/cpython/Lib/test/test_traceback.py", line 226, in test_format_stack
result = fmt()

  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 226, in 
test_format_stack
result = fmt()


- ['  File "/tmp/cpython/Lib/test/test_traceback.py", line 226, in 
test_format_stack\nresult = fmt()\n',
+ ['  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 226, in 
test_format_stack\nresult = fmt()\n',
?  +

-  '  File "/tmp/cpython/Lib/test/test_traceback.py", line 225, in fmt\n
return traceback.format_stack()\n']
+  '  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 225, in fmt\n
return traceback.format_stack()\n']
?  +


==
FAIL: test_print_stack (test.test_traceback.TracebackFormatTests)
--
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 220, in test_print_stack
'traceback.print_stack()',
AssertionError: Lists differ: ['  File "/tmp/cpython/Lib/tes... != ['  File 
"/tmp/cpython/Lib/tes...

First differing element 0:
  File "/tmp/cpython/Lib/test/test_traceback.py", line 214, in test_print_stack
  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 214, in test_print_stack

- ['  File "/tmp/cpython/Lib/test/test_traceback.py", line 214, in 
test_print_stack',
+ ['  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 214, in 
test_print_stack',
?  +

   'prn()',
-  '  File "/tmp/cpython/Lib/test/test_traceback.py", line 212, in prn',
+  '  File "/tmp/cpython/Lib/test/test_traceback.pyc", line 212, in prn',
?  +

   'traceback.print_stack()']

==
FAIL: test_extract_stack (test.test_traceback.MiscTracebackCases)
--
Traceback (most recent call last):
  File "/tmp/cpython/Lib/test/test_traceback.py", line 248, in 
test_extract_stack
(__file__, lineno+1, 'extract', 'return traceback.extract_stack()'),
AssertionError: Lists differ: [('/tmp/cpython/Lib/test/test_... != 
[('/tmp/cpython/Lib/test/test_...

First differing element 0:
('/tmp/cpython/Lib/test/test_traceback.py', 244, 'test_extract_stack', 'result 
= 

[issue23738] Clarify documentation of positional-only default values

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


--
dependencies: +TypeError: truncate() takes no keyword arguments

___
Python tracker 

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



[issue25180] Tools/parser/unparse.py needs to be updated for f-strings

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

I think this patch should do it. No major surgery required, just a good dose of 
recursion :)

def test_nested_fstrings(self):  # Original code
y = 5
self.assertEqual(f'{f"{0}"*3}', '000')
self.assertEqual(f'{f"{y}"*3}', '555')
self.assertEqual(f'{f"{\'x\'}"*3}', 'xxx')

self.assertEqual(f"{r'x' f'{\"s\"}'}", 'xs')
self.assertEqual(f"{r'x'rf'{\"s\"}'}", 'xs')

def test_nested_fstrings(self):  # Unparsed output
y = 5
self.assertEqual(f"{(f'{0}' * 3)}", '000')
self.assertEqual(f"{(f'{y}' * 3)}", '555')
self.assertEqual(f'{(f"{\'x\'}" * 3)}', 'xxx')
self.assertEqual(f'{f"x{\'s\'}"}', 'xs')
self.assertEqual(f'{f"x{\'s\'}"}', 'xs')

There was no problem getting the quoting right; repr() takes care of that, and 
then you slap the “f” on the front. The most subtle thing was knowing that f"{ 
{...} }" cannot be unparsed as f"{{...}}". I unparse other expressions without 
adding spaces, but unparse that one as f"{ {...}}".

Tested by running ./python -bWall -m test -u cpu test_tools

--
keywords: +patch
nosy: +martin.panter
stage: needs patch -> patch review
Added file: http://bugs.python.org/file40524/fstring-unparse.patch

___
Python tracker 

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



[issue25170] 3.5.0 documentation archives missing

2015-09-19 Thread Georg Brandl

Georg Brandl added the comment:

This is still in PEP 101:

  ___ If this is a final release: Move the doc zips and tarballs to
  /srv/www.python.org/ftp/python/doc/X.Y.Z, creating the directory
  if necessary, and adapt the "current" symlink in .../doc to point to
  that directory.  Note though that if you're releasing a maintenance
  release for an older version, don't change the current link.

https://docs.python.org/3.5/archives/ will have the *continuously rebuilt* 
versions, so it's not the same.

--
status: closed -> open

___
Python tracker 

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



[issue21264] test_compileall fails to build in the installed location

2015-09-19 Thread R. David Murray

R. David Murray added the comment:

Yes the point is to test compilation of the path.  If I run python3 -m 
compilelall on my installed python, it works fine (zero return code).  I can't 
really investigate this further right now, but it isn't obvious to me what the 
answer is from the information in the issue so far, except that it doesn't 
*look* like it should be necessary to skip the tests unless the installation 
directories are read only *and* the .pyc files in them are non-existent or out 
of date.

--

___
Python tracker 

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



[issue25079] Tokenize generates NL instead of NEWLINE for comments

2015-09-19 Thread Optimal BPM

Optimal BPM added the comment:

OK.
But just to make me understand, would that explain why an else statement gets 
its DEDENT before the else, instead of before an dedented comment just before 
it? 
Even if the comment is visually dedented as the else?

Example where tokenize returns the DEDENT in a separate place than where it is 
visually:

if a=b:
  statement
# Comment
else:
  other statement

In the above case, the DEDENT is reportet before the else, instead of before 
the comment.

--

___
Python tracker 

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



[issue25175] Documentation-Tkinter Clarify module spelling change in Python 3 docs

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

Perhaps it would be better to add the notice inside the big “See also” box at 
the top. In particular I occasionally find myself looking at the NMT “Tkinter 
reference: a GUI for Python” and Effbot sites as a substitute for the missing 
built-in documentation, and both these are written for Python 2. On the other 
hand, the TkDocs site is also useful, and seem to use Python 3.

--

___
Python tracker 

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



[issue25175] Documentation-Tkinter Clarify module spelling change in Python 3 docs

2015-09-19 Thread Carol Willing

Carol Willing added the comment:

Thank you Bar Harel for submitting a patch.

Ultimately, I believe that the wording should be what is most helpful for the 
end users.

If you wish to avoid mentioning Python 2, then a simple note cautioning the 
user to take care that the case of the module should match the user's Python 
version. 

"Note: Python 3 uses all lowercase for the 'tkinter' module. Earlier versions 
of Python used 'Tkinter'. Please take care to use the correct module name that 
corresponds to the Python version being used."

--

___
Python tracker 

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



[issue25187] bdist_rpm fails due to wrong hardcoded assumption about RPM filename format

2015-09-19 Thread David Ward

New submission from David Ward:

bdist_rpm wrongly assumes a hard-coded format for the filename of the 
non-source RPM which is generated when it calls rpmbuild, specifically:
"%{arch}/%{name}-%{version}-%{release}.%{arch}.rpm"

The format used by rpmbuild is actually specified by the RPM macro 
%{_rpmfilename}. With the /usr/lib/rpm/macros file that is shipped with 
official releases of RPM (at http://rpm.org), %{_rpmfilename} evaluates to the 
value above. However this value cannot be assumed: the directory "%{arch}/" is 
dropped under the Mock chroot environment 
(https://fedoraproject.org/wiki/Mock). Mock is used to build all official 
Fedora Project packages (by Koji) as well as unofficial packages (by Copr). 
These two build systems also target Extra Packages for Enterprise Linux (EPEL) 
in addition to Fedora releases.

As a result, bdist_rpm fails when trying to move the non-source RPM to the 
'dist' folder after it is built by rpmbuild.

The attached patch causes bdist_rpm to evaluate "%{_rpmfilename}" instead of 
relying on the hard-coded value.

--
components: Distutils
files: python-bdist_rpm-evaluate-_rpmfilename.patch
keywords: patch
messages: 251136
nosy: dpward, dstufft, eric.araujo
priority: normal
severity: normal
status: open
title: bdist_rpm fails due to wrong hardcoded assumption about RPM filename 
format
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: 
http://bugs.python.org/file40523/python-bdist_rpm-evaluate-_rpmfilename.patch

___
Python tracker 

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



[issue25179] PEP 498 f-strings need to be documented

2015-09-19 Thread Eric V. Smith

New submission from Eric V. Smith:

Issue 24965 add f-strings (see PEP 498). They need to be documented.

--
assignee: docs@python
components: Documentation
messages: 251101
nosy: docs@python, eric.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: PEP 498 f-strings need to be documented
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



[issue25182] python -v crashes in nonencodable directory

2015-09-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

$ pwd
/home/serhiy/py/cpy�thon-3.5
$ ./python -v
import _frozen_importlib # frozen
import _imp # builtin
import sys # builtin
import '_warnings' # 
import '_thread' # 
import '_weakref' # 
import '_frozen_importlib_external' # 
import '_io' # 
import 'marshal' # 
import 'posix' # 
import _thread # previously loaded ('_thread')
import '_thread' # 
import _weakref # previously loaded ('_weakref')
import '_weakref' # 
# installing zipimport hook
import 'zipimport' # 
# installed zipimport hook
Fatal Python error: Py_Initialize: Unable to get the locale encoding
Traceback (most recent call last):
  File "", line 969, in _find_and_load
# destroy io
  File "", line 958, in _find_and_load_unlocked
# destroy io
  File "", line 673, in _load_unlocked
# destroy io
  File "", line 658, in exec_module
# destroy io
  File "", line 759, in get_code
# destroy io
  File "", line 368, in _verbose_message
# destroy io
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 
21: surrogates not allowed
# destroy encodings
Aborted (core dumped)

--
messages: 251115
nosy: brett.cannon, eric.snow, ncoghlan, serhiy.storchaka
priority: normal
severity: normal
status: open
title: python -v crashes in nonencodable directory
type: crash
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25185] Inconsistency between venv and site

2015-09-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +vinay.sajip

___
Python tracker 

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



[issue25185] Inconsistency between venv and site

2015-09-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

venv writes pyvenv.cfg with utf-8 encoding, but site reads it with locale 
encoding.

--
components: Library (Lib)
messages: 251119
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Inconsistency between venv and site
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25175] Documentation-Tkinter Clarify module spelling change in Python 3 docs

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

Normally the documentation doesn’t mention changes from Python 2. But in this 
case one often has to rely on other sources of documentation, which are often 
about Python 2, so I think the notice might be reasonable.

--
components: +Tkinter
stage: needs patch -> patch review
versions: +Python 3.4 -Python 2.7

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I think the --pgo flag needs only work in single process mode, since
multi-process would probably not write out the profiling data properly.

--

___
Python tracker 

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



[issue25176] Link to urllib.parse.parse_qsl, not parse_qs, from cgi.parse_qsl doc

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

Thanks for the patch. This only applies to the Python 3 doc; Python 2 does not 
have the error.

--
assignee: docs@python -> martin.panter
nosy: +berker.peksag, martin.panter
stage:  -> commit review
versions: +Python 3.4, Python 3.5

___
Python tracker 

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



[issue25176] Link to urllib.parse.parse_qsl, not parse_qs, from cgi.parse_qsl doc

2015-09-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3ed2427758cf by Martin Panter  in branch '3.4':
Issue #25176: Correct link for cgi.parse_qsl; patch from Ville Skyttä
https://hg.python.org/cpython/rev/3ed2427758cf

New changeset 138bbb7cf612 by Martin Panter  in branch '3.5':
Issue #25176: Merge cgi.parse_qsl link from 3.4 into 3.5
https://hg.python.org/cpython/rev/138bbb7cf612

New changeset f08d56387982 by Martin Panter  in branch 'default':
Issue #25176: Merge cgi.parse_qsl link from 3.5
https://hg.python.org/cpython/rev/f08d56387982

--
nosy: +python-dev

___
Python tracker 

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



[issue25180] Tools/parser/unparse.py needs to be updated for f-strings

2015-09-19 Thread Eric V. Smith

Eric V. Smith added the comment:

And it always fails with "-u cpu", which the buildbots use.

--

___
Python tracker 

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



[issue25181] Tests failed in nondecodable directory

2015-09-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

A number of tests are failed or skipped when run in directory with a name that 
contains non-decodable characters. Attached output of following command:

./python -m test.regrtest -uall -v test_cgitb test_cmd_line test_gdb 
test_inspect test_multiprocessin_fork test_multiprocessing_forkserver 
test_multiprocessing_spawn test_pdb test_pydoc test_pyexpat test_sax test_site 
test_subprocess test_tk test_venv test_xml_etree test_xml_etree_c

test_logging just hangs.

Locale is en_US.utf8.

--
components: Tests
files: tests.log
messages: 251113
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Tests failed in nondecodable directory
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40521/tests.log

___
Python tracker 

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



[issue25106] Hash computation speedup for {buffer, string, unicode}object

2015-09-19 Thread Jelle Zijlstra

Changes by Jelle Zijlstra :


--
nosy: +Jelle Zijlstra
status: pending -> open

___
Python tracker 

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



[issue25182] python -v crashes in nonencodable directory

2015-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

python without -v is not failed.

If wrap message in _bootstrap_external._verbose_message with '!%a'% and in 
_bootstrap._verbose_message with '%a'% (why _verbose_message is duplicated in 
_bootstrap and _bootstrap_external?), the output is:

...
# installing zipimport hook
@"import 'zipimport' # "
# installed zipimport hook
!'# 
/home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/__pycache__/__init__.cpython-35.pyc
 matches /home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/__init__.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/encodings/__pycache__/__init__.cpython-35.pyc'"
!'# /home/serhiy/py/cpy\udcffthon-3.5/Lib/__pycache__/codecs.cpython-35.pyc 
matches /home/serhiy/py/cpy\udcffthon-3.5/Lib/codecs.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/__pycache__/codecs.cpython-35.pyc'"
@"import '_codecs' # "
@"import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 
0xb70b9aac>"
!'# 
/home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/__pycache__/aliases.cpython-35.pyc
 matches /home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/aliases.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/encodings/__pycache__/aliases.cpython-35.pyc'"
@"import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader 
object at 0xb70c81ac>"
@"import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 
0xb70b96cc>"
!'# 
/home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/__pycache__/utf_8.cpython-35.pyc
 matches /home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/utf_8.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/encodings/__pycache__/utf_8.cpython-35.pyc'"
@"import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader 
object at 0xb70ccd2c>"
@"import '_signal' # "
!'# 
/home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/__pycache__/latin_1.cpython-35.pyc
 matches /home/serhiy/py/cpy\udcffthon-3.5/Lib/encodings/latin_1.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/encodings/__pycache__/latin_1.cpython-35.pyc'"
@"import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader 
object at 0xb70cf54c>"
!'# /home/serhiy/py/cpy\udcffthon-3.5/Lib/__pycache__/io.cpython-35.pyc matches 
/home/serhiy/py/cpy\udcffthon-3.5/Lib/io.py'
!"# code object from 
'/home/serhiy/py/cpy\\udcffthon-3.5/Lib/__pycache__/io.cpython-35.pyc'"
...

Verbose non-ascii message is written before importing codecs.

--

___
Python tracker 

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



[issue25186] Don't duplicate _verbose_message in importlib._bootstrap and _bootstrap_external

2015-09-19 Thread Brett Cannon

New submission from Brett Cannon:

For some reason _verbose_message() is defined in both _bootstrap and 
_bootstrap_external. Probably should only have it in _bootstrap, unless Eric 
has a reason he duplicated the code.

--
components: Library (Lib)
messages: 251124
nosy: brett.cannon, eric.snow
priority: normal
severity: normal
status: open
title: Don't duplicate _verbose_message in importlib._bootstrap and 
_bootstrap_external
type: enhancement
versions: Python 3.6

___
Python tracker 

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



[issue25175] Documentation-Tkinter Clarify module spelling change in Python 3 docs

2015-09-19 Thread Mark Lawrence

Mark Lawrence added the comment:

Does this open a can of worms?  "You did it for Tkinter, why not do it for 
everything that was changed by PEP3108"?

--
nosy: +BreamoreBoy

___
Python tracker 

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



[issue25177] OverflowError in statistics.mean when summing large floats

2015-09-19 Thread Bar Harel

Bar Harel added the comment:

Seems like this is the only viable option. It fixes the OverflowError but comes 
at the cost of precision and time.
Another option would be to try/except the overflow error and only then return 
the slower method.
Regarding the data [8.988465674311579e+307, 8.98846567431158e+307], float has 
lesser precision than other types like Decimal so the patched method would 
return 8.98846567431158e+307.
A dataset to test the fix is [8.99e+307, 8.989e+307] which gives a correct 
result.

--
keywords: +patch
Added file: http://bugs.python.org/file40519/issue25177.patch

___
Python tracker 

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



[issue23883] __all__ lists are incomplete

2015-09-19 Thread Jacek Kołodziej

Jacek Kołodziej added the comment:

Does anyone have strong preference towards one of the propositions above?

TestCase subclass looks reasonable IMHO, but I'd not add that to the scope of 
this issue (I'd be happy to implement it later, though).

Any suggestions?

--

___
Python tracker 

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



[issue24965] Implement PEP 498: Literal String Formatting

2015-09-19 Thread Eric V. Smith

Eric V. Smith added the comment:

Documentation task added as issue #25179.

Thanks to Martin for the great code reviews.

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



[issue25180] Tools/parser/unparse.py needs to be updated for f-strings

2015-09-19 Thread Eric V. Smith

New submission from Eric V. Smith:

test_unparse.py occasionally fails if it picks a module that uses f-strings.

--
assignee: eric.smith
keywords: easy
messages: 251106
nosy: eric.smith
priority: normal
severity: normal
stage: needs patch
status: open
title: Tools/parser/unparse.py needs to be updated for f-strings
type: behavior
versions: Python 3.6

___
Python tracker 

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



[issue25177] OverflowError in statistics.mean when summing large floats

2015-09-19 Thread Mark Dickinson

Mark Dickinson added the comment:

That patch doesn't really help, I'm afraid, since it introduces problems at the 
other end of the floating-point range: for example, `mean([5e-324, 5e-324])` 
would give `0.0` with that patch (instead of the `5e-324` it currently gives).

So currently, when computing the mean of a sequence of floats (possibly mixed 
with ints), the code:

1. Computes the sum as a Fraction.
2. Converts that Fraction to a float.
3. Divides the result by the number of elements.

Reversing steps 2 and 3 here would solve the issue, but would require some 
refactoring.  It's really up to Steven whether he thinks that that refactoring 
is worth it for these corner cases at the extremes of the floating-point range. 
 (It's difficult to imagine that such numbers would turn up frequently in 
practical applications.)

--

___
Python tracker 

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



[issue24965] Implement PEP 498: Literal String Formatting

2015-09-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a10d37f04569 by Eric V. Smith in branch 'default':
Issue #24965: Implement PEP 498 "Literal String Interpolation". Documentation 
is still needed, I'll open an issue for that.
https://hg.python.org/cpython/rev/a10d37f04569

--

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Skip Montanaro

Skip Montanaro added the comment:

Would it be possible to grep out the warning messages, but let everything
else through?
On Sep 19, 2015 1:34 PM, "Brett Cannon"  wrote:

>
> Brett Cannon added the comment:
>
> The problem with the output is that error cases are unimportant and yet it
> fooled Skip into temporarily caring until he finally noticed the warning
> message. So my worry is that someone doesn't notice the "NOTE: ignore
> errors as they don't affect anything" and then glances at the output to
> notice an error and then worries that their PGO run failed.
>
> It people really want to add output back in, though, they will need to
> patch both the Makefile to have a big NOTE in it as well as the README to
> say that any errors during the test suite run are unimportant and do not
> affect the outcome of the profile-guided optimizations.
>
> --
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue25180] Tools/parser/unparse.py needs to be updated for f-strings

2015-09-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 37d3b95a289b by Eric V. Smith in branch 'default':
Temporary hack for issue #25180: exclude test_fstring.py from the unparse 
round-tripping, while I figure out how to properly fix it.
https://hg.python.org/cpython/rev/37d3b95a289b

--
nosy: +python-dev

___
Python tracker 

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



[issue25182] python -v crashes in nonencodable directory

2015-09-19 Thread Brett Cannon

Brett Cannon added the comment:

And what happens if you leave -v off? Since the failure is in Py_Initialize I 
want to know if that Py_FatalError trigger is avoided without -v.

A possible fix to test is to simply modify 
importlib._bootstrap._verbose_message to catch UnicodeDecodeError and then 
print some message saying that there was some undecodable string and just 
swallow the exception. I just don't know if this is in the right place to 
prevent Py_Initialize from erroring out.

--

___
Python tracker 

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



[issue25175] Documentation-Tkinter Clarify module spelling change in Python 3 docs

2015-09-19 Thread Bar Harel

Bar Harel added the comment:

Is this good? :-)

--
keywords: +patch
nosy: +bar.harel
Added file: http://bugs.python.org/file40520/Issue25175.patch

___
Python tracker 

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



[issue25183] python -m inspect --details fails in nondecodable directory

2015-09-19 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

$ pwd
/home/serhiy/py/cpy�thon-3.5
$ ./python -m inspect --details unittest
Target: unittest
Traceback (most recent call last):
  File "/home/serhiy/py/cpy\udcffthon-3.5/Lib/runpy.py", line 170, in 
_run_module_as_main
"__main__", mod_spec)
  File "/home/serhiy/py/cpy\udcffthon-3.5/Lib/runpy.py", line 85, in _run_code
exec(code, run_globals)
  File "/home/serhiy/py/cpy\udcffthon-3.5/Lib/inspect.py", line 3050, in 

_main()
  File "/home/serhiy/py/cpy\udcffthon-3.5/Lib/inspect.py", line 3030, in _main
print('Origin: {}'.format(getsourcefile(module)))
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcff' in position 
27: surrogates not allowed

--
components: Library (Lib)
messages: 251116
nosy: serhiy.storchaka, yselivanov
priority: normal
severity: normal
status: open
title: python -m inspect --details fails in nondecodable directory
type: behavior
versions: Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue25146] IDLE debugger could better visualize program execution

2015-09-19 Thread Mark Roseman

Mark Roseman added the comment:

Regarding the nested loops, what's happening is:
- IDLE tells interpreter to run program
- Interpreter now has control and is running program, start to end
- Because execution is being traced, before every statement we get a callback

If we didn't use the nested loop and just returned back immediately after we're 
called, the program would go onto the next statement, and the next one, etc. 
(it's in control).

Instead, we block to force the program to wait until we do something, at which 
point it continues to the next statement, after possibly modifying the 
conditions under which the execution traces fire.

If instead, we tell the execution tracing to actually stop on every statement 
(rather than running through start to end), we'll get a callback for each 
statement (to update our display), but can decide to stay stopped, or 
immediately continue on, based on whether we last did single-step, in/out, go, 
etc. That way it is more event-based: we don't need the nested event loop to 
'block' the program from running.

Totally agree on your suggestions (speed setting, and whether or not to show 
where we are outside our own code).

--

___
Python tracker 

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



[issue25181] Tests failed in nondecodable directory

2015-09-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +"python -m pydoc -w" fails in nondecodable directory, python -m 
inspect --details fails in nondecodable directory, python -v crashes in 
nonencodable directory

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Alecsandru Patrascu

Alecsandru Patrascu added the comment:

I can work on modifying the existing regrtest and adding a distinct flag, --pgo 
for example, as Antoine suggested. Indeed, it will not be trivial as regrtest 
has a dual approach (single process and multi process), but I will give it a 
try and post a patch as soon as possible.

I also suggest that I open a new issue for this case as it is somehow a 
distinct implementation than pure PGO and definitively will be some iterations 
on regrtest.py for both versions of Python until we reach a common ground. It 
is ok for everyone?

--

___
Python tracker 

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



Re: Einstein's Riddle

2015-09-19 Thread Michael Torrie
On 09/18/2015 03:51 AM, Nick Sarbicki wrote:
> On Fri, Sep 18, 2015 at 10:33 AM, Steven D'Aprano 
>> Time is relative. Perhaps the poster has been travelling at close to the
>> speed of light, and for him it is only a few minutes after the original
>> post was sent.
> 
> I prefer to think that it just took him this long to do it.

Probably what happened is some computer somewhere was finally rebooted
after 15 years of uptime, and this messages finally was processed after
years stuck in the queue.

I read once of a university that, upon decomissioning a mainframe, found
a job that had been in the queue for many years but had never run.
Probably some poor grad student's job.

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Hello

2015-09-19 Thread Mark Lawrence

On 19/09/2015 18:31, Dennis Lee Bieber wrote:

On Thu, 17 Sep 2015 16:10:55 +0100, moon khondkar 
declaimed the following:


Hello I have problem with python installation.I downloaded python 3.5 but I cannot 
use it on my computer.I can not open the idle. I get something like saying 
"users\local settings\Application data\programs\python\python35-32\pythonw.exe 
is not valid win32 application. Thanks that will be help if you can solve this.


Given that path, you have a very strangely configured Windows system...



All change with 3.5, so that looks about right for a default user 
installation, with "install for all users" going under "Program Files".


--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

--
https://mail.python.org/mailman/listinfo/python-list


RE: Hello

2015-09-19 Thread Watson, Paul
> Hello I have problem with python installation.I downloaded python 3.5 but
> I cannot use it on my computer.I can not open the idle. I get something like 
> saying
> "users\local settings\Application data\programs\python\python35-32\pythonw.exe
> is not valid win32 application. Thanks that will be help if you can solve 
> this.

Did you verify that the md5sum for the file you downloaded is correct?
https://www.python.org/downloads/release/python-350/

*-*-*- PRESBYTERIAN_HEALTHCARE_SERVICES_DISCLAIMER -*-*-*

This message originates from Presbyterian Healthcare Services or one of its 
affiliated organizations.
It contains information, which may be confidential or privileged, and is 
intended only for the
individual or entity named above. It is prohibited for anyone else to disclose, 
copy, distribute
or use the contents of this message. All personal messages express views solely 
of the sender, which are
not to be attributed to Presbyterian Healthcare Services or any of its 
affiliated organizations, and may not
be distributed without this disclaimer. If you received this message in error, 
please notify us immediately
at i...@phs.org. 

If you would like more information about Presbyterian Healthcare Services 
please visit our web site

http://www.phs.org


-- 
https://mail.python.org/mailman/listinfo/python-list


[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Instead of writing a custom test runner from scratch, I would suggest adding a 
hidden --option to regrtest that would disable reporting errors.

--

___
Python tracker 

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



[issue25146] IDLE debugger could better visualize program execution

2015-09-19 Thread Mark Roseman

Mark Roseman added the comment:

Ok, I lied. The program runs through start to finish regardless, and all the 
'stopping' and breakpoints is really just very selectively deciding which 
subset of execution tracing events to pass back to the debugger. So you really 
do need to 'block' in those callbacks.

Doing this in the remote debugger is relatively easy with just a small tweak 
(turning a synchronous call into an async one, so we control when the callback 
'completes'). 

Doing so in the 'run without subprocess' scenario would be tougher, and we'd 
need to either keep the nested loops or do some funky thing with threads.

--

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Brett Cannon

Brett Cannon added the comment:

It didn't break gcc, the buildbot simply wasn't patient enough for the PGO run 
of the test suite to complete: 
http://buildbot.python.org/all/builders/AMD64%20Debian%20PGO%203.5/builds/274/steps/compile/logs/stdio
 . It takes a good amount of time to run the test suite serially with an 
instrumented interpreter and 20 minutes is not enough time. And I don't want to 
add output back simply to appease the buildbot as the output means nothing to a 
user who is doing the build themselves.

So either that buildbot needs to allow for a longer time without output, 
someone needs to come up with a way to simply emit some output that simply 
shows stuff is running (but without letting error condition stuff show up), or 
the buildbot just won't work with PGO.

--
status: open -> pending

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Le 19/09/2015 20:18, Brett Cannon a écrit :
> 
> And I don't
want to add output back simply to appease the buildbot as the output
means nothing to a user who is doing the build themselves.

The output is actually a good indication of progress, so I don't think
it's not as silly to add it back as you seem to think it is :-)

--
status: pending -> open

___
Python tracker 

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



[issue16701] Docs missing the behavior of += (in-place add) for lists.

2015-09-19 Thread R. David Murray

R. David Murray added the comment:

I suggested updating the library reference in my first reply on this issue.  No 
one has proposed a patch yet, though.

--

___
Python tracker 

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



[issue25170] 3.5.0 documentation archives missing

2015-09-19 Thread R. David Murray

R. David Murray added the comment:

I'm not sure there's no bug here, though there certainly doesn't seem to be any 
bug in your execution of the release process.  I think we should ask Georg's 
opinion at least.

--
nosy: +georg.brandl, r.david.murray

___
Python tracker 

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



[issue25173] IDLE - several common dialogs don't have correct parent set

2015-09-19 Thread Mark Roseman

Mark Roseman added the comment:

I think both master and parent are needed, for the likely rare case when you 
don't want a dialog attached to any window, but it needs a Tk window handle to 
build the dialog from. 

Ran across that in SearchEngine, which has a root window just for the purpose 
of creating dialogs, but the search engine doesn't know what search dialog is 
invoking it (a bad example, as in this case, the dialogs should be the ones 
display the error, not the search engine).

Anyway, have attached masterparent.patch for default branch which updates those 
message and file dialogs that make sense to use parent instead of master.

--
keywords: +patch
Added file: http://bugs.python.org/file40517/masterparent.patch

___
Python tracker 

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



[issue25173] IDLE - several common dialogs don't have correct parent set

2015-09-19 Thread Mark Roseman

Mark Roseman added the comment:

Attached masterparent27.patch, same thing for 2.7 branch

--
Added file: http://bugs.python.org/file40518/masterparent27.patch

___
Python tracker 

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



[issue16322] time.tzname on Python 3.3.0 for Windows is decoded by wrong encoding

2015-09-19 Thread Petr Prikryl

Petr Prikryl added the comment:

I have worked around a bit differently -- the snippet from the code:

result = time.tzname[0]# simplified version of the original code.

# Because of the bug in Windows libraries, Python 3.3 tried to work around
# some issues. However, the shit hit the fan, and the bug bubbled here.
# The `time.tzname` elements are (unicode) strings; however, they were
# filled with bad content. See https://bugs.python.org/issue16322 for 
details.
# Actually, wrong characters were passed instead of the good ones.
# This code should be skipped later by versions of Python that will fix
# the issue.
import platform
if platform.system() == 'Windows':
# The concrete example for Czech locale:
# - cp1250 (windows-1250) is used as native encoding
# - the time.tzname[0] should start with 'Střední Evropa'
# - the ascii('Střední Evropa') should return "'St\u0159edn\xed Evropa'"
# - because of the bug it returns "'St\xf8edn\xed Evropa'"
#
# The 'ř' character has unicode code point `\u0159` (that is hex)
# and the `\xF8` code in cp1250. The `\xF8` was wrongly used
# as a Unicode code point `\u00F8` -- this is for the Unicode
# character 'ø' that is observed in the string.
#
# To fix it, the `result` string must be reinterpreted with a different
# encoding. When working with Python 3 strings, it can probably
# done only through the string representation and `eval()`. Here
# the `eval()` is not very dangerous because the string was obtained
# from the OS library, and the values are limited to certain subset.
#
# The `ascii()` literal is prefixed by `binary` type prefix character,
# `eval`uated, and the binary result is decoded to the correct string.
local_encoding = locale.getdefaultlocale()[1]
b = eval('b' + ascii(result))
result = b.decode(local_encoding)

--

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread Brett Cannon

Brett Cannon added the comment:

The problem with the output is that error cases are unimportant and yet it 
fooled Skip into temporarily caring until he finally noticed the warning 
message. So my worry is that someone doesn't notice the "NOTE: ignore errors as 
they don't affect anything" and then glances at the output to notice an error 
and then worries that their PGO run failed.

It people really want to add output back in, though, they will need to patch 
both the Makefile to have a big NOTE in it as well as the README to say that 
any errors during the test suite run are unimportant and do not affect the 
outcome of the profile-guided optimizations.

--

___
Python tracker 

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



[issue25178] IDLE: search regex errors should be in/attached to search dialog

2015-09-19 Thread Mark Roseman

New submission from Mark Roseman:

Follow-on to #25173, any regex errors are displayed by SearchEngine but they 
should be shown by the dialog where the user is typing the error. Either as a 
modal tkMessageBox attached to the dialog, or as an inline error in the dialog 
itself.

--
components: IDLE
messages: 251097
nosy: kbk, markroseman, roger.serwy, terry.reedy
priority: normal
severity: normal
status: open
title: IDLE: search regex errors should be in/attached to search dialog
type: behavior
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6

___
Python tracker 

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



[issue24999] Segfault in test_re.test_sre_character_class_literals() when Python is compiled by ICC

2015-09-19 Thread Mark Dickinson

Changes by Mark Dickinson :


--
nosy: +mark.dickinson

___
Python tracker 

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



[issue17319] http.server.BaseHTTPRequestHandler send_response_only doesn't check the type and value of the code.

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

The proposed patch changes the code to 500 if the code is invalid (rather than 
raising an exception as I initially assumed).

I would be inclined to leave send_response() without any extra error checking 
or handling, unless this is a common problem and there is a real need for it. 
Although I reckon it might be nice to have a generic (higher-level) exception 
handler for the HTTP server that responds with “500 Internal server error” if 
possible.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25138] test_socket: socket.EAI_NODATA doesn't exist on FreeBSD

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

Actually, None is probably a bad default, since gaierror().errno also defaults 
to None. Maybe choose some other unlikely non-integer object instead.

--

___
Python tracker 

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



Re: True == 1 weirdness

2015-09-19 Thread Gregory Ewing

Random832 wrote:

I'm disputing that chained comparisons are used for the particular
combinations that I am actually arguing should not be used in python.
Such as a < b > c or a != b != c  [whereas a may or may not be equal to
c]


I can't remember offhand seeing a != b != c written by a
mathematician, but if I did, I would suspect that he
*intended* it to imply a != c, even if that's not a strict
logical consequence of the notation.

--
Greg
--
https://mail.python.org/mailman/listinfo/python-list


[issue25011] Smarter rl complete: hide private and special names

2015-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

If no one has objections, I'll commit the patch.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue24915] Profile Guided Optimization improvements (better training, llvm support, etc)

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

Hum, the change 7fcff838d09e broke the buildbot "AMD64 Debian PGO 3.5". It 
would nice to add Clang support without loosing GCC support :-D

http://buildbot.python.org/all/builders/AMD64%20Debian%20PGO%203.5/builds/274

--
nosy: +haypo
resolution: fixed -> 
status: closed -> open

___
Python tracker 

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



[issue24999] Segfault in test_re.test_sre_character_class_literals() when Python is compiled by ICC

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

pylong_digits.patch: new patch add two local inlined functions 
_PyLong_AsDigits() and _PyLong_FromDigits() to make the code more readable. 
Does it look good to you?

I chose two shifts since only Tim Peters has an opinion on it, and he prefers 
two shifts :-)

--
Added file: http://bugs.python.org/file40513/pylong_digits.patch

___
Python tracker 

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



Re: True == 1 weirdness

2015-09-19 Thread Jussi Piitulainen
Random832 writes:

> On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote:
>> If a, b, c are members of a totally ordered set, so that < is
>> transitive, this is equivalent to max(a,c) < b.  But the latter makes
>> an irrelevant comparison between a and c.
>
> But *who would write that?* It's not a natural form of notation. I'm
> not saying it doesn't mean anything in Python. Obviously everything
> that is allowed means something. I'm saying no-one would write that in
> an ordinary context of human communication and expect to be
> understood.

It might be natural when discussing partial orders, where (a < b > c) is
compatible with there not being any max(a, c) or even sup(a, c) at all.

Here's a class of strings ordered by inclusion as substrings. The
comparison (u in w != u) in __lt__ came naturally when I wrote this.

class S(object):
def __init__(self, s):
self.s = s
def __lt__(self, other):
return self.s in other.s != self.s
def __eq__(self, other):
return self.s == other.s
def __str__(self):
return 'S({})'.format(repr(self.s))

And here's looking for two distinct elements that have a common proper
upper bound in a given set.

data = ('a', 'oo', 'r', 'foo', 'bar')
print(*( (x.s, y.s)
 for x in map(S, data)
 for y in map(S, data)
 for m in map(S, data)
 if y != x < m > y != x  ),
   sep = '\n')

Output:
('a', 'r')
('r', 'a')

The question is whether some such conditions might, sometimes,
somewhere, in context, look natural. I says yes.

The condition as a whole states a verbalizable relation between x, y, m:
that m is a common upper bound of distinct x, y. It's not stated whether
x < y or x > y or neither.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue21259] replace "except: pass" by "except Exception: pass"

2015-09-19 Thread Raymond Hettinger

Raymond Hettinger added the comment:

> I presume you do not mind if I reclose this.

Thanks, please do reclose this.

--

___
Python tracker 

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



[issue25138] test_socket: socket.EAI_NODATA doesn't exist on FreeBSD

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

Maybe it is good enough use something like this as a workaround, with an 
appropriate comment:

if e.errno == getattr(socket, "EAI_NODATA", None):  # Symbol not defined on 
FreeBSD

However I wonder if it would be reasonable to set this constant (and similar 
undefined error codes) to a dummy value like None by default in the module. The 
documentation already says “for a few symbols, default values are provided”.

--
nosy: +martin.panter

___
Python tracker 

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



Re: Add items from a python list to a javascript array

2015-09-19 Thread Denis McMahon
On Sat, 19 Sep 2015 00:25:20 -0700, Darryl Doherty wrote:

> I have a kiosk for digital signage which has a html index file with a
> javascript which rotates through other html files using iframe at timed
> intervals. What I want to do is edit the array in the index file with
> Python to add and remove the HTML file paths from the array. I have a
> list of all file paths in the python list, so I want to select a path
> from the list and add it to the javascript array. In addition I want to
> be able to use python to remove file paths from the array when needed.
> I'm new to Python so some code examples would be appreciated. Thanks.

I'm going to assume that the whole web page is being generated by python 
code with the web server, and that the list of files is available in the 
python code at the time of web page generation.

First of all, you need to create a python list of the file names to use. 
This will use whatever the current data is when the web page is generated.

Secondly, you need to write this list to a suitable javascript variable 
when you construct the web page. Assuming that all the file paths are 
standard ascii with no spaces etc in them, say you have a python list 
like this:

Here is a very simple code example for a method (and there are others) of 
embedding such a list of paths held in python within a javascript 
variable inside a script element in a web page:

#!/usr/bin/python

files = ["/a/a.htm", "/a/b.htm", "/a/c.htm"]

page = "\n"

fmt = "var frames=Array({});\n"

page += fmt.format(",".join(map(lambda x:'"'+x+'"', files)))

page += "\n"

print page


-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25138] test_socket: socket.EAI_NODATA doesn't exist on FreeBSD

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

It would be better to catch the FreeBSD error code when the hostname is not 
known.

--

___
Python tracker 

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



[issue25101] test_zipfile failure when run by unprivileged user with installed Python

2015-09-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 80d002edc9c1 by Serhiy Storchaka in branch '3.4':
Issue #25101: Try to create a file to test write access in test_zipfile.
https://hg.python.org/cpython/rev/80d002edc9c1

New changeset fe84898fbe98 by Serhiy Storchaka in branch '2.7':
Issue #25101: Try to create a file to test write access in test_zipfile.
https://hg.python.org/cpython/rev/fe84898fbe98

New changeset 6899bf8d21c3 by Serhiy Storchaka in branch '3.5':
Issue #25101: Try to create a file to test write access in test_zipfile.
https://hg.python.org/cpython/rev/6899bf8d21c3

New changeset 399746fde4f8 by Serhiy Storchaka in branch 'default':
Issue #25101: Try to create a file to test write access in test_zipfile.
https://hg.python.org/cpython/rev/399746fde4f8

--
nosy: +python-dev

___
Python tracker 

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



[issue25139] socketserver.ThreadingMixIn exception handler: Just a little refactoring

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

I suggest changing the “except” clause to “except BaseException”, which would 
make the intention clearer.

As an alternative, see also my Issue 23430, were I proposed not catching 
exceptions like KeyboardInterrupt and SystemExit, by changing this to:

try:
self.finish_request(request, client_address)
except Exception:
self.handle_error(request, client_address)
finally:
self.shutdown_request(request)

--
nosy: +martin.panter
title: Just a little refactoring -> socketserver.ThreadingMixIn exception 
handler: Just a little refactoring

___
Python tracker 

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



Add items from a python list to a javascript array

2015-09-19 Thread Darryl Doherty
I have a kiosk for digital signage which has a html index file with a 
javascript which rotates through other html files using iframe at timed 
intervals. What I want to do is edit the array in the index file with Python to 
add and remove the HTML file paths from the array. I have a list of all file 
paths in the python list, so I want to select a path from the list and add it 
to the javascript array. In addition I want to be able to use python to remove 
file paths from the array when needed. I'm new to Python so some code examples 
would be appreciated. Thanks.

File paths:
Python script: '/users/admin/desktop/update.py
HTML file: '/users/admin/desktop/msa0007/content/index.html'
Other html files live in sub directories under 
'/users/admin/desktop/msa0007/content/'

Python List:
mylist = ['/users/admin/desktop/msa0007/content/test1/test1.html', 
'/users/admin/desktop/msa0007/content/test2/test2.html', 
'/users/admin/desktop/msa0007/content/test3/test3.html', 
'/users/admin/desktop/msa0007/content/test4/test4.html', 
'/users/admin/desktop/msa0007/content/test5/test5.html', 
'/users/admin/desktop/msa0007/content/test6/test6.html']

Javascript Array:
var frames = Array('/users/admin/desktop/msa0007/content/test1/test1.html', 
'/users/admin/desktop/msa0007/content/test2/test2.html', 
'/users/admin/desktop/msa0007/content/test3/test3.html', 
'/users/admin/desktop/msa0007/content/test4/test4.html');


Index.html:
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd;>



Changing Pages... Please Wait

var frames = Array('/users/admin/desktop/msa0007/content/test1/test1.html', 
'/users/admin/desktop/msa0007/content/test2/test2.html', 
'/users/admin/desktop/msa0007/content/test3/test3.html', 
'/users/admin/desktop/msa0007/content/test4/test4.html');
var i = 0, len = frames.length;
function ChangeSrc() {
document.getElementById('frame').src = frames[i];
if (i >= len-1) { i = 0 } else { i++; };
setTimeout('ChangeSrc()', (15 * 1000));

}
window.onload = ChangeSrc;






-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25101] test_zipfile failure when run by unprivileged user with installed Python

2015-09-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


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

___
Python tracker 

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



ConnectionError handling problem

2015-09-19 Thread shiva upreti
I am learning python. I wrote a script using requests module.
The scripts runs fine for sometime, but after a while it hangs. When I press 
CTRL+C it shows ConnectionError even though I have included exception handling.
I am not sure as to why it cant handle ConnectionError when the script runs for 
a long time.

This is a part(causing issues) of the script I am running:

while(k<46656):
j=res[k]
url="http://172.16.68.6:8090/login.xml; 
query_args = {'mode':'191', 'username':str(i), 
'password':str(j), 'a':'1442397582010', 'producttype':'0'}

try:
r=requests.post(url, data=query_args)
except:
print "Connection error"
time.sleep(30)
continue

html=r.text
if(len(html) < 10):
continue

if("The system could not log you on" not in html):
print "hello"
filehandle=open("ids", "a")
filehandle.write(str(i)+'\n')
filehandle.write(str(j)+'\n')
filehandle.close()
break

k=k+1

Any help will be highly appreciated.
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25159] Regression in time to import a module

2015-09-19 Thread Terry J. Reedy

Terry J. Reedy added the comment:

I did not find any significant different between 3.4 and 3.5 on Windows running 
the following:

import os, time
from importlib import import_module

files = os.listdir("C:/Programs/Python34/Lib")
excludes = {'antigravity.py', 'compileall.py', 'crypt.py', 'pty.py',
'this.py', 'tty.py', '__phello__.foo.py'}
start = time.monotonic()
for name in files:
if name.endswith('.py') and name not in excludes:
try:
import_module(name[:-3])
except:
print(name)
print(time.monotonic()-start)

Other than a couple of outliers, the time was consintly about .29 seconds with 
both 3.4 and 3.5:
  F:\Python\dev>py -3.x  c:/programs/python34/tem.py
The 3.5 run is a bit odd since it runs both 3.4 code and 3.5 code, but there 
were no extra exceptions once I added the needed exclusions (pyt and tty are 
also unix only) for 3.4.  The same code runs equally faster with Idle (.17 
seconds), but that must be because Idle has already imported so many more /Lib 
modules (not including idlelib/*) than python itself.

--

___
Python tracker 

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



[issue25161] Missing periods at the end of sentences

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


--
stage:  -> patch review

___
Python tracker 

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



[issue25161] Missing periods at the end of sentences

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

All the changes in the non-2.7 patch look reasonable to me. I left two review 
comments suggesting a few extra minor edits.

--
nosy: +martin.panter

___
Python tracker 

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



[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

About the new optional balanced parameter added downstream to Fedora, the patch 
is very small compared to timedlock.patch. It only changes the Python code, not 
the C code:

--- /home/haypo/prog/python/2.7/Lib/threading.py2014-11-05 
15:05:11.432003853 +0100
+++ /usr/lib64/python2.7/threading.py   2015-07-05 16:16:00.0 +0200
@@ -306,7 +306,7 @@
 else:
 return True
 
-def wait(self, timeout=None):
+def wait(self, timeout=None, balancing=True):
 """Wait until notified or until a timeout occurs.
 
 If the calling thread has not acquired the lock when this method is
@@ -355,7 +355,10 @@
 remaining = endtime - _time()
 if remaining <= 0:
 break
-delay = min(delay * 2, remaining, .05)
+if balancing:
+delay = min(delay * 2, remaining, 0.05)
+else:
+delay = remaining
 _sleep(delay)
 if not gotit:
 if __debug__:

(with some additional changes to pass balanced parameter)


Compare:

$ diffstat balanced.patch 
 threading.py |   17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)


$ diffstat timedlock.patch 
 Doc/library/thread.rst  |   31 ++---
 Doc/library/threading.rst   |   32 +-
 Include/pythread.h  |   37 
 Lib/dummy_thread.py |8 +++
 Lib/multiprocessing/pool.py |6 +-
 Lib/test/lock_tests.py  |   44 +--
 Lib/threading.py|   25 +++
 Modules/threadmodule.c  |   53 +++
 Python/thread_nt.h  |   33 +++---
 Python/thread_pthread.h |   98 +++-
 10 files changed, 296 insertions(+), 71 deletions(-)

Do you know if the balanced parameter is used in the wild? Such code only works 
with Python 2 on Fedora/CentOS/RHEL, right?


"For upstream, I think it would be desirable to backport the timeout argument 
and simply have it throw RuntimeError if used with any of the backends other 
than thread_nt and thread_pthread."

It's not how Python handles portability. There are two choices in Python:

* some functions are only available on some platforms, ex: os.fork()
* the feature is supported by all platforms and Python uses a different 
implementation depending on the platform (ex: os.kill)

Raising RuntimeError depending on the platform is not a good practice.


"That way single source Python 2/3 code gains access to the timeout option, 
while code relying on one of the no-longer-available-in-Python-3 threading 
backends doesn't incur any stability risks."

This issue is about the performance of Condition.wait(). The timeout parameter 
already exists on Python 2 in Condition.wait(). So it's already possible to 
write a single code base compatible with Python 2 and Python 3.

If you are talking about adding e *new* timeout parameter to threading.Lock, 
it's a new feature. Usually, we don't add new features in minor releases. It 
makes maintenace more complex: you cannot guarantee anymore that an application 
written for Python 2.7.x will work on Python 2.7.y. If you really want this, I 
consider that a PEP is required to define exactly the scope of such change.


"However, I don't feel strongly enough about that to argue in favour of it 
against opposition - I'm happy enough to confine my argument to changing the 
downstream Fedora/RHEL/CentOS patch."

For this specific change (optimizing Condition.wait(timeout) using OS timeout), 
it makes sense to have a downstream only patch because the change will be 
specific to Linux.

Well, I'm not strongly opposed to optimize Python 2, but since the patch is not 
portable, if you really want it, I consider that the topic should be discussed 
on python-dev to have a wide audience.

--
Added file: http://bugs.python.org/file40512/balanced.patch

___
Python tracker 

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



[issue24999] Segfault in test_re.test_sre_character_class_literals() when Python is compiled by ICC

2015-09-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This variant look overcomplicated to me.

--

___
Python tracker 

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



[issue21259] replace "except: pass" by "except Exception: pass"

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


--
superseder:  -> Fix bare excepts in various places in std lib

___
Python tracker 

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



[issue25112] Windows installer assigns non-existent icons to Python file types

2015-09-19 Thread Mark Mikofski

Mark Mikofski added the comment:

+1 I just wasted at least an hour on this. :( should have checked bugs first. 
Google says nothing, so I thought I was going crazy. I saw that py.exe had only 
one icon and that Python.File had c:\windows\py.exe, 1 while 
Python.CompiledFile had C:\windows\py.exe, 2, so I thought that might be it, 
but I just wasn't sure.

Are the Py2 and Py3 icons exactly the same? if so, then IMO just use the py.ico 
and pyc.ico icons in the DLLs folder as suggested

--
nosy: +bwanamarko

___
Python tracker 

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



[issue17319] http.server.BaseHTTPRequestHandler send_response_only doesn't check the type and value of the code.

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue17319] http.server.BaseHTTPRequestHandler send_response_only doesn't check the type and value of the code.

2015-09-19 Thread Martin Panter

Changes by Martin Panter :


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

___
Python tracker 

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



[issue25101] test_zipfile failure when run by unprivileged user with installed Python

2015-09-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread James Harris


"Laura Creighton"  wrote in message 
news:mailman.5.1442609448.21674.python-l...@python.org...
In a message of Fri, 18 Sep 2015 20:09:19 +0100, "James Harris" 
writes:

Set the daemon flag on the worker threads, so when the main thread
exits, the workers also exit.


Interesting idea, and I did not know that a *thread* could be a 
daemon.

Unfortunately, I think what you suggest would kill the threads stone
dead and not allow them to close connections.


Can you stick your worker threads into a Queue.  When the main thread 
exits

have it tell the queue to clean itself up?

see:
http://code.activestate.com/recipes/82965-threads-tkinter-and-asynchronous-io/

The main thread doesn't have to be a gui ...

(but the author of that recipe and I are now drunkly celebrating a 
birthday

so maybe I ought not to be posting this idea ...)


:-)

I am not sure. The polling every 100ms or similar in periodicCall() is 
something I want to avoid. I think I have a way to do this without any 
polling.


James

--
https://mail.python.org/mailman/listinfo/python-list


[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-19 Thread Flavio Grossi

Flavio Grossi added the comment:

> About the new optional balanced parameter added downstream to Fedora, the 
> patch is very small compared to timedlock.patch. It only changes the Python 
> code, not the C code

The balancing fix has 3 main problems imo:
- It causes long delays to receive the notification (i.e. with a timeout of 30s 
the caller may be notified after 30s in the worst case)
- It doesn't apply to other affected APIs, e.g. Queue.get() which uses a 
condition internally.
- It only fixes the problem in python programs which explicitly use it (and 
being redhat specific i guess it is not very used)

--

___
Python tracker 

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



[issue25175] Documentation-Tkinter wrong statement

2015-09-19 Thread Martin Panter

Martin Panter added the comment:

The problem here is you have quoted the Python 3 documentation (see in the 
title, or the version switcher at the top), when you are presumably using 
Python 2. The module changed name to lowercase in Python 3.

--
nosy: +martin.panter

___
Python tracker 

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



Re: Adding PEP 495 support to dateutil

2015-09-19 Thread Alexander Belopolsky
[Tim Peters]
>
> I think acceptance of 495 should be contingent upon
> someone first completing a fully functional (if not releasable)
> fold-aware zoneinfo wrapping.


[Alexander Belopolsky]
>
> I am making all development public early on and hope to see code reviews
and pull requests from interested parties.  Pull requests with additional
test cases are most welcome.


I've made some additional progress in my dateutil fork [1].  The tzfile
class is now fold-aware.  The tzfile implementation of tzinfo takes the
history of local time type changes from a binary zoneinfo file. These files
are installed on the majority of UNIX platforms.

More testing is needed, but I think my fork is now close to meeting Tim's
challenge.

Please note that you need to run the modified  dateutil fork [1] code under
PEP 495 fork of CPython. [2]

[1]: https://github.com/abalkin/dateutil/tree/pep-0495
[2]: https://github.com/abalkin/cpython
-- 
https://mail.python.org/mailman/listinfo/python-list


Hello

2015-09-19 Thread moon khondkar
Hello I have problem with python installation.I downloaded python 3.5 but I 
cannot use it on my computer.I can not open the idle. I get something like 
saying "users\local settings\Application 
data\programs\python\python35-32\pythonw.exe is not valid win32 application. 
Thanks that will be help if you can solve this.
-- 
https://mail.python.org/mailman/listinfo/python-list


windows 10

2015-09-19 Thread heidimtaylor
I am using Windows 10.  I cannot find the Python (command line).  Do you know 
where I would find it?

Thank you,
Heidi

Sent from Mail for Windows 10
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

"The balancing fix has 3 main problems imo:"

Oh by the way, I don't want to apply it to Python 2.7 upstream for a
similar reason: it's a new feature which would be added to a Python
2.7 minor version. We try to avoid that, even if Python 2.7 is
special.

--

___
Python tracker 

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



[issue24999] Segfault in test_re.test_sre_character_class_literals() when Python is compiled by ICC

2015-09-19 Thread STINNER Victor

STINNER Victor added the comment:

> This variant look overcomplicated to me.

Ok fine. I pushed  pylong_digits.patch, but I also modified a similar code a 
few lines below.

--

___
Python tracker 

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



[issue25177] OverflowError in statistics.mean when summing large floats

2015-09-19 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +steven.daprano

___
Python tracker 

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



[issue9253] argparse: optional subparsers

2015-09-19 Thread Jakub Wilk

Changes by Jakub Wilk :


--
nosy: +jwilk

___
Python tracker 

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



Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread James Harris
"Chris Angelico"  wrote in message 
news:mailman.8.1442612439.21674.python-l...@python.org...
On Sat, Sep 19, 2015 at 3:17 AM, James Harris 
 wrote:
Needless to say, on a test Windows machine AF_UNIX is not present. 
The only

cross-platform option, therefore, seems to be to use each subthread's
select()s to monitor two AF_INET sockets: the one to the client and a
control one from the master thread. I would seem to need IP socket 
pairs
between the master thread and the subthreads. If the master thead 
receives a

shutdown signal it will send a shutdown command to each subthread.

The above seems logical but would use quite a few IP sockets. I 
cannot think

of a better way, though. Any comments on the ideas above?


If you're using select() to monitor the sockets, you don't actually
then have to _do_ anything with the shutdown socket. You could have a
single socket that sends the shutdown signal to all your workers.


I don't understand how a single socket could send the signal to all the 
workers. I did consider some form of multicast but thought it too 
complicated (and possibly infeasible).


Re. not understanding the single sending socket idea that you mention 
perhaps I had better explain a bit of what I had in mind:


1. A worker thread would have a TCP socket connection to its client, and 
another socket for communicating with the master. That second socket has 
to be AF_INET for portability. It could be TCP or UDP. A connected UDP 
socket may be most appropriate and seems worth trying.


2. If something happens to the master thread so that it determines that 
the application should shut down it would iterate over the sockets to 
the workers and tell each one to shut down. It would then shut itself 
down. (Am not sure at the moment whether to wait for the worker 
threads.)


3. A worker thread, being told to shutdown (basically a single byte 
received from the master thread) would tell its client to close the TCP 
connection and then it would wait a little while for it to do so - maybe 
a second or two. When the client closes the TCP connection (or the 
timeout wait period expires) the worker thread will close its end and 
exit.



Bear in mind, though, that Windows has no protection against other
processes shutting you down. You can restrict it to 127.0.0.1 (of
course) but any program running on the same computer as the server -
regardless of user permissions etc - will be able to connect to your
sockets.


I was thinking of a connected UDP socket. That way, AIUI, at least in 
the absence of forged datagrams, only the master thread will be able to 
communicate with the worker, due to connected UDP sockets demulitplexing 
datagrams based on their source as well as their destination, i.e. on a 
5-tuple (UDP, source IP, source port, destination IP, destination port).



So it might be best to do something like this (all on the
main thread):

1) Open a listening socket
2) Connect to the listening socket
3) Accept a connection
4) Close the original listening socket
5) Spin off all your threads, passing them the socket from step 2
6) To terminate them all, write a byte to the socket from step 3.


That sounds similar to what I had in mind but I am not sure why you 
would close the listening socket. Connections could come in at any time 
and threads could therefore be needed at any time so I was thinking that 
the master thread (the one with the listening TCP socket) would just sit 
waiting for new connection requests (or an interrupting signal).


In reality, due to Windows not recognising signals while in the accept() 
call I think there would be a real master thread and a listening thread 
but I have omitted that in the descriptions above. As far as the normal 
worker threads are concerned they would be ready to be told to shut down 
by the listening thread, and it would be ready to be told to shut down 
by the master thread. Still with me? ;-)



This will make it difficult for ordinary userspace code to mess with
you. It'd still be possible, I think, for something with raw sockets
access to feign a termination signal; I have no idea what protections
Windows offers you there.


Yes, something which could forge a packet could tell a worker to close 
down. I don't think there's any significant problem here, thought, 
because:


* other programs are similarly vulnerable to forged packets
* the only forgery effect is to tell a worker thread to stop - not a big 
loss

* the shutdown protocol would/should cause the client to re-request
* a forger would have to know the specific port number used by the 
master thread to communicate with that particular worker, and the port 
number that worker was using.


Overall, I think it would be more than robust enough.

Notwithstanding your comment about a single socket, above, no one seems 
so far to have objected to the number of sockets this would need, which 
was my main concern, so that's good!


James

--

Re: Shutting down a cross-platform multithreaded app

2015-09-19 Thread Chris Angelico
On Sat, Sep 19, 2015 at 7:49 PM, James Harris  wrote:
> "Chris Angelico"  wrote in message
> news:mailman.8.1442612439.21674.python-l...@python.org...
>>
>> On Sat, Sep 19, 2015 at 3:17 AM, James Harris 
>> wrote:
>>>
>>> Needless to say, on a test Windows machine AF_UNIX is not present. The
>>> only
>>> cross-platform option, therefore, seems to be to use each subthread's
>>> select()s to monitor two AF_INET sockets: the one to the client and a
>>> control one from the master thread. I would seem to need IP socket pairs
>>> between the master thread and the subthreads. If the master thead
>>> receives a
>>> shutdown signal it will send a shutdown command to each subthread.
>>>
>>> The above seems logical but would use quite a few IP sockets. I cannot
>>> think
>>> of a better way, though. Any comments on the ideas above?
>>
>>
>> If you're using select() to monitor the sockets, you don't actually
>> then have to _do_ anything with the shutdown socket. You could have a
>> single socket that sends the shutdown signal to all your workers.
>
>
> I don't understand how a single socket could send the signal to all the
> workers. I did consider some form of multicast but thought it too
> complicated (and possibly infeasible).

The way I'm describing it, the workers never actually read from the
socket. Once that socket becomes readable, they immediately shut down,
without making the socket no-longer-readable.

>> Bear in mind, though, that Windows has no protection against other
>> processes shutting you down. You can restrict it to 127.0.0.1 (of
>> course) but any program running on the same computer as the server -
>> regardless of user permissions etc - will be able to connect to your
>> sockets.
>
>
> I was thinking of a connected UDP socket. That way, AIUI, at least in the
> absence of forged datagrams, only the master thread will be able to
> communicate with the worker, due to connected UDP sockets demulitplexing
> datagrams based on their source as well as their destination, i.e. on a
> 5-tuple (UDP, source IP, source port, destination IP, destination port).

TCP sockets also work on that set of five. That's why I suggested a
pre-connected TCP socket, with the original listening socket closed.

(And as mentioned, Python 3.5 supports socketpair() on Windows. That
would definitely be the best option.)

> That sounds similar to what I had in mind but I am not sure why you would
> close the listening socket. Connections could come in at any time and
> threads could therefore be needed at any time so I was thinking that the
> master thread (the one with the listening TCP socket) would just sit waiting
> for new connection requests (or an interrupting signal).

TCP sockets work on the basis of a master socket and any number of
spawned sockets. The master is what gives you an open port; each
spawned socket represents one connection with one client. Once you
have an established connection, the master should be able to be closed
without disrupting that. No other process will be able to connect to
you, but you'll still be able to use one end of the socket to make the
other end readable.

>> This will make it difficult for ordinary userspace code to mess with
>> you. It'd still be possible, I think, for something with raw sockets
>> access to feign a termination signal; I have no idea what protections
>> Windows offers you there.
>
>
> Yes, something which could forge a packet could tell a worker to close down.
> I don't think there's any significant problem here, thought, because:
>
> * other programs are similarly vulnerable to forged packets
> * the only forgery effect is to tell a worker thread to stop - not a big
> loss
> * the shutdown protocol would/should cause the client to re-request
> * a forger would have to know the specific port number used by the master
> thread to communicate with that particular worker, and the port number that
> worker was using.
>
> Overall, I think it would be more than robust enough.

With UDP, any process that can send a UDP packet can flood the system
with them until your workers shut down. You wouldn't even notice until
it succeeds. With TCP, at least an attacker would need raw socket
access. It's still not as protected as a Unix domain socket, but it's
a bit harder for someone to do.

> Notwithstanding your comment about a single socket, above, no one seems so
> far to have objected to the number of sockets this would need, which was my
> main concern, so that's good!

Sure. Sockets are pretty cheap. Even if you had one for every worker,
there's room for you to have thousands (maybe tens of thousands) of
workers without a problem. I think you'll run into other scaling
problems with that many workers on one computer :)

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue25084] remove semi-busy loop in py2.7 threading.Condition.wait(timeout=x)

2015-09-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, let's close it then.

--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



  1   2   >