Skip to content

extmod/uasyncio: Fix syntax of generator functions#10190

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
damz:pr/uasyncio-generator
Dec 14, 2022
Merged

extmod/uasyncio: Fix syntax of generator functions#10190
dpgeorge merged 1 commit into
micropython:masterfrom
damz:pr/uasyncio-generator

Conversation

@damz
Copy link
Copy Markdown
Contributor

@damz damz commented Dec 8, 2022

What?

Fix the syntax of generator functions in the uasyncio package:

  • await is only valid in an async function
  • async functions that use yield are actually async generators (a construct not supported by the compiler right now)

Why?

The compiler is not picky right now, but these are actually all syntax errors.

@damz damz force-pushed the pr/uasyncio-generator branch from 1c0ca83 to a05d80c Compare December 8, 2022 18:25
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2022

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 

1 similar comment
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2022

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 

Comment thread extmod/uasyncio/event.py
@dpgeorge
Copy link
Copy Markdown
Member

Thanks for this, I agree with the change. It's actually close to what I did in #6668, which adds support for async generators.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Dec 13, 2022
@damz damz force-pushed the pr/uasyncio-generator branch from a05d80c to 74c5668 Compare December 13, 2022 16:22
@damz
Copy link
Copy Markdown
Contributor Author

damz commented Dec 13, 2022

@dpgeorge Thanks for the review. I updated the PR as requested.

@github-actions
Copy link
Copy Markdown

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 

@damz damz force-pushed the pr/uasyncio-generator branch from 74c5668 to c8c8399 Compare December 13, 2022 16:35
@github-actions
Copy link
Copy Markdown

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 

The compiler is not picky right now, but these are actually all syntax
errors:
- await is only valid in an async function
- async functions that use yield are actually async generators (a construct
  not supported by the compiler right now)
@dpgeorge dpgeorge force-pushed the pr/uasyncio-generator branch from c8c8399 to 0eba00a Compare December 14, 2022 02:30
@github-actions
Copy link
Copy Markdown

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 

@dpgeorge dpgeorge merged commit 0eba00a into micropython:master Dec 14, 2022
@dpgeorge
Copy link
Copy Markdown
Member

Thanks for updating. Rebased and merged.

tannewt pushed a commit to tannewt/circuitpython that referenced this pull request Mar 31, 2025
Add guards to common_hal_pulseio_pulse(in|out)_deinit to prevent doub…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extmod Relates to extmod/ directory in source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants