[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

It could be the implementation detail if locals() calls were not useful to 
majority of Python software, and if behavior of its returned dict did not 
affect the execution flow of user programs (was deterministic for users who 
should not care about the implementation details).

What I proposed initially is to wrap the locals(), the dict it returns and 
various calls that update this dict into a pattern called "livedict". This 
pattern has a defined behavior, and in OOP it would be encapsulated in a single 
object with one private method locals.__update (called by FastToLocals and 
other internals), and accessor method locals.todict() (name may vary) to 
receive a static copy of the live cache. If somebody needs access to real-time 
updated symbol table, it may request to work with realtime API of this locals 
object instead. This API is turn could have an implementation detail that 
transparently provided faster access to the local symbol table than copying 
dict into cache every time.

Wrapping this into a pattern also makes it easy to communicate details in case 
other Python implementation breaks this implementation detail of CPython. It 
may be easier for understanding to start with broken aspect of the pattern 
without digressing into implementation details, and read about implementation 
details later, than to go other way around.

--

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

RDM's comment:

If that test is run by default, we could change it to only run with -uall.  
Then normal users wouldn't see it.

This is a good idea, only to reduce the occurrence of this test_run. Logically, 
this may not help at all.  I am kind of undecided on this. Shall we take a call 
that the next bug report on the same issue, will lead to moving this test under 
network cover ? :)

--
status: open -> pending

___
Python tracker 

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



[issue5550] [urllib.request]: Comparison of HTTP headers should be insensitive to the case

2013-03-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Case insensitive lookup will be more fool-proof than capitalized look up.
I would in favor of going with case insensitive look up than the capitalized 
look up one. Because the headers could be added in multiple ways and we cannot 
be assured that they are all stored as Capitalized header values.

--

___
Python tracker 

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



[issue17556] os.path.join() converts None to '' by default

2013-03-27 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue17435] threading.Timer.__init__() should use immutable argument defaults for args and kwargs

2013-03-27 Thread Guido van Rossum

Guido van Rossum added the comment:

I agree with the OP -- it's a simple fix and the current code definitely 
violates our recommendations.  I see no reason not to submit this (if there's 
nothing *else* wrong with it -- it actually seems pretty complete).  Not sure 
how important it is to fix in 2.7, but I don't see a problem with it either.

--

___
Python tracker 

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



[issue17435] threading.Timer.__init__() should use immutable argument defaults for args and kwargs

2013-03-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

The reported behavior is not a bug by our usual standards. The code is exactly 
as documented.
manual: class threading.Timer(interval, function, args=[], kwargs={})
docstring: t = Timer(30.0, f, args=[], kwargs={})

Threading is not a beginner module. Any competent Python programmer who reads 
either of the above, or the code line you quoted, would expect exactly the 
behavior you report. I think we should presume that people who monkey-patch the 
class, which is an unusual thing to do, know what they are doing. The patch 
would break any such intentional usage. If the signature were to be changed, 
there should be a deprecation period first, preferably with a 
DeprecationWarning for mutation either through an instance or through .__init__.

I do not see anything special about this particular function. If we change this 
use of [] and {} as defaults, then we should look at all such uses in the 
stdlib -- after pydev discussion. But I currently think we should leave well 
enough alone.

The Timer class was added in Sept. 2001, rev 19727, issue #428326. The patch 
was written by Itamar Shtull-Trauring, approved by Guido, and reviewed and 
committed by Martin.

--
nosy: +gvanrossum, loewis, terry.reedy

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Eric Snow

Eric Snow added the comment:

I've indicated that this issue supercedes issue #7083.

--
stage:  -> needs patch

___
Python tracker 

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-03-27 Thread Eric Snow

Changes by Eric Snow :


--
superseder:  -> Document the circumstances where the locals() dict gets updated

___
Python tracker 

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



[issue5752] xml.dom.minidom does not escape CR, LF and TAB characters within attribute values

2013-03-27 Thread Daniele Varrazzo

Daniele Varrazzo added the comment:

Just got bitten by this bug, which affects xml.etree.ElementTree and 
cElementTree too. Any chance to have it fixed?

Note that lxml.etree is not affected by the bug and can be used as a 
replacement for the stdlib module if you happen to have some work to do.

--
nosy: +piro

___
Python tracker 

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



[issue17563] Excessive resizing of dicts when used as a cache

2013-03-27 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger
nosy: +rhettinger

___
Python tracker 

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



[issue17295] __slots__ on PyVarObject subclass

2013-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I closed the issue, but I didn't see that #1173475 was closed. Sorry, I 
reopened this issue again.

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

___
Python tracker 

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



[issue17295] __slots__ on PyVarObject subclass

2013-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
status: open -> closed

___
Python tracker 

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



[issue17468] Generator memory leak

2013-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue17206] Py_XDECREF() expands its argument multiple times

2013-03-27 Thread STINNER Victor

STINNER Victor added the comment:

I'm not sure that it is a good idea to patch such major function (macro) in a 
minor version (ex: Python 2.7.x). I changed the Versions field to only select 
Python 3.4.

--
nosy: +haypo
versions:  -Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5

___
Python tracker 

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



[issue17433] stdlib generator-like iterators don't forward send/throw

2013-03-27 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
stage:  -> committed/rejected
status: open -> closed
superseder:  -> Implement generator interface in itertools.chain.

___
Python tracker 

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




[issue17565] segfaults during serialization

2013-03-27 Thread STINNER Victor

STINNER Victor added the comment:

ModelSettings.py requires globalSettings which is not attached.

--
nosy: +haypo

___
Python tracker 

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



[issue17559] str.is* implementation seem suboptimal for single character strings

2013-03-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

There's still stuff in bytes_methods.c which looks like the old string code.

--

___
Python tracker 

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



[issue17559] str.is* implementation seem suboptimal for single character strings

2013-03-27 Thread STINNER Victor

STINNER Victor added the comment:

If you would like to improve Python, you have to focus on the development 
version which is Python 3.4. In this version, the code is different:

if (length == 1)
return PyBool_FromLong(
Py_UNICODE_ISSPACE(PyUnicode_READ(kind, data, 0)));

I'm not sure that having a special case for string of 1 character provide any 
speed up...

--

___
Python tracker 

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



[issue17559] str.is* implementation seem suboptimal for single character strings

2013-03-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

The shortcut seems fairly pointless to me.

--

___
Python tracker 

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



[issue17559] str.is* implementation seem suboptimal for single character strings

2013-03-27 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +benjamin.peterson, ezio.melotti, haypo, serhiy.storchaka
versions: +Python 3.4

___
Python tracker 

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



[issue17491] Consolidate traceback.format_tb and traceback.print_tb

2013-03-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Thank you for the patch. It seems like it would make more sense to implement 
print_tb in terms of extract_tb. That is, print_tb should iterate through the 
result of extract_tb and do its printing.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2013-03-27 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue17565] segfaults during serialization

2013-03-27 Thread Benjamin Peterson

Benjamin Peterson added the comment:

Please provide a self-contained explain, we can reproduce.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue17563] Excessive resizing of dicts when used as a cache

2013-03-27 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue17502] unittest.mock: side_effect iterators ignore DEFAULT

2013-03-27 Thread Radu Voicilas

Changes by Radu Voicilas :


--
nosy: +raduv

___
Python tracker 

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



[issue17565] segfaults during serialization

2013-03-27 Thread Daniele Raimondi

New submission from Daniele Raimondi:

pickle and cPickle cause really often segfaults when dumping or loading user 
defined classes. It happens with python 2.7.3 on 64bits architecture, with any 
protocol (0,1,2).
I attach an example of class afflicted by this problem.
Solutions anyone?

--
components: Extension Modules
files: ModelSettings.py
messages: 185389
nosy: eddiewrc
priority: normal
severity: normal
status: open
title: segfaults during serialization
versions: Python 2.7
Added file: http://bugs.python.org/file29599/ModelSettings.py

___
Python tracker 

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



[issue17491] Consolidate traceback.format_tb and traceback.print_tb

2013-03-27 Thread Radu Voicilas

Radu Voicilas added the comment:

Is there anything else that I have to do in order for this patch to be looked 
at ? I am holding off a similar one for print_exception vs. format_exception

--

___
Python tracker 

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



[issue16676] Segfault under Python 3.3 after PyType_GenericNew

2013-03-27 Thread Mark Shannon

Mark Shannon added the comment:

This issue should be considered closed.

PyType_GenericNew is a convenience function for typeobjects to put in their 
tp_new slots. Calling it directly only works for some types. 
It worked in 3.2 for dict, but that was happenstance.

You could use 
((PyTypeObject *)type_object)->tp_new((PyTypeObject *)type_object, NULL, NULL);
to call the new method directly, but it would be better to call the 
type_object:
PyObject_CallObject(type_object, NULL);

--

___
Python tracker 

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



[issue12466] sporadic failures of test_close_fds and test_pass_fds in test_subprocess

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

Hummm...
For those experiencing failures when /proc is mounted: do you have a 
grsecurity-patched kernel?
If RBAC is enabled, /proc/self/fd is empty, so this approach won't work...

--
nosy: +neologix

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread R. David Murray

R. David Murray added the comment:

I think we should instead have it email the ISP that their DNS is broken :)

Seriously, though, complain to your ISP.  My ISP at least provides name servers 
that don't have this "feature" if you prefer to use them, and they are the 
default for business accounts.  So they are being stupid, but less stupid than 
the original offender.

If you run a local DNS forwarding server, you can configure it to ignore the 
wildcard records from your upstream.  IMO everyone should run a local DNS 
caching/forwarding server for both this reason and for performance :)

If that test is run by default, we could change it to only run with -uall.  
Then normal users wouldn't see it.

Now, all that said, I won't be crushed if the test gets deleted, but I will be 
very very sad about what that event says about modern ISPs.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 27/03/13 21:09, Charles-François Natali wrote:
> I could, but I don't have to: a shared memory won't incur any I/O or 
> copy (except if it is swapped). A file-backed mmap will incur a *lot* 
> of I/O: really, just try writting a 1GB file, and you'll see your disk 
> spin, or use cat /proc/diskstats.

You are right.

--

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread Mark Shannon

Mark Shannon added the comment:

