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.

classification
Title: useless PyEval_CallObject function
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: pitrou Nosy List: fijal, lemburg, pitrou
Priority: normal Keywords:

Created on 2010-03-31 22:06 by fijal, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (7)
msg102038 - (view) Author: Maciek Fijalkowski (fijal) Date: 2010-03-31 22:06
In ceval.c there is such code:

PyObject *
PyEval_CallObject(PyObject *func, PyObject *arg)
{
	return PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL);
}
#define PyEval_CallObject(func,arg) \
        PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL)

Is this needed any longer? (both #define and function have the same name)
msg102039 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-03-31 22:09
Well, #defines are not exported in shared libraries. I suppose PyEval_CallObject() was part of an old definition of the Python C-API and it was kept for compatibility.
msg102040 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-03-31 22:10
The #define dates back from 2007, this changeset:

branch:      trunk
user:        guido
date:        Sat Aug 30 17:02:50 1997 +0200
files:       Include/ceval.h Python/ceval.c
description:
[svn r8683] Inline PyObject_CallObject (Marc-Andre Lemburg).
msg102041 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-03-31 22:20
Antoine Pitrou wrote:
> 
> Antoine Pitrou <pitrou@free.fr> added the comment:
> 
> The #define dates back from 2007, this changeset:
> 
> branch:      trunk
> user:        guido
> date:        Sat Aug 30 17:02:50 1997 +0200
> files:       Include/ceval.h Python/ceval.c
> description:
> [svn r8683] Inline PyObject_CallObject (Marc-Andre Lemburg).

That's not useless: it's a typical backwards compatibility macro
to auto-upgrade existing software via recompile.

It's also still used a lot in the Python source code and elsewhere:

http://www.google.de/search?q=PyEval_CallObject

The function PyEval_CallObject() can probably be removed by
now, though.
msg102050 - (view) Author: Maciek Fijalkowski (fijal) Date: 2010-04-01 01:33
Yeah, I meant the function. Sorry for not being specific enough. I suppose the function is there to preserve ABI, but definitely code needed recompilation since 2007.
msg102100 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-01 15:09
Right, we can certainly suppress the function definition now and just keep the macro.
(especially given it's 1997, not 2007, there was a typo in my message)
msg102105 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-01 16:53
Fixed in r79555 (trunk), r79556 (py3k).
History
Date User Action Args
2022-04-11 14:56:59adminsetgithub: 52523
2010-04-01 16:53:54pitrousetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2010-04-01 16:53:44pitrousetmessages: + msg102105
2010-04-01 15:09:57pitrousetpriority: normal
versions: + Python 3.2
messages: + msg102100

assignee: pitrou
type: enhancement
stage: needs patch
2010-04-01 01:33:39fijalsetmessages: + msg102050
2010-03-31 22:20:48lemburgsetmessages: + msg102041
2010-03-31 22:10:39pitrousetnosy: + lemburg
messages: + msg102040
2010-03-31 22:09:18pitrousetnosy: + pitrou
messages: + msg102039
2010-03-31 22:06:51fijalcreate