[pypy-dev] Objects and types in the stdobjspace

Rocco Moretti roccomoretti at netscape.net
Mon Jun 9 05:10:52 MEST 2003


Armin Rigo <arigo at tunes.org> wrote:

>On Sat, Jun 07, 2003 at 08:51:51AM +0200, holger krekel wrote:

>> - how the new test-machinery works so i can make sure that i
>>   don't break big stuff while trying to fix/play around
>
>pypy/testall.py runs all the tests, using the object space specified in the
>environment variable OBJSPACE -- which must be exactly
>pypy.objspace.std.StdObjSpace to use the standard object space; the >trivial
>object space is used otherwise.
>
>pypy/testwice.py is a hack around the previous one to run all the tests in
>both object spaces.

("previous" being the pypy/testall.py file, not any pre-sprint test hook.)

... and pypy/testcts.py is a rather clever piece of code to run tests on 
StdObjSpace, keep track of the results, and report any difference from run 
to run.

>The individual .../test/test_xxx.py files are still runnable. There is a
>testsupport.py file in all test directories for glueing purposes; running 
>it directly should execute all the tests in that directory.

I've been playing around with it over the weekend, and I feel things 
(testing wise) need to be clarified slightly. First, I think we should 
move all pypy-as-a-whole testing related stuff into an approriate 
subdirectory ("pypy/testing" or some such. As it is now, pieces are 
scattered in pypy and pypy/interpreter.

Secondly, the testing framework as written will only run tests at the 
interpreter level. Some tests (such as test_exceptcomp and test_exec) 
should be run at the application level. Additionally, there is no 
provision for running the CPython regression tests automatically within 
the current testing framework.

The thought occured to me if it would not be easiest to "appropriate" the 
CPython regrtest.py framework for our purposes. As best I can tell, it's 
written in a general fashion already, so "all" we would need to do is get 
it to recognize when to run tests under interpreter level and when to run 
tests under application level. (Which could potentially be accomplished by 
a naming convention.)

>> - any "entry points" other than interactive.py?
>
>There is main.py in the same directory. Its purpose is that 'python >main.py
>script-and-options' should be the same as 'pypy script-and-options' if we >had
>a working 'pypy' program. I guess that main.py should invoke >interactive.py
>when started with no argument (it doesn't right now).

Other problems, I assume (from code inspection, not from direct running) 
are that the commandline arguments are not passed to sys.argv, sys.path 
may or may not contain the directory of the script, and 
sys.modules['__main__'] is not set equal to the script module 
(only a problem, I think, when running unittest.main()). And in keeping 
with my rearranging mood, I think main.py should probably be placed in the 
pypy/ directory. -- I also think someone should give me <Dr. Evil> ONE 
BILLION DOLLARS </Dr. Evil> and melons should taste more like currants, so 
that shows you what *I* know.

>> - a recap of the current StdObjsSpace registration/multimethod
>>   mechanisms.
>
>The W_XxxObject classes of the standard object space are, precisely,
>*implementations* of objects. This is not the same as the *type* of the
>object. It is possible to provide several implementations for the same >type
>(the user should not see the difference, though). Typical uses of this >would
>be to hide the int/long disctinction to the user altogether, or more
>interestingly to provide more efficient versions of the data structures >like
>string, list or dict when they become large.

FANTASTIC! An excellent way of looking at things.

But I'm still a little hazy. Could you walk us through how this scheme 
would work with multiple implementations of the same type and specifics as 
to how this would be different from the (CPython) current implementation 
of types being the same as the implementation?

Congrats to the spriters - it looks like quite a few good things have been 
accomplished.

-Rocco

__________________________________________________________________
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!
http://aim.aol.com/aimnew/Aim/register.adp?promo=380455


More information about the pypy-dev mailing list