[issue20116] urlparse.parse_qs should take argument for query separator

2016-04-19 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Luiz,

The original question was about introducing a parameter to override query 
string separate ';'.

If we do with enable or disable, then we should provide another option for 
query string separator.

The OP provided one example of query string which had & as a separator along 
with ';'. I wonder how the parsing of that should be.

The pointer to the RFC makes me think that is alright to provide an option to 
'override' the default separator instead of providing an enable/disable.  

I would like to hear opposite thoughts on this.

--

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Experimentally found that minimal recursion level for 2.7 is 29, for 3.2-3.3 is 
24, and for 3.4-3.6 is 25.

3.2 produces following output and restart the shell:


Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 37227)
Request:  
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 295, in 
_handle_request_noblock
self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 321, in 
process_request
self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 334, in 
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 503, in __init__
socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-3.2/Lib/socketserver.py", line 648, in __init__
self.handle()
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/run.py", line 285, in handle
rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 280, in 
getresponse
response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 300, in 
_getresponse
response = self.pollresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 421, in 
pollresponse
self.putmessage(message)
  File "/home/serhiy/py/cpython-3.2/Lib/idlelib/rpc.py", line 324, in putmessage
s = pickle.dumps(message)
RuntimeError: maximum recursion depth exceeded while pickling an object

*** Unrecoverable, server exiting!


3.3 hangs without any terminal output.

3.4 produces the most detailed output and hangs:


Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 46394)
Request:  
Traceback (most recent call last):
Exception in thread SockThread:
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 305, in 
_handle_request_noblock
self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 331, in 
process_request
self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 344, in 
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 508, in __init__
socketserver.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 673, in __init__
self.handle()
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 318, in handle
rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 288, in 
getresponse
response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 308, in 
_getresponse
response = self.pollresponse(myseq, wait)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 426, in 
pollresponse
self.putmessage(message)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 332, in putmessage
s = dumps(message)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/rpc.py", line 60, in dumps
p.dump(obj)
RuntimeError: maximum recursion depth exceeded while pickling an object

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/serhiy/py/cpython-3.4/Lib/threading.py", line 911, in 
_bootstrap_inner
self.run()
  File "/home/serhiy/py/cpython-3.4/Lib/threading.py", line 859, in run
self._target(*self._args, **self._kwargs)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 162, in 
manage_socket
server.handle_request() # A single request only
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 290, in 
handle_request
self._handle_request_noblock()
  File "/home/serhiy/py/cpython-3.4/Lib/socketserver.py", line 307, in 
_handle_request_noblock
self.handle_error(request, client_address)
  File "/home/serhiy/py/cpython-3.4/Lib/idlelib/run.py", line 288, in 
handle_error
traceback.print_exc(file=erf)
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 252, in print_exc
print_exception(*sys.exc_info(), limit=limit, file=file, chain=chain)
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 169, in 
print_exception
for line in _format_exception_iter(etype, value, tb, limit, chain):
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 153, in 
_format_exception_iter
yield from _format_list_iter(_extract_tb_iter(tb, limit=limit))
  File "/home/serhiy/py/cpython-3.4/Lib/traceback.py", line 18, in 
_format_list_iter
  

[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-19 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Hi Hans-Peter,

I agree with Martin's comments and suggestion.

If I understand the suggestion correctly, the only change will be a 
documentation change. Isn't it? 

Because getproxies_environment() in it's current form already fetches the 
lower_case proxy which you want to highlight that is a winner in case there are 
two environment variables with different cases.

Thanks!

--

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In 3.6 just setting the recursion level to 20 produces following output on 
terminal:


Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 41515)
Unhandled exception in thread started by 

and a hang.

In 2.7 it produces:


Unhandled server exception!
Thread: SockThread
Client Address:  ('127.0.0.1', 35043)
Request:  
Traceback (most recent call last):
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 290, in 
_handle_request_noblock
self.process_request(request, client_address)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 318, in 
process_request
self.finish_request(request, client_address)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 331, in 
finish_request
self.RequestHandlerClass(request, client_address, self)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 500, in 
__init__
SocketServer.BaseRequestHandler.__init__(self, sock, addr, svr)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/SocketServer.py", line 652, in 
__init__
self.handle()
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/run.py", line 292, in 
handle
rpc.RPCHandler.getresponse(self, myseq=None, wait=0.05)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 280, in 
getresponse
response = self._getresponse(myseq, wait)
  File "/home/serhiy/py/cpython-2.7-debug/Lib/idlelib/rpc.py", line 300, in 
_getresponse
response = self.pollresponse(myseq, wait)
RuntimeError: maximum recursion depth exceeded

*** Unrecoverable, server exiting!


and restarts the shell.

Definitely the 20 limit is too low for IDLE.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue22625] When cross-compiling, don’t try to execute binaries

2016-04-19 Thread Martin Panter

Martin Panter added the comment:

In Issue 22359, Xavier has posted a patch that looks like a reasonable solution 
to both cross compiling and allowing parallel make.

--
resolution:  -> duplicate
status: open -> closed
superseder:  -> Remove incorrect uses of recursive make

___
Python tracker 

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



[issue22359] Remove incorrect uses of recursive make

2016-04-19 Thread Martin Panter

Changes by Martin Panter :


--
dependencies:  -When cross-compiling, don’t try to execute binaries
status: languishing -> open

___
Python tracker 

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



[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-19 Thread Martin Panter

Martin Panter added the comment:

I think this should be applied as a bug fix to 2.7 and 3.5 as well. What do you 
think? Lowercase is the normal way to use these variables.

I left some comments on the code review.

A similar bug seems to exist for the “no_proxy” variable. Also, it would be 
nice to add a test case for this.

--
nosy: +martin.panter

___
Python tracker 

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



[issue22558] Missing doc links to source code

2016-04-19 Thread Yoni Lavi

Yoni Lavi added the comment:

I went over all the library rst files and added a link to the source for each 
of the modules.

Also, I standardized the structure of the headers in all of the files to be in 
the following order: """
.. module

.. moduleauthor
.. sectionauthor

.. versionadded

**Source code:**

.. testsetup

.. index

--
"""

This'll be my first Python patch. Please let me know if I chose to go into too 
large of a scope and should split this, or if there's anything else I can 
improve. Also, since I'm modifying most of these files anyway, this might be a 
good opportunity to modify the header structure I mentioned above.

Thanks

--
keywords: +patch
Added file: http://bugs.python.org/file42527/mywork.patch

___
Python tracker 

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



[issue24291] Many servers (wsgiref, http.server, etc) can truncate large output blobs

2016-04-19 Thread Martin Panter

Martin Panter added the comment:

Widening the scope of the title to attract reviewers :)

--
title: wsgiref.handlers.SimpleHandler truncates large output blobs -> Many 
servers (wsgiref, http.server, etc) can truncate large output blobs

___
Python tracker 

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



[issue26769] Python 2.7: make private file descriptors non inheritable

2016-04-19 Thread Martin Panter

Martin Panter added the comment:

The patch looks reasonable as far as I understand it. I don’t know what the 
consequences of adding new PyAPI_FUNC() symbols to 2.7 is, or changing the 
Windows build files, so can’t really comment on those aspects though.

I left some questions about porting _Py_open() and _Py_dup().

--

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

Results of the CPython benchmark suite on dict_version-8.patch.

IMHO regex_v8 can be ignored, this benchmark is unstable (issue #26275).

Original python: ../pep509/python
3.6.0a0 (default:3a9b47b062b9, Apr 19 2016, 16:23:15) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

Patched python: ../pep509/python
3.6.0a0 (default:96f61aab2c6e, Apr 19 2016, 15:21:15) 
[GCC 5.3.1 20151207 (Red Hat 5.3.1-2)]

$ python3 -u perf.py --rigorous -b all ../default.copy/python ../pep509/python

INFO:root:Automatically selected timer: perf_counter
(...)
Report on Linux smithers 4.4.4-301.fc23.x86_64 #1 SMP Fri Mar 4 17:42:42 UTC 
2016 x86_64 x86_64
Total CPU cores: 8

### 2to3 ###
Min: 6.714927 -> 6.856992: 1.02x slower
Avg: 6.726773 -> 6.984359: 1.04x slower
Significant (t=-5.16)
Stddev: 0.01160 -> 0.1: 9.5816x larger

### call_method ###
Min: 0.312567 -> 0.323260: 1.03x slower
Avg: 0.313399 -> 0.323821: 1.03x slower
Significant (t=-284.62)
Stddev: 0.00042 -> 0.00048: 1.1430x larger

### call_simple ###
Min: 0.242091 -> 0.228922: 1.06x faster
Avg: 0.243613 -> 0.229294: 1.06x faster
Significant (t=2134.23)
Stddev: 0.00010 -> 0.5: 1.9124x smaller

### etree_generate ###
Min: 0.255097 -> 0.265558: 1.04x slower
Avg: 0.256947 -> 0.267478: 1.04x slower
Significant (t=-67.89)
Stddev: 0.00111 -> 0.00108: 1.0250x smaller

### etree_parse ###
Min: 0.281726 -> 0.290976: 1.03x slower
Avg: 0.283626 -> 0.292642: 1.03x slower
Significant (t=-62.59)
Stddev: 0.00109 -> 0.00094: 1.1540x smaller

### etree_process ###
Min: 0.217164 -> 0.229552: 1.06x slower
Avg: 0.219401 -> 0.231242: 1.05x slower
Significant (t=-75.05)
Stddev: 0.00112 -> 0.00111: 1.0053x smaller

### fannkuch ###
Min: 1.012875 -> 0.985196: 1.03x faster
Avg: 1.014760 -> 0.992104: 1.02x faster
Significant (t=46.44)
Stddev: 0.00287 -> 0.00395: 1.3778x larger

### float ###
Min: 0.259226 -> 0.251918: 1.03x faster
Avg: 0.266530 -> 0.260176: 1.02x faster
Significant (t=10.69)
Stddev: 0.00403 -> 0.00437: 1.0836x larger

### json_load ###
Min: 0.430602 -> 0.433593: 1.01x slower
Avg: 0.431278 -> 0.486924: 1.13x slower
Significant (t=-24.86)
Stddev: 0.00045 -> 0.02238: 49.8974x larger

### normal_startup ###
Min: 0.319092 -> 0.326082: 1.02x slower
Avg: 0.320093 -> 0.326842: 1.02x slower
Significant (t=-70.52)
Stddev: 0.00067 -> 0.00069: 1.0283x larger

### regex_effbot ###
Min: 0.048969 -> 0.048313: 1.01x faster
Avg: 0.050019 -> 0.048415: 1.03x faster
Significant (t=31.41)
Stddev: 0.00051 -> 0.6: 8.8152x smaller

### regex_v8 ###
Min: 0.051040 -> 0.043412: 1.18x faster
Avg: 0.051325 -> 0.043577: 1.18x faster
Significant (t=45.60)
Stddev: 0.00120 -> 0.00120: 1.0013x larger

### richards ###
Min: 0.157625 -> 0.161126: 1.02x slower
Avg: 0.158952 -> 0.162519: 1.02x slower
Significant (t=-34.92)
Stddev: 0.00073 -> 0.00071: 1.0351x smaller

### silent_logging ###
Min: 0.070547 -> 0.069902: 1.01x faster
Avg: 0.072246 -> 0.069934: 1.03x faster
Significant (t=65.51)
Stddev: 0.00035 -> 0.3: 11.9828x smaller

The following not significant results are hidden, use -v to show them:
call_method_slots, call_method_unknown, chameleon_v2, chaos, django_v3, 
etree_iterparse, fastpickle, fastunpickle, formatted_logging, go, hexiom2, 
json_dump_v2, mako_v2, meteor_contest, nbody, nqueens, pathlib, pickle_dict, 
pickle_list, pidigits, raytrace, regex_compile, simple_logging, spectral_norm, 
startup_nosite, telco, tornado_http, unpack_sequence, unpickle_list.

--

___
Python tracker 

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



[issue26793] uuid causing thread issues when forking using os.fork py3.4+

2016-04-19 Thread Chase Sterling

Chase Sterling added the comment:

@STINNER Victor Your example is starting a thread before calling fork, the 
other examples just init a threading.Thread class before the fork (I imagine 
the OS thread is not created at that point.) Are you saying that just 
instantiating a threading.Thread class before forking (without actually 
starting the thread) is bad?

--
nosy: +Chase Sterling

___
Python tracker 

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



[issue26806] IDLE not displaying RecursionError tracebacks

2016-04-19 Thread Terry J. Reedy

New submission from Terry J. Reedy:

Test program:

import sys
sys.setrecursionlimit(20)
def f(): return f()
f()

F:\Python\mypy>python tem.py
Traceback (most recent call last):
  File "tem.py", line 4, in 
f()
  File "tem.py", line 3, in f
def f(): return f()
...
RecursionError: maximum recursion depth exceeded

In 2.7.11, the error is caught and the user process restarted.

=== RESTART: F:\Python\mypy\tem.py ===

=== RESTART: Shell ===
>>> 

In 3.5.1, the user process hangs, ^C does not work, and a restart explicitly 
requested either with Shell => Restart or running another program.

This behavior is either peculiar to this test case, or a regression, as I 
remember getting proper RecursionError tracebacks in the past.

--
assignee: terry.reedy
messages: 263785
nosy: terry.reedy
priority: normal
severity: normal
stage: test needed
status: open
title: IDLE not displaying RecursionError tracebacks
type: behavior
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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 6535481d610e by Victor Stinner in branch 'default':
> Optimize func(*tuple) function call
> https://hg.python.org/cpython/rev/6535481d610e

Oops. Mercurial is too hard for me /o\ I didn't want to push this change, since 
Serhiy already pushed the change itself. I asked Serhiy what he thinks about 
documenting the optimization. Well, now at least it's documented in NEWS. But 
I'm still interested to know if it's worth to mention the change in What's New 
in Python 3.6?

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Martin Panter

Martin Panter added the comment:

I doubt it is worth spending much effort supporting sys.__stdout__ being 
overwritten with StringIO or deleted. That seems an abuse of the “sys” module. 
Idle doesn’t even seem to alter this attribute.

But if you call stdout.close() or detach(), I think that is a more valid way to 
trigger ValueError, so Serhiy’s patch is worthwhile for that case.

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 6535481d610e by Victor Stinner in branch 'default':
Optimize func(*tuple) function call
https://hg.python.org/cpython/rev/6535481d610e

--

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-04-19 Thread Christian Heimes

Christian Heimes added the comment:

PS: The patch depends on https://github.com/openssl/openssl/pull/979

--

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-04-19 Thread Christian Heimes

Changes by Christian Heimes :


Removed file: 
http://bugs.python.org/file42184/0001-Port-Python-s-SSL-module-to-OpenSSL-1.1.0-WIP.patch

___
Python tracker 

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



[issue26470] Make OpenSSL module compatible with OpenSSL 1.1.0

2016-04-19 Thread Christian Heimes

Christian Heimes added the comment:

The patch makes Python compatible with OpenSSL 1.1.0-pre6-dev from
git. The ssl and hashlib module are also compatible with OpenSSL 0.9.8zh,
1.0.1s, 1.0.2g as well as LibreSSL 2.3.3.

--
Added file: 
http://bugs.python.org/file42526/0001-Port-Python-s-SSL-module-to-OpenSSL-1.1.0-WIP.patch

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3115b6ce1006 by Paul Moore in branch '3.5':
Mention types.SimpleNamespace in collections.namedtuple doc
https://hg.python.org/cpython/rev/3115b6ce1006

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Joe Jevnik

Joe Jevnik added the comment:

CALL_FUNCTION doesn't use extended arg; I don't see what we get by adding some 
opcode to convert the sequence into a tuple. We also don't want to box up the 
stack arguments into a tuple because when we do a CALL_FUNCTION to a python 
function we just copy the stack[-n:] elements into the locals of the next 
frame. Emitting a build_tuple here would be an unneeded allocation.

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> Do you have a reference to the more efficient implementation of CALL_FUNCTION?

Actually it was about MAKE_FUNCTION. But I think the same is applicable to 
CALL_FUNCTION.

http://comments.gmane.org/gmane.comp.python.devel/157321

--

___
Python tracker 

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



[issue23926] skipitem() in getargs.c still supports 'w' and 'w#', and shouldn't

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I reviewed skipitems.patch.

--
nosy: +haypo

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> FYI, there is a proposition about constructing arguments tuple and dict in 
> bytecode instead of ceval.c. This will significantly simplify CALL_FUNCTION 
> (which will get just one optional tuple and one optional dict). Likely this 
> idea will be implemented after changing to wordcode.

Wordcode is the issue #26647.

Do you have a reference to the more efficient implementation of CALL_FUNCTION? 
I recall vaguely this idea.

--

It was also proposed to pass keyword arguments as positional arguments: replace 
func(a=1, b=2) with func(1, 2) with "def func(a, b): ...". But this 
optimization requires something like FAT Python to disable the optimization if 
the function is replaced at runtime.

This optimization is more complex, maybe it's not worth.

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> New changeset 15b20201cfa5 by Serhiy Storchaka in branch 'default':

Oh. I was cooking a commit, you was faster than me :-)

