PyNumber_Int screwing Object.

Tim Peters tim.one at comcast.net
Tue Oct 7 21:41:07 EDT 2003


[Bengt Richter]
> I had the unverified impression that python got raw memory for
> small stuff wholesale, and suballocated from its own pools,

It may or may not, depending on the type of the object, and on whether
pymalloc is enabled.  There are many distinct memory management subsystems
in Python.

> so the issue would seem to come up when either replenishing the
> pools fails, or an app-level allocation of something large fails.
> Either way, if you replenished pools from a reserved wholesale
> chunk at that point, perhaps things could unwind better, assuming
> that the unwinding process doesn't try to allocate more big stuff?
> It might even recover, if the reserve could be re-established after
> the exception was handled. Of course, people couldn't use exception
> catchalls willy-nilly.

First try to define "the problem" you're speculating about fixing.  Have you
experienced any such problem yourself?  Know anyone who has?  If not, how
will you judge an adequate fix?  Or if so, fiddle the C code and try your
ideas.  There's no problem here that I've bumped into, BTW, except on an
embedded system running Linux, where malloc() could return non-NULL even if
it wouldn't let you use the memory returned (== trying to write into it
results in a segfault).  At that point there's nothing Python can trust.






More information about the Python-list mailing list