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 Michael.Felt
Recipients BTaskaya, David.Edelsohn, Michael.Felt, pablogsal, vstinner
Date 2020-04-14.12:49:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <ecdea6b8-8f73-677a-e43d-4ecb7cce5835@felt.demon.nl>
In-reply-to <1586812753.29.0.127360360341.issue40244@roundup.psfhosted.org>
Content
With the print statements - it does not crash:

         ./python -E -S -m sysconfig --generate-posix-vars ; if test $?
-ne 0 ; then  echo "generate-posix-vars failed" ;  rm -f
./pybuilddir.txt ;  exit 1 ;  fi
Objects/genobject.c:122:537318120
Objects/genobject.c:126:0
Objects/genobject.c:131:0
Objects/genobject.c:135:537318120
Objects/genobject.c:122:805942488
Objects/genobject.c:126:0
Objects/genobject.c:131:0
Objects/genobject.c:135:537318120
...

diff --git a/Objects/genobject.c b/Objects/genobject.c
index d3455f8..b8287a3 100644
--- a/Objects/genobject.c
+++ b/Objects/genobject.c
@@ -117,14 +117,23 @@ exc_state_clear(_PyErr_StackItem *exc_state)
 static void
 gen_dealloc(PyGenObject *gen)
 {
+#include <stdio.h>
     PyObject *self = (PyObject *) gen;
+    fprintf(stderr,"%s:%d:%ld\n", __FILE__,__LINE__,
_Py_AS_GC(self)->_gc_next);
+    fflush(stderr);

     _PyObject_GC_UNTRACK(gen);
+    fprintf(stderr,"%s:%d:%ld\n", __FILE__,__LINE__,
_Py_AS_GC(self)->_gc_next);
+    fflush(stderr);

     if (gen->gi_weakreflist != NULL)
         PyObject_ClearWeakRefs(self);
+    fprintf(stderr,"%s:%d:%ld\n", __FILE__,__LINE__,
_Py_AS_GC(self)->_gc_next);
+    fflush(stderr);

     _PyObject_GC_TRACK(self);
+    fprintf(stderr,"%s:%d:%ld\n", __FILE__,__LINE__,
_Py_AS_GC(self)->_gc_next);
+    fflush(stderr);

     if (PyObject_CallFinalizerFromDealloc(self))
         return;                     /* resurrected.  :( */
$

On 13/04/2020 23:19, Batuhan Taskaya wrote:
> Batuhan Taskaya <batuhanosmantaskaya@gmail.com> added the comment:
>
> @Michael.Felt can you just insert some prints between these 3 to see what is going on (and re-compile)
>
> static void
> gen_dealloc(PyGenObject *gen)
> {
>     PyObject *self = (PyObject *) gen;
> <<<<
>     _PyObject_GC_UNTRACK(gen);
> <<<<
>     if (gen->gi_weakreflist != NULL)
>         PyObject_ClearWeakRefs(self);
> <<<<
>     _PyObject_GC_TRACK(self);
>
>
> something like this should work: printf("%ld\n", _Py_AS_GC(self)->_gc_next);
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40244>
> _______________________________________
>
History
Date User Action Args
2020-04-14 12:49:21Michael.Feltsetrecipients: + Michael.Felt, vstinner, David.Edelsohn, pablogsal, BTaskaya
2020-04-14 12:49:21Michael.Feltlinkissue40244 messages
2020-04-14 12:49:21Michael.Feltcreate