[New-bugs-announce] [issue21293] Remove "capsule hack" from object.c?

Larry Hastings report at bugs.python.org
Fri Apr 18 01:55:53 CEST 2014


New submission from Larry Hastings:

I noticed this code in Objects/object.c today:

    /* Hack to force loading of pycapsule.o */
    PyTypeObject *_PyCapsule_hack = &PyCapsule_Type;

What is this doing?  Note that PyCapsule_Type is referred to inside _Py_ReadyTypes(), so there's already a reference to it from this module.  This global seems redundant.

Attached is a patch that removes it.  Trunk compiles and all tests pass with it applied, though I only tried on 64-bit Linux so I concede if this is handling some obscure edge case I probably wouldn't have hit it.

----------
files: larry.remove.no.capsule.hack.1.diff
keywords: patch
messages: 216766
nosy: larry
priority: low
severity: normal
stage: patch review
status: open
title: Remove "capsule hack" from object.c?
type: behavior
versions: Python 3.5
Added file: http://bugs.python.org/file34958/larry.remove.no.capsule.hack.1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21293>
_______________________________________


More information about the New-bugs-announce mailing list