New submission from Enric <len...@gmail.com>:

Attached is a reproducer that calls PyCFunction_New. The reproducer runs 
normally with Python 3.6.5, but it crashes with Python 3.7.1. The reason seems 
to be that the _PyObject_GC_TRACK macro ends up being called and it is broken 
in Python3.7.

A fix for that macro seems to have been committed to master:

https://github.com/python/cpython/pull/10507

----------
files: reproducer.cpp
messages: 3556
nosy: etejedor
priority: bug
status: unread
title: Python3.7 crash in PyCFunction_New due to broken _PyObject_GC_TRACK

_______________________________________________________
PSF Meta Tracker <metatrac...@psf.upfronthosting.co.za>
<http://psf.upfronthosting.co.za/roundup/meta/issue669>
_______________________________________________________
#include "Python.h"
#include "methodobject.h"
 
void myfun()
{
}
 
int main()
{
  PyMethodDef methoddef_ = {
    const_cast< char* >( "myfun" ),
    (PyCFunction) myfun,
    METH_O,
    NULL
  };
 
  PyObject* myFunPtr = PyCFunction_New( &methoddef_, NULL );
 
  return 0;
}

_______________________________________________
Tracker-discuss mailing list
Tracker-discuss@python.org
https://mail.python.org/mailman/listinfo/tracker-discuss
Code of Conduct: https://www.python.org/psf/codeofconduct/

Reply via email to