File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -47,9 +47,17 @@ Changes compared to CPython:
47
47
48
48
#define DEF_MEM_LEVEL 8
49
49
50
- /* Py_UNREACHABLE not defined on PyPy platforms apparently. */
51
- #ifndef Py_UNREACHABLE
50
+ /* PyPy quirks: no Py_UNREACHABLE and requires PyBUF_READ and PyBUF_WRITE set
51
+ in memoryviews that enter a "readinto" call. CPython requires that only
52
+ PyBUF_WRITE is set.
53
+ (Both implementations are wrong because the state of the READ bit should
54
+ not matter.)
55
+ */
56
+ #ifdef PYPY_VERSION
52
57
#define Py_UNREACHABLE () Py_FatalError("Reached unreachable state")
58
+ #define MEMORYVIEW_READINTO_FLAGS (PyBUF_READ | PyBUF_WRITE)
59
+ #else
60
+ #define MEMORYVIEW_READINTO_FLAGS PyBUF_WRITE
53
61
#endif
54
62
55
63
static PyTypeObject IsalZlibCompType ;
@@ -1348,7 +1356,7 @@ static inline ssize_t GzipReader_read_from_file(GzipReader *self)
1348
1356
return -1 ;
1349
1357
}
1350
1358
PyObject * bufview = PyMemoryView_FromMemory (
1351
- (char * )buffer_end , read_in_size , PyBUF_READ | PyBUF_WRITE );
1359
+ (char * )buffer_end , read_in_size , MEMORYVIEW_READINTO_FLAGS );
1352
1360
if (bufview == NULL ) {
1353
1361
return -1 ;
1354
1362
}
You can’t perform that action at this time.
0 commit comments