- Sep 21, 2017
-
-
Damien George authored
The vstr argument to the calls to vstr_add_len are dynamically allocated (ie fixed_buf=false) and so vstr_add_len will never return NULL. So there's no need to check for it. Any out-of-memory errors are raised by the call to m_renew in vstr_ensure_extra.
-
- Aug 20, 2017
-
-
Paul Sokolovsky authored
Per POSIX, this is EINVAL, so raises OSError(EINVAL).
-
- Jul 31, 2017
-
-
Alexander Steffen authored
There were several different spellings of MicroPython present in comments, when there should be only one.
-
- Jun 15, 2017
-
-
Damien George authored
-
- May 29, 2017
-
-
Ville Skyttä authored
-
- Nov 13, 2016
-
-
Paul Sokolovsky authored
Its addition was due to an early exploration on how to add CPython-like stream interface. It's clear that it's not needed and just takes up bytes in all ports.
-
- Oct 27, 2016
-
-
Paul Sokolovsky authored
-
- Oct 17, 2016
-
-
Damien George authored
Saves the following number of bytes of code space: 176 for bare-arm, 352 for minimal, 272 for unix x86-64, 140 for stmhal, 120 for esp8266.
-
- Oct 07, 2016
-
-
Damien George authored
This is an often used code pattern, and its use reduces code size of the core by about 100 bytes.
-
- Sep 22, 2016
-
-
Damien George authored
vstr_extend will now only return NULL if the vstr is a fixed buffer, which in this case it is not.
-
- Aug 23, 2016
-
-
Krzysztof Blazewicz authored
In current state `mp_get_stream_raise` assumes that `self_in` is an object and always performs a pointer derefence which may cause a segfault. This function shall throw an exception whenever `self_in` does not implement a stream protocol, that includes qstr's and numbers. fixes #2331
-
- Jul 30, 2016
-
-
Paul Sokolovsky authored
To filter out even prototypes of mp_stream_posix_*() functions, which require POSIX types like ssize_t & off_t, which may be not available in some ports.
-
- Jul 29, 2016
-
-
Paul Sokolovsky authored
Previoussly such read() and write() methods were used by modussl_axtls, move to py/stream for reuse.
-
- Jul 26, 2016
-
-
Paul Sokolovsky authored
-
- Jul 13, 2016
-
-
Paul Sokolovsky authored
3-arg form: stream.write(data, offset, length) 2-arg form: stream.write(data, length) These allow efficient buffer writing without incurring extra memory allocation for slicing or creating memoryview() object, what is important for low-memory ports. All arguments must be positional. It might be not so bad idea to standardize on 3-arg form, but 2-arg case would need check and raising an exception anyway then, so instead it was just made to work.
-
- Jun 18, 2016
-
-
Paul Sokolovsky authored
It's now used for more than just stream protocol (e.g. pin protocol), so don't use false names.
-
- May 20, 2016
-
-
Paul Sokolovsky authored
-
- May 17, 2016
-
-
Paul Sokolovsky authored
Both read and write operations support variants where either a) a single call is made to the undelying stream implementation and returned buffer length may be less than requested, or b) calls are repeated until requested amount of data is collected, shorter amount is returned only in case of EOF or error. These operations are available from the level of C support functions to be used by other C modules to implementations of Python methods to be used in user-facing objects. The rationale of these changes is to allow to write concise and robust code to work with *blocking* streams of types prone to short reads, like serial interfaces and sockets. Particular object types may select "exact" vs "once" types of methods depending on their needs. E.g., for sockets, revc() and send() methods continue to be "once", while read() and write() thus converted to "exactly" versions. These changes don't affect non-blocking handling, e.g. trying "exact" method on the non-blocking socket will return as much data as available without blocking. No data available is continued to be signaled as None return value to read() and write(). From the point of view of CPython compatibility, this model is a cross between its io.RawIOBase and io.BufferedIOBase abstract classes. For blocking streams, it works as io.BufferedIOBase model (guaranteeing lack of short reads/writes), while for non-blocking - as io.RawIOBase, returning None in case of lack of data (instead of raising expensive exception, as required by io.BufferedIOBase). Such a cross-behavior should be optimal for MicroPython needs.
-
- Apr 10, 2016
-
-
Damien George authored
-
Damien George authored
Saves 16 bytes of code. Also, use mp_obj_get_int_truncated to allow integers as big as a machine word to be passed as the value.
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Will call underlying C virtual methods of stream interface. This isn't intended to be added to every stream object (it's not in CPython), but is convenient way to expose extra operation on Python side without adding bunch of Python-level methods.
-
- Mar 27, 2016
-
-
Paul Sokolovsky authored
-
- Mar 24, 2016
-
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
Spools entire output buffer to a blocking stream (chunk by chunk if needed).
-
- Jan 11, 2016
-
-
Damien George authored
With this patch the n_args parameter is changed type from mp_uint_t to size_t.
-
- Dec 09, 2015
-
-
Damien George authored
-
- Nov 29, 2015
-
-
Damien George authored
This allows the mp_obj_t type to be configured to something other than a pointer-sized primitive type. This patch also includes additional changes to allow the code to compile when sizeof(mp_uint_t) != sizeof(void*), such as using size_t instead of mp_uint_t, and various casts.
-
Damien George authored
-
- Oct 18, 2015
-
-
Paul Sokolovsky authored
-
- Aug 13, 2015
-
-
blmorris authored
-
- May 12, 2015
-
-
Damien George authored
mp_obj_get_int_truncated will raise a TypeError if the argument is not an integral type. Use mp_obj_int_get_truncated only when you know the argument is a small or big int.
-
- Jan 28, 2015
-
-
Damien George authored
This cleans up vstr so that it's a pure "variable buffer", and the user can decide whether they need to add a terminating null byte. In most places where vstr is used, the vstr did not need to be null terminated and so this patch saves code size, a tiny bit of RAM, and makes vstr usage more efficient. When null termination is needed it must be done explicitly using vstr_null_terminate.
-
- Jan 23, 2015
-
-
Paul Sokolovsky authored
-
Paul Sokolovsky authored
After vstr refactor. Fixes #1084.
-
- Jan 21, 2015
-
-
Damien George authored
With this patch str/bytes construction is streamlined. Always use a vstr to build a str/bytes object. If the size is known beforehand then use vstr_init_len to allocate only required memory. Otherwise use vstr_init and the vstr will grow as needed. Then use mp_obj_new_str_from_vstr to create a str/bytes object using the vstr memory. Saves code ROM: 68 bytes on stmhal, 108 bytes on bare-arm, and 336 bytes on unix x64.
-
Damien George authored
This patch allows to reuse vstr memory when creating str/bytes object. This improves memory usage. Also saves code ROM: 128 bytes on stmhal, 92 bytes on bare-arm, and 88 bytes on unix x64.
-
- Jan 01, 2015
-
-
Damien George authored
Addresses issue #1022.
-
- Dec 05, 2014
-
-
Damien George authored
mp_obj_int_get_truncated is used as a "fast path" int accessor that doesn't check for overflow and returns the int truncated to the machine word size, ie mp_int_t. Use mp_obj_int_get_truncated to fix struct.pack when packing maximum word sized values. Addresses issues #779 and #998.
-