IMHO it's worth to make the optimization in Misc/NEWS, or maybe even in Whats 
new in Python 3.6.

I prepared the text:

Issue #26802: Optimize function calls only using unpacking like 
``func(*tuple)`` (no other positional argument, no keyword): avoid copying the 
tuple. Such function calls are up to 15% faster. Patch written by Joe Jevnik.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch that adds ValueError in the exceptions list and adds tests.

--
resolution: fixed -> 
status: closed -> open
Added file: http://bugs.python.org/file42525/get_terminal_size_valueerror.patch

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

Good news. On a microbenchmark, the patch makes func(*tuple) between 14% and 
18% faster. See attached bench.py. I ran the benchmark on Linux with isolated 
CPUs to get reliable results.
https://haypo-notes.readthedocs.org/microbenchmark.html

$ ./python-orig ~/prog/HG/misc/python/benchmark.py script bench.py --file=orig
$ ./python-patched ~/prog/HG/misc/python/benchmark.py script bench.py 
--file=patch
$ ./python-orig ~/prog/HG/misc/python/benchmark.py compare_to orig patch

Common platform:
CPU model: Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
SCM: hg revision=75f40345d784 branch=default date="2016-04-19 22:29 +0200"
Timer info: namespace(adjustable=False, 
implementation='clock_gettime(CLOCK_MONOTONIC)', monotonic=True, 
resolution=1e-09)
Timer: time.perf_counter
Bits: int=32, long=64, long long=64, size_t=64, void*=64
Python unicode implementation: PEP 393
CFLAGS: -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall 
-Wstrict-prototypes
Platform: Linux-4.4.4-301.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three

Platform of campaign orig:
Timer precision: 62 ns
Python version: 3.6.0a0 (default:75f40345d784, Apr 19 2016, 23:07:49) [GCC 
5.3.1 20151207 (Red Hat 5.3.1-2)]
Date: 2016-04-19 23:08:21

Platform of campaign patch:
Timer precision: 61 ns
Python version: 3.6.0a0 (default:084d5315dd50, Apr 19 2016, 23:06:38) [GCC 
5.3.1 20151207 (Red Hat 5.3.1-2)]
Date: 2016-04-19 23:08:39

-++--
Tests|   orig | 
patch
-++--
def func(a, b, c): pass args=(1, 2, 3); func(*args)  | 127 ns (*) | 104 ns 
(-18%)
def func(*args): pass args=(1, 2, 3); func(*args)| 147 ns (*) | 126 ns 
(-14%)
def func(*args): pass args=(2, 3, 4); func(1, *args) | 154 ns (*) |154 
ns
-++--
Total| 429 ns (*) | 384 ns 
(-10%)
-++--

--
Added file: http://bugs.python.org/file42524/bench.py

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

FYI, there is a proposition about constructing arguments tuple and dict in 
bytecode instead of ceval.c. This will significantly simplify CALL_FUNCTION 
(which will get just one optional tuple and one optional dict). Likely this 
idea will be implemented after changing to wordcode.

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 15b20201cfa5 by Serhiy Storchaka in branch 'default':
Issue #26802: Optimized calling a function with *args only positional arguments.
https://hg.python.org/cpython/rev/15b20201cfa5

--
nosy: +python-dev

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Berker Peksag

Berker Peksag added the comment:

Or if you don't want to use any hg extension:

hg update 3.5
hg import --no-c http://bugs.python.org/file42520/collections.patch
hg commit
hg update default
hg merge 3.5
hg revert -ar default
hg resolve -am
hg commit

(Null merge (hg merge 3.5 and later) is step documented at 
https://docs.python.org/devguide/faq.html?#how-do-i-make-a-null-merge)

--
nosy: +berker.peksag

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

Changes by STINNER Victor :


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

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

Well, since Serhiy, Emmanuel and me agree that unit tests are overkill, I 
pushed the obivous and trivial fix. Thank you Emmanual for your contribution! I 
added your name to Misc/ACKS ;-)

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e3763b5964b6 by Victor Stinner in branch '3.5':
Fix shutil.get_terminal_size() error handling
https://hg.python.org/cpython/rev/e3763b5964b6

New changeset 75f40345d784 by Victor Stinner in branch 'default':
Merge 3.5: issue #26801
https://hg.python.org/cpython/rev/75f40345d784

--
nosy: +python-dev

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Emanuel Barry

Emanuel Barry added the comment:

To be fair, I don't think we actually need a unit test to check if 
`os.get_terminal_size` exists, as we catch any `AttributeError` at all. I'd 
want to keep the except clause there to properly handle `sys.__stdout__` being 
`None` (or simply absent). I also don't consider that I'm fixing a bug here, 
but more like an oversight. The except clause with `NameError` is obviously an 
oversight from when the function was ported from `os` to `shutil`, so I'd 
rather fix it.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> Honest, I don't think that we need such complex test for the case that isn't 
> occurred in wild.

