This patch adds gc.get_count() as a companion to gc.get_threshold(). It also adds an optional argument to gc.collect() to allow you to specify the generation to collect. This patch also fixes a couple of gcc warnings.
Logged In: YES user_id=33168 I fixed the 2 warnings with %ld, so that part of the patch isn't necessary any longer. Instead of setting genarg = -999, can't you just set it to NUM_GENERATIONS - 1 and get rid of the check for -999? Doesn't ValueError make more sense than an IndexError? Isn't ValueError typically used for invalid args? Should gc_collect be: METH_VARARGS | METH_KEYWORDS ?
Logged In: YES user_id=33168 Oooooo, tests and doc, very nice. Don't forget to add a NEWS entry. Also the doc should have \versionadded, \versionchanged for the new method/added param. Neil was fine with the concept and no one else objected, so I'd say check it in.