Bah, stupid BT :(
I opened the URL in my browser and got a "helpful" message telling me "Sorry, 
the website sadflkjsasf.i.nvali.d. cannot be found"

Perhaps we should just remove this test?
I suspect this is only going to become more common.

--

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread R. David Murray

R. David Murray added the comment:

Indeed, this is almost always a (common) ISP DNS server misconfiguration.  
Well, they would claim they are "helping their users", but we know better.

Not much we can do about it, except perhaps add an explanatory note to the test 
failure message (if assertRaises allows that...I think I requested that feature 
but I don't know if it has been added).

--
nosy: +r.david.murray

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread Ezio Melotti

Ezio Melotti added the comment:

There's a comment in the test that says it might be because of the ISP.
What happens if you try to open that address in a browser or using something 
like wget?

--
nosy: +ezio.melotti
status: pending -> open

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread Senthil Kumaran

Senthil Kumaran added the comment:

Are you behind some kind of a proxy? This is seen when you are running the 
tests and your interent connection is via proxy (and that is handling this 
invalid URL test)

--
nosy: +orsenthil
status: open -> pending

___
Python tracker 

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



[issue17564] test_urllib2_localnet fails

2013-03-27 Thread Mark Shannon

New submission from Mark Shannon:

The test_urllib2_localnet test fails when run with a clean build from a clean 
checkout.

Machine:
Ubuntu 12.04 LTS, 64 bit
Intel  i3-2370M CPU @ 2.40GHz × 4 

Test output:

$ ./python -m test -v test_urllib2_localnet
== CPython 3.4.0a0 (default:53cc3dbb1918, Mar 27 2013, 21:05:11) [GCC 4.6.3]
==   Linux-3.2.0-29-generic-x86_64-with-debian-wheezy-sid little-endian
==   /home/mark/repositories/cpython/build/test_python_4588
Testing with flags: sys.flags(debug=0, inspect=0, interactive=0, optimize=0, 
dont_write_bytecode=0, no_user_site=0, no_site=0, ignore_environment=0, 
verbose=0, bytes_warning=0, quiet=0, hash_randomization=1)
[1/1] test_urllib2_localnet
test_proxy_qop_auth_int_works_or_throws_urlerror 
(test.test_urllib2_localnet.ProxyAuthTests) ... ok
test_proxy_qop_auth_works (test.test_urllib2_localnet.ProxyAuthTests) ... ok
test_proxy_with_bad_password_raises_httperror 
(test.test_urllib2_localnet.ProxyAuthTests) ... ok
test_proxy_with_no_password_raises_httperror 
(test.test_urllib2_localnet.ProxyAuthTests) ... ok
test_200 (test.test_urllib2_localnet.TestUrlopen) ... ok
test_200_with_parameters (test.test_urllib2_localnet.TestUrlopen) ... ok
test_404 (test.test_urllib2_localnet.TestUrlopen) ... ok
test_bad_address (test.test_urllib2_localnet.TestUrlopen) ... FAIL
test_basic (test.test_urllib2_localnet.TestUrlopen) ... ok
test_chunked (test.test_urllib2_localnet.TestUrlopen) ... ok
test_geturl (test.test_urllib2_localnet.TestUrlopen) ... ok
test_https (test.test_urllib2_localnet.TestUrlopen) ... stopping HTTPS server
joining HTTPS thread
ok
test_https_sni (test.test_urllib2_localnet.TestUrlopen) ... stopping HTTPS 
server
joining HTTPS thread
ok
test_https_with_cadefault (test.test_urllib2_localnet.TestUrlopen) ... stopping 
HTTPS server
Got an error:
[SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:555)
joining HTTPS thread
ok
test_https_with_cafile (test.test_urllib2_localnet.TestUrlopen) ... Got an 
error:
[SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:555)
stopping HTTPS server
joining HTTPS thread
stopping HTTPS server
joining HTTPS thread
ok
test_info (test.test_urllib2_localnet.TestUrlopen) ... ok
test_iteration (test.test_urllib2_localnet.TestUrlopen) ... ok
test_line_iteration (test.test_urllib2_localnet.TestUrlopen) ... ok
test_redirection (test.test_urllib2_localnet.TestUrlopen) ... ok
test_sending_headers (test.test_urllib2_localnet.TestUrlopen) ... ok

==
FAIL: test_bad_address (test.test_urllib2_localnet.TestUrlopen)
--
Traceback (most recent call last):
  File "/home/mark/repositories/cpython/Lib/test/test_urllib2_localnet.py", 
line 568, in test_bad_address
"http://sadflkjsasf.i.nvali.d./";)
AssertionError: OSError not raised by urlopen

--
Ran 20 tests in 1.080s

FAILED (failures=1)
Warning -- threading._dangling was modified by test_urllib2_localnet
test test_urllib2_localnet failed
1 test failed:
test_urllib2_localnet

--
components: Tests
messages: 185379
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: test_urllib2_localnet fails
type: behavior
versions: Python 3.4

___
Python tracker 

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



[issue17563] Excessive resizing of dicts when used as a cache

2013-03-27 Thread Mark Shannon

New submission from Mark Shannon:

If a dict is used a cache, e.g. in functools.lru_cache, 
the reduced resize factor in 3.3 can cause excessive resizing.
This can lead to a significant performance regression.

When the the number of deletions and insertions is roughly in balance
the reduced head room in the dict (compare to 3.2) causes a large increase in 
the number of resizes.

The reason for this above-linear increase is that with fewer dummy keys, the 
chance of a dummy being overwritten is reduced *and* is there is less overhead 
as well.
A dictionary with 128 items will have a capacity of 256 and only 43 dummy keys. 
If it had a capacity of 512 (as it would have done in 3.2) then it will have 
214 keys, making a resize at least 10 times less frequent.

Changing the growth function from round_up_to_power_2(used*2) to
round_up_to_power_2(used*2+capacity/2) the desirable property of only doubling 
in size when growing can be preserved, yet ensuring sufficient overhead when 
used as a cache.

Consider a dict which grows to n items and then remains that size, with 
frequent deletions and insertions, using the proposed growth function:

ItemsCapacity Steady state Capacity
 on reaching ncapacity under 3.2
  28  8   8
  48  16  16 
  616 32  32 
  816 32  32 
  10   16 64  64 
  12   32 64  64 
  15   32 64  64 
  20   32 128 128
  30   64 128 128
  50   128256 256
  80   128512 512
  128  256512 512


Thanks to Raymond Hettinger for bringing this to my attention.

Patch attached.

--
components: Interpreter Core
files: resize.patch
keywords: patch
messages: 185378
nosy: Mark.Shannon
priority: normal
severity: normal
status: open
title: Excessive resizing of dicts when used as a cache
type: performance
versions: Python 3.3
Added file: http://bugs.python.org/file29598/resize.patch

___
Python tracker 

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



[issue17558] gdb debugging python frames in optimised interpreters

2013-03-27 Thread R. David Murray

Changes by R. David Murray :


--
nosy: +dmalcolm

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

> I meant when there is no memory pressure.

http://lwn.net/Articles/326552/
"""
The kernel page cache contains in-memory copies of data blocks
belonging to files kept in persistent storage. Pages which are written
to by a processor, but not yet written to disk, are accumulated in
cache and are known as "dirty" pages. The amount of dirty memory is
listed in /proc/meminfo. Pages in the cache are flushed to disk after
an interval of 30 seconds. Pdflush is a set of kernel threads which
are responsible for writing the dirty pages to disk, either explicitly
in response to a sync() call, or implicitly in cases when the page
cache runs out of pages, if the pages have been in memory for too
long, or there are too many dirty pages in the page cache (as
specified by /proc/sys/vm/dirty_ratio).
"""

>>> FreeBSD has a MAP_NOSYNC flag which gives Linux behaviour (otherwise
>>> dirty pages are flushed every 30-60).
>>
>> It's the same on Linux, depending on your mount options, data will be
>> committed to disk every 5 seconds or so, when the journal is
>> committed.
>
> Googling suggsests that MAP_SHARED on Linux is equivalent to MAP_SHARED
> | MAP_NOSYNC on FreeBSD.  I don't think it has anything to do with mount
> options.

"""
MAP_NOSYNCCauses data dirtied via this VM map to be flushed to
   physical media only when necessary (usually by the
   pager) rather than gratuitously.
[...]
"""

This just means that it will reduce synchronous writeback, but
writeback will still occur (by what they call the pager).

On Linux, writeback can be done by background kernel threads
(pdflush), or synchrously on behalf of the process.

The "mount option" thing is the following:
if the file system is mounted with data=journal or data=ordered, data
is written to disk before corresponding metadata is committed. And
metadata is written when the journal is committed, by default every 5
seconds:

man mount:
"""
ext3

   commit=nrsec   data={journal|ordered|writeback}
  Specifies the journalling mode for file data.  Metadata
is always journaled.  To use modes other than ordered on the root
filesystem, pass the mode to the kernel
  as boot parameter, e.g.  rootflags=data=journal.

  journal
 All data is committed into the journal prior to
being written into the main filesystem.

  ordered
 This is the default mode.  All data is forced
directly out to the main file system prior to its metadata being
committed to the journal.

  writeback
 Data ordering is not preserved - data may be
written into the main filesystem after its metadata has been committed
to the journal.  This is  rumoured  to
 be the highest-throughput option.  It guarantees
internal filesystem integrity, however it can allow old data to appear
in files after a crash and journal
 recovery.

   commit=nrsec
  Sync all data and metadata every nrsec seconds. The
default value is 5 seconds. Zero means default.
"""
> The Linux man page refuses to specify
>
>MAP_SHARED
>  Share this mapping. Updates to the mapping are visible to other
>  processes that map this file, and are carried through to the
>  underlying file. **The file may not actually be updated until
>  msync(2) or munmap() is called.**

*may*,:just as fsync() is required to make sure data is committed to
disk for a file, msync() is required for a mapping. But data is
committed asynchronously or synchronously depending on different
criterias (ratio of dirty pages, free memory, dirty pages age, etc).

> Can you demonstrate a slowdown with a benchmark?

I could, but I don't have to: a shared memory won't incur any I/O or
copy (except if it is swapped).
A file-backed mmap will incur a *lot* of I/O: really, just try
writting a 1GB file, and you'll see your disk spin, or use cat
/proc/diskstats.

--

___
Python tracker 

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



[issue17562] spam

2013-03-27 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy:  -Aslanidi
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
title: Invitation to connect on LinkedIn -> spam

___
Python tracker 

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



[issue17562] Invitation to connect on LinkedIn

2013-03-27 Thread Ezio Melotti

Changes by Ezio Melotti :


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

___
Python tracker 

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



[issue17562] Invitation to connect on LinkedIn

2013-03-27 Thread Konstantin

New submission from Konstantin:

LinkedIn


I'd like to add you to my professional network on LinkedIn.

- Konstantin

Konstantin Aslanidi
Author of opentradingsystem.com
Greater New York City Area

Confirm that you know Konstantin Aslanidi:
https://www.linkedin.com/e/-3qcne3-hesyzdls-6z/isd/11993347706/dmPEJwhm/?hs=false&tok=1F_d-YPz94_lE1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/-3qcne3-hesyzdls-6z/z2oU7dKDzpt2G7xQz2FC2SclHmnUGzmsk0c/goo/report%40bugs%2Epython%2Eorg/20061/I3977399171_1/?hs=false&tok=3pdPq6KFR4_lE1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

--
messages: 185376
nosy: Aslanidi
priority: normal
severity: normal
status: open
title: Invitation to connect on LinkedIn

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 27/03/2013 8:14pm, Charles-François Natali wrote:
>
> Charles-François Natali added the comment:
>
>> Apart from creating, unlinking and resizing the file I don't think there
>> should be any disk I/O.
>>
>> On Linux disk I/O only occurs when fsync() or close() are called.
>
> What?
> Writeback occurs depending on the memory pressure, percentage of used
> pages, page modification time, etc. Try writing a large file without
> closing it, you'll see that there's disk activity (or use
> iostat/vmstat).

I meant when there is no memory pressure.

>> FreeBSD has a MAP_NOSYNC flag which gives Linux behaviour (otherwise
>> dirty pages are flushed every 30-60).
>
> It's the same on Linux, depending on your mount options, data will be
> committed to disk every 5 seconds or so, when the journal is
> committed.

Googling suggsests that MAP_SHARED on Linux is equivalent to MAP_SHARED 
| MAP_NOSYNC on FreeBSD.  I don't think it has anything to do with mount 
options.

The Linux man page refuses to specify

   MAP_SHARED
 Share this mapping. Updates to the mapping are visible to other
 processes that map this file, and are carried through to the
 underlying file. **The file may not actually be updated until
 msync(2) or munmap() is called.**

>> Once the file has been unlink()ed then any sensible operating system
>> should realize it does not need to sync the file.
>
> Why?
> Even if you delete the file right after open, if you write data to it,
> when the amount of data written fills your caches, the data has to go
> somewhere, even if only to make it available to the current process
> upon read()...

Can you demonstrate a slowdown with a benchmark?

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

> What you say is right but whether the kernel supports an hybrid IPv4/6 stack
> or not there's not much we can do about it anyway.
> Exactly what are you suggesting with the ServerSocket class you mentioned?
> What do you expect it to do?

There's a confusion.
Dual-stack merely means that the host supports both IPv4 and IPv6 natively.
The IPV6_V6ONLY tunable is just a way to enable or not IPv4-mapped
addresses (i.e. ::::) so that an IPv4 client can
connect to this socket. It can be set system-wide, or on a socket
basis.

> Note that platforms supporting the dual-stack are already supported. This:
>
 socket.create_server_socket(("::", 0))
>
> ...on Linux will create a socket which is reachable both as "::1" and
> "127.0.0.1".

Try the same thing after:
# echo 1 > /proc/sys/net/ipv6/bindv6only

It won't accept IPv4 connections anymore.

And that's the default on many (most) platforms, e.g. FreeBSD and
OpenBSD (I think it's also true for Windows).

So the bottom line is that with the current code, on some - most -
platforms, we'll only accept IPv6 connections (and since you iterate
over getaddrinfo() in an unspecified order you may very well bind to
IPv4 only first, in which case you'll only accept IPv4 clients).

The proper way to procedd, on platforms which don't support unsetting
IPV6_V6ONLY, is to use two sockets, one in IPv4, and one IPv6, and use
select() to accept connections.

This would propably belong to an overriden accept() method in a
ServerSocket class, since it's far from trivial.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

> Apart from creating, unlinking and resizing the file I don't think there
> should be any disk I/O.
>
> On Linux disk I/O only occurs when fsync() or close() are called.

What?
Writeback occurs depending on the memory pressure, percentage of used
pages, page modification time, etc. Try writing a large file without
closing it, you'll see that there's disk activity (or use
iostat/vmstat).

> FreeBSD has a MAP_NOSYNC flag which gives Linux behaviour (otherwise
> dirty pages are flushed every 30-60).

It's the same on Linux, depending on your mount options, data will be
committed to disk every 5 seconds or so, when the journal is
committed.

> Once the file has been unlink()ed then any sensible operating system
> should realize it does not need to sync the file.

Why?
Even if you delete the file right after open, if you write data to it,
when the amount of data written fills your caches, the data has to go
somewhere, even if only to make it available to the current process
upon read()...

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Guido van Rossum

Guido van Rossum added the comment:

Tulip has something similar.  Someone should compare the two and make sure they 
are equivalent or similar.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 27/03/2013 7:27pm, Charles-François Natali wrote:
>
> Charles-François Natali added the comment:
>
>> Through fork, yes, but "shared" rather than "copy-on-write".
>
> There's a subtlety: because of refcounting, just treating a COW object
> as read-only (e.g. iteratin on the array) will trigger a copy
> anyway...

I mean "write-through" (as opposed to "read-only" or "copy-on-write").

>>   I don't think shm_open() really has any advantages over
>> using mmaps backed by "proper" files (since posix shared memeory uses up
>> space in /dev/shm which is limited).
>
> File-backed mmap() will incur disk I/O (although some of the data will
> probably sit in the page cache), which would be much slower than a
> shared memory. Also, you need corresponding disk space.
> As for the /dev/shm limit, it's normally dimensioned according to the
> amount of RAM, which is normally, which is in turn dimensioned
> according to the working set.

Apart from creating, unlinking and resizing the file I don't think there 
should be any disk I/O.

On Linux disk I/O only occurs when fsync() or close() are called. 
FreeBSD has a MAP_NOSYNC flag which gives Linux behaviour (otherwise 
dirty pages are flushed every 30-60).

Once the file has been unlink()ed then any sensible operating system 
should realize it does not need to sync the file.

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

Side note: this is how in pyftpdlib I determine whether a platform supports the 
dual stack:

def support_hybrid_ip_v4_v6():
# Note: IPPROTO_IPV6 constant is broken on Windows, see:
# http://bugs.python.org/issue6926
sock = None
try:
if not socket.has_ipv6:
return False
sock = socket.socket(socket.AF_INET6)
return not sock.getsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY)
except (socket.error, AttributeError):
return False
finally:
if sock is not None:
sock.close()

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'

Giampaolo Rodola' added the comment:

What you say is right but whether the kernel supports an hybrid IPv4/6 stack or 
not there's not much we can do about it anyway.
Exactly what are you suggesting with the ServerSocket class you mentioned? What 
do you expect it to do?
Note that platforms supporting the dual-stack are already supported. This:

>>> socket.create_server_socket(("::", 0))

...on Linux will create a socket which is reachable both as "::1" and 
"127.0.0.1".
So if I'm not mistaken the alias for specifying "listen on all interfaces for 
both IPv4 and IPv6 addresses" would be "::" instead of "" / None.
We can document that.

--

___
Python tracker 

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



[issue13510] Clarify that readlines() is not needed to iterate over a file

2013-03-27 Thread Ashwini Chaudhary

Changes by Ashwini Chaudhary :


--
nosy: +montysinngh

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

> Through fork, yes, but "shared" rather than "copy-on-write".

There's a subtlety: because of refcounting, just treating a COW object
as read-only (e.g. iteratin on the array) will trigger a copy
anyway...

> I assume you mean "shared memory" and shm_open(), not "semaphores" and
> sem_open().

Yes ;-)

>  I don't think shm_open() really has any advantages over
> using mmaps backed by "proper" files (since posix shared memeory uses up
> space in /dev/shm which is limited).

File-backed mmap() will incur disk I/O (although some of the data will
probably sit in the page cache), which would be much slower than a
shared memory. Also, you need corresponding disk space.
As for the /dev/shm limit, it's normally dimensioned according to the
amount of RAM, which is normally, which is in turn dimensioned
according to the working set.

--

___
Python tracker 

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



[issue17556] os.path.join() converts None to '' by default

2013-03-27 Thread Eric V. Smith

Eric V. Smith added the comment:

I agree with David. This is a programming error, and should result in an 
exception.

--
nosy: +eric.smith

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 27/03/2013 5:47pm, Charles-François Natali wrote:
>> multiprocessing currently only allows sharing of such shared arrays
>> using inheritance.
>
> You mean through fork() COW?

Through fork, yes, but "shared" rather than "copy-on-write".

>>   Perhaps we need a picklable mmap type which can be sent over pipes
>> and queues.  (On Unix this would probably require fd passing.)
>
> If you use POSIX semaphores, you could pass the semaphore path and use
> sem_open in the other process (but that would mean you can't unlink it
> right after open).

I assume you mean "shared memory" and shm_open(), not "semaphores" and 
sem_open().  I don't think shm_open() really has any advantages over 
using mmaps backed by "proper" files (since posix shared memeory uses up 
space in /dev/shm which is limited).

