[issue19070] In place operators of weakref.proxy() not returning self.

2013-10-07 Thread Graham Dumpleton

Graham Dumpleton added the comment:

@shishkander I can't see how what you are talking about has got anything to do 
with the issue with in place operators. The results from your test script are 
expected and normal.

What result are you expecting?

The one thing you cannot override in Python is what type() returns for an 
object. Thus is it completely normal for the weakref.proxy object to have a 
different type that what it wraps.

This is one of the reasons why in Python why should rarely ever do direct 
comparison of type objects. Instead you should use isinstance().

>>> import weakref
>>> class Test(object):
... pass
...
>>> test = Test()
>>> proxy = weakref.proxy(test)
>>> type(test)

>>> type(proxy)

>>> isinstance(test, Test)
True
>>> isinstance(proxy, Test)
True
>>> proxy.__class__


The isinstance() check will work because weakref.proxy will proxy __class__() 
method such that it returns the type of the wrapped object rather than of the 
proxy.

Now if your problem is with methods of wrapped objects which return self not 
having that self object some how automatically wrapped in another proxy, there 
isn't anything the proxy can be do about that. That is a situation where you as 
a user need to be careful about what you are doing. A way one can handle that 
is through derivation off a proxy object and override specific methods where 
you then in turn need to wrap the result, but I can see that easily becoming 
fragile when weakrefs are involved. Also, the weakref proxy in Python doesn't 
expose a class for doing that anyway.

One important thing to note is that where self is returned is returned by a 
normal method, it is still on you to have assigned the result to a variable so 
as to have started any possible problems. In the case of in place operators 
that is done under the covers by Python and you have no control over it. This 
is why the current behaviour as originally described is arguably broken as is 
breaks the expectations of what would logically happen for an in place operator 
when used via a proxy, something you have no control over.

So can you go back and explain what your specific problem is that you believe 
is the same issue as this bug report is, because so far I can't see any 
similarity based on your example code.

--

___
Python tracker 

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



[issue19070] In place operators of weakref.proxy() not returning self.

2013-10-07 Thread shishkander

shishkander added the comment:

@grahamd
In short, instead of this:
$ python t.py 
 => 
 => 

I expected to get this (note the second line):
 => 
 => 

I pass the proxy to the test() function, and I expect the argument inside the 
function to be a proxy. And that works - the type of obj in test() is 
weakproxy. 
However, the test function calls obj.method(), and I expected the method to get 
a proxy of obj as well, but *it does not* (the type of self is now Test)!

The reason I though this is the same bug is that your method doesn't work on a 
proxy any more!

def __iadd__(self, value):
  # self is not longer proxy! it's actually actual class instance now.
  ...

Now, if I call the method like this:
Test.method(weakref.proxy(o)), then obviously the self argument of the method 
is a proxy.

So, the crux of the matter is in how obj.method is handled inside Python 
interpreter. I think the current behavior is wrong, and if it is fixed, I'm 
certain your problem is fixed as well.

--

___
Python tracker 

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



[issue19154] AttributeError: 'NoneType' in http/client.py when using select when file descriptor is closed.

2013-10-07 Thread Florent Viard

Florent Viard added the comment:

Hi Terry,
I think you misunderstood what i was trying to say.
Maybe fileno should raise a ValueError (and not -1) in that case. That is the 
question. It should only be able to be something understood by "select.select".
But currently it is an Bug/Crash as the case where self.fp is None is not 
handled before trying to get self.fp.fileno() and so this raise an 
AttributeError and not a ValueError. And so, it is certainly not managed by 
select.

Please really understand that here I speak about the "def fileno()" function 
that is inside Lib/http/client.py" and not about the "def fileno()" that is in 
socket.py.

--

___
Python tracker 

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



[issue19070] In place operators of weakref.proxy() not returning self.

2013-10-07 Thread Graham Dumpleton

Graham Dumpleton added the comment:

The proxy is intended as a wrapper around an object, it is not intended to 
merge in some way with the wrapped object. The wrapped object shouldn't really 
ever be aware that it was being accessed via a proxy. Thus the expectation that 
the 'self' attribute of the methods of the wrapper object would actually be the 
proxy object is a strange one.

Can you explain why you need it to behave the way you are expecting? Also 
specifically indicate what requirement you have for needing the reference to 
the wrapped object to be a weakref?

Almost sounds a bit like you may be trying to use weakref.proxy in a way not 
intended.

