Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
python-cpython/Include/pyabi.h at main · sthagen/python-cpython · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
sthagen
/
python-cpython
Public
forked from
python/cpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
1
Code
Pull requests
9
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Security and quality
Insights
Files
Expand file tree
main
Breadcrumbs
python-cpython
/
Include
/
pyabi.h
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
123 lines (116 loc) · 4.3 KB
main
Breadcrumbs
python-cpython
/
Include
/
pyabi.h
Copy path
Top
File metadata and controls
Code
Blame
123 lines (116 loc) · 4.3 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* Macros that restrict available definitions and select implementations
* to match an ABI stability promise:
*
* - internal API/ABI (may change at any time) -- Py_BUILD_CORE*
* - general CPython API/ABI (may change in 3.x.0) -- default
* - Stable ABI: abi3, abi3t (long-term stable) -- Py_LIMITED_API,
* Py_TARGET_ABI3T, _Py_OPAQUE_PYOBJECT
* - Free-threading (incompatible with non-free-threading builds)
* -- Py_GIL_DISABLED
*/
#ifndef
_Py_PYABI_H
#define
_Py_PYABI_H
/* Defines to build Python and its standard library:
*
* - Py_BUILD_CORE: Build Python core. Gives access to Python internals; should
* not be used by third-party modules.
* - Py_BUILD_CORE_BUILTIN: Build a Python stdlib module as a built-in module.
* - Py_BUILD_CORE_MODULE: Build a Python stdlib module as a dynamic library.
*
* Py_BUILD_CORE_BUILTIN and Py_BUILD_CORE_MODULE imply Py_BUILD_CORE.
*
* On Windows, Py_BUILD_CORE_MODULE exports "PyInit_xxx" symbol, whereas
* Py_BUILD_CORE_BUILTIN does not.
*/
#if
defined(
Py_BUILD_CORE_BUILTIN
)
&&
!defined(
Py_BUILD_CORE
)
# define
Py_BUILD_CORE
#endif
#if
defined(
Py_BUILD_CORE_MODULE
)
&&
!defined(
Py_BUILD_CORE
)
# define
Py_BUILD_CORE
#endif
/* Check valid values for target ABI macros.
*/
#if
defined(
Py_LIMITED_API
)
&&
Py_LIMITED_API
+
0
<
3
// Empty Py_LIMITED_API used to work; redefine to
// Python 3.2 to be explicit.
# undef
Py_LIMITED_API
# define
Py_LIMITED_API
0x03020000
#endif
#if
defined(
Py_TARGET_ABI3T
)
&&
Py_TARGET_ABI3T
+
0
<
0x030f0000
# error
"Py_TARGET_ABI3T must be 0x030f0000 (3.15) or above"
#endif
/* Stable ABI for free-threaded builds (abi3t, introduced in PEP 803)
* is enabled by one of:
* - Py_TARGET_ABI3T, or
* - Py_LIMITED_API and Py_GIL_DISABLED.
*
* These affect set the following, which Python.h should use internally:
* - Py_LIMITED_API (defines the subset of API we expose)
* - _Py_OPAQUE_PYOBJECT (additionally hides what's ABI-incompatible between
* free-threaded & GIL)
*
* (Don't use Py_TARGET_ABI3T directly. It's currently only used to set these
* 2 macros, and defined for users' convenience.)
*
* This logic is currently partially duplicated in PC/pyconfig.h.
*/
#if
defined(
Py_LIMITED_API
)
&&
defined(
Py_GIL_DISABLED
) \
&&
!defined(
Py_TARGET_ABI3T
)
# define
Py_TARGET_ABI3T
Py_LIMITED_API
#endif
#if
defined(
Py_TARGET_ABI3T
)
# define
_Py_OPAQUE_PYOBJECT
# if
!defined(
Py_LIMITED_API
)
# define
Py_LIMITED_API
Py_TARGET_ABI3T
# elif
Py_LIMITED_API
>
Py_TARGET_ABI3T
// if both are defined, use the *lower* version,
// i.e. maximum compatibility
# undef
Py_LIMITED_API
# define
Py_LIMITED_API
Py_TARGET_ABI3T
# endif
#else
# ifdef
_Py_OPAQUE_PYOBJECT
// _Py_OPAQUE_PYOBJECT is a private macro; do not define it directly.
# error
"Define Py_TARGET_ABI3T to target abi3t."
# endif
#endif
#if
defined(
Py_TARGET_ABI3T
)
# if
!defined(
Py_GIL_DISABLED
)
// Define Py_GIL_DISABLED for users' needs. Users check this macro to see
// whether they need extra synchronization.
# define
Py_GIL_DISABLED
# endif
# if
defined(
_Py_IS_TESTCEXT
)
// When compiling for abi3t, contents of Python.h should not depend
// on Py_GIL_DISABLED.
// We ask GCC to error if it sees the macro from this point on.
// Since users are free to the macro, and there's no way to undo the
// poisoning at the end of Python.h, we only do this in a test module
// (test_cext).
//
// Clang's poisoning is stricter than GCC's: it looks in `#elif`
// expressions after matching `#if`s. We disable it for now.
// We also provide an undocumented, unsupported opt-out macro to help
// porting to other compilers. Consider reaching out if you use it.
# if
defined(
__GNUC__
)
&&
!defined(
__clang__
)
&&
!defined(
_Py_NO_GCC_POISON
)
# undef
Py_GIL_DISABLED
# pragma
GCC poison Py_GIL_DISABLED
# endif
# endif
#endif
/* The internal C API must not be used with the limited C API: make sure
* that Py_BUILD_CORE* macros are not defined in this case.
* But, keep the "original" values, under different names, for "exports.h"
*/
#ifdef
Py_BUILD_CORE
# define
_PyEXPORTS_CORE
#endif
#ifdef
Py_BUILD_CORE_MODULE
# define
_PyEXPORTS_CORE_MODULE
#endif
#ifdef
Py_LIMITED_API
# undef
Py_BUILD_CORE
# undef
Py_BUILD_CORE_BUILTIN
# undef
Py_BUILD_CORE_MODULE
#endif
#endif
// _Py_PYABI_H
You can’t perform that action at this time.