By using fd passing you can get the operating system to do ref counting 
on the mmaps and not worry about when to unlink.

--

___
Python tracker 

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



[issue17554] Compact output for regrtest

2013-03-27 Thread Brett Cannon

Brett Cannon added the comment:

I say move forward and put it behind a flag (w/ quiet is fine, maybe some arg 
to specify quietness or -qq much like -vv?).

--

___
Python tracker 

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



[issue17556] os.path.join() converts None to '' by default

2013-03-27 Thread R. David Murray

R. David Murray added the comment:

I think it is probably better to keep the error, myself.  It seems to me that a 
None creeping in is more likely to be an error in the program.   But I could be 
convinced otherwise :)

What is your use case?

--
nosy: +r.david.murray
versions:  -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 
3.5

___
Python tracker 

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



[issue17554] Compact output for regrtest

2013-03-27 Thread R. David Murray

R. David Murray added the comment:

No, what I'd prefer is that the current "print it as it runs" behavior not 
change, but that the list of skip reasons be displayed at the end. after all 
the tests have completed.  This is probably not a realistic request, so I'm 
fine with just having Ezio's version as an option.  

To be clear: I don't have any use for the list of passed tests other than it 
keeping me informed of the test run progress, and for that use I want it to 
scroll up my display, not overwrite on one line.

That said, I don't have *strong* feelings about this :)

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

I think that's a good idea.

However, there's a problem with the implementation: if one passes "" or None as 
address on a dual-stack node, the resulting socket will be either IPv4 bound to 
INADDR_ANY, or IPv6 bound to IN6ADDR_ANY, whereas one would expect to be bound 
both in IPv4 and IPv6. In the later case, some platforms (like Linux) use 
IPv4-mapped addresses by default, some others (e.g. some versions of FreeBSD) 
don't. So, depending on IPV6_V6ONLY setting, binding to IPV6 any won't accept 
IPv4 connections. Also, some platforms don't support mapped addresses at all, 
so the only portable solution is to bind both to 0.0.0.0 and ::, whith two 
different sockets, and use select() to accept both.

So it would maybe make sense to expose a ServerSocket class, with an accept 
method which would do the right thing (as an added bonus, it could expose 
set_reuse_addr(bool), since SO_REUSEADDR have subtle semantic differences 
between Unix and Windows).

--
nosy: +neologix

___
Python tracker 

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



[issue17329] Document unittest.SkipTest

2013-03-27 Thread Ezio Melotti

Ezio Melotti added the comment:

Fixed, thanks for the patch!

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

___
Python tracker 

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



[issue17329] Document unittest.SkipTest

2013-03-27 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cd5c23583fa5 by Ezio Melotti in branch '3.2':
#17329: document unittest.SkipTest.  Initial patch by Zachary Ware.
http://hg.python.org/cpython/rev/cd5c23583fa5

New changeset 4bf2a53b53b6 by Ezio Melotti in branch '3.3':
#17329: merge with 3.2.
http://hg.python.org/cpython/rev/4bf2a53b53b6

New changeset 53cc3dbb1918 by Ezio Melotti in branch 'default':
#17329: merge with 3.3.
http://hg.python.org/cpython/rev/53cc3dbb1918

New changeset 13eb2fd70893 by Ezio Melotti in branch '2.7':
#17329: document unittest.SkipTest.  Initial patch by Zachary Ware.
http://hg.python.org/cpython/rev/13eb2fd70893

--
nosy: +python-dev

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Ned Batchelder

Changes by Ned Batchelder :


--
nosy: +nedbat

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Eric Snow

Eric Snow added the comment:

I should also point out that the following from that note may actually also be 
a CPython implementation detail:

   Each call to locals() will return the same dictionary, updated to
   the contents of the current local symbol table.

We'd want to be sure that such should be expected from all implementations 
(since it basically adds to the language specification).  Otherwise it should 
also go in an impl-detail note.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread mrjbq7

mrjbq7 added the comment:

