Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ricksorensen/micropython-lib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: micropython/micropython-lib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 3 commits
  • 7 files changed
  • 1 contributor

Commits on Oct 1, 2025

  1. inspect: Implement a very basic signature function.

    This implements a very basic `inspect.signature()` function.
    
    At the moment it returns only a simple `Signature` instance with a
    `parameters` attribute that holds an `OrderedDict` whose length matches the
    arity of the input function (the number of arguments it takes).
    
    So, the following code works and is compatible with CPython:
    
        def f(a, b, *, c):
            pass
    
        print(len(inspect.signature(f).parameters))
    
    That should print 3.
    
    Signed-off-by: Damien George <[email protected]>
    dpgeorge committed Oct 1, 2025
    Configuration menu
    Copy the full SHA
    b4565b4 View commit details
    Browse the repository at this point in the history
  2. datetime: Apply localtz patch to include naive date/time support.

    This commit applies the existing `localtz.patch` patch to add support for
    naive datetime objects.  That is, objects that don't have any info about
    the current timezone.
    
    This allows `datetime.datetime.now()` to work; prior to this patch it would
    raise NotImplementedError.
    
    Although we don't really have support for localtime vs gmtime on
    bare-metal, ports such as the unix port and webassembly port do have this
    distinction, and for them being able to do `datetime.datetime.now()` is
    quite important (at least, that's what users expect to be able to do).
    
    The associated unittest test has been updated.
    
    This patch changes the size of datetime.mpy: 8466 -> 8897, so +431 bytes.
    
    Signed-off-by: Damien George <[email protected]>
    dpgeorge committed Oct 1, 2025
    Configuration menu
    Copy the full SHA
    656f420 View commit details
    Browse the repository at this point in the history
  3. datetime: Optimize for code size.

    Optimizations applied here are:
    - writing once-used helper functions inline in their place of use
    - writing once-used constant tuples inline in their place of use (I would
      have used `from micropython import const` but that renders the code not
      runnable under CPython for testing, and also increases code size itself
      for the import)
    - renamed _tmod to _t
    - renamed _format to _fmt
    - optimised timedelta._tuple() slightly
    
    Reduces datetime.mpy by: 8897 -> 8728, so saves 169 bytes.
    
    Signed-off-by: Damien George <[email protected]>
    dpgeorge committed Oct 1, 2025
    Configuration menu
    Copy the full SHA
    3eaf027 View commit details
    Browse the repository at this point in the history
Loading