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

Add capsule API to _decimal #59442

Open
skrah mannequin opened this issue Jul 1, 2012 · 9 comments
Open

Add capsule API to _decimal #59442

skrah mannequin opened this issue Jul 1, 2012 · 9 comments
Assignees
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@skrah
Copy link
Mannequin

skrah mannequin commented Jul 1, 2012

BPO 15237
Nosy @malemburg, @rhettinger, @mdickinson, @scoder, @larryhastings, @skrah, @pganssle

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/skrah'
closed_at = None
created_at = <Date 2012-07-01.10:02:50.648>
labels = ['type-feature']
title = 'Add capsule API to _decimal'
updated_at = <Date 2019-02-27.16:45:57.702>
user = 'https://github.com/skrah'

bugs.python.org fields:

activity = <Date 2019-02-27.16:45:57.702>
actor = 'p-ganssle'
assignee = 'skrah'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2012-07-01.10:02:50.648>
creator = 'skrah'
dependencies = []
files = []
hgrepos = []
issue_num = 15237
keywords = []
message_count = 9.0
messages = ['164469', '164474', '200154', '200168', '200234', '200236', '200256', '226294', '226300']
nosy_count = 8.0
nosy_names = ['lemburg', 'rhettinger', 'mark.dickinson', 'scoder', 'larry', 'Arfrever', 'skrah', 'p-ganssle']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue15237'
versions = ['Python 3.5']

@skrah
Copy link
Mannequin Author

skrah mannequin commented Jul 1, 2012

Unfortunately, this won't make it into 3.3. -- The self-review of mpdecimal.c had priority and was extremely time consuming.

@skrah skrah mannequin self-assigned this Jul 1, 2012
@skrah skrah mannequin added the type-feature A feature request or enhancement label Jul 1, 2012
@mdickinson
Copy link
Member

See issue bpo-7652 for context.

@skrah
Copy link
Mannequin Author

skrah mannequin commented Oct 17, 2013

I've looked at this, and the question is: Do we really need a capsule
API? All relevant symbols in _decimal start with Py* and shouldn't
need to be static.

@malemburg
Copy link
Member

On 17.10.2013 21:01, Stefan Krah wrote:

Stefan Krah added the comment:

I've looked at this, and the question is: Do we really need a capsule
API? All relevant symbols in _decimal start with Py* and shouldn't
need to be static.

You need a capsule in order to use the C API from other extension
modules. See the datetime module for an example.

@skrah
Copy link
Mannequin Author

skrah mannequin commented Oct 18, 2013

I believe you, but I'd like to understand why. :)

It seems to me that a module and also PyInit_xxx() can be loaded portably.
Say the handles to the module are cached somewhere after loading and
initializing. I think this already happens in Python/dynload_shlib.c.

Why can't another module use a slightly modified form of _PyImport_GetDynLoadFunc()
to get any non-static function apart from PyInit_xxx() by re-using the cached
handle?

@malemburg
Copy link
Member

On 18.10.2013 11:39, Stefan Krah wrote:

Stefan Krah added the comment:

I believe you, but I'd like to understand why. :)

:-)

It seems to me that a module and also PyInit_xxx() can be loaded portably.
Say the handles to the module are cached somewhere after loading and
initializing. I think this already happens in Python/dynload_shlib.c.

Why can't another module use a slightly modified form of _PyImport_GetDynLoadFunc()
to get any non-static function apart from PyInit_xxx() by re-using the cached
handle?

This may work on Linux (and probably does if you use the right
DL flags), but I don't think this works reliably or at all on other
platforms such as Windows. Symbols from shared libs are not necessarily
available to all other shared libraries in the same process.

CObjects, which Capsules originate from, were added to address this
problem in a portable way. It's the Python standard approach to
"importing" C APIs from other extension modules.

@skrah
Copy link
Mannequin Author

skrah mannequin commented Oct 18, 2013

Marc-Andre Lemburg <report@bugs.python.org> wrote:

This may work on Linux (and probably does if you use the right
DL flags), but I don't think this works reliably or at all on other
platforms such as Windows. Symbols from shared libs are not necessarily
available to all other shared libraries in the same process.

Thanks. On Linux the scheme works (I stored the DLL handle in
the PyModuleObject and added a function PyModule_GetSymbol()).

@scoder
Copy link
Contributor

scoder commented Sep 3, 2014

Is this superseded by bpo-22194 now or the other way round?

@larryhastings
Copy link
Contributor

I think bpo-22194 is a duplicate issue.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@iritkatriel iritkatriel added the extension-modules C modules in the Modules dir label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension-modules C modules in the Modules dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

5 participants