Commit Graph

12059 Commits

Author SHA1 Message Date
Damien George 7241d90272 py/repl: Use mp_load_method_protected to prevent leaking of exceptions.
This patch fixes the possibility of a crash of the REPL when tab-completing
an object which raises an exception when its attributes are accessed.

See issue #3729.
2018-05-10 23:05:43 +10:00
Damien George 529860643b py/modbuiltins: Make built-in hasattr work properly for user types.
It now allows __getattr__ in a user type to raise AttributeError when the
attribute does not exist.
2018-05-10 23:03:30 +10:00
Damien George bc87b862fd py/runtime: Add mp_load_method_protected helper which catches exceptions
This new helper function acts like mp_load_method_maybe but is wrapped in
an NLR handler so it can catch exceptions.  It prevents AttributeError from
propagating out, and optionally all other exceptions.  This helper can be
used to fully implement hasattr (see follow-up commit), and also for cases
where mp_load_method_maybe is used but it must now raise an exception.
2018-05-10 23:00:04 +10:00
Scott Shawcroft e4ec672464
Merge pull request #821 from deanm1278/master
add kwargs to bitbangio spi
2018-05-09 13:17:07 -07:00
dean 82b5efa7bc remove unnecessary comment 2018-05-09 15:14:26 -04:00
dean fba1e221c6 DM: add kwargs to bitbangio spi 2018-05-09 15:12:42 -04:00
Damien George eb88803ac8 py/{modbuiltins,repl}: Start qstr probing from after empty qstr.
The list of qstrs starts with MP_QSTR_NULL followed by MP_QSTR_, and these
should never appear in dir() or REPL tab completion, so skip them.
2018-05-09 16:15:02 +10:00
Damien George c1115d931f stm32/usb: Use correct type for USB HID object. 2018-05-09 16:00:19 +10:00
Damien George e1bc85416a stm32/usb: Fix broken pyb.have_cdc() so it works again. 2018-05-09 15:59:48 +10:00
Damien George e638defff4 stm32/i2c: Make sure stop condition is sent after receiving addr nack. 2018-05-09 15:53:09 +10:00
Dan Halbert 734596c90a
Merge pull request #820 from tannewt/pause_audio
Add pause/resume control to AudioOut and I2SOut
2018-05-08 16:16:20 -04:00
Scott Shawcroft fc7c25af6d Make resume idempotent (allowing you to call it twice without complaining.) 2018-05-08 13:00:05 -07:00
Scott Shawcroft 24116eff23 Tweak exception message. 2018-05-08 12:44:27 -07:00
Scott Shawcroft 50fc90bc5f Add pause/resume control to AudioOut and I2SOut
Fixes #808
2018-05-08 11:53:13 -07:00
Scott Shawcroft d3a5d40374
Merge pull request #785 from notro/rtc_calibration
atmel-samd/samd21: Rework clock setup + calibration
2018-05-08 10:55:51 -07:00
Scott Shawcroft 64bd95ea01
Merge pull request #819 from dhalbert/cache
enable cache in SAMD51
2018-05-08 10:40:30 -07:00
Scott Shawcroft b46cc9d29a
Merge pull request #817 from jepler/uzlib-as-submodule
uzlib: convert to submodule
2018-05-08 10:34:51 -07:00
Damien George 2ada1124d4 tests/cpydiff: Remove types_int_tobytesfloat now that it doesn't fail.
Commit e269cabe3e added a check that the
first argument to the to_bytes() method is an integer, and now uPy
follows CPython behaviour and raises a TypeError for this test.

Note: CPython checks the argument types before checking the number of
arguments, but uPy does it the other way around, so they give different
exception messages for this test, but still the same type, a TypeError.
2018-05-08 17:05:32 +10:00
Dan Halbert e82f37c60e enable cache in SAMD51 2018-05-07 21:55:37 -04:00
Jeff Epler a6072f7ae3 uzlib: convert to submodule
Textualy, the files in lib/uzlib/src were identical to the ones committed
in extmod/uzlib so there should be no behavioral change possible as a
result of this commit.
2018-05-07 20:03:30 -05:00
Noralf Trønnes 5d5d14709f Add clock representation with calibration
Add a python representation of the clocks with the possibility to change
the calbration of clock sources.
2018-05-07 23:04:02 +02:00
Scott Shawcroft b0fba2864c
Merge pull request #814 from larsks/feature/utime-compile-only
esp8266/modutime.c: remove symbol conflicts between time and utime modules
2018-05-07 13:53:05 -07:00
Lars Kellogg-Stedman 56bf411d21 esp8266/modutime.c: remove symbol conflicts between time and utime modules
this renames symbols in modutime.c so that it no longer conflicts with
the time module.  This commit does not enable the utime module; it
simply makes it easier for a local developer to do so.
2018-05-07 11:55:20 -04:00
Dan Halbert bca5aec5f4
Merge pull request #813 from jerryneedell/patch-2
Update mpconfigport.h
2018-05-07 10:19:39 -04:00
jerryneedell b617271191
Update mpconfigport.h
comment out define of CIRCUITPYTHON_BOOT_OUTPUT_FILE  for NRF52  --  it does not work properly
2018-05-07 08:59:24 -04:00
Scott Shawcroft d42c83ff41
Merge pull request #806 from jepler/hashlib-py3
Rename uhashlib->hashlib, improve python3 compatibility
2018-05-06 22:36:52 -07:00
Scott Shawcroft c4cfd1170e
Merge pull request #811 from dhalbert/3.0_filesystem_writability_on_boot
3.0: boot.py change of filesystem writability would get overridden.
2018-05-06 22:27:54 -07:00
Dan Halbert 224e245e05 clarify comment 2018-05-07 00:08:26 -04:00
Dan Halbert fc214fb320 boot.py change of filesystem writability would get overridden. 2018-05-06 23:48:11 -04:00
Jeff Epler 2955ada22f docs: fix references to uhashlib 2018-05-06 12:31:54 -05:00
Jeff Epler 11a97bdffe uhashlib: masquerade as hashlib for python3 compatibility 2018-05-06 12:31:54 -05:00
Jeff Epler 005226ae54 uhashlib: some functions should refuse unicode for python3 compatibility
.. this maybe should be subject to MICROPY_CPYTHON_COMPAT, except that
is not defined in the main circuitpython ports so it would be a change
that makes no difference.
2018-05-06 12:31:54 -05:00
Jeff Epler b2084d37d6 tests: add new tests for uhashlib differences
.. these tests currently fail, but a subsequent commit will
fix them
2018-05-06 12:31:53 -05:00
Noralf Trønnes 2893e795fc atmel-samd/samd21: Use XOSC32K on boards with a crystal
Use XOSC32K on boards that have BOARD_HAS_CRYSTAL defined and set to 1.
2018-05-05 18:45:15 +02:00
Noralf Trønnes 4adba51569 atmel-samd/samd21: Rework clock setup
Make clock setup explicit instead of using the convoluted asf4 macro setup.

enable_clock_generator():
- Add GCLK_GENCTRL_OE to stick with the current setup.
- Handle divisor larger than 31 for generator 2
- Change the source argument so it can take the GCLK_GENCTRL_SRC_XXXX_Val
  macros without casting to uint8_t.

This patch should not introduce any functional changes except keeping
GCLK_GENCTRL_OE enabled when the I2S clock is enabled.
2018-05-05 18:01:13 +02:00
Scott Shawcroft d32349cee8
Merge pull request #804 from dhalbert/boot_out_fixes
3.0: Handle bad power on reset.
2018-05-04 10:06:35 -07:00
Scott Shawcroft 034b189c75
Merge pull request #805 from dhalbert/3.0_cpx_freeze_hid_cpx
3.0: add CircuitPlayground and HID to CPX frozen modules
2018-05-04 09:59:16 -07:00
Dan Halbert 32363b801b 3.0: add CircuitPlayground and HID to CPX frozen modules 2018-05-04 08:44:33 -04:00
Damien George 74ab341d3a tests/cpydiff: Remove working cases from types_float_rounding. 2018-05-04 22:30:50 +10:00
Dan Halbert f73e06d910 minor function API improvement 2018-05-04 08:28:05 -04:00
Damien George cd9d71edc8 tests/cpydiff: Remove types_str_decodeerror now that it succeeds.
Commit 68c28174d0 implemented checking for
valid utf-8 data.
2018-05-04 22:27:14 +10:00
Damien George 4b5111f8e1 tests/cpydiff: Remove core_function_unpacking now that it succeeds.
Commit 1e70fda69f fixes this difference.
2018-05-04 22:19:50 +10:00
Noralf Trønnes f21c2494cb atmel-samd/samd21: Enable OSC32K
Enable OSC32K which is used by the RTC.
For some reason the RTC worked without enabling it.
2018-05-04 13:34:30 +02:00
Noralf Trønnes 4a2a553647 atmel-samd/clocks: Split out samd21_clocks.c and samd51_clocks.c
Enhance readability by separating the samd21 and samd51 clock code.

This patch should not introduce any functional changes.
2018-05-04 13:32:56 +02:00
Damien George 3cf02be4e0 py/emitnx86: Fix 32-bit x86 native emitter build by including header. 2018-05-04 20:39:16 +10:00
Damien George aea71dbde0 stm32/Makefile: Use -O2 to optimise compilation of lib/libc/string0.c. 2018-05-04 15:53:51 +10:00
Damien George cb3456ddfe stm32: Don't use %lu or %lx for formatting, use just %u or %x.
On this 32-bit arch there's no need to use the long version of the format
specifier.  It's only there to appease the compiler which checks the type
of the args passed to printf.  Removing the "l" saves a bit of code space.
2018-05-04 15:52:03 +10:00
Damien George b614dc73b0 stm32/dma: Fix duplicate typedef of struct, it's typedef'd in dma.h. 2018-05-04 15:35:43 +10:00
Damien George 318f874cda extmod/modlwip: In ioctl handle case when socket is in an error state.
Using MP_STREAM_POLL_HUP for ERR_RST state follows how *nix handles this
case.
2018-05-04 15:15:04 +10:00
Dan Halbert f486ead84a Handle bad power on reset. 2018-05-03 23:43:02 -04:00