> Richard was saying that you shouldn't serialize such a large array,
> that's just a huge performance bottleneck. The right way would be 
> to use a shared memory.

Gotcha, for clarification, my original use case was to *create* them
in the other process (something which took some time since they were 
calculated and not just random as in the example) and returned to the 
original process for further computation...

--

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Eric Snow

Eric Snow added the comment:

Okay, I found it.  sys.settrace() ultimately results in the setting of 
tstate->use_tracing to true and sets tstate->c_tracefunc and tstate_c_traceobj 
(see sys_settrace() in Python/sysmodule.c and PyEval_SetTrace() in 
Python/ceval.c).  tstate->c_tracefunc() gets set to trace_trampoline() in 
Python/sysmodule.c and tstate->c_traceobj gets set to your tracing function.

When an execution frame begins, the interpreter sets up tracing.  From 
Python/ceval.c:1124:

/* tstate->c_tracefunc, if defined, is a
   function that will be called on *every* entry
   to a code block.  Its return value, if not
   None, is a function that will be called at
   the start of each executed line of code.
   (Actually, the function must return itself
   in order to continue tracing.)  The trace
   functions are called with three arguments:
   a pointer to the current frame, a string
   indicating why the function is called, and
   an argument which depends on the situation.
   The global trace function is also called
   whenever an exception is detected. */

So trace_trampoline() gets at the start of each block and once for each line of 
Python code.  Each time it calls call_trampoline() (also in 
Python/sysmodule.c).  You'll find that in call_trampoline(), there is a call to 
PyFrame_FastToLocals() just before it calls your tracing function (at that 
point called "callback").

When called, PyFrame_FastToLocals() updates the contents of the frame's "slow" 
locals (f_locals) with the values in the fast locals.  And...wait for 
it...f_locals is the dict that gets returned by locals().

Thus, when tracing is on, the dict returned by locals() gets updated once per 
block and once per line of Python code.  That is exactly what you are seeing.

When tracing is not on, PyFrame_FastToLocals() would only be called when you 
call locals() (inside a function).  It's interesting to note that in that case 
locals() will return the exact same dictionary:

>>> def f():
... return locals() is locals()
...
>>> f()
True

Conclusion
--

The bottom line is that the docs for locals() could stand to have a little more 
detail for this case (including a link to the docs for tracing at 
sys.settrace() or wherever).  However, the behavior here is--at present--a 
CPython implementation detail.  Any note would likely say as much; something 
like this:

.. function:: locals()

   ...

   Each call to locals() will return the same dictionary, updated to
   the contents of the current local symbol table.

   .. impl-detail::

  Under tracing and profiling in CPython, the dict returned by
  ``locals()`` will be updated at the beginning of each code block
  and at each line of code.  See :func:`sys.settrace`.

The note is really only meaningful for functions since class bodies and modules 
don't use fast locals and f_locals is set to f_globals (i.e. locals() == 
globals()).  However, that point is superfluous to the above note since it 
remains true either way.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Charles-François Natali

Charles-François Natali added the comment:

> Also, does pickle currently handle byte strings larger than 4GB?

The 2.7 failure is indeed a pickle limitation, which should now be fixed by 
issue #13555.

> On a machine with 256GB of RAM, it makes more sense to send arrays
> of this size than say on a laptop...

Richard was saying that you shouldn't serialize such a large array, that's just 
a huge performance bottleneck. The right way would be to use a shared memory.

> multiprocessing currently only allows sharing of such shared arrays
> using inheritance.

You mean through fork() COW?

>  Perhaps we need a picklable mmap type which can be sent over pipes
> and queues.  (On Unix this would probably require fd passing.)

If you use POSIX semaphores, you could pass the semaphore path and use sem_open 
in the other process (but that would mean you can't unlink it right after open).

--
nosy: +neologix

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

On 27/03/2013 5:13pm, mrjbq7 wrote:
> On a machine with 256GB of RAM, it makes more sense to send arrays
> of this size than say on a laptop...

I was thinking more of speed than memory consumption.

--

___
Python tracker 

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



[issue16754] Incorrect shared library extension on linux

2013-03-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

So sysconfig.get_config_var('SO') will change in a micro release?

Won't this break working user code? Give unexpected file names?

--
nosy: +amaury.forgeotdarc
status: pending -> open

___
Python tracker 

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-03-27 Thread Terry J. Reedy

Terry J. Reedy added the comment:

Calling locals() updates the dict, just as documented.

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread mrjbq7

mrjbq7 added the comment:

On a machine with 256GB of RAM, it makes more sense to send arrays of this size 
than say on a laptop...

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

> I *think* we need to keep compatibility with the wire format, but perhaps 
> we could use a special length value (-1?) to introduce a longer (64-bit) 
> length value.

Yes we could, although that would not help on Windows pipe connections (where 
byte oriented messages are used instead).  Also, does pickle currently handle 
byte strings larger than 4GB?

But I can't help feeling that multigigabyte arrays should be transferred using 
shared mmaps rather than serialization.  numpy.frombuffer() could be used to 
recreate the array from the mmap.

multiprocessing currently only allows sharing of such shared arrays using 
inheritance.  Perhaps we need a picklable mmap type which can be sent over 
pipes and queues.  (On Unix this would probably require fd passing.)

--

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +gvanrossum

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Eric Snow

Eric Snow added the comment:

Thanks for the script Anatoly.  That's pretty much what I was imagining from 
your description.  This definitely reinforces my belief that profiling.

--
versions: +Python 3.3, Python 3.4

___
Python tracker 

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



[issue17561] Add socket.create_server_sock() convenience function

2013-03-27 Thread Giampaolo Rodola'

New submission from Giampaolo Rodola':

Here's a function similar to socket.create_connection() which addresses all the 
repetitive tasks needed to order to create an IPv4/IPv6 agnostic server socket.

--
components: Library (Lib)
files: socket.patch
keywords: easy, needs review, patch
messages: 185348
nosy: giampaolo.rodola, pitrou
priority: normal
severity: normal
status: open
title: Add socket.create_server_sock() convenience function
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file29596/socket.patch

___
Python tracker 

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



[issue17557] test_getgroups of test_posix can fail on OS X 10.8 if more than 16 groups

2013-03-27 Thread Jesús Cea Avión

Changes by Jesús Cea Avión :


--
nosy: +jcea

___
Python tracker 

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



[issue7083] locals() behaviour differs when tracing is in effect

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

Attached localtest2.py where an empty locals() call changes behavior.

--- localtest.pyWed Mar 27 19:48:06 2013
+++ localtest2.py   Wed Mar 27 19:45:19 2013
@@ -3,6 +3,7 @@
 def X():
 l = locals()
 i = "foo"
+locals()
 print("Is 'i' in stored locals()? ", ('i' in l))

 print("Running normally")

--
Added file: http://bugs.python.org/file29597/localtest2.py

___
Python tracker 

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



[issue17553] Note that distutils’ bdist_rpm command is not used to build a CPython rpm

2013-03-27 Thread Éric Araujo

Changes by Éric Araujo :


--
assignee:  -> docs@python
components: +Distutils, Documentation -Build
keywords: +easy
nosy: +docs@python, tarek
stage:  -> needs patch
title: python setup.py bdist_rpm is broken -> Note that distutils’ bdist_rpm 
command is not used to build a CPython rpm
versions: +Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue17551] Windows - accessing drive with nothing mounted forces user interaction

