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 David.Edelsohn, Michael.Felt, skrah, vstinner
Date 2020-04-10.14:01:23
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <51476d3d-4d92-de49-8f8a-870bcd019aa2@felt.demon.nl>
In-reply-to <1586520060.04.0.792331001042.issue40244@roundup.psfhosted.org>
Content
On 10/04/2020 14:01, STINNER Victor wrote:
> STINNER Victor <vstinner@python.org> added the comment:
>
> The assertion failure occurs in _PyObject_GC_TRACK() at:
>
> 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);  // <==== HERE
>
>     ...
> }
>
> It's surprising that the generator is still tracked by the GC after _PyObject_GC_UNTRACK().
>
>
>> Calling this a compile error - as it seems to be compiler dependent.
> Do you reproduce the bug if you build Python with GCC?

To be clear - gcc does not not have an issue. As I stated elsewhere - it
is specific to xlc-v16, so likely it is a compiler error.

See also the result of `git bisect` study.

>
> Which ./configure command did you use? What are the compiler and linker flags?
>
> You can try:
>
> ./python -m test.pythoninfo|grep -E 'CFLAGS|CC|OPT|LDFLAGS'

With:

$ ./python -m test.pythoninfo|grep -E 'CFLAGS|CC|OPT|LDFLAGS'
Objects/genobject.c:127: _PyObject_GC_TRACK: Assertion "!(((PyGC_Head
*)(op)-1)->_gc_next != 0)" failed: object already tracked by the garbage
collector
Enable tracemalloc to get the memory block allocation traceback

object address  : 30084150
object refcount : 0
object type     : 200144a8
object type name: generator
object repr     : <refcnt 0 at 30084150>

Fatal Python error: _PyObject_AssertFailed: _PyObject_AssertFailed
Python runtime state: core initialized

Current thread 0x00000001 (most recent call first):
  File "<frozen importlib._bootstrap_external>", line 1593 in _setup
  File "<frozen importlib._bootstrap_external>", line 1634 in _install
  File "<frozen importlib._bootstrap>", line 1189 in
_install_external_importers
ksh: 27328848 IOT/Abort trap(coredump)

Without error:

$ ./python -m test.pythoninfo|grep -E 'CFLAGS|CC|OPT|LDFLAGS'
os.environ[CC]: xlc_r
sysconfig[CC]: xlc_r
sysconfig[CFLAGS]: -O
sysconfig[CONFIG_ARGS]: '--with-openssl=/opt/aixtools'
'--without-computed-gotos' '--with-pydebug' 'CC=xlc_r'
sysconfig[OPT]: -O
sysconfig[PY_CFLAGS]: -O
sysconfig[PY_CFLAGS_NODIST]: -I./Include/internal
sysconfig[PY_STDMODULE_CFLAGS]: -O -I./Include/internal -I. -I./Include

> ----------
> nosy: +vstinner
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue40244>
> _______________________________________
>
History
Date User Action Args
2020-04-10 14:01:23Michael.Feltsetrecipients: + Michael.Felt, vstinner, skrah, David.Edelsohn
2020-04-10 14:01:23Michael.Feltlinkissue40244 messages
2020-04-10 14:01:23Michael.Feltcreate