Right. I'm also fine if you test manually this corner case.

The Lib/shutil.py change LGTM in get_term_size_with_test2.patch (I ignored the 
unit test).

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

call-function-var-3.patch LGTM. Thank you for your contribution Joe.

--
assignee:  -> serhiy.storchaka
stage: patch review -> commit review

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I don't know what "inactive" means in Mercurial. Python 3.5 is
actively developed (maintained):
https://docs.python.org/devguide/#status-of-python-branches

> How should I do the commit into 3.5?

Update to 3.5 (hg up 3.5), transplant your change (hg transplant
c3232d1d8ca0). Fix if needed. I don't recall if you need to commit or
not (commit if you get the patch as local changes). Then update to
default (hg update default), and merge 3.5 (hg merge 3.5). Commit.

https://docs.python.org/devguide/devcycle.html#branches

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Honest, I don't think that we need such complex test for the case that isn't 
occurred in wild. If delete os.get_terminal_size, all TermsizeTests tests fail, 
so we will know if encounter a platform without os.get_terminal_size.

Instead I suggest to add ValueError in exceptions list and add tests for 
changed sys.__stdout__: None, StringIO(), open(TESTFN, "w"). Some of these 
tests fail without AttributeError in the exceptions list.

--

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Paul Moore

Paul Moore added the comment:

Ah, thanks. I probably did the commit the wrong way round in that case, as I 
committed to tip. How should I do the commit into 3.5? (I'm also somewhat 
confused by the fact that hg describes the 3.5 branch as "inactive"...)

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> Hmm, if `sys.__stdout__` was deleted (or set to `None`), this would also 
> raise an `AttributeError` when calling `shutil.get_terminal_size`, so I think 
> that even if `os.get_terminal_size` is guaranteed to be always present (which 
> it's not, IIUC), catching `AttributeError` would prevent that bug, too.

It would be nice to have an unit test too for this case. You can use something 
like:

with unittest.mock.patch('shutil.sys') as mock_sys:
del mock_sys.__stdout__
print(shutil.get_terminal_size((3, 3)))

(and mock also os.envion, as shown in the review.)

--

___
Python tracker 

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



[issue14102] argparse: add ability to create a man page

2016-04-19 Thread Zbyszek Jędrzejewski-Szmek

Changes by Zbyszek Jędrzejewski-Szmek :


--
nosy: +zbysz

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

types.SimpleNamespace is also available on Python 3.5, you may also modify 
Python 3.5 doc.

--

___
Python tracker 

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



[issue26799] gdb support fails with "Invalid cast."

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> Turns out the type->length of the the globally initialized ptr types is 
> wrong: It is 4 instead of 8, causing the cast to fail. I suspect the 
> initialization is done before the executable is loaded and gdb is using some 
> default.

Hum. I see two options:

* try late initialization: initialize types at the first usage
* remove variables: always lookup types at runtime

Would you like to try to implement these options?

--

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Paul Moore

Changes by Paul Moore :


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

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Emanuel Barry

Changes by Emanuel Barry :


Added file: http://bugs.python.org/file42523/get_term_size_with_test2.patch

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c3232d1d8ca0 by Paul Moore in branch 'default':
Mention types.SimpleNamespace in collections.namedtuple doc
https://hg.python.org/cpython/rev/c3232d1d8ca0

--
nosy: +python-dev

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Emanuel Barry

Emanuel Barry added the comment:

Hmm, if `sys.__stdout__` was deleted (or set to `None`), this would also raise 
an `AttributeError` when calling `shutil.get_terminal_size`, so I think that 
even if `os.get_terminal_size` is guaranteed to be always present (which it's 
not, IIUC), catching `AttributeError` would prevent that bug, too.

Should I write a unit test for that too? Even though this one theorically 
covers it as well, I wouldn't want people in the future to think they can 
safely remove `except AttributeError` from the code.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread Emanuel Barry

Emanuel Barry added the comment:

On posix-based OSes, `os.get_terminal_size` might not exist ( 
https://hg.python.org/cpython/file/default/Modules/posixmodule.c#l12462 ), so 
this is needed.

New patch file with tests included.

--
Added file: http://bugs.python.org/file42522/get_term_size_with_test.patch

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Josh Rosenberg

Josh Rosenberg added the comment:

BTW, for a realistic use case that would be sped up by this patch (possibly a 
lot), consider a recursive function that is continually doing a "virtual" pop 
of the first argument, and receiving the rest as varargs, which are then 
unpacked for the recursive call, e.g., a function to make a multidimensional 
list populated with zeroes:

def nestedzeroes(firstdim, *dims):
'''Make multidimensional list populated with 0s'''
if not dims:
return [0] * firstdim
return [nestedzeroes(*dims) for _ in range(firstdim)]

It's somewhat less artificial in that it multiplies the effect of the 
optimization in a way that would actually exercise a microbenchmark-like 
scenario, where the amount of work involved in the star-args-only function 
calls is an appreciable percentage of the work. Running nestedzeroes(5, 5, 5) 
to create a 5x5x5 structure would involve 30 recursive calls; for 
nestedzeroes(10, 10, 10), 110 recursive calls.

I've actually used code like this (admittedly rarely) to avoid the hassle of 
inlining a many times nested set of list comprehensions to initialize a 
multidimensional list.

--
nosy: +josh.r

___
Python tracker 

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



[issue1612012] builtin compile() doc needs PyCF_DONT_IMPLY_DEDENT

2016-04-19 Thread Berker Peksag

Berker Peksag added the comment:

A similar request (issue 12207 - "Document ast.PyCF_ONLY_AST") was rejected in 
2012.

--
nosy: +berker.peksag
resolution:  -> rejected
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue4260] ctypes.xFUNCTYPE are decorators.

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
versions: +Python 3.5, Python 3.6 -Python 3.0

___
Python tracker 

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



[issue26799] gdb support fails with "Invalid cast."

2016-04-19 Thread Thomas

Thomas added the comment:

I have done a bit more digging, turns out it is actually no problem at all to 
debug python in gdb with gdb with python support (at least using a fixed 
python-gdb-py).

Turns out the type->length of the the globally initialized ptr types is wrong: 
It is 4 instead of 8, causing the cast to fail. I suspect the initialization is 
done before the executable is loaded and gdb is using some default. To verify, 
I have put two prints in the global initialization and in a command invocation:

GOBAL INITIALIZATION: gdb.lookup_type('char').pointer().sizeof == 4
COMMAND INVOKE: gdb.lookup_type('char').pointer().sizeof == 8

I guess to be fully portable those types need to be looked up at least whenever 
gdb changes it's binary, but I have no idea if there is a hook for that. But it 
seems reasonable to just replace those globals with on-demand lookup functions 
or properties.

If you are interested in the actual python/c stack traces for the error:

Thread 1 "gdb" hit Breakpoint 1, value_cast (type=type@entry=0x2ef91e0, 
arg2=arg2@entry=0x32b13f0) at ../../gdb/valops.c:571
571   error (_("Invalid cast."));
(gdb) py-bt
Traceback (most recent call first):
  
  File "[...]/python-gdb.py", line 1151, in proxyval
field_str = field_str.cast(_type_unsigned_char_ptr)
  File "[...]/python-gdb.py", line 945, in print_traceback
% (self.co_filename.proxyval(visited),
  File "[...]/python-gdb.py", line 1578, in print_traceback
pyop.print_traceback()
  File "[...]/python-gdb.py", line 1761, in invoke
frame.print_traceback()
(gdb) bt
#0  value_cast (type=type@entry=0x2ef91e0, arg2=arg2@entry=0x32b13f0) at 
../../gdb/valops.c:571
#1  0x0052261f in valpy_do_cast (self=, 
args=, op=UNOP_CAST) at ../../gdb/python/py-value.c:525
#2  0x7fc7ce2141de in PyCFunction_Call (func=func@entry=, args=args@entry=(,), kwds=kwds@entry=0x0)
at ../../Python-3.5.1/Objects/methodobject.c:109
#3  0x7fc7ce2c8887 in call_function 
(pp_stack=pp_stack@entry=0x7c81cec8, oparg=oparg@entry=1) at 
../../Python-3.5.1/Python/ceval.c:4655
#4  0x7fc7ce2c57ac in PyEval_EvalFrameEx (

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Joe Jevnik

Joe Jevnik added the comment:

> It's possible that stararg is already an empty tuple. Is it worth to use it?

PyTuple_New(0) should return the unit tuple in most cases:

#if PyTuple_MAXSAVESIZE > 0
if (size == 0 && free_list[0]) {
op = free_list[0];
Py_INCREF(op);
#ifdef COUNT_ALLOCS
tuple_zero_allocs++;
#endif
return (PyObject *) op;
}


Looking at this again I think that checking if stararg is nonnull is more 
clear, I will update the patch (as call-function-var-3.patch). I cannot exactly 
rewrite the if to use the control flow you show because that would cause 
non-tuple subclasses to forward a stararg of () instead of copying it into a 
normal tuple when no arguments are passed ont the stack.

--
Added file: http://bugs.python.org/file42521/call-function-var-3.patch

___
Python tracker 

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



[issue22558] Missing doc links to source code

2016-04-19 Thread Yoni Lavi

Changes by Yoni Lavi :


--
nosy: +Yoni Lavi

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

FYI I ran the full test suite with the second attached patch and all tests pass.

By the way, please add a suffix like -2, -3, etc. to your patches next time. 
It's easier to identify them if they have a different name ;-)

--

___
Python tracker 

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



[issue26799] gdb support fails with "Invalid cast."

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I tried Python 3.6 with "./configure --with-pydebug --without-pymalloc 
--with-valgrind". The py-bt commands works as expect in gdb.

Can you try to modify python-gdb.py to get a traceback of your Invalid cast 
error?

> I am able to fix it with the following commands:
> (...) _type_char_ptr = gdb.lookup_type('char').pointer() # char*

These defines are already in Tools/gdb/libpython.py (python-gdb.py is just a 
copy). I don't understand why you have to redeclare these variables again.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> On all supported platforms (including such exotic as old AIX, QNX or Minix) 
> it should be defined.

test_shutil always call shutil.get_terminal_size() and I didn't see any failure 
on the unit suite on our buildbots, even less common platforms like OpenBSD, 
AIX, OpenIndiana, etc.

So yes, os.get_terminal_size() looks to be available on all supported platforms.

--

___
Python tracker 

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



[issue26801] Fix shutil.get_terminal_size() to catch AttributeError

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

get_terminal_size.diff LGTM.

Would you like to try to write an unit test? Maybe using unittest.mock.patch?

--
nosy: +haypo

___
Python tracker 

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



[issue26516] Add PYTHONMALLOC env var and add support for malloc debug hooks in release mode

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c4c14e34e528 by Victor Stinner in branch 'default':
Don't define _PyMem_PymallocEnabled() if pymalloc is disabled
https://hg.python.org/cpython/rev/c4c14e34e528

--

___
Python tracker 

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



[issue26803] syslog logging handler fails with address in unix abstract namespace

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

The following change looks good to me:

-if isinstance(address, str):
+if isinstance(address, (str, bytes)):
 self.unixsocket = True
 self._connect_unixsocket(address)

But I don't understand the testcase. Is an address starting with a NULL 
character a special address? How does it the bytes address case?

+# override the definition in the base class
+self.address = '\x00python_logging_test'

"syslog logging handler fails with address in unix abstract namespace"

What is the unix abstract namespace?

--
nosy: +haypo

___
Python tracker 

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



[issue11233] clarifying Availability: Unix

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I like the idea of a single place where the Availability is described, and 
adding a link to this place.  availability-directive.patch LGTM.

--
nosy: +haypo

___
Python tracker 

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



[issue25942] subprocess.call SIGKILLs too liberally

2016-04-19 Thread Mike Pomraning

Mike Pomraning added the comment:

Re: #2, I'd rather have a zombie than a hard kill on a child whose code I 
perhaps don't control.  Zombies are a fact of life (er, a fact of undeath?) in 
UNIX process management, and are the historical and IMHO expected behavior.

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

call-function-var.patch LGTM.

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

+if (!nstar) {
+/* There are no positional arguments on the stack or in in a
+   sequence that was unpacked. */
+return PyTuple_New(0);
+}

It's possible that stararg is already an empty tuple. Is it worth to use it?

+if (!nstar) {
+if (stararg != NULL && PyTuple_CheckExact(stararg)) {
+Py_INCREF(stararg);
+return stararg;
+}
+else {
+/* There are no positional arguments on the stack or in in a
+   sequence that was unpacked. */
+return PyTuple_New(0);
+}
+}

--

___
Python tracker 

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



[issue21668] The select and time modules uses libm functions without linking against it

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I pushed ext_modules_libm.patch with the helper function proposed by Chi Hsuan 
Yen in 
https://github.com/yan12125/python3-android/blob/038271d/mk/python/modules-link-libm.patch.

Tell me if it's not enough. I hope that it will make CPython a little bit more 
portable ;-)

--
resolution:  -> fixed
status: open -> closed
versions: +Python 3.6 -Python 3.4

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Paul Moore

Paul Moore added the comment:

Thanks Victor. I'll sort this out this evening when I get to my PC with access 
to the CPython repo.

--

___
Python tracker 

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



[issue21668] The select and time modules uses libm functions without linking against it

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f92fea23161d by Victor Stinner in branch '3.5':
setup.py: add missing libm dependency
https://hg.python.org/cpython/rev/f92fea23161d

New changeset 3a9b47b062b9 by Victor Stinner in branch 'default':
Merge 3.5: Issue #21668
https://hg.python.org/cpython/rev/3a9b47b062b9

--
nosy: +python-dev

___
Python tracker 

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



[issue13876] Sporadic failure in test_socket: testRecvmsgEOF

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
status: open -> closed

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

LGTM. I was going to push your sugestion when I saw that you are allowed to 
push yourself. See my attached patch:

* I fixed :ref:`types.SimpleNamespace` => you have to use :class:`...`
* I replaced "may be" with "can be" (I'm not confortable with "may", but it's 
up to you)

--
keywords: +patch
nosy: +haypo
Added file: http://bugs.python.org/file42520/collections.patch

___
Python tracker 

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



[issue22297] 2.7 json encoding broken for enums

2016-04-19 Thread Berker Peksag

Berker Peksag added the comment:

-1 from me, too.

--
nosy: +berker.peksag
stage:  -> resolved
status: open -> closed

___
Python tracker 

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



[issue11233] clarifying Availability: Unix

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
nosy: +berker.peksag
stage: needs patch -> patch review
type:  -> enhancement
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue9014] Incorrect documentation of the PyObject_HEAD macro

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
stage: commit review -> resolved

