Implements callable using ctypes (useful on Python 3.0 and 3.1)
Most Python versions have a native builtin function called callable which checks if the argument is a callable object.
Python 3 initially removed the builtin function (but kept the internal C function), before adding it back in Python 3.2 because no alternative is truly equivalent in all cases.
This module provides a function named callable which is equivalent to the native callable, by directly accessing the underlying CPython API through the ctypes module.
This isn’t very useful by itself for most Python versions, but it is an essential building block for enabling code relying on callable to work on Python 3.0 and 3.1.
Versioning
This library’s version numbers follow the SemVer 2.0.0 specification.
The current version number is available in the variable __version__ as is normal for Python modules.
Installation
pip install ctypes-callable
Usage
The use-case for using this module is if:
You are using an early CPython 3 release missing callable.
You cannot upgrade to a newer CPython 3 for some reason.
You want to use code which uses the callable builtin.
To do this, run this before any code that uses callable (for example, usercustomize or sitecustomize might be good places):
import ctypes_callable
import builtins
builtins.callable = ctypes_callable.callable
Portability
This module will fail on import on Jython, IronPython, PyPy, MicroPython, PyPy.js, Brython, Transcrypt, and probably any other implementation besides CPython, because it relies on accessing the Python C API through ctypes.
If you’re looking for something that’s basically this, but won’t break upon import on other Python implementations, you can use polyfill-callable.
Metadata
Release files for ctypes-callable 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ctypes-callable-1.0.1.tar.gz | 3.0 kB | Without provenance | Details for ctypes-callable-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ctypes_callable-1.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for ctypes_callable-1.0.1-py2.py3-none-any.whl |
Total release size: 7.1 kB
Release files / ctypes-callable-1.0.1.tar.gz
| Download URL | ctypes-callable-1.0.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b51117106f9a8ea1aa9cb5412b9b9b8dcad265df51a87d50793212d73ca4d38
|
|
BLAKE2b-256 checksum How to use checksums |
075f15503b579b8a37a39dca92610b124ec49e8fc14ffd66361a363eee19f57b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
|
Release files / ctypes_callable-1.0.1-py2.py3-none-any.whl
| Download URL | ctypes_callable-1.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
eb0f5b0a6dcecebc8f2270b3e91259eb98a34d248d0d1e6eb61289dc16eeca16
|
|
BLAKE2b-256 checksum How to use checksums |
6d2f68c949887c37fd935d8a28631cfd988d4af03b4b83890d7301d0438a401d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3
|
Security for ctypes-callable 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.