Author: Brian Kearns <[email protected]>
Branch: refactor-buffer-api
Changeset: r70936:bac2a6251789
Date: 2014-04-24 16:03 -0400
http://bitbucket.org/pypy/pypy/changeset/bac2a6251789/
Log: flesh out buffer flags
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1364,12 +1364,18 @@
self.wrap('cannot convert negative integer '
'to unsigned int'))
- # XXX define these flags correctly, possibly put elsewhere?
- BUF_SIMPLE = 0
- BUF_FULL_RO = 1
- BUF_CONTIG = 2
- BUF_CONTIG_RO = 3
- BUF_WRITABLE = 4
+ BUF_SIMPLE = 0x0000
+ BUF_WRITABLE = 0x0001
+ BUF_FORMAT = 0x0004
+ BUF_ND = 0x0008
+ BUF_STRIDES = 0x0010 | BUF_ND
+ BUF_INDIRECT = 0x0100 | BUF_STRIDES
+
+ BUF_CONTIG_RO = BUF_ND
+ BUF_CONTIG = BUF_ND | BUF_WRITABLE
+
+ BUF_FULL_RO = BUF_INDIRECT | BUF_FORMAT
+ BUF_FULL = BUF_INDIRECT | BUF_FORMAT | BUF_WRITABLE
def check_buf_flags(self, flags, readonly):
if readonly and flags & self.BUF_WRITABLE == self.BUF_WRITABLE:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit