[issue14373] C implementation of functools.lru_cache

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here are the recent version of the patch and minimal crash reproducer.

--
Added file: http://bugs.python.org/file39478/clru_cache_3.patch
Added file: http://bugs.python.org/file39479/clru_cache_crasher.py

___
Python tracker 

___diff -r 2df7c958974e Lib/functools.py
--- a/Lib/functools.py  Sat May 23 18:08:55 2015 -0700
+++ b/Lib/functools.py  Sun May 24 10:11:21 2015 +0300
@@ -419,120 +419,129 @@ def lru_cache(maxsize=128, typed=False):
 if maxsize is not None and not isinstance(maxsize, int):
 raise TypeError('Expected maxsize to be an integer or None')
 
+def decorating_function(user_function):
+wrapper = _lru_cache_wrapper(user_function, maxsize, typed, _CacheInfo)
+return update_wrapper(wrapper, user_function)
+
+return decorating_function
+
+def _lru_cache_wrapper(user_function, maxsize, typed, _CacheInfo):
 # Constants shared by all lru cache instances:
 sentinel = object()  # unique object used to signal cache misses
 make_key = _make_key # build a key from the function arguments
 PREV, NEXT, KEY, RESULT = 0, 1, 2, 3   # names for the link fields
 
-def decorating_function(user_function):
-cache = {}
-hits = misses = 0
-full = False
-cache_get = cache.get# bound method to lookup a key or return None
-lock = RLock()   # because linkedlist updates aren't threadsafe
-root = []# root of the circular doubly linked list
-root[:] = [root, root, None, None] # initialize by pointing to self
+cache = {}
+hits = misses = 0
+full = False
+cache_get = cache.get# bound method to lookup a key or return None
+lock = RLock()   # because linkedlist updates aren't threadsafe
+root = []# root of the circular doubly linked list
+root[:] = [root, root, None, None] # initialize by pointing to self
 
-if maxsize == 0:
+if maxsize == 0:
 
-def wrapper(*args, **kwds):
-# No caching -- just a statistics update after a successful 
call
-nonlocal misses
-result = user_function(*args, **kwds)
-misses += 1
+def wrapper(*args, **kwds):
+# No caching -- just a statistics update after a successful call
+nonlocal misses
+result = user_function(*args, **kwds)
+misses += 1
+return result
+
+elif maxsize is None:
+
+def wrapper(*args, **kwds):
+# Simple caching without ordering or size limit
+nonlocal hits, misses
+key = make_key(args, kwds, typed)
+result = cache_get(key, sentinel)
+if result is not sentinel:
+hits += 1
 return result
+result = user_function(*args, **kwds)
+cache[key] = result
+misses += 1
+return result
 
-elif maxsize is None:
+else:
 
-def wrapper(*args, **kwds):
-# Simple caching without ordering or size limit
-nonlocal hits, misses
-key = make_key(args, kwds, typed)
-result = cache_get(key, sentinel)
-if result is not sentinel:
+def wrapper(*args, **kwds):
+# Size limited caching that tracks accesses by recency
+nonlocal root, hits, misses, full
+key = make_key(args, kwds, typed)
+with lock:
+link = cache_get(key)
+if link is not None:
+# Move the link to the front of the circular queue
+link_prev, link_next, _key, result = link
+link_prev[NEXT] = link_next
+link_next[PREV] = link_prev
+last = root[PREV]
+last[NEXT] = root[PREV] = link
+link[PREV] = last
+link[NEXT] = root
 hits += 1
 return result
-result = user_function(*args, **kwds)
-cache[key] = result
+result = user_function(*args, **kwds)
+with lock:
+if key in cache:
+# Getting here means that this same key was added to the
+# cache while the lock was released.  Since the link
+# update is already done, we need only return the
+# computed result and update the count of misses.
+pass
+elif full:
+# Use the old root to store the new key and result.
+oldroot = root
+oldroot[KEY] = key
+oldroot[RESULT] = result
+# Empty th

[issue24273] _scproxy.so causes EXC_BAD_ACCESS (SIGSEGV)

2015-05-24 Thread Jacob

Jacob added the comment:

Thanks! That does work.

I'm concerned there may be unintended or undesired consequences of this.

Hope the bug gets fixed, but will use the workaround for now.

--

___
Python tracker 

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



[issue24273] _scproxy.so causes EXC_BAD_ACCESS (SIGSEGV)

2015-05-24 Thread Ned Deily

Changes by Ned Deily :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> exception error in _scproxy.so

___
Python tracker 

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



[issue17239] XML vulnerabilities in Python

2015-05-24 Thread Stefan Behnel

Changes by Stefan Behnel :


--
nosy: +scoder

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Tal Einat

Tal Einat added the comment:

I'm now working this into a patch against current default.

--
nosy: +taleinat

___
Python tracker 

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



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

2015-05-24 Thread Martin Panter

Martin Panter added the comment:

Garrett Cooper: If you are still around, you might want to review the following 
three changes in this new patch. I suspect they were mistakes in your version, 
but I cannot be 100 percent sure.

* Restoring length - 1 subtraction in call_readline() at line 1239
* Change #if __APPLE__ back to #ifdef
* Gnu Readline requires  to be included first, so I fixed the 
configure.ac script

Other changes in this new patch:

* Merged with current code
* Remove outdated comment about using a runtime library check
* Couple minor corrections to comments, conditional variable declarations, etc
* Fixed wrong HIST_ENTRY pointer type used in a Gnu Readline conditional branch
* Changed double single quote sign back to single single quote. I am no 
Autocrap expert, but it screwed up the generated comment in pyconfig.h.in.
* Add ability to include with 

Tested on Arch Linux with both Gnu Readline 6.3.008 and Editline 20150325-3.1 
available:

No readline argument: Uses Gnu Readline
--with-readline=editline: Uses Editline
--with-readline=readline: Gnu Readline
--with-readline=yes: Gnu Readline
--with-readline: Gnu Readline
--with-readline=no: No “readline” module
--without-readline: No “readline” module
--without-readline=no: error: invalid package name: readline=no

However after successfully compiling with Editline, there are a couple bugs 
with keystrokes or output not being synchronized. I do not think I will spent 
much more effort on it. But perhaps other people are interested in taking this 
further.

--
components: +Extension Modules -Library (Lib)
nosy: +vadmium
stage: patch review -> needs patch
versions: +Python 3.6 -Python 3.3
Added file: http://bugs.python.org/file39480/editline.v2.patch

___
Python tracker 

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



[issue18459] readline: libedit support on non-apple platforms

2015-05-24 Thread Martin Panter

Martin Panter added the comment:

There was already a potential patch in Issue 13501.

--
nosy: +vadmium
resolution:  -> duplicate
superseder:  -> Make libedit support more generic; port readline / libedit to 
FreeBSD

___
Python tracker 

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



[issue18459] readline: libedit support on non-apple platforms

2015-05-24 Thread Martin Panter

Changes by Martin Panter :


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



[issue24266] raw_input + readline: Ctrl+C during search breaks readline

2015-05-24 Thread Martin Panter

Martin Panter added the comment:

I suspect this is actually a bug with Gnu Readline. The same issue exists in 
GDB.

When a signal handler (such as SIGINT) raises an exception to abort the input, 
Python calls rl_free_line_state(). The documentation for that function, 
 says 
Readline’s own SIGINT handler (which Python doesn’t normally actually use) also 
calls it to abort the current line. It lists various states that are “freed”. 
Although the search state is not in the list, it seems like it should be.

--

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Tal Einat

Tal Einat added the comment:

Attached is a patch based on Chris Barker's implementation on github[1]. This 
includes only the C implementation, as well as tests, documentation and entries 
in NEWS and whatsnew.

I had to keep the (PyCFunction) cast in the module method list in 
Modules/mathmodule.c. That part should certainly be reviewed.

As for documentation etc., I took the best wording I could find from the PEP 
and the docs in the github repo, and made very slight changes only where I 
though they made things significantly clearer.

.. [1]: https://github.com/PythonCHB/close_pep

--
keywords: +patch
Added file: http://bugs.python.org/file39481/math_isclose.patch

___
Python tracker 

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



[issue23965] test_ssl failure on Fedora 22

2015-05-24 Thread Mark Daoust

Mark Daoust added the comment:

I think I might have found a related/real world example.

I'm on a mac with OSX-10.10.3 and "test_ssl" passes, but when I try to install 
jupyter_notebook it attempts to download some css, and gives what looks like an 
identical error to the first one, in the initial report (test_protocol_sslv23). 
The download works fine in 2.7 and 3.4:

>>> sys.version
'3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 14:19:25) \n[GCC 4.2.1 (Apple 
Inc. build 5666) (dot 3)]'

>>> ssl.OPENSSL_VERSION
'OpenSSL 0.9.8zd 8 Jan 2015'

>>> urllib.request.urlopen("https://cdn.jupyter.org/notebook/4.0.0-dev/style/style.min.css";)

Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/urllib/request.py",
 line 1239, in do_open
h.request(req.get_method(), req.selector, req.data, headers)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 1083, in request
self._send_request(method, url, body, headers)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 1128, in _send_request
self.endheaders(body)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 1079, in endheaders
self._send_output(message_body)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 911, in _send_output
self.send(msg)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 854, in send
self.connect()
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/http/client.py",
 line 1237, in connect
server_hostname=server_hostname)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 
376, in wrap_socket
_context=self)
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 
747, in __init__
self.do_handshake()
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 
983, in do_handshake
self._sslobj.do_handshake()
  File 
"/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/ssl.py", line 
628, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] sslv3 alert handshake 
failure (_ssl.c:634)

--
nosy: +suki

___
Python tracker 

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



[issue11029] Crash, 2.7.1, Tkinter and threads and line drawing

2015-05-24 Thread Jackmoo

Jackmoo added the comment:

Hi there, recently I also encounter this in windows(7), and my python program 
occasionally crash and the windows pops 'appcrash' message with tcl8.5.dll 
error c05 (access violation).

And this end up related to thread safe problem described as above. Since in my 
program, I have to build the tkinter UI in another thread (main thread was 
occupied by other module which blocking), so I can't follow the 'build UI in 
main thread' solution. My work around is, add a handler which using .after() 
and get_nowait() to call itself periodically to handle the command in queue.

def commandQueueHandler(self):
try:
while 1:
your_command = self.textCommandQueue.get_nowait()
if your_command is not None:
# execute the command 
self.Text.update_idletasks()
except Queue.Empty:
pass
self.Text.after(100, self.commandQueueHandler)

Once this method is triggered, just build another thread to put() command in 
textCommandQueue, then it will be executed periodically.
One thing that should mention is the update_idletasks() should be added after 
each command execution, otherwise the UI refresh will be slower then expected. 
(in my case, the scrolling of Text widge is a bit 'sticky' when I pull it. 
After adding update_idletasks(), it becomes smoother.)

TL:DR,
If you have to run tkinter UI in another thread, add a queue and self-called 
method with after() and get_nowait() in UI thread to handle the queue. If you 
want to send command to UI at other thread, just put() the command in the queue 
of UI thread.

--
nosy: +Jackmoo

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Stefan Behnel

Stefan Behnel added the comment:

The cast is correct and required (the actual signature is determined by the 
METH_* flags).

Patch LGTM, FWIW.

--
components: +Library (Lib)
nosy: +scoder
type:  -> enhancement

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Property descriptor getter uses cached tuple for args (issue23910). This can 
cause problems when called function use args after reading other property or 
save args. For now I know only one example - clru_cache_3.patch in issue14373.

Proposed patch use cached tuple in more robust manner.

--
components: Interpreter Core
files: property_cached_args.patch
keywords: patch
messages: 243980
nosy: barry, eric.smith, eric.snow, ll, python-dev, rhettinger, 
serhiy.storchaka
priority: high
severity: normal
stage: patch review
status: open
title: Correct reuse argument tuple in property descriptor
type: crash
versions: Python 3.5
Added file: http://bugs.python.org/file39482/property_cached_args.patch

___
Python tracker 

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



[issue23910] property_descr_get reuse argument tuple

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This patch caused crash with C implementation of lru_cache (issue14373). Opened 
issue24276 for fixing this.

--

___
Python tracker 

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



[issue14373] C implementation of functools.lru_cache

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

The problem is in property descriptor getter. It uses cached tuple for args and 
can unexpectedly modify it. Opened issue24276 for fixing this bug.

Another way is to remove fast path in lru_cache_make_key() and always copy args 
tuple.

--
Added file: http://bugs.python.org/file39483/clru_cache_4.patch

___
Python tracker 

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



[issue14373] C implementation of functools.lru_cache

2015-05-24 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
dependencies: +Correct reuse argument tuple in property descriptor

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Affect on performance:

$ ./python -m timeit -r 11 -s "from collections import namedtuple as n;a = 
n('n', 'a b c')(1, 2, 3)"

Unpatched: 1000 loops, best of 11: 0.0567 usec per loop
Patched  : 1000 loops, best of 11: 0.0567 usec per loop

--

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Tal Einat

Tal Einat added the comment:

I have a question regarding complex values. The code (from Chris Barker) 
doesn't support complex values (only things that can be converted into 
doubles). However, the PEP states the following under "Non-float types":

"complex : for complex, the absolute value of the complex values will be used 
for scaling and comparison. If a complex tolerance is passed in, the absolute 
value will be used as the tolerance."

Should math.isclose() support complex values? Should an equivalent function be 
added to cmath? Should we just leave things as they are and remove mention of 
complex values from the PEP (it isn't mentioned in the docs)?

--

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Stefan Behnel

Stefan Behnel added the comment:

Eventually, I think a corresponding function should be added to cmath. 
math.isclose() shouldn't deal with complex values by itself (other than 
rejecting them as non-floatish input).

--

___
Python tracker 

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



[issue24270] PEP 485 (math.isclose) implementation

2015-05-24 Thread Tal Einat

Changes by Tal Einat :


--
nosy: +mark.dickinson, rhettinger, stutzbach

___
Python tracker 

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



[issue24277] Take the new email package features out of provisional status

2015-05-24 Thread R. David Murray

New submission from R. David Murray:

I plan to remove the provisional status of the new email features in 3.5.  This 
is a documentation only change, but the documentation change is extensive 
(pretty much a complete rewrite of the package docs).

--
assignee: r.david.murray
components: Documentation
messages: 243986
nosy: r.david.murray
priority: normal
severity: normal
stage: needs patch
status: open
title: Take the new email package features out of provisional status
type: enhancement
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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-24 Thread Martin Blais

New submission from Martin Blais:

Functions that parse arguments like  PyArg_ParseTupleAndKeywords() have several 
formatters that fill in C strings, e.g. "s".

In the C API doc:
https://docs.python.org/3.5/c-api/arg.html#c.PyArg_ParseTupleAndKeywords

There should be an explicit mention of whether this memory needs to be free (in 
this case: No) and if not, how this memory is managed (in this case: This 
refers to a buffer managed by the string object itself). Because of questions 
of encoding, it raises questions where this memory lies, and what its lifetime 
is (in this case: That of the owning string object from the caller).

This deserves an explicit mention, even if brief.

--
assignee: docs@python
components: Documentation
messages: 243987
nosy: blais, docs@python
priority: normal
severity: normal
status: open
title: Docs on Parsing arguments should say something about mem mgmt for 
formatters returning C strings

___
Python tracker 

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



[issue11029] Crash, 2.7.1, Tkinter and threads and line drawing

2015-05-24 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Thanks for the report.

--

___
Python tracker 

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-24 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Would you propose a patch for docs?

--
nosy: +asvetlov
stage:  -> needs patch

___
Python tracker 

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-24 Thread Martin Blais

Martin Blais added the comment:

I don't think I'm the right person to propose a patch for this; I'm just 
guessing how it works so far, I haven't had time to look into the source code 
in detail, I'm sure there's a lot more context to it.

