This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author georg.brandl
Recipients docs@python, georg.brandl, stefan
Date 2016-02-13.11:58:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1455364716.81.0.100558622619.issue25726@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, this is because internally, sys.setprofile (or to be exact, PyEval_SetProfile) sets two things: a C function, and a "profileobj", which is the argument to setprofile().

sys.setprofile sets the C function to the "profile_trampoline", which supports calling Python profile functions.  The profileobj is the Python profile function.

The C profiler sets the C function to a different callback, and uses the profileobj for storing the reference to the Profiler object.

sys.getprofile just returns the profileobj, which means that you can't save/restore the profiler state with the two functions when using cProfile.

There is not much we can do here except for explicitly documenting this.
History
Date User Action Args
2016-02-13 11:58:36georg.brandlsetrecipients: + georg.brandl, stefan, docs@python
2016-02-13 11:58:36georg.brandlsetmessageid: <1455364716.81.0.100558622619.issue25726@psf.upfronthosting.co.za>
2016-02-13 11:58:36georg.brandllinkissue25726 messages
2016-02-13 11:58:36georg.brandlcreate