___
Python tracker 

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



[issue18378] locale.getdefaultlocale() fails on Mac OS X with default language set to English

2016-04-19 Thread Tommy Sparber

Changes by Tommy Sparber :


--
nosy: +tsparber

___
Python tracker 

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



[issue23710] C API doc for PyObject_HEAD is outdated

2016-04-19 Thread Berker Peksag

Berker Peksag added the comment:

Docs of PyObject_HEAD and friends have already been fixed in 760c5cfacbaa.

https://docs.python.org/3/extending/newtypes.html still needs to be updated to 
mention ob_base:

This is what a Noddy object will contain—in this case, nothing more than 
what every Python object contains—a refcount and a pointer to a type object. 
These are the fields the PyObject_HEAD macro brings in.

--
keywords: +easy
nosy: +berker.peksag
stage:  -> needs patch
type:  -> behavior
versions: +Python 3.5, Python 3.6

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
keywords: +easy
stage:  -> needs patch
versions: +Python 3.5

___
Python tracker 

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



[issue26769] Python 2.7: make private file descriptors non inheritable

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> It looks like some of these do make the file descriptor accessible to the 
> Python user. (...)

Oh right, I reverted changes on these modules.

What do you think of the patch version 2?

Changes since patch version 1:

* Revert changes in linuxaudio, oss, select, etc. modules
* Fix _Py_try_set_non_inheritable(): *set* the FD_CLOEXEC flag, don't clear it!
* Optimize _Py_try_set_non_inheritable(): avoid fcntl() if possible (backport 
issue #26770)

--
Added file: http://bugs.python.org/file42519/set_inheritable-2.patch

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Chris Angelico

Changes by Chris Angelico :


--
nosy: +Rosuav

___
Python tracker 

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



[issue26805] Refer to types.SimpleNamespace in namedtuple documentation

2016-04-19 Thread Paul Moore

New submission from Paul Moore:

People often look towards collections.namedtuple when all they actually want is 
"named attribute" access to a collection of values, without needing a tuple 
subclass, or positional access. In these cases, types.SimpleNamespace may be a 
better fit.

I suggest adding the following pointer to the top of the namedtuple 
documentation:

"""
For simple uses, where the only requirement is to be able to refer to a set of 
values by name using attribute-style access, the :ref:`types.SimpleNamespace` 
type may be a suitable alternative to using a namedtuple.
"""

--
assignee: docs@python
components: Documentation
messages: 263733
nosy: docs@python, paul.moore
priority: normal
severity: normal
status: open
title: Refer to types.SimpleNamespace in namedtuple documentation
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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 19.04.2016 13:11, STINNER Victor wrote:
> 
> STINNER Victor added the comment:
> 
>> Could you perhaps check what's causing these slowdowns ?
> 
> It's obvious, no? My patch causes the slowdown.

Well, yes, of course :-) I meant whether there's anything you
can do about those slowdowns.

> On a timeit microbenchmark, I don't see such slowdown. That's also why
> I suspect that pybench is unstable.
> 
> python3.6 -m timeit '{}' says 105 ns with and without the patch.
> 
> python3.6 -m timeit 'd={}; d[1]=1; d[2]=2; d[3]=3; d[4]=4; d[5]=5;
> d[6]=6; d[7]=7; d[8]=8; d[9]=9; d[10]=10' says 838 ns with and without
> the patch.
> 
> I have to "cheat": I run timeit enough times until I see the "minimum".

Those operations are too fast for timeit. The overhead associated
with looping is much larger than the time it takes to run the
operation itself. That's why in pybench I put the operations into
blocks of repeated statements. The interpreter then doesn't spend
time on branching when going from one statement execution to the
next (inside those blocks) and you get closer to the real runtime
of the operation you're trying to measure.

--

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

> Could you perhaps check what's causing these slowdowns ?

It's obvious, no? My patch causes the slowdown.

On a timeit microbenchmark, I don't see such slowdown. That's also why
I suspect that pybench is unstable.

python3.6 -m timeit '{}' says 105 ns with and without the patch.

python3.6 -m timeit 'd={}; d[1]=1; d[2]=2; d[3]=3; d[4]=4; d[5]=5;
d[6]=6; d[7]=7; d[8]=8; d[9]=9; d[10]=10' says 838 ns with and without
the patch.

I have to "cheat": I run timeit enough times until I see the "minimum".

--

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

On 19.04.2016 12:52, STINNER Victor wrote:
> 
> As usual, I'm very skeptical on the pybench results which almost look like 
> noise. I don't understand how my change can make any operation *faster*, 
> whereas some benchmarks are faster with the patch...

This can easily happen as a result of different memory layout, but is
very much dependent on the machine architecture, CPU, memory type, etc.

> Dict microbenchmarks:
> 
>DictCreation:38ms36ms   +4.8%39ms37ms   +3.9%
>   DictWithFloatKeys:40ms40ms   -0.8%40ms40ms   -0.4%
> DictWithIntegerKeys:33ms31ms   +7.2%33ms31ms   +7.6%
>  DictWithStringKeys:29ms28ms   +0.4%29ms29ms   +0.7%
>  SimpleDictManipulation:59ms59ms   -0.4%59ms59ms   -0.4%

Only dict creation and the integer keys benchmark results are relevant.

Could you perhaps check what's causing these slowdowns ?

--
nosy: +lemburg

___
Python tracker 

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



[issue24838] tarfile.py: fix GNU and USTAR formats to properly handle paths with special characters that are encoded with more than one byte each

2016-04-19 Thread Berker Peksag

Changes by Berker Peksag :


--
resolution:  -> fixed

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

pybench results on dict_version-8.patch with CPU isolation: 
http://haypo-notes.readthedocs.org/microbenchmark.html

As usual, I'm very skeptical on the pybench results which almost look like 
noise. I don't understand how my change can make any operation *faster*, 
whereas some benchmarks are faster with the patch...

Dict microbenchmarks:

   DictCreation:38ms36ms   +4.8%39ms37ms   +3.9%
  DictWithFloatKeys:40ms40ms   -0.8%40ms40ms   -0.4%
DictWithIntegerKeys:33ms31ms   +7.2%33ms31ms   +7.6%
 DictWithStringKeys:29ms28ms   +0.4%29ms29ms   +0.7%
 SimpleDictManipulation:59ms59ms   -0.4%59ms59ms   -0.4%

Full output:

$ ./python.version Tools/pybench/pybench.py -f pybench.version
$ ./python.orig Tools/pybench/pybench.py -f pybench.orig
$ ./python.orig Tools/pybench/pybench.py -s pybench.version -c pybench.orig 

---
PYBENCH 2.1
---
* using CPython 3.6.0a0 (default:e281a57d5b29, Apr 19 2016, 12:30:36) [GCC 
5.3.1 20151207 (Red Hat 5.3.1-2)]
* disabled garbage collection
* system check interval set to maximum: 2147483647
* using timer: time.perf_counter
* timer: resolution=1e-09, implementation=clock_gettime(CLOCK_MONOTONIC)

---
Benchmark: pybench.version
---

Rounds: 10
Warp:   10
Timer:  time.perf_counter

Machine Details:
   Platform ID:
Linux-4.4.4-301.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three
   Processor:  x86_64