--

___
Python tracker 

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



[issue24260] TabError behavior doesn't match documentation

2015-05-24 Thread Evgeny Kapun

Evgeny Kapun added the comment:

Prohibiting tabs after spaces is not enough. For example, Python rejects this 
code:

if 1:
if 1:
pass

because its indentation is invalid if tab width is 1. However, it accepts this 
code:

if 1:
if 1:
<10 spaces>pass

despite its indentation being invalid if tab width is 10 or more.

--

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 Thread Raymond Hettinger

Raymond Hettinger added the comment:

LGTM, go ahead and apply.

--
assignee:  -> serhiy.storchaka

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Sorry, it was incorrect microbenchmark. Correct is:

$ ./python -m timeit -r 11 -s "from collections import namedtuple as n;a = 
n('n', 'a b c')(1, 2, 3)" -- "a.a"
3.4  : 100 loops, best of 11: 0.601 usec per loop
3.5 unpatched: 100 loops, best of 11: 0.445 usec per loop
3.5 patched  : 100 loops, best of 11: 0.454 usec per loop

There is small slowdown (2%), but it is only small part of the gain of the 
optimization.

--

___
Python tracker 

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



[issue23903] Generate PC/python3.def by scraping headers

2015-05-24 Thread Zachary Ware

Zachary Ware added the comment:

What about including this in Tools/scripts/patchcheck.py?  I think that might 
strike a good enough balance between making changes noticeable and not 
automatically changing the def file.

As far as all the differences this has uncovered, I'll try to make a patch to 
#ifdef them in/out.

--

___
Python tracker 

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



[issue24260] TabError behavior doesn't match documentation

2015-05-24 Thread R. David Murray

R. David Murray added the comment:

We should probably just introduce a new error mode (-ttt?) that makes it an 
error to use tabs at all for semantic indentation.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue24272] PEP 484 docs

2015-05-24 Thread Daniel Andrade Groppe

Daniel Andrade Groppe added the comment:

A first iteration of the documentation based on the PEP and the module source.

This still needs a lot of work.

--
keywords: +patch
nosy: +Daniel.Andrade.Groppe
Added file: http://bugs.python.org/file39484/typing_doc.patch

___
Python tracker 

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



[issue23903] Generate PC/python3.def by scraping headers

2015-05-24 Thread Steve Dower

Steve Dower added the comment:

Could the latter break people already using the stable ABI on other platforms? 
Does it even work for others? I don't know what the equivalent of python3.dll 
would be.

If it doesn't exist outside of Windows, then assuming that everything not in 
python3.def isn't stable is fine. Otherwise I think we need to go the other way.

--

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5dbf3d932a59 by Serhiy Storchaka in branch 'default':
Issue #24276: Fixed optimization of property descriptor getter.
https://hg.python.org/cpython/rev/5dbf3d932a59

--

___
Python tracker 

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



[issue24279] Update test_base64 to use test.support.script_helper

2015-05-24 Thread Christie

New submission from Christie:

As described in Issue9517, many test modules do not make use of the helpers in 
script_helpers.py to invoke the python interpreter in a subprocess. Issue9517 
will be broken down into several smaller issues so we can address smaller 
change sets.

This issue is to update test_base64.py to use script_helpers.py.

--
messages: 243999
nosy: bobcatfish
priority: normal
severity: normal
status: open
title: Update test_base64 to use test.support.script_helper
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



[issue24279] Update test_base64 to use test.support.script_helper

2015-05-24 Thread Christie

Christie added the comment:

Updated TestMain in test_base64 to use test.support.script_helpers. Split 
`test_encode_file` into two tests.

--
keywords: +patch
Added file: http://bugs.python.org/file39485/issue24279_base64.patch

___
Python tracker 

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



[issue9517] Make test.script_helper more comprehensive, and use it in the test suite

2015-05-24 Thread Christie

Christie added the comment:

Created Issue24279 for updating test_base64.

--

___
Python tracker 

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



[issue24276] Correct reuse argument tuple in property descriptor

2015-05-24 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



[issue14373] C implementation of functools.lru_cache

2015-05-24 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Backed out the backout in cb30db9cc029.

--

___
Python tracker 

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



[issue24280] Unable to install Python

2015-05-24 Thread Jeff Ding

New submission from Jeff Ding:

After uninstalling old versions of Python:

Python is unable to install unless I disable pip.

Once python installs, python immediately crashes due to Py_Initialize

--
components: Windows
files: python_crash.png
messages: 244003
nosy: Jeff77789, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: Unable to install Python
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file39486/python_crash.png

___
Python tracker 

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



[issue23965] test_ssl failure on Fedora 22

2015-05-24 Thread Ned Deily

Ned Deily added the comment:

(@suki, I assume this is the issue reported here:  
https://github.com/jupyter/notebook/issues/111 ?)

--
nosy: +ned.deily

___
Python tracker 

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



[issue16991] Add OrderedDict written in C

2015-05-24 Thread Matthew Barnett

Matthew Barnett added the comment:

First some background: when you put a new entry into a dict, it looks for an 
empty slot, the key's hash determining the initial choice, but if that slot's 
occupied, it picks another, etc, so the key might not be in the slot of first 
choice.

In "PyODict_DelItem", it deletes the key from the dict and then calls 
"_odict_clear_node" to delete the node.

If the key that it's looking for wasn't in the slot of first choice, but that 
slot is empty, that'll be the one it'll return, ie, the wrong one.

The solution, therefore, is to delete the node _before_ deleting the key from 
the dict.

When I tried that, the test ran to completion.

--

___
Python tracker 

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



[issue24278] Docs on Parsing arguments should say something about mem mgmt for formatters returning C strings

2015-05-24 Thread Martin Panter

Martin Panter added the comment:

At the top of the list 
, it says which 
cases have to be freed or not, and also mentions releasing buffers. Are you 
proposing to add this information to each entry in the list as well?

Or just mention how the pointer lifetime relates to the Python object lifetime 
at the top? I think you will find most of the cases are the same, except for 
the ones that explicitly allocate extra memory.

--
nosy: +vadmium

___
Python tracker 

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



[issue24260] TabError behavior doesn't match documentation

2015-05-24 Thread Martin Panter

Martin Panter added the comment:

I would be in favour of making the existing indentation behaviour more strict 
by default, or at least outputting some sort of warning for Evgeny’s examples. 
I.e. no reason to supply a special -ttt option.

But prohibiting tabs entirely might not go down well. I never use tabs in my 
own code, but I wouldn’t want to convert other people’s code to spaces just to 
run it in a future Python release, especially when the tab usage is universal.

I don’t exactly know Python’s rules for intentation, but my model for 
“consistent indentation” would work something like:

* Remember the exact sequence of spaces and tabs for each level of indentation
* Ignore blank and commented lines, even if their indentation is inconsistent
* If a line begins with the highest level of indentation, but continues with 
more spaces or tabs, it starts a new indentation level
* If a line’s indentation exactly matches any of the saved sequences, it jumps 
back to that level (or stays at the highest level)
* Otherwise, the indentation is inconsistent, and it should be an error or 
warning

Yet another option could be to say indentation is allowed to be only tabs or 
only spaces, and the use of tabs or spaces must match the rest of the file, or 
at least the rest of the indented block. But I still prefer my model above :)

--
nosy: +vadmium

___
Python tracker 

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



[issue24268] PEP 489 -- Multi-phase extension module initialization

2015-05-24 Thread Matthias Bussonnier

Matthias Bussonnier added the comment:

Hi, 

Since the last few patches related to this, I seem to have an issue with 
`Python/importdl.c:get_encoded_name` (I guess)  sometime returning the name 
with a leading dot. This lead to `PyInit_.modulename` being searched which 
fails.

My C-foo is extremely low, but changing [1] to `lastdot+1`
seem to do the trick for me (hence above supposition).

More especially in my case compiling Cython `failed to import Cython: dynamic 
module does not define module export function (PyInit_.Scanning)`, from `import 
Cython.Compiler.Scanning` I suppose. While it seem to does that ok with the 
`+1`.

I haven't found any related issues, and my read of pep 489 made me think this 
was not meant to change, Though I doubt my fix is correct.

Sorry if duplicate or already fixed, I searched as I could but did not found 
anything. 

Thanks.



[1] https://hg.python.org/cpython/rev/e729b946cc03#l29.59

--
nosy: +mbussonn

___
Python tracker 

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



[issue24260] TabError behavior doesn't match documentation

2015-05-24 Thread Mark Lawrence

Mark Lawrence added the comment:

So when does Python 3 generate this "TabError: inconsistent use of tabs and 
spaces in indentation" and when doesn't it?

--

___
Python tracker 

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



[issue24272] PEP 484 docs

2015-05-24 Thread Daniel Andrade Groppe

Daniel Andrade Groppe added the comment:

Addressing comments from the review. Here is an updated patch.

--
Added file: http://bugs.python.org/file39487/typing_doc_v2.patch

___
Python tracker 

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



[issue24281] String formatting: incorrect number of decimal places

2015-05-24 Thread James Luscher

New submission from James Luscher:

Doc for 3.4: at 6.1.3.1. Format Specification Mini-Language
indicates that:
"The precision is a decimal number indicating how many digits should be 
displayed after the decimal point for a floating point value"

Yet I find that I get this behavior:

Python 3.4.3 (default, Mar 26 2015, 22:03:40) 
[GCC 4.9.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> '{:08.3}'.format(12.34)
'12.3'

When what I am expecting is:  '0012.340'

--
assignee: docs@python
components: Documentation
messages: 244011
nosy: docs@python, jluscher
priority: normal
severity: normal
status: open
title: String formatting: incorrect number of decimal places
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue24281] String formatting: incorrect number of decimal places

2015-05-24 Thread Larry Hastings

Changes by Larry Hastings :


--
nosy: +eric.smith

___
Python tracker 

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



[issue24281] String formatting: incorrect number of decimal places

2015-05-24 Thread Christopher Welborn

Christopher Welborn added the comment:

You forgot the 'f' to specify that you want float formatting:

```
>>> '{:08.3f}'.format(12.34)

 '0012.340'
```

--
nosy: +cjwelborn

___
Python tracker 

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



[issue24021] Add docstring to urllib.urlretrieve

2015-05-24 Thread Daniel Andrade Groppe

Daniel Andrade Groppe added the comment:

Adding docstrings for urllib.urlretrieve() and urlib.cleanup() for Python 2.7.

--
keywords: +patch
nosy: +Daniel.Andrade.Groppe
Added file: http://bugs.python.org/file39488/urllib_2.7.patch

___
Python tracker 

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



[issue24281] String formatting: incorrect number of decimal places

2015-05-24 Thread R. David Murray

Changes by R. David Murray :


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

___
Python tracker 

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



[issue24275] lookdict_* give up too soon

2015-05-24 Thread Benjamin Peterson

Benjamin Peterson added the comment:

You could have a non-unicode key that compares equal to a unicode string.

--
nosy: +benjamin.peterson
resolution:  -> rejected
status: open -> closed

___
Python tracker 

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



[issue5315] signal handler never gets called

2015-05-24 Thread Devin Jeanpierre

Devin Jeanpierre added the comment:

Agree with Charles-François's second explanation. This makes it very hard to 
reliably handle signals -- basically everyone has to remember to use 
set_wakeup_fd, and most people don't. For example, gunicorn is likely 
vulnerable to this because it doesn't use set_wakeup_fd. I suspect most code 
using select + signals is wrong.

I've attached a patch which fixes the issue for select(), but not any other 
functions. If it's considered a good patch, I can work on the rest of the 
functions in the select module. (Also, tests for the details of the behavior.)

Also the patch is pretty hokey, so I'd appreciate feedback if it's going to go 
in. :)

--
keywords: +patch
nosy: +Devin Jeanpierre
Added file: http://bugs.python.org/file39489/select_select.diff

___
Python tracker 

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