Skip to content

Support relative import in custom __import__ callback #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

oliver-joos
Copy link

I manually rebased your branch onto current upstream master branch.

I had to move some code into the new evaluate_relative_import() function. Type checking of globals now also captures non-relative imports. And I added 2 tests for this type checking to increase coverage.

dpgeorge and others added 30 commits December 30, 2021 15:47
Signed-off-by: Damien George <damien@micropython.org>
Because the GENERIC board won't fit in the flash defined by esp8266_ota.ld.

Signed-off-by: Damien George <damien@micropython.org>
Following the unix port.

Support for building variants with msvc was done by @stinos.
The application isn't necessarily called 'micropython' especially
not When using variants, i.e. the tests need to be ran using $(PROG).
This is the same fix as applied in uselect_poll_basic.py.
This makes sure changes from previous related commits actually work.
And how they relate to MicroPython.  As these features are implemented (or
the decision is made to not implement them) the tables can be updated to
document the differences between MicroPython and standard Python.
The qstr_last_chunk is not collected by the garbage collector.  This relies
on the assertion that qstr_pool_t also references the qstr_last_chunk.  If
an exception is raised while allocating the qstr_pool_t, qstr_last_chunk
has to be invalidated not to become a dangling reference at the next
garbage collection.

Signed-off-by: Emilie Feral <emilie.feral@numworks.com>
- Cleanup pyexec flags definitions so it's clear they are different.
- Use mp_uint_t for exec_flags because it should be unsigned.
- Add default values for I2S features added in ESP-IDF 4.4.
- Add workaround for bug introduced in ESP-IDF 4.4
  (espressif/esp-idf#8121).
After changing the bitstream implementation to use the RMT driver in
commit 72d8615
("esp32/machine_bitstream.c: Replace with RMT-based driver."), using
multiple `Neopixel` instances shows signal duplication between the
instances (i.e. a `write()` on one instance is written to all instances).

On invocation, the rmt driver configures the GPIO matrix to route the
output signal to the respective GPIO pin.  When called for a different
`NeoPixel` instance using a different pin, the new route is established,
but the old route still exists.  Now, the RMT output signal is sent to both
pins.

Fix this by setting the standard GPIO output function for the current pin
after uninstalling the RMT driver.

Signed-off-by: Simon Baatz <gmbnomis@gmail.com>
The top value was off by 1: in order to count n ticks it has to be set to
n-1.

Fixes issue micropython#8122.
The duty is saved and set whenever the frequency is changed, unless the
duty rate was not set yet.
As a prerequisite to upgrading to Zephyr v2.7.0, upgrade CI to use
Zephyr docker image v0.21.0. In particular, this is needed to pick up a
newer CMake version because Zephyr v2.7.0 increased the minimum CMake
version required to 3.20.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
As a prerequisite to upgrading to Zephyr v2.7.0, upgrade the minimum
CMake version required for the Zephyr port to 3.20.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The reboot header was moved to a different path in Zephyr v2.6.0. The
old path was deprecated for two releases (v2.6.0 and v2.7.0) and will no
longer be supported after Zephyr v2.7.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Updates the Zephyr port to get the UART console device from devicetree
instead of Kconfig. The Kconfig option CONFIG_UART_CONSOLE_ON_DEV_NAME
was removed in Zephyr v2.7.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
CONFIG_USB was removed in Zephyr v2.7.0 after some Kconfig rework that
made it sufficient to use CONFIG_USB_DEVICE_STACK only.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
- The wrong ACK is returned and checked.
- Send secondary DNS to google.
Signed-off-by: Damien George <damien@micropython.org>
Fixes build on MCUs with built-in USB HS PHY.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
climblinne and others added 27 commits March 7, 2022 14:12
This adds the "Not relevant" designation to PEP 486 since it has to do with
the Python Launcher for Windows and not the Python language itself.

Also fix a typo while we are touching this line.

Signed-off-by: David Lechner <david@pybricks.com>
Fixes issue micropython#8380.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
The disk_access header was moved to a different path in Zephyr v2.6.0.
The old path was deprecated for two releases (v2.6.0 and v2.7.0) and
will no longer be supported after Zephyr v2.7.0.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
Updates the Zephyr port build instructions and CI to use the latest
Zephyr release tag.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
The .hex file contains more information than .bin, useful for flashing.

Signed-off-by: Damien George <damien@micropython.org>
Signed-off-by: Damien George <damien@micropython.org>
To not rely on sets, which are an optional feature.

Signed-off-by: Damien George <damien@micropython.org>
Add support for configuring drive strength of output pins with `drive` 
keyword argument and `DRIVE_*` constants.
Add brief documentation of the new `drive` keyword argument.
Update documents with new common names for the drive strength constants.
Updated DRIVE_x constants representing pin drive strength.

Signed-off-by: Philipp Ebensberger
The method was changed, but not for the CSx pins.  No functional change.
OCOTP_Init() has been removed from mphalport.c.  The library files are
missing for the MIMXRT1015, and for just reading the OCOTP the Init is not
required.
Sometimes frames could not be sent immediately because the controller was
still busy with previous frames.  Then, an error was returned to lwip.
This fix adds a limited number of retries for this busy state, waiting
100µs before the next attempt.  Typically the transmit succeeds now at the
second attempt.

Second change: Reset the controller for a clean state after soft reset.
Teensy 4.1 used different pins for SPI1 than Teensy 4.0, which made the
boards unnecessarily different.
If the board directory contains a manifest.py file, it will be included.
File not found errors will be ignored.
That caused Ethernet to lock up at high data rates after ~200MByte data
average in a row.  Tested now with data bursts up to 10 GByte and overall
data rates of ~8MByte/s at the Eth100 port.
Ensure the symmetry of PWM: the duty rate of X and Q channels was not 50%,
when it should have been.  That is evident at high frequencies, like 15Mhz
or 37.5 MHz.  At low frequencies the deviation mattered less.  The A/B
channels were fine.

Also round up or down non-integer division factors. Before, always the
floor value was used.
From RFC 1950 section 2.2: "CINFO is the base-2 logarithm of the LZ77
window size, minus eight (CINFO=7 indicates a 32K window size)"

Signed-off-by: Daniël van de Giessen <daniel@dvdgiessen.nl>
It is currently not enabled by default on any board.
The globals need to be forwarded from the callers context.
globals() needs to be provided in case __import__ is a Python function
@oliver-joos oliver-joos force-pushed the fix-override-relative-import branch from ef223fd to 9a08ff6 Compare March 12, 2022 20:06
zsquareplusc pushed a commit that referenced this pull request Mar 13, 2022
asan considers that memcmp(p, q, N) is permitted to access N bytes at each
of p and q, even for values of p and q that have a difference earlier.
Accessing additional values is frequently done in practice, reading 4 or
more bytes from each input at a time for efficiency, so when completing
"non_exist<TAB>" in the repl, this causes a diagnostic:

    ==16938==ERROR: AddressSanitizer: global-buffer-overflow on
    address 0x555555cd8dc8 at pc 0x7ffff726457b bp 0x7fffffffda20 sp 0x7fff
    READ of size 9 at 0x555555cd8dc8 thread T0
        #0 0x7ffff726457a  (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xb857a)
        #1 0x555555b0e82a in mp_repl_autocomplete ../../py/repl.c:301
        micropython#2 0x555555c89585 in readline_process_char ../../lib/mp-readline/re
        micropython#3 0x555555c8ac6e in readline ../../lib/mp-readline/readline.c:513
        micropython#4 0x555555b8dcbd in do_repl /home/jepler/src/micropython/ports/uni
        micropython#5 0x555555b90859 in main_ /home/jepler/src/micropython/ports/unix/
        micropython#6 0x555555b90a3a in main /home/jepler/src/micropython/ports/unix/m
        micropython#7 0x7ffff619a09a in __libc_start_main ../csu/libc-start.c:308
        micropython#8 0x55555595fd69 in _start (/home/jepler/src/micropython/ports/uni

    0x555555cd8dc8 is located 0 bytes to the right of global variable
    'import_str' defined in '../../py/repl.c:285:23' (0x555555cd8dc0) of
    size 8
      'import_str' is ascii string 'import '

Signed-off-by: Jeff Epler <jepler@gmail.com>
@zsquareplusc zsquareplusc merged commit cc31c03 into zsquareplusc:fix-override-relative-import Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy