8000 Discussion of Python 3.7 support · Issue #7886 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content

Discussion of Python 3.7 support #7886

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

Open
1 of 29 tasks
mattytrentini opened this issue Oct 8, 2021 · 4 comments
Open
1 of 29 tasks

Discussion of Python 3.7 support #7886

mattytrentini opened this issue Oct 8, 2021 · 4 comments

Comments

@mattytrentini
Copy link
Contributor
mattytrentini commented Oct 8, 2021

This issue is intended to track the status of Python 3.7 core features as implemented by MicroPython. Not all of these changes should necessarily be implemented in MicroPython but documenting their status is important.

Python 3.7.0 (final) was released on the 27 June 2018. The Features for 3.7 are defined in PEP 537 and an explanation of the changes can be found in What's New in Python 3.7.

  • PEP 538 - Coercing the legacy C locale to a UTF-8 based locale
  • PEP 539 - A New C-API for Thread-Local Storage in CPython
  • PEP 540 - UTF-8 mode
  • PEP 552 - Deterministic pyc
  • PEP 553 - Built-in breakpoint()
  • PEP 557 - Data Classes
  • PEP 560 - Core support for typing module and generic types
  • PEP 562 - Module __getattr__ and __dir__; see partial implementation (__getattr__): 454cca6
  • PEP 563 - Postponed Evaluation of Annotations
  • PEP 564 - Time functions with nanosecond resolution; see partial implementation: d4b61b0
  • PEP 565 - Show DeprecationWarning in __main__
  • PEP 567 - Context Variables

Other language changes

  • async and await are now reserved keywords
  • dict objects must preserve insertion-order
  • More than 255 arguments can now be passed to a function, and a function can now have more than 255 parameters
  • bytes.fromhex() and bytearray.fromhex() now ignore all ASCII whitespace, not only spaces
  • str, bytes, and bytearray gained support for the new isascii() method, which can be used to test if a string or bytes contain only the ASCII characters
  • ImportError now displays module name and module __file__ path when from ... import ... fails
  • Circular imports involving absolute imports with binding a submodule to a name are now supported
  • object.__format__(x, '') is now equivalent to str(x) rather than format(str(self), '')
  • In order to better support dynamic creation of stack traces, types.TracebackType can now be instantiated from Python code, and the tb_next attribute on tracebacks is now writable
  • When using the -m switch, sys.path[0] is now eagerly expanded to the full starting directory path, rather than being left as the empty directory (which allows imports from the current working directory at the time when an import occurs)
  • The new -X importtime option or the PYTHONPROFILEIMPORTTIME environment variable can be used to show the timing of each module import

Changes to MicroPython built-in modules

  • asyncio (many, may need a separate ticket)
  • gc - New features: gc.freeze(), gc.unfreeze(), gc-get_freeze_count
  • math - math.remainder() added to implement IEEE 754-style remainder
  • re - A number of tidy up features including better support for splitting on empty strings and copy support for compiled expressions and match objects
  • sys - sys.breakpointhook() added. sys.get(/set)_coroutine_origin_tracking_depth() added.
  • time - Mostly updates to support nanosecond resolution in PEP564, see above.

(Changes to non-built-in modules will need to be documented elsewhere.)

8000
@mattytrentini
Copy link
Contributor Author

Also see Discussion of Python 3.5 support #1329 and Discussion of Python 3.6 support #2415.

@beyonlo
Copy link
beyonlo commented Oct 9, 2021

Hi all!

I vote the priority for the "asyncio (many, may need a separate ticket)"

In my opinion, uasyncio is a pillar of development software using MicroPython.

Thank you

@peterhinch
Copy link
Contributor

Given that uasyncio V3 is a subset of CPython V3.8 asyncio my guess is that @dpgeorge has already reviewed these changes and decided which to include.

@mattytrentini
Copy link
Contributor Author

Yes, many (most?) of the asyncio features here have already been implemented; but, to be complete, I'll list them all and we can strike through them if they're complete and note where they differ.

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

No branches or pull requests

3 participants
0