Message2974

Author mehendran
Recipients
Date 2008-01-31.15:06:35
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
For the point no 3:

In jython, the function re.search() requires both the pattern and the object to be searched to be a string instance.In python, the object to be searched can be either a string or a buffer object. 
Python provides support for "buffer interface"(please see http://docs.python.org/api/bufferObjects.html) which jython does not.Thus in python, array & mmap objects(which implement the buffer interface) along with strings can be used as arguments to functions like file.write(),re.search() etc. which accept buffer objects/strings as arguments.In jython, due to lack of buffer support, functions like file.write() and re.search() accept only a string instance as argument.As per Python's implementation of mmap, mmap is required to expose the buffer interface so that it can be used as argument to re.search()/file.write()....and this is precisely what is tested in the test-file.
Instead of deriving mmap from PyString, the code for re.search() can be modified to deal with mmap object as a special case(for the sole purpose of making the tests pass!).Another way to do it would be to subclass PyString,but instead of maintaining a string that is a duplicate of the mmap contents,the string would be simply maintaind as an empty string.However,I guess it will be a better idea to skip the test where a mmap instance is checked to see whether it has buffer-like behaviour.Even Jython's array implementation has no buffer support.   
Is there any specific reason why jython does not have buffer support?

Please clarify...
History
Date User Action Args
2008-02-20 17:18:54adminlinkissue1854873 messages
2008-02-20 17:18:54admincreate