Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useless PyEval_CallObject function #52523

Closed
fijal opened this issue Mar 31, 2010 · 7 comments
Closed

useless PyEval_CallObject function #52523

fijal opened this issue Mar 31, 2010 · 7 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@fijal
Copy link

fijal commented Mar 31, 2010

BPO 8276
Nosy @malemburg, @pitrou

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/pitrou'
closed_at = <Date 2010-04-01.16:53:54.496>
created_at = <Date 2010-03-31.22:06:51.464>
labels = ['interpreter-core', 'type-feature']
title = 'useless PyEval_CallObject function'
updated_at = <Date 2010-04-01.16:53:54.495>
user = 'https://bugs.python.org/fijal'

bugs.python.org fields:

activity = <Date 2010-04-01.16:53:54.495>
actor = 'pitrou'
assignee = 'pitrou'
closed = True
closed_date = <Date 2010-04-01.16:53:54.496>
closer = 'pitrou'
components = ['Interpreter Core']
creation = <Date 2010-03-31.22:06:51.464>
creator = 'fijal'
dependencies = []
files = []
hgrepos = []
issue_num = 8276
keywords = []
message_count = 7.0
messages = ['102038', '102039', '102040', '102041', '102050', '102100', '102105']
nosy_count = 3.0
nosy_names = ['lemburg', 'pitrou', 'fijal']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue8276'
versions = ['Python 2.7', 'Python 3.2']

@fijal
Copy link
Author

fijal commented Mar 31, 2010

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)

@fijal fijal added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Mar 31, 2010
@pitrou
Copy link
Member

pitrou commented Mar 31, 2010

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.

@pitrou
Copy link
Member

pitrou commented Mar 31, 2010

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).

@malemburg
Copy link
Member

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.

@fijal
Copy link
Author

fijal commented Apr 1, 2010

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.

@pitrou
Copy link
Member

pitrou commented Apr 1, 2010

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)

@pitrou pitrou self-assigned this Apr 1, 2010
@pitrou pitrou added the type-feature A feature request or enhancement label Apr 1, 2010
@pitrou
Copy link
Member

pitrou commented Apr 1, 2010

Fixed in r79555 (trunk), r79556 (py3k).

@pitrou pitrou closed this as completed Apr 1, 2010
@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants