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.

Title: PyCFunction_New no longer exposed by python DLL breaking bdist_wininst installers
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.4, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: asvetlov Nosy List: asvetlov, georg.brandl, larry, mhammond, pitrou, python-dev, steve.dower, tim.golden, zach.ware
Priority: release blocker Keywords: patch

Created on 2014-04-26 08:00 by mhammond, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
t.patch mhammond, 2014-04-26 08:00 patch to install.c review
Messages (14)
msg217185 - (view) Author: Mark Hammond (mhammond) * (Python committer) Date: 2014-04-26 08:00
Python 3.3 and earlier have in methodobject.c:

/* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(),
   but it's part of the API so we need to keep a function around that
   existing C extensions can call.

#undef PyCFunction_New
PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *);

which means PyCFunction_New is exported from the DLL.  Python 3.4 does not have this (which seems a bug in its own right given the comment in 3.3 and earlier) but PC/bdist_wininst/install.c has code that attempts to dynamically load this function from the DLL and fails, causing 3rd party installers to fail.

Assuming the removal of this API was intentional so the problem is that install.c needs to be updated, the following patch fixes the issue.
msg217194 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-26 13:01
This is apparently because mismanagement of issue #15422.

Andrew, you did the commits, can you restore the PyAPI_FUNC declaration?
msg217195 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2014-04-26 13:05
(while none of PyCFunction_New and PyCFunction_NewEx are documented, they are part of the stable ABI - the python3.def file -, so removing the API is presumably a bug, not a feature)
msg217384 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2014-04-28 17:05
Ok, I'll take a look. Sorry, probably I've missed python3.def file.
msg227191 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2014-09-20 22:46
This is still not fixed.
msg227192 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-09-20 22:50
Sorry for the "mismanagement", I probably didn't check again after the final resolution.
msg235535 - (view) Author: Larry Hastings (larry) * (Python committer) Date: 2015-02-07 23:48
Still not fixed!  This has been marked as "release blocker" for most of a year.  Should I just apply the patch?
msg235538 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2015-02-08 00:03
Perhaps Steve can confirm that the patch is right.
msg235539 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2015-02-08 00:37
I'm sorry.
The patch is correct from my perspective if we want to make bdist_install just working.
Or as an option I can restore PyCFunction_New function declaration.

What do you prefer?
msg235540 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2015-02-08 01:52
As Andrew says, the patch is fine for the bug, but the PyCFunction_New function is certainly part of the stable ABI and needs to be restored.
msg240747 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2015-04-13 20:58
Steve, Andrew, does either of you want to take care of this or shall I give it a shot?  I'm figuring on using the patch here and re-adding PyCFunction_New as it had been.
msg240757 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2015-04-13 21:16
Will do up to weekend.

Sent from Mailbox

On Mon, Apr 13, 2015 at 4:58 PM, Zachary Ware <>

> Zachary Ware added the comment:
> Steve, Andrew, does either of you want to take care of this or shall I give it a shot?  I'm figuring on using the patch here and re-adding PyCFunction_New as it had been.
> ----------
> _______________________________________
> Python tracker <>
> <>
> _______________________________________
msg242116 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-27 14:49
New changeset 69951573cb0e by Andrew Svetlov in branch '3.4':
Issue #21354: PyCFunction_New function is exposed by python DLL again.
msg242117 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2015-04-27 14:50
Fixed. Sorry for long delay.
Date User Action Args
2022-04-11 14:58:02adminsetgithub: 65553
2015-04-27 15:26:04berker.peksagsetstage: needs patch -> resolved
2015-04-27 14:50:28asvetlovsetstatus: open -> closed
resolution: fixed
2015-04-27 14:50:15asvetlovsetmessages: + msg242117
2015-04-27 14:49:28python-devsetnosy: + python-dev
messages: + msg242116
2015-04-13 21:16:53asvetlovsetmessages: + msg240757
2015-04-13 20:58:52zach.waresetmessages: + msg240747
2015-02-08 01:52:57steve.dowersetmessages: + msg235540
2015-02-08 00:37:53asvetlovsetmessages: + msg235539
2015-02-08 00:03:16pitrousetmessages: + msg235538
2015-02-07 23:48:23larrysetmessages: + msg235535
2015-01-16 08:33:43pitrousetnosy: + tim.golden, zach.ware, steve.dower
2014-10-02 05:58:20ned.deilylinkissue22103 superseder
2014-09-20 22:50:43georg.brandlsetnosy: + georg.brandl
messages: + msg227192
2014-09-20 22:46:53larrysetmessages: + msg227191
2014-04-28 17:05:11asvetlovsetmessages: + msg217384
2014-04-26 13:05:21pitrousetmessages: + msg217195
2014-04-26 13:01:35pitrousetpriority: normal -> release blocker

assignee: asvetlov
versions: + Python 3.4, Python 3.5
nosy: + asvetlov, larry, pitrou

messages: + msg217194
stage: needs patch
2014-04-26 08:00:55mhammondcreate