micropython/extmod
Damien George 60f5b941e0 extmod/vfs_reader: Fix mp_reader_new_file to open file in "rb" mode.
mp_reader_new_file() is used to read in files for importing, either .py or
.mpy files, for the lexer and persistent code loader respectively.  In both
cases the file should be opened in raw bytes mode: the lexer handles
unicode characters itself, and .mpy files contain 8-bit bytes by nature.

Before this commit importing was working correctly because, although the
file was opened in text mode, all native filesystem implementations (POSIX,
FAT, LFS) would access the file in raw bytes mode via mp_stream_rw()
calling mp_stream_p_t.read().  So it was only an issue for non-native
filesystems, such as those implemented in Python.  For Python-based
filesystem implementations, a call to mp_stream_rw() would go via IOBase
and then to readinto() at the Python level, and readinto() is only defined
on files opened in raw bytes mode.

Signed-off-by: Damien George <damien@micropython.org>
2020-08-12 23:40:50 +10:00
..
axtls-include py/py.mk: Build axtls library directly from its source files. 2018-09-08 00:07:23 +10:00
btstack extmod/modbluetooth: Add event for "indicate acknowledgement". 2020-07-20 23:26:41 +10:00
crypto-algorithms extmod/crypto-algorithms: Add source to header and populate copyright. 2019-08-22 17:20:16 +10:00
lwip-include all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
nimble extmod/modbluetooth: Add event for "indicate acknowledgement". 2020-07-20 23:26:41 +10:00
re1.5 extmod/re1.5: Support escaping within RE classes. 2019-10-18 12:20:32 +11:00
uasyncio extmod/uasyncio: Add StreamReader.readexactly(n) method. 2020-07-25 23:10:05 +10:00
uzlib extmod/uzlib: Explicitly cast ptr-diff-expr to unsigned. 2019-12-23 00:07:03 +11:00
webrepl all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
extmod.mk py/stream: Remove mp_stream_errno and use system errno instead. 2020-04-27 23:58:46 +10:00
machine_i2c.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
machine_i2c.h extmod/machine_i2c: Change C-level API to allow split I2C transactions. 2019-05-20 15:04:29 +10:00
machine_mem.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
machine_mem.h all: Use the name MicroPython consistently in comments 2017-07-31 18:35:40 +10:00
machine_pinbase.c extmod/machine_pinbase: Put PinBase singleton in ROM. 2017-09-12 16:00:21 +10:00
machine_pinbase.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_pulse.c esp8266: Provide custom machine_time_pulse_us that feeds soft WDT. 2019-07-01 22:53:00 +10:00
machine_pulse.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_signal.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
machine_signal.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
machine_spi.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
machine_spi.h drivers/bus: Pull out software SPI implementation to dedicated driver. 2018-03-10 00:59:43 +11:00
misc.h extmod/uos_dupterm: Add mp_uos_dupterm_poll to poll all dupterms. 2019-07-01 17:10:12 +10:00
modbluetooth.c extmod/modbluetooth: Add event for "indicate acknowledgement". 2020-07-20 23:26:41 +10:00
modbluetooth.h extmod/modbluetooth: Add event for "indicate acknowledgement". 2020-07-20 23:26:41 +10:00
modbluetooth_hci.h stm32: Refactor Bluetooth HCI RX to be independent of transport layer. 2020-03-10 01:53:42 +11:00
modbtree.c extmod/modbtree: Retain reference to underlying stream so it's not GC'd. 2020-05-02 16:08:04 +10:00
modframebuf.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
modlwip.c all: Fix implicit floating point to integer conversions. 2020-04-18 22:42:24 +10:00
modonewire.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
moduasyncio.c all: Clean up error strings to use lowercase and change cannot to can't. 2020-04-13 22:19:37 +10:00
modubinascii.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
moducryptolib.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
moductypes.c extmod/moductypes: Use mp_obj_is_dict_or_ordereddict to simplify code. 2020-06-24 12:05:00 +10:00
moduhashlib.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
moduheapq.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
modujson.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
modurandom.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
modure.c extmod/ure: Use single function for match/search/sub. 2020-06-08 09:16:09 +02:00
moduselect.c all: Fix implicit floating point promotion. 2020-04-18 22:36:14 +10:00
modussl_axtls.c extmod/modussl: Improve exception error messages. 2020-07-20 23:41:45 +10:00
modussl_mbedtls.c extmod/modussl_mbedtls: Integrate shorter error strings. 2020-07-21 00:31:05 +10:00
modutimeq.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
moduwebsocket.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
moduwebsocket.h extmod/moduwebsocket: Refactor `websocket` to `uwebsocket`. 2019-02-14 00:35:45 +11:00
moduzlib.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
modwebrepl.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
network_cyw43.c all: Format code to add space after C++-style comment start. 2020-04-23 11:24:25 +10:00
network_cyw43.h extmod: Add network-level class binding to cyw43 driver. 2019-06-03 16:47:35 +10:00
uos_dupterm.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
utime_mphal.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
utime_mphal.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00
vfs.c extmod/vfs: Retain previous working directory if chdir fails. 2020-05-29 23:05:01 +10:00
vfs.h extmod/vfs: Factor out vfs mount-and-chdir helper from stm32. 2020-03-11 14:24:26 +11:00
vfs_blockdev.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_fat.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_fat.h extmod: Factor out block-device struct to make independent of fatfs. 2019-10-29 12:12:37 +11:00
vfs_fat_diskio.c tools/uncrustify: Enable more opts to remove space between func and '('. 2020-06-19 22:07:32 +10:00
vfs_fat_file.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_lfs.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_lfs.h extmod: Add VFS littlefs bindings. 2019-10-29 14:17:29 +11:00
vfs_lfsx.c extmod/vfs_lfs: Fix littlefs bindings to build in nan-box mode. 2020-06-25 16:32:48 +10:00
vfs_lfsx_file.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
vfs_posix.c unix: Implement PEP 475 to retry syscalls failing with EINTR. 2020-03-27 14:40:46 +11:00
vfs_posix.h extmod/vfs: Introduce a C-level VFS protocol, with fast import_stat. 2018-06-06 14:33:42 +10:00
vfs_posix_file.c all: Use MP_ERROR_TEXT for all error messages. 2020-04-05 15:02:06 +10:00
vfs_reader.c extmod/vfs_reader: Fix mp_reader_new_file to open file in "rb" mode. 2020-08-12 23:40:50 +10:00
virtpin.c all: Reformat C and Python source code with tools/codeformat.py. 2020-02-28 10:33:03 +11:00
virtpin.h all: Unify header guard usage. 2017-07-18 11:57:39 +10:00