Skip to content

v0.9.13: support runtime str.format; fix with-as stmt; some opt

Latest

Choose a tag to compare

@litlighilit litlighilit released this 08 Aug 14:51
· 46 commits to master since this release

v0.9.13 - 2025-08-08

Full Changelog: v0.9.12...v0.9.13

Bug Fixes

  • py:

    • type:

      • TypeError if using float for x, X, o specifier. (53368bc)
      • flags are now considered. (f56ae5c)
      • add range check and error message as Python's; s % v where v is SomeNumber now works on JS. (323e6fa)
      • %s, %r, %a, %b raised AssertDefect for non-string. (fb15970)
      • translateEscape: allow error message as Python's. (37a6cdd)
      • translateEscape: support bytes mode; disallow Nim's special escape unless -d:nimpylibTranslateEscapeAllowNimExt. (c0a6f74)
    • tuple:

      • tuple.len gave 0 for non-literal. (a7f4e07)
      • one-char string in tuple was not accepted; renamed getRune to getAsRune. (6354263)
    • bytes:

      • @: "Error: cannot instantiate: 'newSeqUninitialized[T]'". (5c17434)
    • builtins:

      • $ and repr for list, set, dict, etc., just used system's. (d658f78)
    • sugar:

      • with .. as .. did not compile. (d3ebb73)
      • with <infix instead of as> did not compile. (ba1a32d)
    • str:

      • str.format: support non-static format string. (87075a9)
      • str.format_map: fixed compatibility. (f43a58d)
    • TemporaryDirectory:

      • with TemporaryDirectory(..) as n gave n not as string. (a99eb0e)
    • print:

      • did not compile when -d:deno. (80e5a06)
  • nimpatch:

    • newUninit: system.setLenUninit only declared on defined(nimHasSetLengthSeqUninitMagic). (899052c)

Feature Additions

  • EXT:

  • py:

    • %c: for string; for bytes, accept integer too. (f51abb9)
    • %: static format string evaluation at compile time; TypeError also at compile time. (7dcd1ce)
    • %: * accepts variable. (b6679a2)
    • str.format: for bool, char, cstring, and typeinfo.Any. (7e2ca68)
  • js:

    • partly support due to lack of system.getTypeInfo. (0ff3439)
    • support %-format (printf-format). (afa0f32)
  • builtins:

Improvements

  • py:

    • opt: Py_normalize_encoding accepts cstring now. (2e06f94)
    • opt: refined pushDigitChar overflow check; raise ValueError over OverflowDefect. (f575d2a)
    • opt: faster parse flags; bound checks turned off. (59f75d0)
    • opt: %: passing tuple[T,...] as array of T over Any. (52fe21c)
  • str:

    • format: no longer add char for string snippets between interpolators. (4de10d4)
  • percent_format:

    • merged common code; fixed overflow checks missed 's'. (da5cb5e)

Breaking Changes

  • py:

    • Py_FormatEx's arguments accept Getitem-able over openArray[(string, string)]. (8bf7407)

Refactor

  • py:

    • replaced parse,get with parseNumberAs,getAs; parseChar,getAsChar. (d97ffd0)
    • renamed getAsBiggestXxx,getSomeNumberAsBiggestXxx. (b1997b7)

Chores

  • CI:

    • testC, testJs: allow workflow_dispatch. (a43a7d6)
  • nimble: