From f488fa29e485964d15f9f9dbfad5180c580e4b24 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 27 Jan 2017 21:01:18 +1100 Subject: extmod/modlwip: Add socket.readinto() method. --- extmod/modlwip.c | 1 + 1 file changed, 1 insertion(+) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 62699bd41..0f2a6c64b 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1172,6 +1172,7 @@ STATIC const mp_map_elem_t lwip_socket_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_makefile), (mp_obj_t)&lwip_socket_makefile_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_read), (mp_obj_t)&mp_stream_read_obj }, + { MP_OBJ_NEW_QSTR(MP_QSTR_readinto), (mp_obj_t)&mp_stream_readinto_obj }, { MP_OBJ_NEW_QSTR(MP_QSTR_readline), (mp_obj_t)&mp_stream_unbuffered_readline_obj}, { MP_OBJ_NEW_QSTR(MP_QSTR_write), (mp_obj_t)&mp_stream_write_obj }, }; -- cgit v1.2.3 From a937750cebc104296f9342e559626ff354772fda Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 15 Feb 2017 19:20:46 +0300 Subject: extmod/modlwip: Add my copyright. Per: $ git log modlwip.c |grep ^Auth | sort | uniq -c 9 Author: Damien George 2 Author: Galen Hazelwood 43 Author: Paul Sokolovsky --- extmod/modlwip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 0f2a6c64b..5b03d7c29 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1,10 +1,11 @@ /* - * This file is part of the Micro Python project, http://micropython.org/ + * This file is part of the MicroPython project, http://micropython.org/ * * The MIT License (MIT) * * Copyright (c) 2013, 2014 Damien P. George * Copyright (c) 2015 Galen Hazelwood + * Copyright (c) 2015-2016 Paul Sokolovsky * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal -- cgit v1.2.3 From b568448306910d7526a5f1085eca8b33f36694b3 Mon Sep 17 00:00:00 2001 From: Damien George Date: Sun, 26 Mar 2017 19:19:35 +1100 Subject: extmod/modlwip: Use mp_obj_str_get_str instead of mp_obj_str_get_data. --- extmod/modlwip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 5b03d7c29..5709413de 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1264,8 +1264,7 @@ STATIC void lwip_getaddrinfo_cb(const char *name, ip_addr_t *ipaddr, void *arg) // lwip.getaddrinfo STATIC mp_obj_t lwip_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { - mp_uint_t hlen; - const char *host = mp_obj_str_get_data(host_in, &hlen); + const char *host = mp_obj_str_get_str(host_in); mp_int_t port = mp_obj_get_int(port_in); getaddrinfo_state_t state; -- cgit v1.2.3 From b6c7e4b143d96ff9f84ccb22d83b1e15ab084250 Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 31 Mar 2017 22:29:39 +1100 Subject: all: Use full path name when including mp-readline/timeutils/netutils. This follows the pattern of how all other headers are now included, and makes it explicit where the header file comes from. This patch also removes -I options from Makefile's that specify the mp-readline/timeutils/ netutils directories, which are no longer needed. --- cc3200/application.mk | 3 --- cc3200/ftp/ftp.c | 2 +- cc3200/mods/moduos.c | 2 +- cc3200/mods/modusocket.c | 2 +- cc3200/mods/modutime.c | 2 +- cc3200/mods/pybrtc.c | 2 +- cc3200/mptask.c | 2 +- esp8266/Makefile | 3 --- esp8266/fatfs_port.c | 2 +- esp8266/machine_rtc.c | 2 +- esp8266/modnetwork.c | 2 +- esp8266/modutime.c | 2 +- examples/embedding/Makefile.upylib | 1 - extmod/modlwip.c | 2 +- lib/mp-readline/readline.c | 2 +- lib/netutils/netutils.c | 2 +- lib/timeutils/timeutils.c | 2 +- minimal/Makefile | 1 - pic16bit/Makefile | 1 - pic16bit/main.c | 2 +- py/py.mk | 3 --- stmhal/Makefile | 3 --- stmhal/input.c | 2 +- stmhal/main.c | 2 +- stmhal/modnwcc3k.c | 2 +- stmhal/modnwwiznet5k.c | 2 +- stmhal/moduos.c | 2 +- stmhal/modusocket.c | 2 +- stmhal/modutime.c | 2 +- teensy/Makefile | 1 - teensy/main.c | 2 +- unix/Makefile | 1 - 32 files changed, 23 insertions(+), 40 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/cc3200/application.mk b/cc3200/application.mk index b15dbde7f..5d25424e1 100644 --- a/cc3200/application.mk +++ b/cc3200/application.mk @@ -18,9 +18,6 @@ APP_INC += -Iutil APP_INC += -Ibootmgr APP_INC += -I$(BUILD) APP_INC += -I$(BUILD)/genhdr -APP_INC += -I../lib/mp-readline -APP_INC += -I../lib/netutils -APP_INC += -I../lib/timeutils APP_INC += -I../stmhal APP_CPPDEFINES = -Dgcc -DTARGET_IS_CC3200 -DSL_FULL -DUSE_FREERTOS diff --git a/cc3200/ftp/ftp.c b/cc3200/ftp/ftp.c index 22035d6b3..1febe291f 100644 --- a/cc3200/ftp/ftp.c +++ b/cc3200/ftp/ftp.c @@ -29,6 +29,7 @@ #include "py/mpstate.h" #include "py/obj.h" +#include "lib/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" @@ -48,7 +49,6 @@ #include "fifo.h" #include "socketfifo.h" #include "updater.h" -#include "timeutils.h" #include "moduos.h" /****************************************************************************** diff --git a/cc3200/mods/moduos.c b/cc3200/mods/moduos.c index 5523c887f..add10ec6c 100644 --- a/cc3200/mods/moduos.c +++ b/cc3200/mods/moduos.c @@ -33,6 +33,7 @@ #include "py/objtuple.h" #include "py/objstr.h" #include "py/runtime.h" +#include "lib/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "genhdr/mpversion.h" @@ -43,7 +44,6 @@ #include "random.h" #include "mpexception.h" #include "version.h" -#include "timeutils.h" #include "pybsd.h" #include "pybuart.h" diff --git a/cc3200/mods/modusocket.c b/cc3200/mods/modusocket.c index 4e2da6737..ca28bf7ba 100644 --- a/cc3200/mods/modusocket.c +++ b/cc3200/mods/modusocket.c @@ -34,7 +34,7 @@ #include "py/objstr.h" #include "py/runtime.h" #include "py/stream.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "modnetwork.h" #include "modusocket.h" #include "mpexception.h" diff --git a/cc3200/mods/modutime.c b/cc3200/mods/modutime.c index 8e3c71402..48fde67e7 100644 --- a/cc3200/mods/modutime.c +++ b/cc3200/mods/modutime.c @@ -33,8 +33,8 @@ #include "py/obj.h" #include "py/smallint.h" #include "py/mphal.h" +#include "lib/timeutils/timeutils.h" #include "extmod/utime_mphal.h" -#include "timeutils.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" diff --git a/cc3200/mods/pybrtc.c b/cc3200/mods/pybrtc.c index 13d7a49cb..134bd440e 100644 --- a/cc3200/mods/pybrtc.c +++ b/cc3200/mods/pybrtc.c @@ -29,6 +29,7 @@ #include "py/obj.h" #include "py/runtime.h" #include "py/mperrno.h" +#include "lib/timeutils/timeutils.h" #include "inc/hw_types.h" #include "inc/hw_ints.h" #include "inc/hw_memmap.h" @@ -37,7 +38,6 @@ #include "pybrtc.h" #include "mpirq.h" #include "pybsleep.h" -#include "timeutils.h" #include "simplelink.h" #include "modnetwork.h" #include "modwlan.h" diff --git a/cc3200/mptask.c b/cc3200/mptask.c index 3c49a5603..d446711a2 100644 --- a/cc3200/mptask.c +++ b/cc3200/mptask.c @@ -33,6 +33,7 @@ #include "py/runtime.h" #include "py/gc.h" #include "py/mphal.h" +#include "lib/mp-readline/readline.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "extmod/vfs.h" @@ -51,7 +52,6 @@ #include "lib/utils/pyexec.h" #include "gccollect.h" #include "gchelper.h" -#include "readline.h" #include "mperror.h" #include "simplelink.h" #include "modnetwork.h" diff --git a/esp8266/Makefile b/esp8266/Makefile index 28dbf08a6..a3da9d398 100644 --- a/esp8266/Makefile +++ b/esp8266/Makefile @@ -25,9 +25,6 @@ ESP_SDK = $(shell $(CC) -print-sysroot)/usr INC += -I. INC += -I.. INC += -I../stmhal -INC += -I../lib/mp-readline -INC += -I../lib/netutils -INC += -I../lib/timeutils INC += -I$(BUILD) INC += -I$(ESP_SDK)/include diff --git a/esp8266/fatfs_port.c b/esp8266/fatfs_port.c index 20c3235d4..02384f605 100644 --- a/esp8266/fatfs_port.c +++ b/esp8266/fatfs_port.c @@ -25,8 +25,8 @@ */ #include "py/obj.h" +#include "lib/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" -#include "timeutils.h" #include "modmachine.h" DWORD get_fattime(void) { diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c index 8c1fe0779..019b705ba 100644 --- a/esp8266/machine_rtc.c +++ b/esp8266/machine_rtc.c @@ -30,7 +30,7 @@ #include "py/nlr.h" #include "py/obj.h" #include "py/runtime.h" -#include "timeutils.h" +#include "lib/timeutils/timeutils.h" #include "user_interface.h" #include "modmachine.h" diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c index 762717b35..627655b36 100644 --- a/esp8266/modnetwork.c +++ b/esp8266/modnetwork.c @@ -32,7 +32,7 @@ #include "py/objlist.h" #include "py/runtime.h" #include "py/mphal.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "queue.h" #include "user_interface.h" #include "espconn.h" diff --git a/esp8266/modutime.c b/esp8266/modutime.c index 117720e6f..bdeb3bb45 100644 --- a/esp8266/modutime.c +++ b/esp8266/modutime.c @@ -34,8 +34,8 @@ #include "py/runtime.h" #include "py/mphal.h" #include "py/smallint.h" +#include "lib/timeutils/timeutils.h" #include "modmachine.h" -#include "timeutils.h" #include "user_interface.h" #include "extmod/utime_mphal.h" diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 8b506e95e..873c0fd34 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -14,7 +14,6 @@ INC += -I. INC += -I.. INC += -I$(MPTOP) INC += -I$(MPTOP)/unix -#INC += -I../lib/timeutils INC += -I$(BUILD) # compiler settings diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 5709413de..fffabb98a 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -36,7 +36,7 @@ #include "py/mperrno.h" #include "py/mphal.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "lwip/init.h" #include "lwip/timers.h" diff --git a/lib/mp-readline/readline.c b/lib/mp-readline/readline.c index cbb99cc94..4b9875136 100644 --- a/lib/mp-readline/readline.c +++ b/lib/mp-readline/readline.c @@ -31,7 +31,7 @@ #include "py/mpstate.h" #include "py/repl.h" #include "py/mphal.h" -#include "readline.h" +#include "lib/mp-readline/readline.h" #if 0 // print debugging info #define DEBUG_PRINT (1) diff --git a/lib/netutils/netutils.c b/lib/netutils/netutils.c index 3a4c600dc..a2ea31cf3 100644 --- a/lib/netutils/netutils.c +++ b/lib/netutils/netutils.c @@ -31,7 +31,7 @@ #include "py/obj.h" #include "py/nlr.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" // Takes an array with a raw IPv4 address and returns something like '192.168.0.1'. mp_obj_t netutils_format_ipv4_addr(uint8_t *ip, netutils_endian_t endian) { diff --git a/lib/timeutils/timeutils.c b/lib/timeutils/timeutils.c index 19d3ddbdd..0af39a295 100644 --- a/lib/timeutils/timeutils.c +++ b/lib/timeutils/timeutils.c @@ -27,7 +27,7 @@ #include "py/obj.h" -#include "timeutils.h" +#include "lib/timeutils/timeutils.h" // LEAPOCH corresponds to 2000-03-01, which is a mod-400 year, immediately // after Feb 29. We calculate seconds as a signed integer relative to that. diff --git a/minimal/Makefile b/minimal/Makefile index 3b446beae..d61515797 100644 --- a/minimal/Makefile +++ b/minimal/Makefile @@ -14,7 +14,6 @@ endif INC += -I. INC += -I.. -INC += -I../lib/mp-readline INC += -I../stmhal INC += -I$(BUILD) diff --git a/pic16bit/Makefile b/pic16bit/Makefile index add9a8495..8c0c1c999 100644 --- a/pic16bit/Makefile +++ b/pic16bit/Makefile @@ -14,7 +14,6 @@ PART = 33FJ256GP506 INC += -I. INC += -I.. -INC += -I../lib/mp-readline INC += -I../stmhal INC += -I$(BUILD) INC += -I$(XC16)/include diff --git a/pic16bit/main.c b/pic16bit/main.c index f2a9debab..7de790069 100644 --- a/pic16bit/main.c +++ b/pic16bit/main.c @@ -35,7 +35,7 @@ #include "py/mphal.h" #include "py/mperrno.h" #include "lib/utils/pyexec.h" -#include "readline.h" +#include "lib/mp-readline/readline.h" #include "board.h" #include "modpyb.h" diff --git a/py/py.mk b/py/py.mk index 37bb5d023..5ff1fd6a6 100644 --- a/py/py.mk +++ b/py/py.mk @@ -16,9 +16,6 @@ endif # some code is performance bottleneck and compiled with other optimization options CSUPEROPT = -O3 -INC += -I../lib -INC += -I../lib/netutils - # this sets the config file for FatFs CFLAGS_MOD += -DFFCONF_H=\"lib/oofatfs/ffconf.h\" diff --git a/stmhal/Makefile b/stmhal/Makefile index 51aa07f3c..09643be94 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -47,9 +47,6 @@ INC += -I$(CMSIS_DIR)/ INC += -I$(HAL_DIR)/inc INC += -I$(USBDEV_DIR)/core/inc -I$(USBDEV_DIR)/class/inc #INC += -I$(USBHOST_DIR) -INC += -I../lib/mp-readline -INC += -I../lib/netutils -INC += -I../lib/timeutils CFLAGS_CORTEX_M = -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -Wdouble-promotion CFLAGS_MCU_f4 = $(CFLAGS_CORTEX_M) -mtune=cortex-m4 -mcpu=cortex-m4 -DMCU_SERIES_F4 diff --git a/stmhal/input.c b/stmhal/input.c index 07e7ba35c..c78525cc9 100644 --- a/stmhal/input.c +++ b/stmhal/input.c @@ -26,7 +26,7 @@ #include "py/nlr.h" #include "py/obj.h" -#include "readline.h" +#include "lib/mp-readline/readline.h" STATIC mp_obj_t mp_builtin_input(uint n_args, const mp_obj_t *args) { if (n_args == 1) { diff --git a/stmhal/main.c b/stmhal/main.c index 8d076a08b..566c2db07 100644 --- a/stmhal/main.c +++ b/stmhal/main.c @@ -31,6 +31,7 @@ #include "py/stackctrl.h" #include "py/gc.h" #include "py/mphal.h" +#include "lib/mp-readline/readline.h" #include "lib/utils/pyexec.h" #include "lib/oofatfs/ff.h" #include "extmod/vfs.h" @@ -40,7 +41,6 @@ #include "pendsv.h" #include "pybthread.h" #include "gccollect.h" -#include "readline.h" #include "modmachine.h" #include "i2c.h" #include "spi.h" diff --git a/stmhal/modnwcc3k.c b/stmhal/modnwcc3k.c index ae403cacd..26c6cd48c 100644 --- a/stmhal/modnwcc3k.c +++ b/stmhal/modnwcc3k.c @@ -37,7 +37,7 @@ #include "py/runtime.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "modnetwork.h" #include "pin.h" #include "genhdr/pins.h" diff --git a/stmhal/modnwwiznet5k.c b/stmhal/modnwwiznet5k.c index e3d5c6370..b32f16913 100644 --- a/stmhal/modnwwiznet5k.c +++ b/stmhal/modnwwiznet5k.c @@ -33,7 +33,7 @@ #include "py/runtime.h" #include "py/mperrno.h" #include "py/mphal.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "modnetwork.h" #include "pin.h" #include "genhdr/pins.h" diff --git a/stmhal/moduos.c b/stmhal/moduos.c index 0af682612..745c0d5d7 100644 --- a/stmhal/moduos.c +++ b/stmhal/moduos.c @@ -31,12 +31,12 @@ #include "py/runtime.h" #include "py/objtuple.h" #include "py/objstr.h" +#include "lib/timeutils/timeutils.h" #include "lib/oofatfs/ff.h" #include "lib/oofatfs/diskio.h" #include "extmod/vfs.h" #include "extmod/vfs_fat.h" #include "genhdr/mpversion.h" -#include "timeutils.h" #include "rng.h" #include "uart.h" #include "portmodules.h" diff --git a/stmhal/modusocket.c b/stmhal/modusocket.c index d066501d0..fd60c5ad4 100644 --- a/stmhal/modusocket.c +++ b/stmhal/modusocket.c @@ -32,7 +32,7 @@ #include "py/objlist.h" #include "py/runtime.h" #include "py/mperrno.h" -#include "netutils.h" +#include "lib/netutils/netutils.h" #include "modnetwork.h" #if MICROPY_PY_USOCKET diff --git a/stmhal/modutime.c b/stmhal/modutime.c index 2c7245080..97af35c49 100644 --- a/stmhal/modutime.c +++ b/stmhal/modutime.c @@ -31,9 +31,9 @@ #include "py/nlr.h" #include "py/smallint.h" #include "py/obj.h" +#include "lib/timeutils/timeutils.h" #include "extmod/utime_mphal.h" #include "systick.h" -#include "timeutils.h" #include "portmodules.h" #include "rtc.h" diff --git a/teensy/Makefile b/teensy/Makefile index e613b8f27..9f52cc3c7 100644 --- a/teensy/Makefile +++ b/teensy/Makefile @@ -32,7 +32,6 @@ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -mfloat INC += -I. INC += -I.. INC += -I../stmhal -INC += -I../lib/mp-readline INC += -I$(BUILD) INC += -Icore diff --git a/teensy/main.c b/teensy/main.c index d62ae3bdb..41bbeb5d9 100644 --- a/teensy/main.c +++ b/teensy/main.c @@ -10,7 +10,7 @@ #include "py/mphal.h" #include "gccollect.h" #include "lib/utils/pyexec.h" -#include "readline.h" +#include "lib/mp-readline/readline.h" #include "lexermemzip.h" #include "Arduino.h" diff --git a/unix/Makefile b/unix/Makefile index f28a4bcae..546985306 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -17,7 +17,6 @@ include ../py/py.mk INC += -I. INC += -I.. -INC += -I../lib/timeutils INC += -I$(BUILD) # compiler settings -- cgit v1.2.3 From 4c2402e41e869772d3c9fa9b197040c5712624f6 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 29 Apr 2017 18:56:39 +0300 Subject: extmod/modlwip: getaddrinfo: Allow to accept all 6 standard params. But warn if anything else but host/port is passed. --- extmod/modlwip.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index fffabb98a..6a1dcaef5 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1263,7 +1263,12 @@ STATIC void lwip_getaddrinfo_cb(const char *name, ip_addr_t *ipaddr, void *arg) } // lwip.getaddrinfo -STATIC mp_obj_t lwip_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { +STATIC mp_obj_t lwip_getaddrinfo(size_t n_args, const mp_obj_t *args) { + if (n_args > 2) { + mp_warning("getaddrinfo constraints not supported"); + } + + mp_obj_t host_in = args[0], port_in = args[1]; const char *host = mp_obj_str_get_str(host_in); mp_int_t port = mp_obj_get_int(port_in); @@ -1299,7 +1304,7 @@ STATIC mp_obj_t lwip_getaddrinfo(mp_obj_t host_in, mp_obj_t port_in) { tuple->items[4] = netutils_format_inet_addr((uint8_t*)&state.ipaddr, port, NETUTILS_BIG); return mp_obj_new_list(1, (mp_obj_t*)&tuple); } -STATIC MP_DEFINE_CONST_FUN_OBJ_2(lwip_getaddrinfo_obj, lwip_getaddrinfo); +STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(lwip_getaddrinfo_obj, 2, 6, lwip_getaddrinfo); // Debug functions -- cgit v1.2.3 From 5db55e63f3e7a5beda732c241693e37e3a7b099f Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Mon, 1 May 2017 18:20:09 +0300 Subject: extmod/modlwip: ioctl POLL: Fix handling of peer closed socket. Peer-closed socket is both readable and writable: read will return EOF, write - error. Without this poll will hang on such socket. Note that we don't return POLLHUP, based on argumentation in http://www.greenend.org.uk/rjk/tech/poll.html that it should apply to deeper disconnects, for example for networking, that would be link layer disconnect (e.g. WiFi went down). --- extmod/modlwip.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 6a1dcaef5..c72849cf9 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -1143,8 +1143,11 @@ STATIC mp_uint_t lwip_socket_ioctl(mp_obj_t self_in, mp_uint_t request, uintptr_ ret |= MP_STREAM_POLL_WR; } - if (flags & MP_STREAM_POLL_HUP && socket->state == STATE_PEER_CLOSED) { - ret |= MP_STREAM_POLL_HUP; + if (socket->state == STATE_PEER_CLOSED) { + // Peer-closed socket is both readable and writable: read will + // return EOF, write - error. Without this poll will hang on a + // socket which was closed by peer. + ret |= flags & (MP_STREAM_POLL_RD | MP_STREAM_POLL_WR); } } else { -- cgit v1.2.3 From ca16c3821053e5bf2b87aeb10007f73f31dc1eac Mon Sep 17 00:00:00 2001 From: Ville Skyttä Date: Mon, 29 May 2017 10:08:14 +0300 Subject: various: Spelling fixes --- cc3200/README.md | 2 +- docs/library/btree.rst | 2 +- docs/library/machine.SD.rst | 2 +- docs/library/machine.UART.rst | 2 +- docs/library/uhashlib.rst | 4 ++-- docs/library/utime.rst | 4 ++-- docs/sphinx_selective_exclude/README.md | 2 +- docs/sphinx_selective_exclude/modindex_exclude.py | 2 +- esp8266/README.md | 2 +- esp8266/machine_rtc.c | 2 +- examples/conwaylife.py | 4 ++-- examples/embedding/Makefile.upylib | 2 +- examples/embedding/README.md | 2 +- extmod/modlwip.c | 4 ++-- extmod/modwebsocket.c | 2 +- lib/timeutils/timeutils.c | 2 +- lib/utils/stdout_helpers.c | 2 +- py/asmthumb.c | 2 +- py/builtinimport.c | 4 ++-- py/compile.c | 4 ++-- py/misc.h | 2 +- py/mkenv.mk | 2 +- py/mpconfig.h | 2 +- py/obj.c | 2 +- py/objstr.c | 4 ++-- py/py.mk | 2 +- py/ringbuf.h | 2 +- py/stream.c | 2 +- py/vm.c | 4 ++-- qemu-arm/README.md | 2 +- tests/basics/namedtuple1.py | 2 +- tests/basics/try_reraise2.py | 2 +- tests/pyb/can.py | 2 +- tests/thread/stress_aes.py | 2 +- tests/wipy/uart.py | 2 +- tools/insert-usb-ids.py | 2 +- tools/pyboard.py | 2 +- unix/Makefile | 2 +- unix/modsocket.c | 2 +- windows/windows_mphal.c | 2 +- zephyr/modutime.c | 2 +- 41 files changed, 49 insertions(+), 49 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/cc3200/README.md b/cc3200/README.md index 753fd450a..53cad3ba0 100644 --- a/cc3200/README.md +++ b/cc3200/README.md @@ -138,7 +138,7 @@ If `WIPY_IP`, `WIPY_USER` or `WIPY_PWD` are omitted the default values (the ones ## Regarding old revisions of the CC3200-LAUNCHXL First silicon (pre-release) revisions of the CC3200 had issues with the ram blocks, and MicroPython cannot run -there. Make sure to use a **v4.1 (or higer) LAUNCHXL board** when trying this port, otherwise it won't work. +there. Make sure to use a **v4.1 (or higher) LAUNCHXL board** when trying this port, otherwise it won't work. ### Note regarding FileZilla diff --git a/docs/library/btree.rst b/docs/library/btree.rst index aebcbc160..bd7890586 100644 --- a/docs/library/btree.rst +++ b/docs/library/btree.rst @@ -69,7 +69,7 @@ Functions Open a database from a random-access `stream` (like an open file). All other parameters are optional and keyword-only, and allow to tweak advanced - paramters of the database operation (most users will not need them): + parameters of the database operation (most users will not need them): * `flags` - Currently unused. * `cachesize` - Suggested maximum memory cache size in bytes. For a diff --git a/docs/library/machine.SD.rst b/docs/library/machine.SD.rst index 0eb024602..608e95831 100644 --- a/docs/library/machine.SD.rst +++ b/docs/library/machine.SD.rst @@ -34,7 +34,7 @@ Methods .. method:: SD.init(id=0, pins=('GP10', 'GP11', 'GP15')) - Enable the SD card. In order to initalize the card, give it a 3-tuple: + Enable the SD card. In order to initialize the card, give it a 3-tuple: ``(clk_pin, cmd_pin, dat0_pin)``. .. method:: SD.deinit() diff --git a/docs/library/machine.UART.rst b/docs/library/machine.UART.rst index f9c8efef7..64ff28e1a 100644 --- a/docs/library/machine.UART.rst +++ b/docs/library/machine.UART.rst @@ -16,7 +16,7 @@ UART objects can be created and initialised using:: uart = UART(1, 9600) # init with given baudrate uart.init(9600, bits=8, parity=None, stop=1) # init with given parameters -Supported paramters differ on a board: +Supported parameters differ on a board: Pyboard: Bits can be 7, 8 or 9. Stop can be 1 or 2. With `parity=None`, only 8 and 9 bits are supported. With parity enabled, only 7 and 8 bits diff --git a/docs/library/uhashlib.rst b/docs/library/uhashlib.rst index cd0216dae..6b9a764ba 100644 --- a/docs/library/uhashlib.rst +++ b/docs/library/uhashlib.rst @@ -15,11 +15,11 @@ be implemented: * SHA1 - A previous generation algorithm. Not recommended for new usages, but SHA1 is a part of number of Internet standards and existing - applications, so boards targetting network connectivity and + applications, so boards targeting network connectivity and interoperatiability will try to provide this. * MD5 - A legacy algorithm, not considered cryptographically secure. Only - selected boards, targetting interoperatibility with legacy applications, + selected boards, targeting interoperatibility with legacy applications, will offer this. Constructors diff --git a/docs/library/utime.rst b/docs/library/utime.rst index 871f6c678..f3a067cde 100644 --- a/docs/library/utime.rst +++ b/docs/library/utime.rst @@ -146,8 +146,8 @@ Functions too distant inbetween, see below). The function returns **signed** value in the range [``-TICKS_PERIOD/2`` .. ``TICKS_PERIOD/2-1``] (that's a typical range definition for two's-complement signed binary integers). If the result is negative, it means that - ``ticks1`` occured earlier in time than ``ticks2``. Otherwise, it means that - ``ticks1`` occured after ``ticks2``. This holds ``only`` if ``ticks1`` and ``ticks2`` + ``ticks1`` occurred earlier in time than ``ticks2``. Otherwise, it means that + ``ticks1`` occurred after ``ticks2``. This holds ``only`` if ``ticks1`` and ``ticks2`` are apart from each other for no more than ``TICKS_PERIOD/2-1`` ticks. If that does not hold, incorrect result will be returned. Specifically, if two tick values are apart for ``TICKS_PERIOD/2-1`` ticks, that value will be returned by the function. diff --git a/docs/sphinx_selective_exclude/README.md b/docs/sphinx_selective_exclude/README.md index cc9725c21..dab140739 100644 --- a/docs/sphinx_selective_exclude/README.md +++ b/docs/sphinx_selective_exclude/README.md @@ -66,7 +66,7 @@ index for PDF, just the same as for HTML. search_auto_exclude ------------------- -Even if you exclude soem documents from toctree:: using only:: +Even if you exclude some documents from toctree:: using only:: directive, they will be indexed for full-text search, so user may find them and get confused. This plugin follows very simple idea that if you didn't include some documents in the toctree, then diff --git a/docs/sphinx_selective_exclude/modindex_exclude.py b/docs/sphinx_selective_exclude/modindex_exclude.py index 18b49cc80..bf8db795e 100644 --- a/docs/sphinx_selective_exclude/modindex_exclude.py +++ b/docs/sphinx_selective_exclude/modindex_exclude.py @@ -2,7 +2,7 @@ # This is a Sphinx documentation tool extension which allows to # exclude some Python modules from the generated indexes. Modules # are excluded both from "modindex" and "genindex" index tables -# (in the latter case, all members of a module are exlcuded). +# (in the latter case, all members of a module are excluded). # To control exclusion, set "modindex_exclude" variable in Sphinx # conf.py to the list of modules to exclude. Note: these should be # modules (as defined by py:module directive, not just raw filenames). diff --git a/esp8266/README.md b/esp8266/README.md index 897bb4737..d717d26fe 100644 --- a/esp8266/README.md +++ b/esp8266/README.md @@ -100,7 +100,7 @@ programming). __WiFi__ -Initally, the device configures itself as a WiFi access point (AP). +Initially, the device configures itself as a WiFi access point (AP). - ESSID: MicroPython-xxxxxx (x’s are replaced with part of the MAC address). - Password: micropythoN (note the upper-case N). - IP address of the board: 192.168.4.1. diff --git a/esp8266/machine_rtc.c b/esp8266/machine_rtc.c index 019b705ba..b17bcb261 100644 --- a/esp8266/machine_rtc.c +++ b/esp8266/machine_rtc.c @@ -93,7 +93,7 @@ void pyb_rtc_set_us_since_2000(uint64_t nowus) { int64_t delta = nowus - (((uint64_t)rtc_last_ticks * cal) >> 12); // As the calibration value jitters quite a bit, to make the - // clock at least somewhat practially usable, we need to store it + // clock at least somewhat practically usable, we need to store it system_rtc_mem_write(MEM_CAL_ADDR, &cal, sizeof(cal)); system_rtc_mem_write(MEM_DELTA_ADDR, &delta, sizeof(delta)); }; diff --git a/examples/conwaylife.py b/examples/conwaylife.py index f99796175..323f42e85 100644 --- a/examples/conwaylife.py +++ b/examples/conwaylife.py @@ -8,7 +8,7 @@ lcd.light(1) def conway_step(): for x in range(128): # loop over x coordinates for y in range(32): # loop over y coordinates - # count number of neigbours + # count number of neighbours num_neighbours = (lcd.get(x - 1, y - 1) + lcd.get(x, y - 1) + lcd.get(x + 1, y - 1) + @@ -25,7 +25,7 @@ def conway_step(): if self and not (2 <= num_neighbours <= 3): lcd.pixel(x, y, 0) # not enough, or too many neighbours: cell dies elif not self and num_neighbours == 3: - lcd.pixel(x, y, 1) # exactly 3 neigbours around an empty cell: cell is born + lcd.pixel(x, y, 1) # exactly 3 neighbours around an empty cell: cell is born # randomise the start def conway_rand(): diff --git a/examples/embedding/Makefile.upylib b/examples/embedding/Makefile.upylib index 873c0fd34..4663ad30a 100644 --- a/examples/embedding/Makefile.upylib +++ b/examples/embedding/Makefile.upylib @@ -170,7 +170,7 @@ SRC_QSTR_AUTO_DEPS += include $(MPTOP)/py/mkrules.mk # Value of configure's --host= option (required for cross-compilation). -# Deduce it from CROSS_COMPILE by default, but can be overriden. +# Deduce it from CROSS_COMPILE by default, but can be overridden. ifneq ($(CROSS_COMPILE),) CROSS_COMPILE_HOST = --host=$(patsubst %-,%,$(CROSS_COMPILE)) else diff --git a/examples/embedding/README.md b/examples/embedding/README.md index 989ce1fc8..804dfede6 100644 --- a/examples/embedding/README.md +++ b/examples/embedding/README.md @@ -18,7 +18,7 @@ Building the example is as simple as running: It's worth to trace what's happening behind the scenes though: 1. As a first step, a MicroPython library is built. This is handled by a -seperate makefile, Makefile.upylib. It is more or less complex, but the +separate makefile, Makefile.upylib. It is more or less complex, but the good news is that you won't need to change anything in it, just use it as is, the main Makefile shows how. What may require editing though is a MicroPython configuration file. MicroPython is highly configurable, so diff --git a/extmod/modlwip.c b/extmod/modlwip.c index c72849cf9..47669cb3a 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -373,7 +373,7 @@ STATIC err_t _lwip_tcp_recv(void *arg, struct tcp_pcb *tcpb, struct pbuf *p, err } /*******************************************************************************/ -// Functions for socket send/recieve operations. Socket send/recv and friends call +// Functions for socket send/receive operations. Socket send/recv and friends call // these to do the work. // Helper function for send/sendto to handle UDP packets. @@ -805,7 +805,7 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { mp_raise_OSError(MP_EINPROGRESS); } } - // Register our recieve callback. + // Register our receive callback. tcp_recv(socket->pcb.tcp, _lwip_tcp_recv); socket->state = STATE_CONNECTING; err = tcp_connect(socket->pcb.tcp, &dest, port, _lwip_tcp_connected); diff --git a/extmod/modwebsocket.c b/extmod/modwebsocket.c index 8200ea708..9e17d6a6d 100644 --- a/extmod/modwebsocket.c +++ b/extmod/modwebsocket.c @@ -132,7 +132,7 @@ STATIC mp_uint_t websocket_read(mp_obj_t self_in, void *buf, mp_uint_t size, int self->buf_pos = 0; self->to_recv = to_recv; - self->msg_sz = sz; // May be overriden by FRAME_OPT + self->msg_sz = sz; // May be overridden by FRAME_OPT if (to_recv != 0) { self->state = FRAME_OPT; } else { diff --git a/lib/timeutils/timeutils.c b/lib/timeutils/timeutils.c index 0af39a295..06915f25a 100644 --- a/lib/timeutils/timeutils.c +++ b/lib/timeutils/timeutils.c @@ -165,7 +165,7 @@ mp_uint_t timeutils_mktime(mp_uint_t year, mp_int_t month, mp_int_t mday, // // tm_tomorrow = list(time.localtime()) // tm_tomorrow[2] += 1 # Adds 1 to mday - // tomorrow = time.mktime(tm_tommorrow) + // tomorrow = time.mktime(tm_tomorrow) // // And not have to worry about all the weird overflows. // diff --git a/lib/utils/stdout_helpers.c b/lib/utils/stdout_helpers.c index 5f7a17d32..3de119757 100644 --- a/lib/utils/stdout_helpers.c +++ b/lib/utils/stdout_helpers.c @@ -9,7 +9,7 @@ * implementation below can be used. */ -// Send "cooked" string of given length, where every occurance of +// Send "cooked" string of given length, where every occurrence of // LF character is replaced with CR LF. void mp_hal_stdout_tx_strn_cooked(const char *str, size_t len) { while (len--) { diff --git a/py/asmthumb.c b/py/asmthumb.c index 749c1e405..7e92e4de4 100644 --- a/py/asmthumb.c +++ b/py/asmthumb.c @@ -52,7 +52,7 @@ void asm_thumb_end_pass(asm_thumb_t *as) { #if defined(MCU_SERIES_F7) if (as->base.pass == MP_ASM_PASS_EMIT) { - // flush D-cache, so the code emited is stored in memory + // flush D-cache, so the code emitted is stored in memory SCB_CleanDCache_by_Addr((uint32_t*)as->base.code_base, as->base.code_size); // invalidate I-cache SCB_InvalidateICache(); diff --git a/py/builtinimport.c b/py/builtinimport.c index d01ebbe73..6994fc48f 100644 --- a/py/builtinimport.c +++ b/py/builtinimport.c @@ -271,7 +271,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { if (level != 0) { // What we want to do here is to take name of current module, // chop trailing components, and concatenate with passed-in - // module name, thus resolving relative import name into absolue. + // module name, thus resolving relative import name into absolute. // This even appears to be correct per // http://legacy.python.org/dev/peps/pep-0328/#relative-imports-and-name // "Relative imports use a module's __name__ attribute to determine that @@ -441,7 +441,7 @@ mp_obj_t mp_builtin___import__(size_t n_args, const mp_obj_t *args) { #if MICROPY_CPYTHON_COMPAT // Store module as "__main__" in the dictionary of loaded modules (returned by sys.modules). mp_obj_dict_store(MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_loaded_modules_dict)), MP_OBJ_NEW_QSTR(MP_QSTR___main__), module_obj); - // Store real name in "__main__" attribute. Choosen semi-randonly, to reuse existing qstr's. + // Store real name in "__main__" attribute. Chosen semi-randonly, to reuse existing qstr's. mp_obj_dict_store(MP_OBJ_FROM_PTR(o->globals), MP_OBJ_NEW_QSTR(MP_QSTR___main__), MP_OBJ_NEW_QSTR(mod_name)); #endif } diff --git a/py/compile.c b/py/compile.c index 8533e0528..3b6a264d6 100644 --- a/py/compile.c +++ b/py/compile.c @@ -939,7 +939,7 @@ STATIC void c_del_stmt(compiler_t *comp, mp_parse_node_t pn) { } } } else { - // some arbitrary statment that we can't delete (eg del 1) + // some arbitrary statement that we can't delete (eg del 1) goto cannot_delete; } @@ -1090,7 +1090,7 @@ STATIC void compile_import_name(compiler_t *comp, mp_parse_node_struct_t *pns) { STATIC void compile_import_from(compiler_t *comp, mp_parse_node_struct_t *pns) { mp_parse_node_t pn_import_source = pns->nodes[0]; - // extract the preceeding .'s (if any) for a relative import, to compute the import level + // extract the preceding .'s (if any) for a relative import, to compute the import level uint import_level = 0; do { mp_parse_node_t pn_rel; diff --git a/py/misc.h b/py/misc.h index 146b9a8e4..caa5945bf 100644 --- a/py/misc.h +++ b/py/misc.h @@ -197,7 +197,7 @@ int DEBUG_printf(const char *fmt, ...); extern mp_uint_t mp_verbose_flag; // This is useful for unicode handling. Some CPU archs has -// special instructions for efficient implentation of this +// special instructions for efficient implementation of this // function (e.g. CLZ on ARM). // NOTE: this function is unused at the moment #ifndef count_lead_ones diff --git a/py/mkenv.mk b/py/mkenv.mk index eb1e44fef..b167b2533 100644 --- a/py/mkenv.mk +++ b/py/mkenv.mk @@ -32,7 +32,7 @@ ifeq ($(BUILD_VERBOSE),0) $(info Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.) endif -# default settings; can be overriden in main Makefile +# default settings; can be overridden in main Makefile PY_SRC ?= $(TOP)/py BUILD ?= build diff --git a/py/mpconfig.h b/py/mpconfig.h index a61d431e5..78e346d73 100644 --- a/py/mpconfig.h +++ b/py/mpconfig.h @@ -32,7 +32,7 @@ // mpconfigport.h is a file containing configuration settings for a // particular port. mpconfigport.h is actually a default name for -// such config, and it can be overriden using MP_CONFIGFILE preprocessor +// such config, and it can be overridden using MP_CONFIGFILE preprocessor // define (you can do that by passing CFLAGS_EXTRA='-DMP_CONFIGFILE=""' // argument to make when using standard MicroPython makefiles). // This is useful to have more than one config per port, for example, diff --git a/py/obj.c b/py/obj.c index 98ffa930b..493945a22 100644 --- a/py/obj.c +++ b/py/obj.c @@ -401,7 +401,7 @@ mp_obj_t mp_obj_id(mp_obj_t o_in) { return MP_OBJ_NEW_SMALL_INT(id); } else { // If that didn't work, well, let's return long int, just as - // a (big) positve value, so it will never clash with the range + // a (big) positive value, so it will never clash with the range // of small int returned in previous case. return mp_obj_new_int_from_uint((mp_uint_t)id); } diff --git a/py/objstr.c b/py/objstr.c index 70de0a693..a1e223572 100644 --- a/py/objstr.c +++ b/py/objstr.c @@ -798,7 +798,7 @@ STATIC mp_obj_t str_uni_strip(int type, size_t n_args, const mp_obj_t *args) { } assert(last_good_char_pos >= first_good_char_pos); - //+1 to accomodate the last character + //+1 to accommodate the last character size_t stripped_len = last_good_char_pos - first_good_char_pos + 1; if (stripped_len == orig_str_len) { // If nothing was stripped, don't bother to dup original string @@ -1811,7 +1811,7 @@ STATIC mp_obj_t str_islower(mp_obj_t self_in) { } #if MICROPY_CPYTHON_COMPAT -// These methods are superfluous in the presense of str() and bytes() +// These methods are superfluous in the presence of str() and bytes() // constructors. // TODO: should accept kwargs too STATIC mp_obj_t bytes_decode(size_t n_args, const mp_obj_t *args) { diff --git a/py/py.mk b/py/py.mk index 5ff1fd6a6..70891677d 100644 --- a/py/py.mk +++ b/py/py.mk @@ -25,7 +25,7 @@ ifeq ($(MICROPY_SSL_AXTLS),1) CFLAGS_MOD += -DMICROPY_SSL_AXTLS=1 -I../lib/axtls/ssl -I../lib/axtls/crypto -I../lib/axtls/config LDFLAGS_MOD += -Lbuild -laxtls else ifeq ($(MICROPY_SSL_MBEDTLS),1) -# Can be overriden by ports which have "builtin" mbedTLS +# Can be overridden by ports which have "builtin" mbedTLS MICROPY_SSL_MBEDTLS_INCLUDE ?= ../lib/mbedtls/include CFLAGS_MOD += -DMICROPY_SSL_MBEDTLS=1 -I$(MICROPY_SSL_MBEDTLS_INCLUDE) LDFLAGS_MOD += -L../lib/mbedtls/library -lmbedx509 -lmbedtls -lmbedcrypto diff --git a/py/ringbuf.h b/py/ringbuf.h index 5662594f7..5e108afad 100644 --- a/py/ringbuf.h +++ b/py/ringbuf.h @@ -33,7 +33,7 @@ typedef struct _ringbuf_t { uint16_t iput; } ringbuf_t; -// Static initalization: +// Static initialization: // byte buf_array[N]; // ringbuf_t buf = {buf_array, sizeof(buf_array)}; diff --git a/py/stream.c b/py/stream.c index c915110e0..d3fc767bb 100644 --- a/py/stream.c +++ b/py/stream.c @@ -51,7 +51,7 @@ STATIC mp_obj_t stream_readall(mp_obj_t self_in); #define STREAM_CONTENT_TYPE(stream) (((stream)->is_text) ? &mp_type_str : &mp_type_bytes) // Returns error condition in *errcode, if non-zero, return value is number of bytes written -// before error condition occured. If *errcode == 0, returns total bytes written (which will +// before error condition occurred. If *errcode == 0, returns total bytes written (which will // be equal to input size). mp_uint_t mp_stream_rw(mp_obj_t stream, void *buf_, mp_uint_t size, int *errcode, byte flags) { byte *buf = buf_; diff --git a/py/vm.c b/py/vm.c index 5094e3e45..ad3d9e29c 100644 --- a/py/vm.c +++ b/py/vm.c @@ -947,7 +947,7 @@ unwind_jump:; DECODE_UINT; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword - // We have folowing stack layout here: + // We have following stack layout here: // fun arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 2; #if MICROPY_STACKLESS @@ -1018,7 +1018,7 @@ unwind_jump:; DECODE_UINT; // unum & 0xff == n_positional // (unum >> 8) & 0xff == n_keyword - // We have folowing stack layout here: + // We have following stack layout here: // fun self arg0 arg1 ... kw0 val0 kw1 val1 ... seq dict <- TOS sp -= (unum & 0xff) + ((unum >> 7) & 0x1fe) + 3; #if MICROPY_STACKLESS diff --git a/qemu-arm/README.md b/qemu-arm/README.md index 329ae4d92..0cf93c7d5 100644 --- a/qemu-arm/README.md +++ b/qemu-arm/README.md @@ -4,7 +4,7 @@ provided by QEMU (http://qemu.org). The purposes of this port are to enable: 1. Continuous integration - - run tests agains architecture-specific parts of code base + - run tests against architecture-specific parts of code base 2. Experimentation - simulation & prototyping of anything that has architecture-specific code diff --git a/tests/basics/namedtuple1.py b/tests/basics/namedtuple1.py index 132dcf96b..70372f7ca 100644 --- a/tests/basics/namedtuple1.py +++ b/tests/basics/namedtuple1.py @@ -76,7 +76,7 @@ T4 = namedtuple("TupTuple", ("foo", "bar")) t = T4(1, 2) print(t.foo, t.bar) -# Try single string with comma field seperator +# Try single string with comma field separator # Not implemented so far #T2 = namedtuple("TupComma", "foo,bar") #t = T2(1, 2) diff --git a/tests/basics/try_reraise2.py b/tests/basics/try_reraise2.py index d9434397c..5648d2467 100644 --- a/tests/basics/try_reraise2.py +++ b/tests/basics/try_reraise2.py @@ -1,4 +1,4 @@ -# Reraise not the latest occured exception +# Reraise not the latest occurred exception def f(): try: raise ValueError("val", 3) diff --git a/tests/pyb/can.py b/tests/pyb/can.py index 617eb7ccc..7f2d070ec 100644 --- a/tests/pyb/can.py +++ b/tests/pyb/can.py @@ -158,7 +158,7 @@ print(can.recv(1)) del can -# Testing asyncronous send +# Testing asynchronous send can = CAN(1, CAN.LOOPBACK) can.setfilter(0, CAN.MASK16, 0, (0, 0, 0, 0)) diff --git a/tests/thread/stress_aes.py b/tests/thread/stress_aes.py index ecc963c92..df75e616c 100644 --- a/tests/thread/stress_aes.py +++ b/tests/thread/stress_aes.py @@ -8,7 +8,7 @@ # # The AES code comes first (code originates from a C version authored by D.P.George) # and then the test harness at the bottom. It can be tuned to be more/less -# agressive by changing the amount of data to encrypt, the number of loops and +# aggressive by changing the amount of data to encrypt, the number of loops and # the number of threads. # # MIT license; Copyright (c) 2016 Damien P. George on behalf of Pycom Ltd diff --git a/tests/wipy/uart.py b/tests/wipy/uart.py index a3a1c14e8..8e794015d 100644 --- a/tests/wipy/uart.py +++ b/tests/wipy/uart.py @@ -95,7 +95,7 @@ print(uart1.read() == None) print(uart1.write(b'123') == 3) print(uart0.read() == b'123') -# no pin assignemnt +# no pin assignment uart0 = UART(0, 1000000, pins=(None, None)) print(uart0.write(b'123456789') == 9) print(uart1.read() == None) diff --git a/tools/insert-usb-ids.py b/tools/insert-usb-ids.py index 420db34c5..cdccd3be9 100644 --- a/tools/insert-usb-ids.py +++ b/tools/insert-usb-ids.py @@ -1,4 +1,4 @@ -# Reads the USB VID and PID from the file specifed by sys.arg[1] and then +# Reads the USB VID and PID from the file specified by sys.argv[1] and then # inserts those values into the template file specified by sys.argv[2], # printing the result to stdout diff --git a/tools/pyboard.py b/tools/pyboard.py index 5eac030bd..921ffc52d 100755 --- a/tools/pyboard.py +++ b/tools/pyboard.py @@ -69,7 +69,7 @@ class TelnetToSerial: self.tn.write(bytes(password, 'ascii') + b"\r\n") if b'for more information.' in self.tn.read_until(b'Type "help()" for more information.', timeout=read_timeout): - # login succesful + # login successful from collections import deque self.fifo = deque() return diff --git a/unix/Makefile b/unix/Makefile index 837ddf2b7..006bce0ef 100644 --- a/unix/Makefile +++ b/unix/Makefile @@ -262,7 +262,7 @@ coverage_test: coverage gcov -o build-coverage/extmod ../extmod/*.c # Value of configure's --host= option (required for cross-compilation). -# Deduce it from CROSS_COMPILE by default, but can be overriden. +# Deduce it from CROSS_COMPILE by default, but can be overridden. ifneq ($(CROSS_COMPILE),) CROSS_COMPILE_HOST = --host=$(patsubst %-,%,$(CROSS_COMPILE)) else diff --git a/unix/modsocket.c b/unix/modsocket.c index 9ca04b88b..c7be6461e 100644 --- a/unix/modsocket.c +++ b/unix/modsocket.c @@ -58,7 +58,7 @@ from socket_more_funcs2 import * ------------------- I.e. this module should stay lean, and more functions (if needed) - should be add to seperate modules (C or Python level). + should be add to separate modules (C or Python level). */ #define MICROPY_SOCKET_EXTRA (0) diff --git a/windows/windows_mphal.c b/windows/windows_mphal.c index 1dd3105d8..a73140e54 100644 --- a/windows/windows_mphal.c +++ b/windows/windows_mphal.c @@ -72,7 +72,7 @@ void mp_hal_stdio_mode_orig(void) { // Previous versions of the mp_hal code would install a handler whenever Ctrl-C input is // allowed and remove the handler again when it is not. That is not necessary though (1), // and it might introduce problems (2) because console notifications are delivered to the -// application in a seperate thread. +// application in a separate thread. // (1) mp_hal_set_interrupt_char effectively enables/disables processing of Ctrl-C via the // ENABLE_PROCESSED_INPUT flag so in raw mode console_sighandler won't be called. // (2) if mp_hal_set_interrupt_char would remove the handler while Ctrl-C was issued earlier, diff --git a/zephyr/modutime.c b/zephyr/modutime.c index 378068bb3..0c268046a 100644 --- a/zephyr/modutime.c +++ b/zephyr/modutime.c @@ -36,7 +36,7 @@ #include "extmod/utime_mphal.h" STATIC mp_obj_t mod_time_time(void) { - /* The absense of FP support is deliberate. The Zephyr port uses + /* The absence of FP support is deliberate. The Zephyr port uses * single precision floats so the fraction component will start to * lose precision on devices with a long uptime. */ -- cgit v1.2.3 From a0dbbbebb8c0286e00ae06751b0173cbca4ec801 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 3 Jun 2017 22:32:07 +0300 Subject: extmod/modlwip: connect: For non-blocking mode, return EINPROGRESS. Instead of ETIMEDOUT. This is consistent with POSIX: http://pubs.opengroup.org/onlinepubs/7908799/xns/connect.html --- extmod/modlwip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index 47669cb3a..aa93eaa27 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -822,7 +822,7 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { if (socket->state != STATE_CONNECTING) break; } if (socket->state == STATE_CONNECTING) { - mp_raise_OSError(MP_ETIMEDOUT); + mp_raise_OSError(MP_EINPROGRESS); } } else { while (socket->state == STATE_CONNECTING) { -- cgit v1.2.3 From 5da8de2b66d3f43107e1e745afa9bb6a4bf601eb Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 4 Jun 2017 12:30:41 +0300 Subject: extmod/modlwip: Fix error codes for duplicate calls to connect(). If socket is already connected, POSIX requires returning EISCONN. If connection was requested, but not yet complete (for non-blocking socket), error code is EALREADY. http://pubs.opengroup.org/onlinepubs/7908799/xns/connect.html --- extmod/modlwip.c | 4 ++-- py/mperrno.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index aa93eaa27..d243985ad 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -800,9 +800,9 @@ STATIC mp_obj_t lwip_socket_connect(mp_obj_t self_in, mp_obj_t addr_in) { case MOD_NETWORK_SOCK_STREAM: { if (socket->state != STATE_NEW) { if (socket->state == STATE_CONNECTED) { - mp_raise_OSError(MP_EALREADY); + mp_raise_OSError(MP_EISCONN); } else { - mp_raise_OSError(MP_EINPROGRESS); + mp_raise_OSError(MP_EALREADY); } } // Register our receive callback. diff --git a/py/mperrno.h b/py/mperrno.h index 4d092de45..6ea99ae22 100644 --- a/py/mperrno.h +++ b/py/mperrno.h @@ -73,6 +73,7 @@ #define MP_ECONNABORTED (103) // Software caused connection abort #define MP_ECONNRESET (104) // Connection reset by peer #define MP_ENOBUFS (105) // No buffer space available +#define MP_EISCONN (106) // Transport endpoint is already connected #define MP_ENOTCONN (107) // Transport endpoint is not connected #define MP_ETIMEDOUT (110) // Connection timed out #define MP_ECONNREFUSED (111) // Connection refused @@ -127,6 +128,7 @@ #define MP_ECONNABORTED ECONNABORTED #define MP_ECONNRESET ECONNRESET #define MP_ENOBUFS ENOBUFS +#define MP_EISCONN EISCONN #define MP_ENOTCONN ENOTCONN #define MP_ETIMEDOUT ETIMEDOUT #define MP_ECONNREFUSED ECONNREFUSED -- cgit v1.2.3 From 50de6d2fab9ad67c6df0d74ce4b8c3704d1de090 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sun, 4 Jun 2017 13:45:37 +0300 Subject: extmod/modlwip: accept: Fix error code for non-blocking mode. In non-blocking mode, if no pending connection available, should return EAGAIN, not ETIMEDOUT. --- extmod/modlwip.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'extmod/modlwip.c') diff --git a/extmod/modlwip.c b/extmod/modlwip.c index d243985ad..01190d200 100644 --- a/extmod/modlwip.c +++ b/extmod/modlwip.c @@ -732,7 +732,9 @@ STATIC mp_obj_t lwip_socket_accept(mp_obj_t self_in) { // accept incoming connection if (socket->incoming.connection == NULL) { - if (socket->timeout != -1) { + if (socket->timeout == 0) { + mp_raise_OSError(MP_EAGAIN); + } else if (socket->timeout != -1) { for (mp_uint_t retries = socket->timeout / 100; retries--;) { mp_hal_delay_ms(100); if (socket->incoming.connection != NULL) break; -- cgit v1.2.3