Message183608
Here's a proof of concept that defines a new _print_total_refs() function and calls it through the PRINT_TOTAL_REFS macro, disables printing the refs by default, and adds a "-X showrefcount" option to reenable it. This can also be achieved at runtime by adding/removing 'showrefcount' from the sys._xoptions dict.
Things that should be done/decided before the final version:
1) the function and/or prototype should probably be moved to a better place;
2) the 'showrefcount' name sounds ok to me, but I'm open to suggestions if you can come up with something better;
3) the function could do the equivalent of "if sys._xoptions.get('showrefcount', False):" instead of "if 'showrefcount' in sys._xoptions:";
4) now that this can be enabled/disabled at runtime, we might make it available to non-debug builds too (unless there are other negative side-effects); |
|
Date |
User |
Action |
Args |
2013-03-06 19:29:43 | ezio.melotti | set | recipients:
+ ezio.melotti, brian.curtin, chris.jerdonek |
2013-03-06 19:29:43 | ezio.melotti | set | messageid: <1362598183.05.0.0896828726406.issue17323@psf.upfronthosting.co.za> |
2013-03-06 19:29:43 | ezio.melotti | link | issue17323 messages |
2013-03-06 19:29:42 | ezio.melotti | create | |
|