It is technically possible to write an object proxy which would work how you 
are expecting, but the Python standard library doesn't provide an object proxy 
implementation to base such a thing on.

--

___
Python tracker 

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



[issue19185] Allow multiprocessing Pool initializer to return values

2013-10-07 Thread Richard Oudkerk

Richard Oudkerk added the comment:

I think "misuse" is an exageration.  Various functions change some state and 
return a value that is usually ignored, e.g. os.umask(), signal.signal().

> Global variables usage is a pattern which might lead to code errors and many 
> developers discourage from following it.

What sort of code errors?  This really seems a stylistic point.  Maybe such 
developers would be happier using class methods and class variables rather than 
functions and globals variables.

Out of interest, what do you usually do in your initializer functions?

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Christian Heimes

Christian Heimes added the comment:

Your benchmark is a bit unrealistic because it times the hash cache most of the 
time. Here is a better benchmark (but bytes-only):

$ ./python -m timeit -s "words=[w.encode('utf-8') for line in 
open('../LICENSE') for w in line.split()]; import collections" -- "c = 
collections.Counter(memoryview(w) for w in words); c.most_common(10)"
1000 loops, best of 3: 1.63 msec per loop

This increases the number of hash calculations from about 28k to over 8.4 mio. 

I also added a little statistic function to see how large typical string are. 
The artificial benchmark: 

hash 1:115185
hash 2:   1440956
hash 3:   1679976
hash 4:873769
hash 5:948124
hash 6:651799
hash 7:676707
hash 8:545459
hash 9:523615
hash10:421232
hash11:161641
hash12:140797
hash13: 86826
hash14: 41702
hash15: 41570
hash16:   332
hash17:   211
hash18:  4275
hash19:   205
hash20:   131
hash21:  4197
hash22:70
hash23:35
hash24:44
hash25:  4145
hash26:  4137
hash27:  4137
hash28:21
hash29:  4124
hash30: 8
hash31: 5
hash32: 1
hash other: 28866
hash total:   8404302

And here is the statistic of a full test run.

hash 1: 18935
hash 2:596761
hash 3:643973
hash 4:645399
hash 5:576231
hash 6:742531
hash 7:497214
hash 8:330890
hash 9:291301
hash10: 93206
hash11:   1417900
hash12:160802
hash13: 58675
hash14: 49324
hash15: 48068
hash16: 90634
hash17: 24163
hash18: 66079
hash19: 23408
hash20: 20695
hash21: 16424
hash22: 17236
hash23: 59135
hash24: 10368
hash25:  6047
hash26:  6784
hash27:  5565
hash28:  5931
hash29:  3469
hash30:  4220
hash31:  2652
hash32:  2911
hash other: 72042
hash total:   6608973

About 50% of the hashed elements are between 1 and 5 characters long. A 
realistic hash collision attack on 32bit needs at least 7, 8 chars. I see the 
chance of a micro-optimization! :)

--

___
Python tracker 

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



[issue19070] In place operators of weakref.proxy() not returning self.

2013-10-07 Thread shishkander

shishkander added the comment:

@grahamd
Well, I read the PEP for weakproxy and python doc on weakref library, and I got 
an impression that weakproxy is really like a weak pointer in C++: i can pass 
it around as it was a strong pointer, and get an exception if actual object has 
been deleted. Well, but I see now that it was wrong.

My use case

If you are familiar with kazoo library, then what I am making is similar to 
KazooClient object. See here, for example:
https://kazoo.readthedocs.org/en/latest/basic_usage.html#connection-handling
The typical usage for my object is like this:

zk = KazooClient(hosts='127.0.0.1:2181')
zk.start()
# user *MUST* call zk.stop() otherwise there is a leak

Now I think it's not user-friendly to require the call to zk.stop(). I prefer 
the call to stop() to be called automatically from destructor of zk object 
whenever it goes out of scope. However, the background thread which is created 
in zk.start() also holds reference to zk object, and so __del__ is never 
called, the thread is never stopped, and the leak occurs.

Of course, I can do this to solve the problem above:

class Wrapper(object):
  def __init__(self, *args, **kwargs):
self.__obj = KazooClient(*args, **kwargs)
self.__obj.start()
  def __getattr__(self, attr):
return getattr(self.__obj, attr)
  def __del__(self):
self.__obj.stop()


