Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
4405845
Fix isinstance/issubclass validation, pow overflow, tp_base default; …
jgarzik Mar 17, 2026
5fe3c97
Add contains iteration fallback, str_contains validation; import test…
jgarzik Mar 18, 2026
1e8dc6e
Add UnboundLocalError, __qualname__, formatted error messages; 3 un-s…
jgarzik Mar 18, 2026
40ca4dc
Fix LIST_TO_TUPLE rbx clobber, repr RecursionError; 3 more un-skips
jgarzik Mar 18, 2026
261d891
Import 5 new CPython test suites: exception_variations, genexps, list…
jgarzik Mar 18, 2026
76500f9
Fix None==0 identity comparison bug; import test_compare (15 tests, 0…
jgarzik Mar 18, 2026
b3513cf
Add exc_dict, exc_setattr, BaseException→object; import test_with, te…
jgarzik Mar 18, 2026
f4a92cd
Add 2-arg next(); import test_extcall, test_iter, test_lambda, test_p…
jgarzik Mar 18, 2026
7d41b52
Import test_bytes, test_builtin, test_types
jgarzik Mar 18, 2026
2e674b6
Add assertIsNone; import test_closures, test_dict_extra, test_tuple_e…
jgarzik Mar 18, 2026
0d9f936
Import test_controlflow, test_math_basic, test_global_nonlocal, test_…
jgarzik Mar 18, 2026
b4df012
Fix SEND exhausted path for non-generator iterators; import 5 test su…
jgarzik Mar 18, 2026
c2dee48
Import test_format, test_slice_ops, test_numeric, test_comprehensions
jgarzik Mar 18, 2026
28ff34b
Import test_decorators_extra, test_walrus, test_match, test_datastruc…
jgarzik Mar 18, 2026
593933c
Import test_exceptions_builtin, test_functions, test_range_extra, tes…
jgarzik Mar 18, 2026
2d23ca4
Python 3.12 compliance: crash fixes, language features, exception typ…
jgarzik Mar 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,83 @@ gen-cpython-tests:
@$(PYTHON) -m py_compile tests/cpython/test_scope.py
@echo "Compiling tests/cpython/test_generators.py..."
@$(PYTHON) -m py_compile tests/cpython/test_generators.py
@echo "Compiling tests/cpython/test_unary.py..."
@$(PYTHON) -m py_compile tests/cpython/test_unary.py
@echo "Compiling tests/cpython/test_pow.py..."
@$(PYTHON) -m py_compile tests/cpython/test_pow.py
@echo "Compiling tests/cpython/test_contains.py..."
@$(PYTHON) -m py_compile tests/cpython/test_contains.py
@echo "Compiling tests/cpython/test_exception_variations.py..."
@$(PYTHON) -m py_compile tests/cpython/test_exception_variations.py
@echo "Compiling tests/cpython/test_genexps.py..."
@$(PYTHON) -m py_compile tests/cpython/test_genexps.py
@echo "Compiling tests/cpython/test_listcomps.py..."
@$(PYTHON) -m py_compile tests/cpython/test_listcomps.py
@echo "Compiling tests/cpython/test_raise.py..."
@$(PYTHON) -m py_compile tests/cpython/test_raise.py
@echo "Compiling tests/cpython/test_class.py..."
@$(PYTHON) -m py_compile tests/cpython/test_class.py
@echo "Compiling tests/cpython/test_compare.py..."
@$(PYTHON) -m py_compile tests/cpython/test_compare.py
@echo "Compiling tests/cpython/test_with.py..."
@$(PYTHON) -m py_compile tests/cpython/test_with.py
@echo "Compiling tests/cpython/test_opcodes.py..."
@$(PYTHON) -m py_compile tests/cpython/test_opcodes.py
@echo "Compiling tests/cpython/test_baseexception.py..."
@$(PYTHON) -m py_compile tests/cpython/test_baseexception.py
@echo "Compiling tests/cpython/test_extcall.py..."
@$(PYTHON) -m py_compile tests/cpython/test_extcall.py
@echo "Compiling tests/cpython/test_iter.py..."
@$(PYTHON) -m py_compile tests/cpython/test_iter.py
@echo "Compiling tests/cpython/test_lambda.py..."
@$(PYTHON) -m py_compile tests/cpython/test_lambda.py
@echo "Compiling tests/cpython/test_property.py..."
@$(PYTHON) -m py_compile tests/cpython/test_property.py
@echo "Compiling tests/cpython/test_string.py..."
@$(PYTHON) -m py_compile tests/cpython/test_string.py
@echo "Compiling tests/cpython/test_bytes.py..."
@$(PYTHON) -m py_compile tests/cpython/test_bytes.py
@echo "Compiling tests/cpython/test_builtin.py..."
@$(PYTHON) -m py_compile tests/cpython/test_builtin.py
@echo "Compiling tests/cpython/test_types.py..."
@$(PYTHON) -m py_compile tests/cpython/test_types.py
@echo "Compiling tests/cpython/test_closures.py..."
@$(PYTHON) -m py_compile tests/cpython/test_closures.py
@echo "Compiling tests/cpython/test_dict_extra.py..."
@$(PYTHON) -m py_compile tests/cpython/test_dict_extra.py
@echo "Compiling tests/cpython/test_tuple_extra.py..."
@$(PYTHON) -m py_compile tests/cpython/test_tuple_extra.py
@echo "Compiling tests/cpython/test_set_extra.py..."
@$(PYTHON) -m py_compile tests/cpython/test_set_extra.py
@echo "Compiling tests/cpython/test_list_extra.py..."
@$(PYTHON) -m py_compile tests/cpython/test_list_extra.py
@echo "Compiling tests/cpython/test_controlflow.py..."
@$(PYTHON) -m py_compile tests/cpython/test_controlflow.py
@echo "Compiling tests/cpython/test_math_basic.py..."
@$(PYTHON) -m py_compile tests/cpython/test_math_basic.py
@echo "Compiling tests/cpython/test_global_nonlocal.py..."
@$(PYTHON) -m py_compile tests/cpython/test_global_nonlocal.py
@echo "Compiling tests/cpython/test_unpacking.py..."
@$(PYTHON) -m py_compile tests/cpython/test_unpacking.py
@echo "Compiling tests/cpython/test_inheritance.py..."
@$(PYTHON) -m py_compile tests/cpython/test_inheritance.py
@$(PYTHON) -m py_compile tests/cpython/test_del.py
@$(PYTHON) -m py_compile tests/cpython/test_assert.py
@$(PYTHON) -m py_compile tests/cpython/test_assignment.py
@$(PYTHON) -m py_compile tests/cpython/test_exceptions_extra.py
@$(PYTHON) -m py_compile tests/cpython/test_generators_extra.py
@$(PYTHON) -m py_compile tests/cpython/test_format.py
@$(PYTHON) -m py_compile tests/cpython/test_slice_ops.py
@$(PYTHON) -m py_compile tests/cpython/test_numeric.py
@$(PYTHON) -m py_compile tests/cpython/test_comprehensions.py
@$(PYTHON) -m py_compile tests/cpython/test_decorators_extra.py
@$(PYTHON) -m py_compile tests/cpython/test_walrus.py
@$(PYTHON) -m py_compile tests/cpython/test_match.py
@$(PYTHON) -m py_compile tests/cpython/test_datastructures.py
@$(PYTHON) -m py_compile tests/cpython/test_exceptions_builtin.py
@$(PYTHON) -m py_compile tests/cpython/test_functions.py
@$(PYTHON) -m py_compile tests/cpython/test_range_extra.py
@$(PYTHON) -m py_compile tests/cpython/test_conditional.py
@echo "Done."

check-cpython: $(TARGET) gen-cpython-tests
Expand Down Expand Up @@ -127,3 +204,97 @@ check-cpython: $(TARGET) gen-cpython-tests
@./apython tests/cpython/__pycache__/test_scope.cpython-312.pyc
@echo "Running CPython test_generators.py..."
@./apython tests/cpython/__pycache__/test_generators.cpython-312.pyc
@echo "Running CPython test_unary.py..."
@./apython tests/cpython/__pycache__/test_unary.cpython-312.pyc
@echo "Running CPython test_pow.py..."
@./apython tests/cpython/__pycache__/test_pow.cpython-312.pyc
@echo "Running CPython test_contains.py..."
@./apython tests/cpython/__pycache__/test_contains.cpython-312.pyc
@echo "Running CPython test_exception_variations.py..."
@./apython tests/cpython/__pycache__/test_exception_variations.cpython-312.pyc
@echo "Running CPython test_genexps.py..."
@./apython tests/cpython/__pycache__/test_genexps.cpython-312.pyc
@echo "Running CPython test_listcomps.py..."
@./apython tests/cpython/__pycache__/test_listcomps.cpython-312.pyc
@echo "Running CPython test_raise.py..."
@./apython tests/cpython/__pycache__/test_raise.cpython-312.pyc
@echo "Running CPython test_class.py..."
@./apython tests/cpython/__pycache__/test_class.cpython-312.pyc
@echo "Running CPython test_compare.py..."
@./apython tests/cpython/__pycache__/test_compare.cpython-312.pyc
@echo "Running CPython test_with.py..."
@./apython tests/cpython/__pycache__/test_with.cpython-312.pyc
@echo "Running CPython test_opcodes.py..."
@./apython tests/cpython/__pycache__/test_opcodes.cpython-312.pyc
@echo "Running CPython test_baseexception.py..."
@./apython tests/cpython/__pycache__/test_baseexception.cpython-312.pyc
@echo "Running CPython test_extcall.py..."
@./apython tests/cpython/__pycache__/test_extcall.cpython-312.pyc
@echo "Running CPython test_iter.py..."
@./apython tests/cpython/__pycache__/test_iter.cpython-312.pyc
@echo "Running CPython test_lambda.py..."
@./apython tests/cpython/__pycache__/test_lambda.cpython-312.pyc
@echo "Running CPython test_property.py..."
@./apython tests/cpython/__pycache__/test_property.cpython-312.pyc
@echo "Running CPython test_string.py..."
@./apython tests/cpython/__pycache__/test_string.cpython-312.pyc
@echo "Running CPython test_bytes.py..."
@./apython tests/cpython/__pycache__/test_bytes.cpython-312.pyc
@echo "Running CPython test_builtin.py..."
@./apython tests/cpython/__pycache__/test_builtin.cpython-312.pyc
@echo "Running CPython test_types.py..."
@./apython tests/cpython/__pycache__/test_types.cpython-312.pyc
@echo "Running CPython test_closures.py..."
@./apython tests/cpython/__pycache__/test_closures.cpython-312.pyc
@echo "Running CPython test_dict_extra.py..."
@./apython tests/cpython/__pycache__/test_dict_extra.cpython-312.pyc
@echo "Running CPython test_tuple_extra.py..."
@./apython tests/cpython/__pycache__/test_tuple_extra.cpython-312.pyc
@echo "Running CPython test_set_extra.py..."
@./apython tests/cpython/__pycache__/test_set_extra.cpython-312.pyc
@echo "Running CPython test_list_extra.py..."
@./apython tests/cpython/__pycache__/test_list_extra.cpython-312.pyc
@echo "Running CPython test_controlflow.py..."
@./apython tests/cpython/__pycache__/test_controlflow.cpython-312.pyc
@echo "Running CPython test_math_basic.py..."
@./apython tests/cpython/__pycache__/test_math_basic.cpython-312.pyc
@echo "Running CPython test_global_nonlocal.py..."
@./apython tests/cpython/__pycache__/test_global_nonlocal.cpython-312.pyc
@echo "Running CPython test_unpacking.py..."
@./apython tests/cpython/__pycache__/test_unpacking.cpython-312.pyc
@echo "Running CPython test_inheritance.py..."
@./apython tests/cpython/__pycache__/test_inheritance.cpython-312.pyc
@echo "Running CPython test_del.py..."
@./apython tests/cpython/__pycache__/test_del.cpython-312.pyc
@echo "Running CPython test_assert.py..."
@./apython tests/cpython/__pycache__/test_assert.cpython-312.pyc
@echo "Running CPython test_assignment.py..."
@./apython tests/cpython/__pycache__/test_assignment.cpython-312.pyc
@echo "Running CPython test_exceptions_extra.py..."
@./apython tests/cpython/__pycache__/test_exceptions_extra.cpython-312.pyc
@echo "Running CPython test_generators_extra.py..."
@./apython tests/cpython/__pycache__/test_generators_extra.cpython-312.pyc
@echo "Running CPython test_format.py..."
@./apython tests/cpython/__pycache__/test_format.cpython-312.pyc
@echo "Running CPython test_slice_ops.py..."
@./apython tests/cpython/__pycache__/test_slice_ops.cpython-312.pyc
@echo "Running CPython test_numeric.py..."
@./apython tests/cpython/__pycache__/test_numeric.cpython-312.pyc
@echo "Running CPython test_comprehensions.py..."
@./apython tests/cpython/__pycache__/test_comprehensions.cpython-312.pyc
@echo "Running CPython test_decorators_extra.py..."
@./apython tests/cpython/__pycache__/test_decorators_extra.cpython-312.pyc
@echo "Running CPython test_walrus.py..."
@./apython tests/cpython/__pycache__/test_walrus.cpython-312.pyc
@echo "Running CPython test_match.py..."
@./apython tests/cpython/__pycache__/test_match.cpython-312.pyc
@echo "Running CPython test_datastructures.py..."
@./apython tests/cpython/__pycache__/test_datastructures.cpython-312.pyc
@echo "Running CPython test_exceptions_builtin.py..."
@./apython tests/cpython/__pycache__/test_exceptions_builtin.cpython-312.pyc
@echo "Running CPython test_functions.py..."
@./apython tests/cpython/__pycache__/test_functions.cpython-312.pyc
@echo "Running CPython test_range_extra.py..."
@./apython tests/cpython/__pycache__/test_range_extra.cpython-312.pyc
@echo "Running CPython test_conditional.py..."
@./apython tests/cpython/__pycache__/test_conditional.cpython-312.pyc
4 changes: 3 additions & 1 deletion include/errcodes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struc PyExceptionObject
.exc_context: resq 1 ; +48: ptr to __context__ or NULL
.exc_cause: resq 1 ; +56: ptr to __cause__ or NULL
.exc_args: resq 1 ; +64: ptr to args tuple or NULL
.exc_dict: resq 1 ; +72: ptr to instance dict or NULL (for custom attrs)
endstruc

; Exception group object (extends PyExceptionObject with eg_exceptions)
Expand All @@ -59,7 +60,8 @@ struc PyExceptionGroupObject
.exc_context: resq 1 ; +48
.exc_cause: resq 1 ; +56
.exc_args: resq 1 ; +64
.eg_exceptions: resq 1 ; +72: tuple of sub-exceptions
.exc_dict: resq 1 ; +72: ptr to instance dict or NULL
.eg_exceptions: resq 1 ; +80: tuple of sub-exceptions
endstruc

; Traceback object
Expand Down
14 changes: 14 additions & 0 deletions lib/abc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# abc.py - Abstract Base Classes (minimal stub for apython)

def abstractmethod(funcobj):
"""Decorator indicating abstract methods."""
funcobj.__isabstractmethod__ = True
return funcobj

class ABCMeta(type):
"""Metaclass for defining Abstract Base Classes (ABCs)."""
pass

class ABC(metaclass=ABCMeta):
"""Helper class that provides a standard way to create an ABC using inheritance."""
__slots__ = ()
Loading
Loading