Skip to content

Crash when extending native class #7305

@ali1234

Description

@ali1234

CircuitPython version

Adafruit CircuitPython 8.0.0-beta.4 on 2022-10-30; Raspberry Pi Pico with rp2040

(It also crashes 7.)

Code/REPL

import board
import pwmio

class PWMOutExtend(pwmio.PWMOut):
    def __init__(self, pin, frequency=1000, slew_rate=1000):
        super().__init__(pin, frequency=frequency)
        self.foo_bar_baz = 0
        self.duty_cycle = 0

led = PWMOutExtend(board.GP25, frequency=1000)

print('before')
led.foo_bar_baz = 0
print('after')

Behavior

You see "before" on the REPL and then the device freezes. If you put it in code.py you now have to enter safe mode to access CIRCUITPY.

Description

Every line of the example is necessary except for the prints. In particular all three assignments are necessary.

I can't reproduce it when extending a class I defined myself.

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions