[issue17128] OS X system openssl deprecated - installer should build local libssl

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 288b03b5c60d by Ned Deily in branch '3.4':
Issue #17128: Use private version of OpenSSL for 3.x OS X 10.5+ installers.
https://hg.python.org/cpython/rev/288b03b5c60d

New changeset 1c249d0cab5d by Ned Deily in branch 'default':
Issue #17128: Merge / update from 3.4
https://hg.python.org/cpython/rev/1c249d0cab5d

New changeset 961f988eaa6a by Ned Deily in branch '2.7':
Use rtf format files for legacy OS X installer builds.
https://hg.python.org/cpython/rev/961f988eaa6a

--

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



[issue23047] typo in pyporting.rst

2014-12-13 Thread Xavier de Gaye

New submission from Xavier de Gaye:

In Doc/howto/pyporting.rst at line from __future__ import print_statement:
  s/print_statement/print_function/

--
assignee: docs@python
components: Documentation
messages: 232600
nosy: brett.cannon, docs@python, xdegaye
priority: normal
severity: normal
status: open
title: typo in pyporting.rst
type: behavior
versions: Python 3.5

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



[issue17636] Modify IMPORT_FROM to fallback on sys.modules

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 3a35638bce66 by Ned Deily in branch 'default':
Issue #17636: Install new test directories.
https://hg.python.org/cpython/rev/3a35638bce66

--

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



[issue23031] pdb crashes when jumping over with statement

2014-12-13 Thread Xavier de Gaye

Xavier de Gaye added the comment:

This has been fixed by issue 14612 for version 2.7.4.

--
nosy: +xdegaye

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



[issue23031] pdb crashes when jumping over with statement

2014-12-13 Thread Dan

Changes by Dan potapovdan...@mail.ru:


--
resolution:  - out of date
status: open - closed

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



[issue23030] lru_cache manual get/put

2014-12-13 Thread Constantin

Constantin added the comment:

It may be the case, that an lru_cache does not provide the best strategy for 
reliably caching many base cases in recursively written code. I suggest that 
someday we think about a different caching paradigm which fits this purpose and 
add it to functools e.g. as functools.recopt_cache. This cache would then 
implement the same interface as lru_cache and therefore all code currently 
using lru_cache could benefit from recopt_cache with just one line of code 
change.

Furthermore, by designing this interface, it becomes more probable that user 
defined caching decorators are compatible.

Please remember: My suggestion isn't just about lru_cache, but about an 
interface for caching decorators.

--

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



[issue23048] abort when jumping out of a loop

2014-12-13 Thread Xavier de Gaye

New submission from Xavier de Gaye:

With the following jump.py script:
def foo():
import pdb; pdb.set_trace()
while 1:
pass
return # this is line 5

foo()


The following debugging session aborts on Python 3.5.0a0 (default:334c01aa7f93, 
Dec  3 2014, 16:20:19):
$ python jump.py
 /tmp/test/jump.py(3)foo()
- while 1:
(Pdb) next
 /tmp/test/jump.py(4)foo()
