Skip to content

Commit e2d61fa

Browse files
committed
Add workaround to build with Python 3.10 limited API
We generally require Python 3.11 to build with the limited API, but add a workaround so that it works with 3.10 as well, so that it can be used by IMP's Windows installer. Relates salilab/imp#1112.
1 parent 38870b8 commit e2d61fa

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/ihm_format.i

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,13 @@ static void handle_error(struct ihm_error *err)
5858

5959
%{
6060

61+
/* PyBUF_WRITE didn't officially enter the Python limited API until 3.11,
62+
but it's just a constant and that constant's value has never changed.
63+
Allow building with the 3.10 limited API (used by IMP). */
64+
#if defined(Py_LIMITED_API) && Py_LIMITED_API+0 < 0x030B0000
65+
#define PyBUF_WRITE 0x200
66+
#endif
67+
6168
/* Read data from a Python filelike object, in text mode */
6269
static ssize_t pyfile_text_read_callback(char *buffer, size_t buffer_len,
6370
void *data, struct ihm_error **err)

0 commit comments

Comments
 (0)