But even this doesn't quite solve the problem of callbacks. To have callbacks 
from KazooClient, they have to be stored in Wrapper object instead, and 
KazooClient has to be given weak references to some special Wrapper method, 
which will call the real callback. When KazooClient executes callback, it 
operates on a weakproxy, but as soon as it calls wrapper.method() the weakproxy 
is transformed to actual instance, and that complicates things.

It still works with current weakref implementation, but it would be simpler and 
more flexible if the weakproxy was working as I expected, as then I don't have 
to use unnatural calls: Class.method(proxy, ...) instead of just 
proxy.method(...).

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Your benchmark is a bit unrealistic because it times the hash cache
> most of the time. Here is a better benchmark (but bytes-only):
> 
> $ ./python -m timeit -s "words=[w.encode('utf-8') for line in
> open('../LICENSE') for w in line.split()]; import collections" -- "c
> = collections.Counter(memoryview(w) for w in words);
> c.most_common(10)"
> 1000 loops, best of 3: 1.63 msec per loop

Good point. Can you also post all benchmark results?

--

___
Python tracker 

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



[issue19075] Add sorting algorithm visualization to turtledemo

2013-10-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> What are the requirements (if any) to get something added to demos?

Nothing much AFAIK, except that someone must be willing to maintain the code.

--
nosy: +pitrou
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



[issue19070] In place operators of weakref.proxy() not returning self.

2013-10-07 Thread Graham Dumpleton

Graham Dumpleton added the comment:

The __del__() method is generally something to be avoided. As this is a design 
issue with how you are doing things, I would suggest you move the discussion to:

https://groups.google.com/forum/#!forum/comp.lang.python

You will no doubt get many suggestions there.

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Christian Heimes

Christian Heimes added the comment:

unmodified Python:

1000 loops, best of 3: 307 usec per loop (unicode)
1000 loops, best of 3: 930 usec per loop (memoryview)

SipHash:

1000 loops, best of 3: 300 usec per loop (unicode)
1000 loops, best of 3: 906 usec per loop (memoryview)

--

___
Python tracker 

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



[issue19186] expat symbols should be namespaced in pyexpat again

2013-10-07 Thread AThompson

New submission from AThompson:

The issue with confliciting expat versions has poped up again in python 3.
http://bugs.python.org/issue1295808

It looks like the fix for this was removed when upgrading to expat 2.1 in 
http://hg.python.org/cpython/rev/e4dc8be9a72f  on Sat, 14 Jul 2012 14:12:35 
-0700 Gregory P. Smith
--- a/Modules/expat/expat_external.h
/* Namespace external symbols to allow multiple libexpat version to
-   co-exist. */
-#include "pyexpatns.h"

Same backtrace as before.
#0  0x003507481321 in __strlen_sse2 () from /lib64/libc.so.6
#1  0x7facace1b0d0 in PyUnicode_FromString (u=0x0) at 
Objects/unicodeobject.c:1824
#2  0x7facaceefddc in PyModule_AddStringConstant (m=0x7fac9c7cf678,
name=0x7fac9c5ab2e3 "XML_ERROR_UNBOUND_PREFIX", value=0x0) at 
Python/modsupport.c:554
#3  0x7fac9c582f31 in PyInit_pyexpat () at 
/home/hex/Downloads/Python-3.3.2/Modules/pyexpat.c:1870
#4  0x7facacee8f89 in _PyImport_LoadDynamicModule (name=0x7fac9c7db450, 
path=0x7fac9cdf9928, fp=0x0)

--
components: Extension Modules
messages: 199143
nosy: athompson
priority: normal
severity: normal
status: open
title: expat symbols should be namespaced in pyexpat again
type: crash
versions: Python 3.3, Python 3.4

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c960bed22bf6 by Christian Heimes in branch 'default':
Make Nick BDFG delegate
http://hg.python.org/peps/rev/c960bed22bf6

--
nosy: +python-dev

___
Python tracker 

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



[issue19186] expat symbols should be namespaced in pyexpat again

2013-10-07 Thread Christian Heimes

Changes by Christian Heimes :


--
nosy: +christian.heimes, fdrake
stage:  -> needs patch

___
Python tracker 

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



[issue19186] expat symbols should be namespaced in pyexpat again

2013-10-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +gregory.p.smith

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I propose extract all hash related stuff from Include/object.h in separated 
file Include/pyhash.h. And perhaps move Objects/hash.c to Python/pyhash.c.

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Since hash algorithm determined at compile time, the _Py_HashSecret_t structure 
and the _Py_HashSecret function are redundant. We need define only the 
_Py_HashBytes function.

