Commit Graph

200 Commits

Author SHA1 Message Date
K. Lange
361f915cce Only descriptors with __set__ methods should be __get__'d preemptively 2023-01-26 20:33:40 +09:00
K. Lange
1e044c140d Support for __init_subclass__ 2023-01-26 20:01:39 +09:00
K. Lange
617d30d804 Very initial rebuild of class creation 2023-01-25 22:10:13 +09:00
K. Lange
f9df8b22ef initial support for __new__ 2023-01-24 18:15:13 +09:00
K. Lange
7d57acd49a Support /,*,kws in function definitions 2022-09-29 21:46:10 +09:00
K. Lange
ad39476a35 Clean up function, method repring 2022-08-06 12:20:04 +09:00
K. Lange
9bd257e625 Exceptions raised in 'else' should run 'finally' before raising, not run 'except' 2022-07-29 20:05:21 +09:00
K. Lange
2f18ecbaa1 Support 'else' block on 'try' 2022-07-29 19:33:31 +09:00
K. Lange
d6c9602abd Properly run __exit__, finally on break or continue 2022-07-29 19:13:33 +09:00
K. Lange
4dc3f08fa0 Fix upvalue capture in generators 2022-07-24 15:54:36 +09:00
HarJIT
a580a835b8
Codecs revisited (#28)
* xraydict functionality and usage improvements

Add a filter_function to xraydict, allowing fewer big data structures. Make
uses of xraydict prefer exclusion sets to exclusion lists, to avoid
repeated linear search of a list.

* Make `big5_coded_forms_from_hkscs` a set, remove set trailing commas.

* Remove `big5_coded_forms_from_hkscs` in favour of a filter function.

* Similarly, use sets for 7-bit exclusion lists except when really short.

* Revise mappings for seven 78JIS codepoints.

Mappings for 25-23 and 90-22 were previously the same as those used for
97JIS; they have been swapped to correspond with how the IBM extension
versus the standard code are mapped in the "old sequence" (78JIS-based)
as opposed to the "new sequence".

Mappings for 32-70, 34-45, 35-29, 39-77 and 54-02 in 78JIS have been
changed to reflect disunifications made in 2000-JIS and 2004-JIS, assigning
the 1978-edition unsimplified variants of those characters separate coded
forms (where previously, only swaps and disunifications in 83JIS and
disunifications in 90JIS (including JIS X 0212) had been considered).

This only affects the `jis_encoding` codec (including the decoding
direction for `iso-2022-jp-2`, `iso-2022-jp-3` and `iso-2022-jp-2004`),
and the decoding is only affected when `ESC $ @` (not `ESC $ B`) is used.
The `iso-2022-jp` codec is unaffected, and remains similar to (but more
consistently pedantic than) the WHATWG specification, thus using the same
table for both 78JIS and 97JIS.

* Make `johab-ebcdic` decoder use many-to-one, not corporate PUA.

Many-to-one decodes are not uncommon in CJK encodings (e.g. Windows-31J),
and mapping to the IBM Corporate PUA (code page 1449) would probably make
it render as completely the wrong character if at all in practice.

* Switch `cp950_no_eudc_encoding_map` away from a hardcoded exclusion list.

* Codec support for `x-mac-korean`.

* Add a test bit for the UTF-8 wrapper.

* Document the unique error-condition definition of the ISO-2022-JP codec.

* Update docs now there is an actual implementation for `x-mac-korean`.

* Further explanations of the hazards of `jis_encoding`.

* Sanitised → Sanitised or escaped.

* Further clarify the status with not verifying Shift In.

* Corrected description of End State 2.

* Changes to MacKorean to avoid mapping non-ASCII using ASCII punctuation.

* Extraneous word "still".

* Fix omitting MacKorean single-byte codes.
2022-07-23 08:32:54 +09:00
K. Lange
79a4a02b58 Resolve long-standing left/right binding issue with '**' 2022-07-20 09:21:21 +09:00
K. Lange
eeca53e4f1 Fix bad argument collection with optional positionals 2022-07-11 10:03:00 +09:00
K. Lange
391a4d79db Fixup concatenating unalike string tokens in compiler 2022-07-10 17:44:06 +09:00
K. Lange
7d409ebcbb Format spec support in f-strings 2022-07-10 16:11:12 +09:00
K. Lange
d8a1861c23 format() and object.__format__() 2022-07-10 16:10:07 +09:00
K. Lange
9b5ce15bf7 Implement Python's identifier mangling 2022-07-10 13:13:27 +09:00
K. Lange
c10a457242 Rudimentary __setattr__ support 2022-07-07 14:54:30 +09:00
K. Lange
c9b989cb56 Add test for __set_name__ 2022-07-06 21:43:15 +09:00
K. Lange
2d8de139b3 More fixes to tuple comparisons; port to lists 2022-07-06 21:25:59 +09:00
K. Lange
ee1420cd35 Use krk_unpackIterable (and a temporary tuple) in OP_UNPACK 2022-07-05 14:45:47 +09:00
K. Lange
ebe1b0276e Remove tupleOf builtin 2022-07-05 11:43:11 +09:00
K. Lange
f38a451f19 Attach and build upon partial tracebacks
If an exception is raised within a 'try', attach a traceback only up
until that 'try'. If a re-raised exception has a traceback already,
attach the new traceback "above" the existing one.
2022-07-03 20:39:07 +09:00
K. Lange
85ad910f23 Attach __cause__, __context__ to exceptions; support 'raise ... from ...' 2022-07-03 19:50:00 +09:00
K. Lange
2d2691710c Exceptions with no argument should not set it to 'None' 2022-07-03 19:38:04 +09:00
K. Lange
abd90ccd3d Fixup, complete tuple comparisons 2022-07-03 11:18:11 +09:00
K. Lange
2000161d34 Trim trailing whitespace in string-to-int/long conversions 2022-06-29 14:55:46 +09:00
K. Lange
0d28885009 Fix that one old test to not go through float() 2022-06-29 13:55:21 +09:00
K. Lange
f61922d155 long type 2022-06-27 20:40:24 +09:00
K. Lange
cdcfb63f41 New '__options__' psuedo-module with compile-time changes 2022-06-04 15:59:24 +09:00
K. Lange
48f9d34a9b Tests for bound method edge cases 2022-06-02 14:34:40 +09:00
K. Lange
bbfe948b86 Lambda should be able to accept *args and **kwargs 2022-05-30 17:46:24 +09:00
K. Lange
a4e2b5c881 Relative imports 2022-05-28 15:41:47 +09:00
K. Lange
aa6781609e Fix bad encoding of large upvalue indexes 2022-05-27 18:37:37 +09:00
K. Lange
1ac8f296b2 Invalidate caches of subclass method pointers when they change in a superclass 2022-05-27 00:05:27 +09:00
K. Lange
74e064c82c Test case for preceding fix 2022-05-24 13:33:34 +09:00
K. Lange
4a052191de Support 'else' blocks on for and while loops 2022-05-23 09:41:12 +09:00
K. Lange
ece7da299a Support = to print f-string expression alongside value 2022-05-23 08:42:40 +09:00
K. Lange
6613db6cd4 Implement slice objects, slice stepping
This is an initial implementation of slice stepping and slice objects.
The __getslice__, __setslice__, and __delslice__ methods have been removed.
Slice expressions are now turned into slice objects with the OP_SLICE instruction.
Slice objects have a start, end, and step, all of which default to None.
Slice objects are passed to __getitem__, et al., as a normal parameter.

Support for slices in list.__getitem__, str.__getitem__, and bytes.__getitem__ has
been implemented.
2022-05-03 16:49:58 +09:00
K. Lange
e24ea3d32c Fix incorrect handling of blank and comment lines before 'else', 'except', etc. 2022-02-17 09:49:24 +09:00
K. Lange
2c158f9491 Fixup bad cast when comparing int to float 2021-12-15 17:31:15 +09:00
K. Lange
abd49b93a7 Fix 'del' on table entries not updating count 2021-12-15 17:22:52 +09:00
K. Lange
6a431e9aa3 Add a test for that 2021-12-15 15:11:27 +09:00
K. Lange
3733c996bc Fix assignments to single complex assignment targets (trailing commas) 2021-04-23 14:15:14 +09:00
K. Lange
84765c1f4d Update test for change in dict ordering 2021-04-14 22:32:51 +09:00
K. Lange
40836cba21 Implement Python 3 division semantics 2021-04-02 16:02:05 +09:00
K. Lange
dc361af48b Fix incorrect binding of classmethod when called on instance of subclass 2021-04-02 12:25:07 +09:00
K. Lange
002412ecf8 Initial support for async/await 2021-03-31 19:27:13 +09:00
K. Lange
f4ea799d42 Fix generator not being popped from stack on 'yield from' 2021-03-31 19:09:06 +09:00
K. Lange
729220568e Try swapping args to __eq__ on NotImplemented 2021-03-30 17:00:23 +09:00