Python:
   Implementation: CPython
   Executable: /home/haypo/prog/python/default/python.version
   Version:3.6.0a0
   Compiler:   GCC 5.3.1 20151207 (Red Hat 5.3.1-2)
   Bits:   64bit
   Build:  Apr 19 2016 12:29:16 (#default:e281a57d5b29+)
   Unicode:UCS4


---
Comparing with: pybench.orig
---

Rounds: 10
Warp:   10
Timer:  time.perf_counter

Machine Details:
   Platform ID:
Linux-4.4.4-301.fc23.x86_64-x86_64-with-fedora-23-Twenty_Three
   Processor:  x86_64

Python:
   Implementation: CPython
   Executable: /home/haypo/prog/python/default/python.orig
   Version:3.6.0a0
   Compiler:   GCC 5.3.1 20151207 (Red Hat 5.3.1-2)
   Bits:   64bit
   Build:  Apr 19 2016 12:30:36 (#default:e281a57d5b29)
   Unicode:UCS4


Test minimum run-timeaverage  run-time
 thisother   diffthisother   diff
---
  BuiltinFunctionCalls:49ms50ms   -1.3%49ms50ms   -1.2%
   BuiltinMethodLookup:26ms26ms   -0.8%26ms27ms   -1.2%
 CompareFloats:29ms30ms   -2.0%29ms30ms   -1.9%
 CompareFloatsIntegers:39ms39ms   +1.4%39ms39ms   +1.5%
   CompareIntegers:43ms43ms   -1.1%43ms43ms   -1.1%
CompareInternedStrings:28ms28ms   -0.2%28ms28ms   -0.3%
  CompareLongs:25ms25ms   +2.8%25ms25ms   +2.9%
CompareStrings:26ms27ms   -0.8%26ms27ms   -1.6%
ComplexPythonFunctionCalls:44ms44ms   -1.6%44ms45ms   -1.6%
 ConcatStrings:35ms33ms   +6.4%35ms33ms   +6.1%
   CreateInstances:49ms48ms   +2.6%50ms49ms   +1.8%
CreateNewInstances:37ms36ms   +2.5%37ms36ms   +2.2%
   CreateStringsWithConcat:65ms63ms   +3.3%66ms64ms   +2.9%
  DictCreation:38ms36ms   +4.8%39ms37ms   +3.9%
 DictWithFloatKeys:40ms40ms   -0.8%40ms40ms   -0.4%
   DictWithIntegerKeys:33ms31ms   +7.2%33ms31ms   +7.6%
DictWithStringKeys:29ms28ms   +0.4%29ms29ms   +0.7%
  ForLoops:25ms25ms   -0.4%26ms26ms   -0.3%
IfThenElse:37ms35ms   +3.3%37ms36ms   +3.0%
   ListSlicing:39ms38ms   +0.3%39ms39ms   +0.0%
NestedForLoops:40ms40ms   +0.1%40ms40ms   -0.0%
  NestedListComprehensions:41ms42ms   -0.2%42ms42ms   -0.9%
  NormalClassAttribute:82ms78ms   +4.0%82ms79ms   +3.8%
   NormalInstanceAttribute:43ms42ms   

[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

I ran again timeit microbenchmarks with CPU isolation on dict_version-8.patch, 
minimum of 10 runs.

-m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del d[2]; d.clear()'

* Original: 287 ns
* Version: 289 ns (+2 ns, +0.7%)

-m timeit 'd={i:i for i in range(2**16)}' 'for i in range(2**16): d[i]=i-1' 
'for i in range(2**16): d[i]=i+1' 'for i in range(2**15): del d[i]' 'd.clear()'

* Original: 21.2 msec
* Version: 21.4 msec (+0.2 ms, +0.9%)

--

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

timeit microbenchmarks on dict_version-8.patch, minimum of 10 runs.

$ ./python.orig -m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del 
d[2]; d.clear()'
100 loops, best of 3: 0.292 usec per loop
$ ./python.version -m timeit 'd={1: 0}; d[2]=0; d[3]=0; d[4]=0; del d[1]; del 
d[2]; d.clear()'
100 loops, best of 3: 0.293 usec per loop

=> 1 nanosecond (0.3%) slower

$ ./python.orig -m timeit 'd={i:i for i in range(2**16)}' 'for i in 
range(2**16): d[i]=i-1' 'for i in range(2**16): d[i]=i+1' 'for i in 
range(2**15): del d[i]' 'd.clear()'
10 loops, best of 3: 21.2 msec per loop
$ ./python.version -m timeit 'd={i:i for i in range(2**16)}' 'for i in 
range(2**16): d[i]=i-1' 'for i in range(2**16): d[i]=i+1' 'for i in 
range(2**15): del d[i]' 'd.clear()'
10 loops, best of 3: 21.3 msec per loop

=> 0.1 ms (0.5%) slower

--

___
Python tracker 

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



[issue26058] PEP 509: Add ma_version to PyDictObject

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

Patch version 8:

* Update to the latest PEP: remove micro-optimization in dictobject.c if the 
new value is identical to the current value, dict.__setitem__() now always 
changes the version
* Refactor test_pep509 to address Brett's comments
* Add new unit tests on identical values
* Add new unit tests on equal values (with special __eq__ method)

--
Added file: http://bugs.python.org/file42518/dict_version-8.patch

___
Python tracker 

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



[issue1322] Deprecate platform.dist() and platform.linux_distribution() functions

2016-04-19 Thread Andy Maier

Andy Maier added the comment:

@leycec: By the way, the "ld" package *does* use shlex.shlex() to parse the 
os-release file.

--

___
Python tracker 

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



[issue1322] Deprecate platform.dist() and platform.linux_distribution() functions

2016-04-19 Thread Andy Maier

Andy Maier added the comment:

Nir currently proposes to change the package name from "ld" to "dist". See 
https://github.com/nir0s/ld/issues/103
Comments on this name change proposal are welcome (over there).

On "Given the unremarkable simplicity of implementing this function correctly 
...":

It seems to me that this is over-simplifying the task somewhat. Nir's "ld" 
package needs to understand all of the (currently) three different formats on 
Linux, and goes for a precedence-based approach to consolidate the information. 
Also, determining supposedly simple things like a reliable distro ID, or a 
precise distro version is not trivial, given that some Linux distros provide 
their data quite inconsistently between the different data sources and 
sometimes change things like distro ID incompatibly in a new minor release.

Overall, I can only encourage people to try out the "ld" package (v0.5.0 is 
currently on PyPI) and give feedback (on its GitHub project).

Does the deprecation and removal of these functions discriminate Linux compared 
to Windows and OS-X? Maybe, but I'm pragmatic here, and for me the important 
criteria is the one that was stated from the beginning in this discussion: The 
higher change rate in Linux fits quite well with the approach of having a 
separate package that is not part of the standard Python.

Does that mean that less batteries are now included in Python out of the box: 
Yes, a very small part of the batteries is now no longer included. But maybe 
one day when the "ld" package is perfect and does not require a high change 
rate anymore, it gets added to standard Python.

Also, there are many packages the average Python project needs these days that 
are no longer coming with standard Python (six, setuptools, pbr, better unit 
testers, lxml, M2Crypto, Sphinx, lxml, ). If you look at the long 
backlog of pull requests and open issues in standard Python, it is a good thing 
actually, not to overload the community maintaining the standard Python even 
further. But that is a bit off-topic for this issue, I am just mentioning it in 
order to beg for acceptance for the approach taken for linux distro information.

--

___
Python tracker 

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



[issue24838] tarfile.py: fix GNU and USTAR formats to properly handle paths with special characters that are encoded with more than one byte each

2016-04-19 Thread Lars Gustäbel

Lars Gustäbel added the comment:

Sorry for the glitch, I suppose everything works fine now.

--
status: open -> closed

___
Python tracker 

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



[issue24838] tarfile.py: fix GNU and USTAR formats to properly handle paths with special characters that are encoded with more than one byte each

2016-04-19 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 78ede2baa146 by Lars Gustäbel in branch '3.5':
Issue #24838: Fix test_tarfile.py for non-utf8 filesystem encodings.
https://hg.python.org/cpython/rev/78ede2baa146

New changeset 08835d1e7a50 by Lars Gustäbel in branch 'default':
Issue #24838: Merge test_tarfile.py fix from 3.5.
https://hg.python.org/cpython/rev/08835d1e7a50

--

___
Python tracker 

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



[issue24838] tarfile.py: fix GNU and USTAR formats to properly handle paths with special characters that are encoded with more than one byte each

2016-04-19 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-19 Thread SilentGhost

Changes by SilentGhost :


--
components: +Library (Lib) -Extension Modules
nosy: +orsenthil
stage:  -> patch review

___
Python tracker 

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



[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-19 Thread Hans-Peter Jansen

Changes by Hans-Peter Jansen :


--
versions: +Python 3.6 -Python 3.5

___
Python tracker 

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



[issue26804] Prioritize lowercase proxy variables in urllib.request

2016-04-19 Thread Hans-Peter Jansen

New submission from Hans-Peter Jansen:

During programming a function, that replaces a wget call, I noticed, that 
something is wrong with urllibs proxy handling. 

I usually use the scheme "http_proxy= wget -N -nd URL" when I need to bypass 
the proxy. Hence I was pretty confused, that this doesn't work with python(3). 
Creating an empty ProxyHandler isn't the real Mc Coy either. Diving into the 
issue, I found getproxies_environment, but couldn't make much sense out of its 
behavior, up until I noticed, that
my OS (openSUSE ) creates both variants of environment variables behind the 
scenes: uppercase and lowercase. 

Consequence: python3 needs the scheme "http_proxy= HTTP_PROXY= python3 ..."

Since I, like everyone else, prefer gentle tones over the loud, and want to 
spare this surprise for others in the future, I propose the attached patch.

Process environment variables in two passes, first uppercase, then lowercase, 
allowing an empty lowercase value to overrule any uppercase value.

Please consider applying this.

--
components: Extension Modules
files: prioritize_lowercase_proxy_vars_in_urllib_request.diff
keywords: patch
messages: 263720
nosy: frispete
priority: normal
severity: normal
status: open
title: Prioritize lowercase proxy variables in urllib.request
type: behavior
versions: Python 3.5
Added file: 
http://bugs.python.org/file42516/prioritize_lowercase_proxy_vars_in_urllib_request.diff

___
Python tracker 

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



[issue24838] tarfile.py: fix GNU and USTAR formats to properly handle paths with special characters that are encoded with more than one byte each

2016-04-19 Thread STINNER Victor

STINNER Victor added the comment:

Tests fail on FreeBSD:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.x%203.5/builds/713/steps/test/logs/stdio

Example:



==
FAIL: test_unicode_link1 (test.test_tarfile.UstarUnicodeTest)
--
Traceback (most recent call last):
  File 
"/usr/home/buildbot/python/3.5.koobs-freebsd9/build/Lib/test/test_tarfile.py", 
line 1807, in test_unicode_link1
self._test_ustar_link("0123456789" * 9 + "01234567\xff")
  File 
"/usr/home/buildbot/python/3.5.koobs-freebsd9/build/Lib/test/test_tarfile.py", 
line 1826, in _test_ustar_link
self.assertEqual(name, t.linkname)
AssertionError: '0123[44 
chars]89012345678901234567890123456789012345678901234567\xff' != '0123[44 
chars]89012345678901234567890123456789012345678901234567\udcc3\udcbf'
- 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\xff
?   
^
+ 
01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567\udcc3\udcbf
?   
^^

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Joe Jevnik

Changes by Joe Jevnik :


--
type:  -> performance

___
Python tracker 

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



[issue21668] The select and time modules uses libm functions without linking against it

2016-04-19 Thread Chi Hsuan Yen

Chi Hsuan Yen added the comment:

The approach with a helper function is better. See 
https://github.com/yan12125/python3-android/blob/038271d/mk/python/modules-link-libm.patch.

By the way, I have verified there are no libraries referencing libm functions 
with 
https://github.com/yan12125/python3-android/blob/cpython-hg/devscripts/import_all.py

--

___
Python tracker 

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



[issue26802] Avoid copy in call_function_var when no extra stack args are passed

2016-04-19 Thread Joe Jevnik

Joe Jevnik added the comment:

in _PyEval_EvalCodeWithName we will have already pulled the underlying array 
out of the tuple subclass and the then we will reconstruct the vararg value in 
the locals from this array. This means that with this patch we can get:

>>> class C(tuple): pass
... 
>>> def f(*args): print(type(args))
... 
>>> f(*C([1, 2, 3]))


The only case where we get potentially strange behavior is if we have a type 
whose tp_call did not forward to PyArg_Parse* or the PyTupleObject api and went 
though the abstract object interface. I ran the tests and the benchmark suite 
and did not run into any issues here but I can see how this would be 
potentially problematic behavior.

I have updated the code to also do a PyTuple_CheckExact against `stararg`. The 
tests I ran are:

timeit("h(*(a, b, c, d, e, f, g))", 'def h(a, b, c, d, e, f, g): pass\na, b, c, 
d, e, f, g = range(7)', number=int(10e7))

default: 17.191688070015516
patch: 14.060781285981648

There is also a really great case where you star unpack a tuple of literals 
which gets pushed into the co_consts:

timeit("f(*('a', 'b', 'c', 'd', 'e', 'f', 'g'))", 'def f(a, b, c, d, e, f, g): 
pass', number=int(10e7))

default: 13.842308042978402
patch: 9.696972723002546

This case seems far less common, but maybe someone has something like:

a = 1, 2, 3
...
f(*a)

--
type: performance -> 
Added file: http://bugs.python.org/file42515/call-function-var.patch

___
Python tracker 

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



[issue21668] The select and time modules uses libm functions without linking against it

2016-04-19 Thread Xavier de Gaye

Xavier de Gaye added the comment:

The _datetime module also calls functions in libm: delta_new() uses
round() and accum() uses modf().

The attached patch updates setup.py for all the modules that use libm.

--
nosy: +xdegaye
Added file: http://bugs.python.org/file42514/ext_modules_libm.patch

___
Python tracker 

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



[issue26803] syslog logging handler fails with address in unix abstract namespace

2016-04-19 Thread Xavier de Gaye

New submission from Xavier de Gaye:

The traceback:

Traceback (most recent call last):
  File "Lib/logging/handlers.py", line 917, in emit
self.socket.sendto(msg, self.address)
TypeError: getsockaddrarg: AF_INET address must be tuple, not bytes

The attached patch reproduces the issue with a test case and fixes it.

--
components: Library (Lib)
files: unix_abstract_namespace.patch
keywords: patch
messages: 263715
nosy: vinay.sajip, xdegaye
priority: normal
severity: normal
status: open
title: syslog logging handler fails with address in unix abstract namespace
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file42513/unix_abstract_namespace.patch

___
Python tracker 

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



  1   2   >