[plt-scheme] GC surprise collection

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Sep 5 10:02:39 EDT 2004

At Sun, 5 Sep 2004 01:30:32 +0900, Daniel Silva wrote:
> moduleobject.c:
> 
> PyObject* PyModule_New(char *name)
> {
>   Scheme_Object* ns = scheme_make_namespace(0, 0);
>   assert(SCHEME_NAMESPACEP(o));
>   return PyModule_SpyNew(name, PySchemeNS_New((Scheme_Env*) ns));
> }

The `o' above is supposed to be `ns', right?

Assuming the usual assert(), and assuming that PyModule_SpyNew() is a
function (not a macro), then there's no GC between the return of
scheme_make_namespace() and call to PySchemeNS_New()...

> schemensobject.c:
> 
> PyObject* PySchemeNS_New(Scheme_Env* ns)
> {
>   assert(SCHEME_NAMESPACEP((Scheme_Object*)ns));
>   ...
>   return (PyObject*) ...;
> }

... so I don't see how this assertion can fail.

Maybe you can create a complete (but as small as possible) example to
demonstrate the problem.

Matthew



Posted on the users mailing list.