Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Terry Reedy



Antoine Pitrou wrote:

Facundo Batista  gmail.com> writes:

The test_raiseMemError() in test_unicode.py is complicating me the
regression tests: tries to use all the memory in my system, which
starts to swap as crazy, and almost freezes everything. When the test
finishes (always pass ok), I have all the memory flushed so it take a
few seconds to go back to the normal system.


If the test does allocate the very large string, it means MemoryError isn't
raised, which defeats the purpose of the test.
I think that:
u"a" * (sys.maxint // 2 - 100)
should be replaced with:
u"a" * (sys.maxsize - 100)
The latter raises MemoryError reliably here, while the former doesn't.


In 3.0, sys.maxint is gone, only sys.maxsize remains, so that some 
change must have been made for 3.0.  Just checked: in 3.0b2 
test_unicode.py has no test_raisexxx().



An assertRaises could also be used in place of the try/except, it would ensure
the test does exercise what it is meant to exercise.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Facundo Batista
2008/8/16 "Martin v. Löwis" <[EMAIL PROTECTED]>:

> See bug http://bugs.python.org/issue3556
>
> If no solution is forthcoming quickly, I recommend to remove/disable the
> test.

The Antoine patch works ok for me, and solves the whole issue.

I'm on linux, if somebody can give it a try in another platform, we
should commit it ASAP...

Thanks!

-- 
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Martin v. Löwis

> Are you having also this issue? Do you think that it should run not *always*?

See bug http://bugs.python.org/issue3556

If no solution is forthcoming quickly, I recommend to remove/disable the
test.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Antoine Pitrou
Facundo Batista  gmail.com> writes:
> 
> I do *not* want to remove the test.

You misunderstood my remark.
If the test takes a lot of time and eats a lot of memory, it's precisely because
the MemoryError isn't raised; and the test needs MemoryError to be raised in
order to be meaningful.

I was proposing a way of fixing the test so that the MemoryError is raised,
which would also stop it from taking a lot of time.

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Jean-Paul Calderone

On Sat, 16 Aug 2008 13:01:33 -0300, Facundo Batista <[EMAIL PROTECTED]> wrote:

2008/8/16 Antoine Pitrou <[EMAIL PROTECTED]>:


If the test does allocate the very large string, it means MemoryError isn't
raised, which defeats the purpose of the test.


I do *not* want to remove the test.


Antoine wasn't suggesting removing it.  He's suggesting that the test
is not accomplishing its goal if the "except" suite isn't executed,
and so the test should be changed to make this failure noticable.

Jean-Paul
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Facundo Batista
2008/8/16 Antoine Pitrou <[EMAIL PROTECTED]>:

> If the test does allocate the very large string, it means MemoryError isn't
> raised, which defeats the purpose of the test.

I do *not* want to remove the test.

I just want to execute it *only* when I run "-u all" or "-u memory",
not everytime I run the regression tests.

Regards,

-- 
. Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Antoine Pitrou
Facundo Batista  gmail.com> writes:
> 
> The test_raiseMemError() in test_unicode.py is complicating me the
> regression tests: tries to use all the memory in my system, which
> starts to swap as crazy, and almost freezes everything. When the test
> finishes (always pass ok), I have all the memory flushed so it take a
> few seconds to go back to the normal system.

If the test does allocate the very large string, it means MemoryError isn't
raised, which defeats the purpose of the test.
I think that:
u"a" * (sys.maxint // 2 - 100)
should be replaced with:
u"a" * (sys.maxsize - 100)
The latter raises MemoryError reliably here, while the former doesn't.

An assertRaises could also be used in place of the try/except, it would ensure
the test does exercise what it is meant to exercise.

Regards

Antoine.


___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Victor Stinner
Hi,

Le Saturday 16 August 2008 15:43:28 Facundo Batista, vous avez écrit :
> The test_raiseMemError() in test_unicode.py is complicating me the
> regression tests: tries to use all the memory in my system, which
> starts to swap as crazy, and almost freezes everything.

On UNIX, it's possible to limit a process memory using RLIMIT_AS:

from resource import getrlimit, setrlimit, RLIMIT_AS

def limitMemory(soft):
try:
old_soft, hard = getrlimit(RLIMIT_AS)
if old_soft != -1:
soft = min(soft, old_soft)
except ValueError:
hard = -1
setrlimit(RLIMIT_AS, (soft, hard))

Values are in bytes. So it's possible to get MemoryError without using the 
whole system memory.

Victor
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Memory tests in Unicode

2008-08-16 Thread Nick Coghlan
Facundo Batista wrote:
> The test_raiseMemError() in test_unicode.py is complicating me the
> regression tests: tries to use all the memory in my system, which
> starts to swap as crazy, and almost freezes everything. When the test
> finishes (always pass ok), I have all the memory flushed so it take a
> few seconds to go back to the normal system.
> 
> I told myself that this test should run only in some special cases,
> but didn't find any flag in regrtest.py (like "largefile", or
> "network"), to put this test under.
> 
> Are you having also this issue? Do you think that it should run not *always*?
> 
> It's ok if I add a flag like "memory" that will hold "Tests that use
> large amount of memory. Normally these tests take long to run because
> use all your memory and make the system swap"?

I asked a similar question the other day, so a definite +1 from me.

Cheers,
Nick.

-- 
Nick Coghlan   |   [EMAIL PROTECTED]   |   Brisbane, Australia
---
http://www.boredomandlaziness.org
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com