- pass
(Pdb) jump 5
python: Objects/frameobject.c:258: frame_setlineno: Assertion `blockstack_top 
== 0' failed.
Aborted (core dumped)

--
components: Interpreter Core
messages: 232604
nosy: xdegaye
priority: normal
severity: normal
status: open
title: abort when jumping out of a loop
type: crash
versions: Python 3.5

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



[issue23047] typo in pyporting.rst

2014-12-13 Thread Chaitanya agrawal

Chaitanya agrawal added the comment:

Typo corrected according to message232600.

--
keywords: +patch
nosy: +krypten
Added file: http://bugs.python.org/file37438/issue23047.patch

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



[issue23040] Better documentation for the urlencode safe parameter

2014-12-13 Thread Wojtek Ruszczewski

Wojtek Ruszczewski added the comment:

Updated the patch, additionally changing be to contain in the first 
sentence.

--
Added file: http://bugs.python.org/file37439/urlencode-safe-v2.diff

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



[issue23041] csv needs more quoting rules

2014-12-13 Thread Skip Montanaro

Skip Montanaro added the comment:

It doesn't look like a difficult change, but is it really needed? I guess my 
reaction is the same as Raymond's. Are there real-world uses where the current 
set of quoting styles isn't sufficient?

--

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



[issue23047] typo in pyporting.rst

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 914e9092984e by Berker Peksag in branch '3.4':
Issue #23047: Fix typo in pyporting.rst.
https://hg.python.org/cpython/rev/914e9092984e

New changeset 81a56c9e1e1c by Berker Peksag in branch 'default':
Issue #23047: Fix typo in pyporting.rst.
https://hg.python.org/cpython/rev/81a56c9e1e1c

--
nosy: +python-dev

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



[issue23047] typo in pyporting.rst

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset f1f404f5422a by Berker Peksag in branch '2.7':
Issue #23047: Fix typo in pyporting.rst.
https://hg.python.org/cpython/rev/f1f404f5422a

--

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



[issue23047] typo in pyporting.rst

2014-12-13 Thread Berker Peksag

Berker Peksag added the comment:

Thanks for the report, Xavier and thanks for the patch, Chaitanya.

--
nosy: +berker.peksag
resolution:  - fixed
stage:  - resolved
status: open - closed
versions: +Python 2.7, Python 3.4

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



[issue23004] mock_open() should allow reading binary data

2014-12-13 Thread Aaron Hill

Aaron Hill added the comment:

I've created a new patch, which addresses the problem. Your example now 
currently returns [b'foo\n', b'bar\n']

--
Added file: 
http://bugs.python.org/file37440/mock-open-allow-binary-data-updated.patch

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



[issue19698] Implement _imp.exec_builtin and exec_dynamic

2014-12-13 Thread Nick Coghlan

Nick Coghlan added the comment:

Yes, if we don't get to it beforehand. I'd still like to take the draft 
Create/Exec C level hook design I came up with and turn it into a PEP, but I 
don't know when I'll get time.

Maybe I should just put that together as a (very) rough draft and lob it at 
import-sig? Then we'll have a concrete base for discussion at PyCon, and 
someone may be able to put together a draft implementation while you, me  Eric 
are all in the same place at the same time.

--

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



[issue23017] string.printable.isprintable() returns False

2014-12-13 Thread Akira Li

Akira Li added the comment:

C standard defines locale-specific *printing characters* that are [ -~]
in C locale for implementations that use 7-bit US ASCII character set
i.e., SP (space, 0x20) is a printing character in C (isprint() returns
nonzero).

There is isgraph() function that returns zero for the space but
otherwise is equivalent to isprint().

POSIX definition is aligned with the ISO C standard.

I don't know what RFC 5822 has to do with this issue but the rfc
contradicts itself e.g., in one place it has: printable US-ASCII
characters except SP that imlies that SP *is* printable but in other
places it considers isprint==isgraph. The authors probably meant
characters for which isgraph() is nonzero when they use printable
US-ASCII (that is incorrect according to C standard).

Tests from issue9770 show the relation between C character classes and
string constants [1]:

  set(string.printable) == set(C['graph']) + set(C['space'])

where C['space'] is '\t\n\v\f\r ' (the standard C whitespace).

It is a documented behavior [2]:

  This is a combination of digits, ascii_letters, punctuation,
  and whitespace

where *whitespace* is C['space'].

In Python 2, *printable* is locale-dependent and it coincides with the
corresponding Python 3 definition in C locale with ASCII charset.

Unlike other string constants, *printable* differs from C['print'] on
both Python 2 and 3 because it includes whitespace characters other than
space.

str.isprintable [3] obeys C['print'] (in ASCII range) and considers SP
to be printable.

---

It might be too late to change string.printable to correspond to C
isprint() (for ASCII characters).

I've uploaded a documentation patch that mentions that string.printable
and str.isprintable differ.

[1] http://bugs.python.org/review/9770/diff/12212/Lib/test/test_curses_ascii.py
[2] https://hg.python.org/cpython/file/3.4/Doc/library/string.rst#l62
[3] https://docs.python.org/3.4/library/stdtypes.html#str.isprintable

--
nosy: +akira
Added file: http://bugs.python.org/file37441/docs-string.printable.diff

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



[issue23048] abort when jumping out of a loop

2014-12-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Building on OS X 10.10 with the head of the code tree (as of today), I cannot 
reproduce this.  Also the disassembly looks fine:

$ python3.5 jump.py 
 /Users/raymond/tmp/jump.py(3)foo()
- while 1:
(Pdb) next
 /Users/raymond/tmp/jump.py(4)foo()
- pass
(Pdb) jump 5
 /Users/raymond/tmp/jump.py(5)foo()
- return # this is line 5
(Pdb) list
  1 def foo():
  2 import pdb; pdb.set_trace()
  3 while 1:
  4 pass
  5  - return # this is line 5
  6 
  7 foo()
  8 
[EOF]
(Pdb) !from dis import dis
(Pdb) !dis(foo)
  2   0 LOAD_CONST   1 (0)
  3 LOAD_CONST   0 (None)
  6 IMPORT_NAME  0 (pdb)
  9 STORE_FAST   0 (pdb)
 12 LOAD_FAST0 (pdb)
 15 LOAD_ATTR1 (set_trace)
 18 CALL_FUNCTION0 (0 positional, 0 keyword pair)
 21 POP_TOP

  3  22 SETUP_LOOP   3 (to 28)

  425 JUMP_ABSOLUTE   25

  528 LOAD_CONST   0 (None)
 31 RETURN_VALUE
(Pdb) !import sys
(Pdb) p sys.version_info
sys.version_info(major=3, minor=5, micro=0, releaselevel='alpha', serial=0)

--
nosy: +rhettinger

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



[issue19527] Test failures with COUNT_ALLOCS

2014-12-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thenks Antoine for great idea proposed in comments on Rietveld. Following patch 
introduces strip_python_stdout() which strips COUNT_ALLOCS debug output from 
stdout (unfortunately this operation is not always unambiguous) and call it in 
assert_python_ok() and assert_python_failure(). This automatically fixes a 
large number of tests. Also fixed a number of other tests failing with 
COUNT_ALLOCS. Virtually all tests are now fixed except test_doctest and 
test_distutils.

A large part of the patch will be applied only to 3.4 and 2.7. With resolved 
issue23034 the patch for 3.5 will be much simpler, strip_python_stdout() and 
@requires_clean_stdout will gone away.

--
dependencies: +Dynamically control debugging output
Added file: 
http://bugs.python.org/file37442/00141-fix-tests_with_COUNT_ALLOCS-v5.patch

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



[issue22955] Pickling of methodcaller, attrgetter, and itemgetter

2014-12-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 functools.partial is a somewhat less than ideal comparison.  The pure-Python 
 version is not picklable, the Python and C versions return different things 
 (the Python version is a function returning a function, the C version is a 
 regular class and returns an instance).

Looks as Python version of functools.partial() needs a fix.

Reimplementations of the pure-Python itemgetter and attrgetter to automatically 
pickleable Python classes have a disadvantage. It makes the pickling 
incompatible between Python and C versions. This means that itemgetter pickled 
in CPython will be not unpickleable on Python implementation which don't use C 
accelerator and vice versa.

--

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



[issue22955] Pickling of methodcaller, attrgetter, and itemgetter

2014-12-13 Thread Zachary Ware

Zachary Ware added the comment:

Serhiy Storchaka added the comment:
 Reimplementations of the pure-Python itemgetter and attrgetter to
 automatically pickleable Python classes have a disadvantage. It makes
 the pickling incompatible between Python and C versions. This means
 that itemgetter pickled in CPython will be not unpickleable on Python
 implementation which don't use C accelerator and vice versa.

That's a very good point that I hadn't thought about.  Consider my
patch withdrawn.

--

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



[issue9393] shelve.open/bsddb.hashopen exception with unicode paths

2014-12-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage: test needed - needs patch
versions: +Python 3.4, Python 3.5 -Python 3.1, Python 3.2

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



[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee: benjamin.peterson - serhiy.storchaka

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



[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c3f960cff3e6 by Serhiy Storchaka in branch '3.4':
Issue #22823: Use set literals in lib2to3.
https://hg.python.org/cpython/rev/c3f960cff3e6

New changeset d3e43f7ecca8 by Serhiy Storchaka in branch 'default':
Issue #22823: Use set literals in lib2to3.
https://hg.python.org/cpython/rev/d3e43f7ecca8

--

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



[issue22823] Use set literals instead of creating a set from a list

2014-12-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

That's all I think. Distutils is too conservative for such changes.

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

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



[issue22875] asyncio: call_soon() documentation unclear on timing

2014-12-13 Thread Guido van Rossum

Guido van Rossum added the comment:

Docfix LGTM.

On Fri, Dec 12, 2014 at 10:53 PM, Martin Panter rep...@bugs.python.org
wrote:


 Martin Panter added the comment:

 I have been bitten by this when attempting to implement my own event
 loops. Parts of the “asyncio” code itself expects that the callback is not
 invoked directly after call_soon() returns. Here is a simple patch.

 --
 keywords: +patch
 nosy: +vadmium
 versions: +Python 3.4
 Added file: http://bugs.python.org/file37437/call_soon.patch

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


--

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



[issue19949] Explicitly skip or mask skipped/disabled tests in test_xpickle

2014-12-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In updated patch the xpickle resource is tested before attempts to run Python 
executables. Also these checks are moved from decorator to the setUp() method. 
The result of have_python_version() now is memoized. Fixed running the test in 
unicode-disabled build. And added tests for installed Python 2.7. As far as 
older Python versions are rarely installed nowadays, this allows to check that 
the test is work at all (and that there is no significant regression against 
previous bugfix).

--
Added file: http://bugs.python.org/file37443/test_xpickle_cleanup_2.patch

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



[issue23048] abort when jumping out of a loop

2014-12-13 Thread Benjamin Peterson

Changes by Benjamin Peterson benja...@python.org:


--
assignee:  - benjamin.peterson
nosy: +benjamin.peterson

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



[issue23048] abort when jumping out of a loop

2014-12-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 09f938915c6f by Benjamin Peterson in branch '3.4':
pop the loop block even for infinite while loops (closes #23048)
https://hg.python.org/cpython/rev/09f938915c6f

New changeset baa5258bef22 by Benjamin Peterson in branch '2.7':
pop the loop block even for infinite while loops (closes #23048)
https://hg.python.org/cpython/rev/baa5258bef22

New changeset ec96ffa6aa95 by Benjamin Peterson in branch 'default':
merge 3.4 (#23048)
https://hg.python.org/cpython/rev/ec96ffa6aa95

--
nosy: +python-dev
resolution:  - fixed
stage:  - resolved
status: open - closed

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



[issue19698] Implement _imp.exec_builtin and exec_dynamic

2014-12-13 Thread Brett Cannon

Brett Cannon added the comment:

sgtm

--

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



[issue21279] str.translate documentation incomplete

2014-12-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Many people may not know that IndexError and KeyError are subclasses of 
LookupError. I have not decided what to add yet, but I think we are close.

--

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



[issue23011] Duplicate Paragraph in documentation for json module

2014-12-13 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Will reconsider if an actual duplication is presented.

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

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



[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Terry J. Reedy

New submission from Terry J. Reedy:

from functools import reduce
def add(a,b): return a+b
reduce(add, {})

Traceback (most recent call last):
  File C:\Programs\Python34\tem.py, line 3, in module
reduce(add, {})
TypeError: reduce() of empty sequence with no initial value

However, the reduce-equivalent code in the doc sets a bad example and forgets 
to account for empty iterators.

def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
value = next(it)
else: ...

So it lets the StopIteration escape (a bad practice that can silently break 
iterators).  The code should be

def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
try:
value = next(it)
except StopIteration:
raise TypeError(reduce() of empty sequence with no initial value) 
from None
else: ...

(patch coming)

--
assignee: docs@python
components: Documentation, Interpreter Core
messages: 232626
nosy: docs@python, terry.reedy
priority: normal
severity: normal
stage: needs patch
status: open
title: Fix functools.reduce code equivalent.
type: behavior
versions: Python 3.4, Python 3.5

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



[issue23030] lru_cache manual get/put

2014-12-13 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Sorry Constantin, I am rejecting this proposal or any variants of it.

* As Nick pointed-out in the referenced thread, we provide two tools: a 
functools caching decorator that is tightly focused on the task of caching 
function calls and a collections OrderedDict that is a general purpose data 
store suitable for implementing custom LRU logic when needed.

* As John pointed-out, this proposal isn't even fit for the original use case.  
Any speed benefits of a tail recursion optimization get immediately wiped out 
by overhead of a LRU cache decorator, and the clarity of the original code 
starts to get lost in the extra code to call cache_get() and cache_put() -- 
remember the decorator was designed to wrap around a function without having to 
change the logic inside it.  Also, the optimization itself is fundamentally 
suspect because it changes the semantics of the language (thereby defeating all 
decorators that supply wrapper functions including memoization decorators, call 
loggers, precondition/postcondition checkers, subscription notifiers, type 
checkers, etc).

* The essence of this proposal is at odds with what the functools caching 
decorator is all about -- providing a cache for function calls.  The proposal 
bypasses the function call itself, making it more difficult to reason about 
what is in the cache (i.e. the result of previous function calls) and mucking 
up the cache hit/miss statistics which stop being meaningful.

* The proposal also adds API complexity (making it less like a function 
decorator and more like an exposed data store such as an ordered dictionary).  
And, it creates a new control flow exception NotInCache.  Collectively, these 
changes make the decorator slower, harder to maintain, harder to learn, harder 
to avoid reentrancy and locking problems, and harder to reason about but it 
doesn't provide much if any incremental benefit over using an OrderedDict 
directly.  

* To the extent there are valid niche use cases, we shouldn't try to cater to 
all of them.  Good standard library API design stay focused on serving on the 
common case as well as possible and leaving the rest to OrderedDict or a 
third-party package (you're welcome to publish one to see if it actually serves 
a real need).

* In designing the cache, I surveyed previously published memoization 
decorators and did not find the proposed feature. That means that it is false 
to state that every memoization decorator *must have* some functionality to 
insert or lookup entries while bypassing the function call that was intended to 
be cached.  If it really was must have behavior, then it would have already 
been commonplace.  IMO, cache_put() is bad design (would you want you database 
cache to return something that was never in the database or your disk cache to 
return values that had never been written to disk?)

* Hopefully, this message explains my reasoning clearly, so you will understand 
why I'm closing this one.  That said, judging by the insistent wording of your 
posts, I don't expect that you will be convinced.  Your mental model of caching 
tools is very different from what the functools.lru_cache was intended to 
accomplish.  To the extent that you don't really want a transparent function 
decorator and would prefer a full featured class (with methods for getting, 
setting, deleting, re-ordering, listing, monitoring, etc), I recommend that you 
write one and post it to the Python Package Index.  The 
collections.OrderedDict() class should easily handle the LRU storage logic, so 
all you have to do is specify your API and decide which parts of the store you 
want to expose.

--
resolution:  - rejected
status: open - closed

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



[issue23049] Fix functools.reduce code equivalent.

2014-12-13 Thread Raymond Hettinger

Changes by Raymond Hettinger raymond.hettin...@gmail.com:


--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue22735] Fix various crashes exposed through mro() customization

2014-12-13 Thread Benjamin Peterson

Benjamin Peterson added the comment:

I will try to look eventually.

--
assignee:  - benjamin.peterson

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



[issue23004] mock_open() should allow reading binary data

2014-12-13 Thread Demian Brecht

Demian Brecht added the comment:

Thanks for the update, but this doesn't quite work either as you're assuming 
utf-8 (which is what .encode() and .decode() default to). For example, when 
using latin-1:

 m = mock_open(read_data= b'\xc6')
 with patch('__main__.open', m, create=True) :
... with open('abc', 'rb') as f :
... print(f.read())
...
Traceback (most recent call last):
  [snip]
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc6 in position 0: 
unexpected end of data

Additionally, a bytes object may simply be binary data that doesn't adhere to 
any specific encoding.

My suggestion is to remove the use of format() altogether as it's really not 
doing anything complex and simply append either '\n' or b'\n' depending on the 
type of object passed in. That way, you can deal with the type of object passed 
in directly without coercion.

--

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



[issue23041] csv needs more quoting rules

2014-12-13 Thread Chaitanya agrawal

Chaitanya agrawal added the comment:

Used function PyUnicode_Check instead of PyString_Check

--
keywords: +patch
nosy: +krypten
Added file: http://bugs.python.org/file37444/issue23041.patch

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



[issue23041] csv needs more quoting rules

2014-12-13 Thread Chaitanya agrawal

Changes by Chaitanya agrawal chaitiagra...@gmail.com:


Added file: http://bugs.python.org/file37445/issue23041_test.patch

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