Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't include structmember.h in pythoncapi_compat.h#161

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
colesbury wants to merge2 commits intopython:main
base:main
Choose a base branch
Loading
fromcolesbury:structmember.h
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 23 additions & 26 deletionspythoncapi_compat.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -25,9 +25,6 @@ extern "C" {
#if PY_VERSION_HEX < 0x030b00B4 && !defined(PYPY_VERSION)
# include "frameobject.h" // PyFrameObject, PyFrame_GetBack()
#endif
#if PY_VERSION_HEX < 0x030C00A3
# include <structmember.h> // T_SHORT, READONLY
#endif


#ifndef _Py_CAST
Expand DownExpand Up@@ -1919,33 +1916,33 @@ PyLongWriter_Finish(PyLongWriter *writer)


#if PY_VERSION_HEX < 0x030C00A3
# define Py_T_SHORTT_SHORT
# define Py_T_INTT_INT
# define Py_T_LONGT_LONG
# define Py_T_FLOATT_FLOAT
# define Py_T_DOUBLET_DOUBLE
# define Py_T_STRINGT_STRING
# define _Py_T_OBJECTT_OBJECT
# define Py_T_CHART_CHAR
# define Py_T_BYTET_BYTE
# define Py_T_UBYTET_UBYTE
# define Py_T_USHORTT_USHORT
# define Py_T_UINTT_UINT
# define Py_T_ULONGT_ULONG
# define Py_T_STRING_INPLACET_STRING_INPLACE
# define Py_T_BOOLT_BOOL
# define Py_T_OBJECT_EXT_OBJECT_EX
# define Py_T_LONGLONGT_LONGLONG
# define Py_T_ULONGLONGT_ULONGLONG
# define Py_T_PYSSIZETT_PYSSIZET
# define Py_T_SHORT0
# define Py_T_INT1
# define Py_T_LONG2
# define Py_T_FLOAT3
# define Py_T_DOUBLE4
# define Py_T_STRING5
# define _Py_T_OBJECT6
# define Py_T_CHAR7
# define Py_T_BYTE8
# define Py_T_UBYTE9
# define Py_T_USHORT10
# define Py_T_UINT11
# define Py_T_ULONG12
# define Py_T_STRING_INPLACE13
# define Py_T_BOOL14
# define Py_T_OBJECT_EX16
# define Py_T_LONGLONG17
# define Py_T_ULONGLONG18
# define Py_T_PYSSIZET19

# if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
# define _Py_T_NONET_NONE
# define _Py_T_NONE20
# endif

# define Py_READONLYREADONLY
# define Py_AUDIT_READREAD_RESTRICTED
# define _Py_WRITE_RESTRICTEDPY_WRITE_RESTRICTED
# define Py_READONLY1
# define Py_AUDIT_READ2
# define _Py_WRITE_RESTRICTED4
#endif


Expand Down
49 changes: 25 additions & 24 deletionstests/test_pythoncapi_compat_cext.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
#undef NDEBUG

#include "pythoncapi_compat.h"
#include <structmember.h> // T_SHORT, READONLY

#ifdef NDEBUG
# error "assertions must be enabled"
Expand DownExpand Up@@ -2118,32 +2119,32 @@ test_long_stdint(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
static PyObject *
test_structmember(PyObject *Py_UNUSED(module), PyObject *Py_UNUSED(args))
{
assert(Py_T_SHORT >= 0);
assert(Py_T_INT >= 0);
assert(Py_T_LONG >= 0);
assert(Py_T_FLOAT >= 0);
assert(Py_T_DOUBLE >= 0);
assert(Py_T_STRING >= 0);
assert(_Py_T_OBJECT >= 0);
assert(Py_T_CHAR >= 0);
assert(Py_T_BYTE >= 0);
assert(Py_T_UBYTE >= 0);
assert(Py_T_USHORT >= 0);
assert(Py_T_UINT >= 0);
assert(Py_T_ULONG >= 0);
assert(Py_T_STRING_INPLACE >= 0);
assert(Py_T_BOOL >= 0);
assert(Py_T_OBJECT_EX >= 0);
assert(Py_T_LONGLONG >= 0);
assert(Py_T_ULONGLONG >= 0);
assert(Py_T_PYSSIZET >= 0);
assert(Py_T_SHORT == T_SHORT);
assert(Py_T_SHORT == T_SHORT);
assert(Py_T_INT == T_INT);
assert(Py_T_LONG == T_LONG);
assert(Py_T_FLOAT == T_FLOAT);
assert(Py_T_DOUBLE == T_DOUBLE);
assert(Py_T_STRING == T_STRING);
assert(_Py_T_OBJECT == T_OBJECT);
assert(Py_T_CHAR == T_CHAR);
assert(Py_T_BYTE == T_BYTE);
assert(Py_T_UBYTE == T_UBYTE);
assert(Py_T_USHORT == T_USHORT);
assert(Py_T_UINT == T_UINT);
assert(Py_T_ULONG == T_ULONG);
assert(Py_T_STRING_INPLACE == T_STRING_INPLACE);
assert(Py_T_BOOL == T_BOOL);
assert(Py_T_OBJECT_EX == T_OBJECT_EX);
assert(Py_T_LONGLONG == T_LONGLONG);
assert(Py_T_ULONGLONG == T_ULONGLONG);
assert(Py_T_PYSSIZET == T_PYSSIZET);
#if PY_VERSION_HEX >= 0x03000000 && !defined(PYPY_VERSION)
assert(_Py_T_NONE>= 0);
assert(_Py_T_NONE== T_NONE);
#endif

assert(Py_READONLY >= 0);
assert(Py_AUDIT_READ >= 0);
assert(_Py_WRITE_RESTRICTED >= 0);
assert(Py_READONLY == READONLY);
assert(Py_AUDIT_READ == READ_RESTRICTED);
assert(_Py_WRITE_RESTRICTED == PY_WRITE_RESTRICTED);

Py_RETURN_NONE;
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp