Closed wiwichips closed 3 months ago
This is not supported.
See https://github.com/Distributive-Network/PythonMonkey/blob/main/src/BufferType.cc#L99 and https://github.com/Distributive-Network/PythonMonkey/blob/main/tests/python/test_buffer_typed_array.py#L192
so we don't want to treat an immutable object as mutable...yet
This could be supported by implementing a JS type that works like a JS TypedArray but is immutable
@wiwichips as I asked in slack here: https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1721168301362849 did this occur in some specific context/task or just while playing around? Is this useful in bifrost 2?
@philippedistributive check out the additional info section on the ticket
In short yes, this would be nice to support in bifrost2, however it's not required - we can use copy bytes into bytebuffers instead
Would it be a terrible idea to implement a ImmutableUint8Array ?
conversation continued here: https://dstrbtv.slack.com/archives/C03RNFRL4NQ/p1721247135158099
maybe doesn't make sense to proxy python bytes
into js as some new immutable or frozen type -
Philippe Laporte So we cannot use bytearray instead of bytes correct?
Will So yeah we can use bytearrays - the only problem is that we'll often be casting bytes to bytearrays which is a copy under the hood These buffers could be quite large, and it would be nice to avoid copies by passing the reference to pythonmonkey instead
Issue type
Bug
How did you install PythonMonkey?
Source
OS platform and distribution
Ubuntu 22.04.4 LTS x86_64
Python version (
python --version
)3.10
PythonMonkey version (
pip show pythonmonkey
)Version: 0.6.0
Bug Description
No response
Standalone code to reproduce the issue
Relevant log output or backtrace
Additional info if applicable
What branch of PythonMonkey were you developing on? (If applicable)
No response