2013-03-27 Thread Bob Alexander

Bob Alexander added the comment:

Thanks for the prompt reply!

Your suggested change does change the behavior to exactly the way I think
it should work by default. Tried it on both Windows 7 and Vista; no popups
when accessing a "mobile mount" drive with nothing in it, just quietly
reports False.

I vote for making this the normal behavior of these "file exists" sort of
operations.

Hmm, I notice that msvcrt.SetErrorMode is not discussed in the current
Python 3 Standard Library docs...  :-)

Bob

On Wed, Mar 27, 2013 at 6:40 AM, Amaury Forgeot d'Arc <
rep...@bugs.python.org> wrote:

>
> Amaury Forgeot d'Arc added the comment:
>
> Does it change something if you insert in your script (in 3.3):
> import msvcrt
> msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS)
>
> --
> nosy: +amaury.forgeotdarc
>
> ___
> Python tracker 
> 
> ___
>

--

___
Python tracker 

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



[issue17553] python setup.py bdist_rpm is broken

2013-03-27 Thread Sean Carolan

Sean Carolan added the comment:

Ok, thanks for clearing that up.  Maybe the documentation could be updated to 
explicitly state this to avoid confusion, eg:

"NOTE:  You cannot use setup.py to build a Python RPM.  It is only for building 
Python modules."

--

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread Antoine Pitrou

Antoine Pitrou added the comment:

A multiprocessing queue currently uses a 32-bit signed int to encode object 
length (in bytes):

def _send_bytes(self, buf):
# For wire compatibility with 3.2 and lower
n = len(buf)
self._send(struct.pack("!i", n))
# The condition is necessary to avoid "broken pipe" errors
# when sending a 0-length buffer if the other end closed the pipe.
if n > 0:
self._send(buf)

I *think* we need to keep compatibility with the wire format, but perhaps we 
could use a special length value (-1?) to introduce a longer (64-bit) length 
value.

--
nosy: +pitrou, sbt
type:  -> enhancement
versions: +Python 3.4 -Python 3.3

___
Python tracker 

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



[issue17560] problem using multiprocessing with really big objects?

2013-03-27 Thread mrjbq7

New submission from mrjbq7:

I ran into a problem using multiprocessing to create large data objects (in 
this case numpy float64 arrays with 90,000 columns and 5,000 rows) and return 
them to the original python process.

It breaks in both Python 2.7 and 3.3, using numpy 1.7.0 (but with different 
error messages).

It is possible the array is too large to be serialized (450 million 64-bit 
numbers exceeds a 32-bit limit)?


Python 2.7
==

Process PoolWorker-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(*self._args, **self._kwargs)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 99, in worker
put((job, i, result))
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 390, in put
return send(obj)
SystemError: NULL result without error in PyObject_Call


Python 3.3
==

Traceback (most recent call last):
  File "multi.py", line 18, in 
results = pool.map_async(make_data, range(5)).get(999)
  File "/usr/lib/python3.3/multiprocessing/pool.py", line 562, in get
raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '[array([[ 
0.74628629,  0.36130663, -0.65984794, ..., -0.70921838,
 0.34389663, -1.7135126 ],
   [ 0.60266867, -0.40652402, -1.31590562, ...,  1.44896246,
-0.3922366 , -0.85012842],
   [ 0.59629641, -0.00623001, -0.12914128, ...,  0.99925511,
-2.30418136,  1.73414009],
   ..., 
   [ 0.24246639,  0.87519509,  0.24109069, ..., -0.48870107,
-0.20910332,  0.11749621],
   [ 0.62108937, -0.86217542, -0.47357384, ...,  1.59872243,
 0.76639995, -0.56711461],
   [ 0.90976471,  1.73566475, -0.18191821, ...,  0.19784432,
-0.29741643, -1.46375835]])]'. Reason: 'error("'i' format requires 
-2147483648 <= number <= 2147483647",)'

--
files: multi.py
messages: 185344
nosy: mrjbq7
priority: normal
severity: normal
status: open
title: problem using multiprocessing with really big objects?
versions: Python 3.3
Added file: http://bugs.python.org/file29595/multi.py

___
Python tracker 

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



[issue17553] python setup.py bdist_rpm is broken

2013-03-27 Thread Éric Araujo

Éric Araujo added the comment:

Sorry, I don’t understand the question.

The point still stands: one should not use setup.py build_rpm to build an RPM 
for CPython.  Please read Misc/RPM/README.

--

___
Python tracker 

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



[issue17553] python setup.py bdist_rpm is broken

2013-03-27 Thread Sean Carolan

Sean Carolan added the comment:

Éric Araujo, if that is the case then why does it build what looks like a 
*.spec file for Python itself?

[scarolan@titania:~/Python-2.7.3]$ head -10 
./build/bdist.linux-x86_64/rpm/SPECS/Python.spec
%define name Python
%define version 2.7.3
%define unmangled_version 2.7.3
%define release 1

Summary: A high-level object-oriented programming language
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz

--

___
Python tracker 

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



[issue17553] python setup.py bdist_rpm is broken

2013-03-27 Thread Éric Araujo

Éric Araujo added the comment:

To build Python itself you need to use the Makefile and the 
Misc/RPM/python-2.7.spec file.  The doc you’re referring to talks about 
building rpm packages for Python libraries, not CPython itself.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue17536] update browser list with additional browser names

2013-03-27 Thread Éric Araujo

Éric Araujo added the comment:

FTR the shlex unicode bug reports are #6988 and #1170, and the cStringIO bug is 
#1548891.

--

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

> "I as a user" can
> see and can inspect for further troubleshooting

This doesn't work for this example, which was your question.

I still feel like this needs further clarification. For a user this behavior is 
not expected. User is someone who doesn't know the internal details of Python 
interpreter (and may not even remember that dict can be modified by reference). 
If you disagree with me - try to do corridor testing and see how many people 
will compile it in their head and give you the right answer to this example.

--

___
Python tracker 

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



[issue17559] str.is* implementation seem suboptimal for single character strings

2013-03-27 Thread Gaëtan de Menten

New submission from Gaëtan de Menten:

In isspace, isalpha, isalnum and isdigit, I see code like:

/* Shortcut for single character strings */
if (PyString_GET_SIZE(self) == 1 &&
isspace(*p))
return PyBool_FromLong(1);

Is it intentional to not use:

if (PyString_GET_SIZE(self) == 1))
return PyBool_FromLong(isspace(*p) != 0);

which would be faster when the result is False (but a tad slower when it is 
True because of the extra comparison).

Also, is there a reason (other than historical) why the macros Py_RETURN_TRUE 
and Py_RETURN_FALSE are not used instead of their equivalent functions 
PyBool_FromLong(1) and PyBool_FromLong(0)?

See:
http://hg.python.org/cpython/file/e87364449954/Objects/stringobject.c#l3324

--
components: Interpreter Core
messages: 185338
nosy: gdementen
priority: normal
severity: normal
status: open
title: str.is* implementation seem suboptimal for single character strings
type: performance

___
Python tracker 

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



[issue17558] gdb debugging python frames in optimised interpreters

2013-03-27 Thread Marcus Cobden

New submission from Marcus Cobden:

I've made some tweaks to the libpython.py util functions to better pick up 
python frames when using a normal python interpreter.

It's not by any means perfect, but it works on my ubuntu-shipped python 
interpreter (with debugging symbols installed, but not running the debug 
interpreter).

It works by finding the top frame via the thread state struct, and then going 
up the frame stack, comparing the stack pointer to a stack pointer in the C 
context.

I'd appreciate some feedback/advice :)

https://gist.github.com/leth/5254239/revisions

--
components: Demos and Tools
messages: 185337
nosy: mcobden
priority: normal
severity: normal
status: open
title: gdb debugging python frames in optimised interpreters
type: enhancement
versions: Python 2.7

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

This is expected: "zc = xxx" updates locals!
but not the copy.

--

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread bob gailer

bob gailer added the comment:

On 3/27/2013 9:48 AM, anatoly techtonik wrote:
> anatoly techtonik added the comment:
>
> Example:
>
>  l = locals()
>  z = dict(a=5, b=3)
>
>  lc = dict(l)
>  zc = dict(z)
>
>  print(lc == l)
>  print(zc == z)
>
> Gives:
>
>  False
>  True
Expected behavior.
lc is not another reference to locals(). It refers to a new object.
zc = ... updates locals() but not lc

--
nosy: +bgailer
title: Document the circumstances where the locals() dict gets updated -> 
Document the circumstances where the locals() dict gets   updated

___
Python tracker 

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



[issue12271] panel.h is not found even if it's installed on various flavours of SUSE

2013-03-27 Thread Kenneth O'Brien

Kenneth O'Brien added the comment:

I have created a simple patch that solves this problem. Depending on whether 
panel.h or ncurses/panel.h are found, the appropriate one is included.

--
nosy: +Kenneth.O'Brien
Added file: http://bugs.python.org/file29594/ken_ncurses.patch

___
Python tracker 

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



[issue17329] Document unittest.SkipTest

2013-03-27 Thread Michael Foord

Michael Foord added the comment:

For features like test skipping I would prefer to keep all the documentation 
together.

--

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

Example:

l = locals()
z = dict(a=5, b=3)

lc = dict(l)
zc = dict(z)

print(lc == l)
print(zc == z)

Gives:

False
True

--

___
Python tracker 

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



[issue17551] Windows - accessing drive with nothing mounted forces user interaction

2013-03-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Does it change something if you insert in your script (in 3.3):
import msvcrt
msvcrt.SetErrorMode(msvcrt.SEM_FAILCRITICALERRORS)

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue17554] Compact output for regrtest

2013-03-27 Thread Brett Cannon

Brett Cannon added the comment:

So are you saying you want both the short-form output while running but then 
the whole output upon completion, David? I can understand wanting the summaries 
still in order to sort the skipped tests vs. failures, but not outputting every 
test that succeeded since you can figure that out through a process of 
elimination w/o much issue.

I think instead it would serve us better to have a command to write the tests 
that were run and what happened to a file for use with the -f with successes 
commented out, skips commented out along with the skipped message, and then 
only failures left uncommented for easier re-running of the tests in the same 
order.

--

___
Python tracker 

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2013-03-27 Thread Domen Kožar

Domen Kožar added the comment:

One relevant use case is the following: 
https://github.com/Pylons/venusian/issues/23

Here the module is supposed to raise an ImportError.

--

___
Python tracker 

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



[issue7559] TestLoader.loadTestsFromName swallows import errors

2013-03-27 Thread Michael Foord

Michael Foord added the comment:

My preferred fix is to wrap "an exception during import" as a test that fails 
instead of an AttributeError. This would definitely be a new feature rather 
than a bugfix - so it could only be in 3.4. 

It could be made available to Python 2.7 through the unittest2 backport.

None of the current patches implement my preferred solution yet.

--
versions: +Python 3.4 -Python 2.7, Python 3.2, Python 3.3

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

> Normal dict in Python is updated by user code (which "I as a user" can
> see and can inspect for further troubleshooting) and for locals's dict
> this is not correct.

Do you have an example?

--

___
Python tracker 

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



[issue11664] Add patch method to unittest.TestCase

2013-03-27 Thread Michael Foord

Michael Foord added the comment:

Yes this is still relevant and needs doing (and is easy).

The implementation should be similar to:

def patch(self, *args, **kwargs):
# lazy import
from unittest.mock import patch
p = patch(*args, **kwargs)
result = p.start()
self.addCleanup(p.stop)
return result

Plus tests and documentation.

--
status: pending -> open

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

Amaury, from user's point of view (I am not a core developer - I just need to 
troubleshoot complicated Python code) the object (the internal structure) 
returned by locals() has different behavior than a normal dict.

Normal dict in Python is updated by user code (which "I as a user" can see and 
can inspect for further troubleshooting) and for locals's dict this is not 
correct. 

If dict and locals's object are of the same type, I'd expect them to be 
interchangeable.

By proposing a documentation fix as a final remedy, please think about the 
entry point through which users come to this "trap".

--

___
Python tracker 

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



[issue17546] Document the circumstances where the locals() dict gets updated

2013-03-27 Thread anatoly techtonik

anatoly techtonik added the comment:

Eric, here is the code that confirms changed behavior under trace function for 
both Python 2 and 3 - http://bugs.python.org/file15081/localstest.py

I agree that the documentation fix is necessary, and if you say that it is an 
easier sell - I tend to believe you. But with this fix the issue is still not 
fully covered, so it is interesting to know what builds up to the cost of 
renaming if we come to some common point about the type of this 'dict' from the 
user point of view.

--

___
Python tracker 

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



[issue17555] Creating new processes after importing multiprocessing.managers consumes more and more memory

2013-03-27 Thread Richard Oudkerk

Richard Oudkerk added the comment:

_afterfork_registry is not supposed to be cleared.  But the problem with 
ForkAwareThreadLocal meant that the size of the registry at generation n is 
2**n!

--

___
Python tracker 

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



  1   2   >