Currently SipHash algorithm doesn't work with unaligned data.

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And note that the quality of the FNV hash function is reduced (msg186403). We 
need "shuffle" result's bits.

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

> The test for unaligned hashing passes without an error or a segfault.

On some platforms it can work without a segfault.

--

___
Python tracker 

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



[issue19183] PEP 456 Secure and interchangeable hash algorithm

2013-10-07 Thread Christian Heimes

Christian Heimes added the comment:

Sure it does. The test for unaligned hashing passes without an error or a 
segfault.

--

___
Python tracker 

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



[issue19178] Entries for "module" and "package" in glossary

2013-10-07 Thread Eric Snow

Eric Snow added the comment:

They are defined in the Python 3 glossary [1], so I expect it just a matter of 
backporting those entries.

[1] http://docs.python.org/3/glossary.html

--
nosy: +eric.snow
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue12892] UTF-16 and UTF-32 codecs should reject (lone) surrogates

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Updated whatsnew and Misc/ files.

--
Added file: http://bugs.python.org/file31984/utf_16_32_surrogates_4.patch

___
Python tracker 

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



[issue18758] Fix internal references in the documentation

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes. I have 180 Kb patch which touches 107 files, and this is yet too large for 
one issue. I will continue split this patch for lesser issues.

--

___
Python tracker 

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



[issue16129] No good way to set 'PYTHONIOENCODING' when embedding python.

2013-10-07 Thread Bastien Montagne

Bastien Montagne added the comment:

Updated patch (mostly from Brecht's remarks, removed an obvious bug...)

--
Added file: http://bugs.python.org/file31985/setstdio.diff

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou

New submission from Antoine Pitrou:

This is a simple enhancement that may reduce memory consumption by a bit 
(unfortunately, this is difficult to measure using standard tools).

--
components: Interpreter Core
files: setintern.patch
keywords: patch
messages: 199154
nosy: haypo, pitrou
priority: low
severity: normal
stage: patch review
status: open
title: Use a set for interned strings
type: resource usage
versions: Python 3.4
Added file: http://bugs.python.org/file31986/setintern.patch

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Dict has a special case for string keys. Is set have such optimization?

--
nosy: +serhiy.storchaka

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

> Dict has a special case for string keys. Is set have such optimization?

Yes (see set_lookkey_unicode).

--

___
Python tracker 

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



[issue19188] Add PySet_CheckExact()

2013-10-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

There are PyFrozenSet_CheckExact() and PyAnySet_CheckExact() but there is no 
PySet_CheckExact(). Perhaps we should add it for consistency.

--
components: Interpreter Core
messages: 199157
nosy: christian.heimes, pitrou, rhettinger, serhiy.storchaka
priority: normal
severity: normal
stage: needs patch
status: open
title: Add PySet_CheckExact()
type: enhancement
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



[issue3430] httplib.HTTPResponse documentations inconsistent

2013-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Docs are still as deficient in 3.3, and so I presume in 3.4.

Part of the discrepancy between the first two lists is that data attributes 
msg, version, status, and reason are instance-only attributes.

#19154 is (now) about improving fileno doc. That, some other methods, are 
missing doctrings, making help(method) useless.

A big change in 3.x is that HTTPResponse now subclasses io.RawIOBase and hence 
inherits or implements even more (undocumented) methods than listed here. I 
suppose they could be documented by reference to the base class, if that is the 
normal procedure when subclassing.

--
dependencies: +AttributeError: 'NoneType' in http/client.py when using select 
when file descriptor is closed.
nosy:  -georg.brandl
versions: +Python 3.4 -Python 3.2

___
Python tracker 

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



[issue19154] AttributeError: 'NoneType' in http/client.py when using select when file descriptor is closed.

2013-10-07 Thread Terry J. Reedy

Terry J. Reedy added the comment:

We are both talking about 2.7 httplib.HTTPResponse.fileno. I should have said 
that users should try: ...fileno(); except AttributeError rather than 
ValueError. Any caller can understand AttributeError as well as ValueError or 
any other exception.

It is not an error for a python function to raise an exception. In fact, it is 
the normal thing to do when it cannot do as requested. API changes are not 
allowed in 2.7 and this one would be dubious even in a future 3.x.

I do think the doc should be more informative and that

Return(s) the fileno of the underlying socket.

should be extended to indicate the specific exception raised when that is not 
possible.

Return the fileno of the underlying socket if there is one or raise 
AttributeError.

This should also be added as a docstring (currently missing).

The above is also true for 3.x as self.fp continues to be replaced with None on 
closing.

The HTTPResponse docs are known to be deficient. #3430

--
I do not think select needs to be changed to understand the HTTPResponse.fileno 
error indicator because it does not call that method. As indicated in the 
traceback, it calls (in 2.7) socket._fileinput.fileno. I believe it is only a 
bug in nappstore (that would be harder to reproduce in 3.x) that 
_fileinput.fileno is forwarded to HTTPResponse.fileno instead of 
_socket.fileno. The latter seem to be the clear intention. Even if I am wrong, 
changing something in the select or socket modules would be a different issue 
from changing something in the client module.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
keywords: +easy, patch
nosy: +docs@python
stage: test needed -> needs patch
type: behavior -> enhancement
versions: +Python 3.3, Python 3.4

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Note that the resizing heuristic is slightly different for sets and dicts, so a 
small-to-middle-size dict can sometimesbe smaller than a set of the same len().

However, for large dicts (>= 5) it seems the corresponding set is most 
always 66% smaller.

--

___
Python tracker 

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



[issue18948] deliberately crashing tests should prevent core dumps

2013-10-07 Thread Zachary Ware

Zachary Ware added the comment:

Here's a patch that combines Valerie's patch with a merged suppress_crash_popup 
and SuppressCoreFiles called SuppressCrashReport.  

Tests ok on Windows; I haven't been able to test on Unix yet.

--
Added file: http://bugs.python.org/file31987/issue18948-combined.diff

___
Python tracker 

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



[issue19189] Improve cross-references in pickle documentation.

2013-10-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is a patch which fixes internal references in the documentation of the 
pickle package.

--
assignee: docs@python
components: Documentation
files: refs.pickle.patch
keywords: patch
messages: 199162
nosy: alexandre.vassalotti, docs@python, pitrou, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Improve cross-references in pickle documentation.
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31988/refs.pickle.patch

___
Python tracker 

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



[issue19190] Improve cross-references in builtins documentation.

2013-10-07 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Here is a patch which fixes internal references for in the documentation of 
builtins.

--
assignee: docs@python
components: Documentation
files: refs.builtins.patch
keywords: patch
messages: 199163
nosy: docs@python, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Improve cross-references in builtins documentation.
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file31989/refs.builtins.patch

___
Python tracker 

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



[issue18948] deliberately crashing tests should prevent core dumps

2013-10-07 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Thanks! The patch works fine here under Linux, too (though I haven't tried to 
figure out if it really prevented core files from being generated).

--

___
Python tracker 

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



[issue19190] Improve cross-references in builtins documentation.

2013-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file31990/refs.builtins.patch

___
Python tracker 

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



[issue19190] Improve cross-references in builtins documentation.

2013-10-07 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Removed file: http://bugs.python.org/file31989/refs.builtins.patch

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue19142] Cross-compile fails trying to execute foreign pgen on build host

2013-10-07 Thread Trevor Bowen

Trevor Bowen added the comment:

In the vein of:

http://randomsplat.com/id5-cross-compiling-python-for-embedded-linux.html

I have created a patch and top-level build script, which builds the requisite 
python interpreter and Parser/pgen binary to run on the build system, which are 
both used during the cross-compile process.

In some ways, this patch is simpler, because of the new cross-compile 
capabilities in 2.7.4 and 2.7.5.  However, previous work is still insufficient, 
because the Makefile assumes the cross-compiled Parser/pgen can be executed on 
the build system during build.  This patch primarily compensates for that, but 
it also works around some misplaced installation file issues.

My top-level cross-compile script, which applies the patch *during* the build 
process is also attached.  It depends on a VCS to restore the original version, 
but I could have just as easily made 2 copies of the patched files (before and 
after patching) and copied the original versions as needed.

I hope this helps others.  Hopefully, bits of this can be integrated to help 
further simplify future cross-compile efforts.

--
keywords: +patch
Added file: http://bugs.python.org/file31991/Python-2.7.5-xcompile.patch

___
Python tracker 

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



[issue19142] Cross-compile fails trying to execute foreign pgen on build host

2013-10-07 Thread Trevor Bowen

Trevor Bowen added the comment:

Short version of cross-compile script without error checking:

#!/bin/bash
export RFS=/local/my_root_file_system
make distclean
rm -rf python_for_build Parser/pgen_for_build
git checkout -- Makefile.pre.in Modules/Setup.dist configure setup.py
./configure
make python Parser/pgen
mv python python_for_build
mv Parser/pgen Parser/pgen_for_build
patch -p3 < Python-2.7.5-xcompile.patch
export 
PATH="/opt/my_cross_compile_toolchain/gcc-4.3.74-eglibc-2.8.74-dp-2/powerpc-none-linux-gnuspe/bin:${PATH}"
make distclean
./configure --host=powerpc-none-linux-gnuspe --build=i586-linux-gnu --prefix=/  
\
--disable-ipv6 ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no 
ac_cv_have_long_long_format=yes
make --jobs=4
sudo make install DESTDIR=${RFS} PATH="${PATH}"

--
Added file: http://bugs.python.org/file31992/cross-compile.sh

___
Python tracker 

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



[issue19142] Cross-compile fails trying to execute foreign pgen on build host

2013-10-07 Thread Trevor Bowen

Trevor Bowen added the comment:

FWIW, I also explored my original proposal, which essentially moved the above 
script and modifications into the Python configure.ac and Makefile.pre.in 
files, so that Python's internal build process would create the native build 
system versions of Python and Parser/pgen, if necessary.  I made some progress 
in creating additional Make targets just for the native build system, which 
redefined the toolchain after completion; however, I encountered unexepected, 
overwhelming configure contamination in the auto-generated header files.

Maybe someone can push this farther than me?  I'm attaching my patch, in case 
it helps someone else and just as reference.

As for me, I think it is much easier to use the above solution, which would 
require very little patching to the sources to make a 2-step compilation to be 
trivial.

--
Added file: 
http://bugs.python.org/file31993/Python-2.7.5-xcompile_improvements.patch

___
Python tracker 

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



[issue18037] 2to3 passes through string literal which causes SyntaxError in 3.x

2013-10-07 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

These revisions also introduced escaping of \u and \U in raw literals, which is 
incorrect.
It breaks e.g. Sphinx.

--
resolution: fixed -> 
stage: committed/rejected -> 
status: closed -> open

___
Python tracker 

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



[issue19187] Use a set for interned strings

2013-10-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

If sets need to be hacked-up to accommodate this, I would like to draft the 
patch for it that I think will be cleaner.

FWIW, I'm dubious that there will be any benefit from this at all.  The savings 
of one-pointer is the dictionary is likely to be insignificant compared to the 
size of the string object themselves.

Also, I think sets conceptually are not the right choice of data structure 
because they are primarily about membership testing and not about looking up 
values.   Incorporating this kind of hack will make my other set optimization 
efforts more difficult.

--

___
Python tracker 

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



[issue19188] Add PySet_CheckExact()

2013-10-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

AFACIT, there is no use case.  I left this out of the API for a reason.  It was 
not an unintentional omission.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue19178] Entries for "module" and "package" in glossary

2013-10-07 Thread Berker Peksag

Changes by Berker Peksag :


Added file: http://bugs.python.org/file31995/issue19178_py2.diff

___
Python tracker 

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



[issue19178] Entries for "module" and "package" in glossary

2013-10-07 Thread Berker Peksag

Berker Peksag added the comment:

For 3.x, I've added cross references between module and package entries.

For 2.7, I've backported importing, module and package entries.

--
keywords: +patch
nosy: +berker.peksag
stage: needs patch -> patch review
Added file: http://bugs.python.org/file31994/issue19178_py3.diff

___
Python tracker 

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



[issue19190] Improve cross-references in builtins documentation.

2013-10-07 Thread Georg Brandl

Georg Brandl added the comment:

Why the need for these changes -- the references I checked are working fine as 
is.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue19178] Entries for "module" and "package" in glossary

2013-10-07 Thread Georg Brandl

Georg Brandl added the comment:

Looks good to me.

--

___
Python tracker 

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



[issue19178] Entries for "module" and "package" in glossary

2013-10-07 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5e1f359d54c4 by Georg Brandl in branch '2.7':
Closes #19178: backport entries for "module" and "package" from 3.x glossary. 
Patch by Berker Peksag.
http://hg.python.org/cpython/rev/5e1f359d54c4

New changeset b6205505e1e4 by Georg Brandl in branch '3.3':
Closes #19178: some more cross-references about packages in glossary. Patch by 
Berker Peksag.
http://hg.python.org/cpython/rev/b6205505e1e4

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/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