* Implement property.__name__ attribute
Add getter and setter for the __name__ attribute on property objects.
The getter returns the explicitly set name if available, otherwise
falls back to the getter function's __name__. Raises AttributeError
if no name is available, matching CPython 3.13 behavior.
The implementation handles edge cases:
- Returns None when explicitly set to None
- Propagates non-AttributeError exceptions from getter's __getattr__
- Raises property-specific AttributeError when getter lacks __name__
This fix enables test_property_name in test_property.py to pass.
* Refactor to use get_property_name in __name__ implementation
Consolidate duplicate logic by making name_getter() use the existing
get_property_name() helper method. This eliminates code duplication
and improves maintainability.
Changes:
- Update get_property_name() to return PyResult<Option<PyObjectRef>>
to properly handle and propagate non-AttributeError exceptions
- Simplify name_getter() to delegate to get_property_name()
- Update format_property_error() to handle the new return type
This addresses review feedback about the relationship between
get_property_name() and __name__ implementation.
* style comment
Validate that the handler argument passed to codecs.register_error
is callable, raising TypeError with message 'handler must be callable'
if it is not. This matches CPython behavior.
This fix enables test_badregistercall in test_codeccallbacks.py to pass.
* Resolve number slots via MRO in PyNumber and operator, ensure inherited and dynamically added methods are found.
Use class().mro_find_map() to mimic the same behaviour as CPython.
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
* CTRL+Z then Enter will now close shell on Windows.
* Additional comment.
* Use EOF const
* Add cfg(windows) for EOF_CHAR
---------
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
* Fix ldexp to prevent math range errors
Implemented IEEE 754-compliant handling for large numbers to avoid
overflow and represent results using scientific notation.
Fixes#5471
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
* Fix ldexp to handle denormalized inputs correctly
Detect denormalized input values below f64::MIN_POSITIVE
Scale subnormal inputs by 2^54 to bring them into normalized range
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
* tests(math): remove expectedFailure from testLdexp_denormal
As now we have implemented IEEE 754 format , so this will pass.
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
* Update Lib/test/test_math.py
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
* fixed formate in math.rs
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
---------
Signed-off-by: Yash Suthar <yashsuthar983@gmail.com>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
* Use ruff for unparse backend
* Update `test_future_stmt/*.py` from 3.13.7
* Mark failing tests
* Mark failing test
* Merge remote-tracking branch 'upstream/main' into ruff-unparse
* Reapply ruff code
* remove git symbols
* Unmark passing test
* Update changed files from 3.13.7 -> 3.13.8
* Reapply some patches
* Reaaply patches to `test_bytes.py`
* fix test markers in `test_exceptions.py`
* Patch `test_posix.py`
* Patched `test_{pyexpat,site,sysconfig}.py`
* Patched `test_typing.py`
* Patch failing tests in `test_typing.py`
* Update `seq_tests` from 3.13.8
* Mark failing tests in `test_genericalias.py`
* mark failing tests in `test_pyexpat.py`
* Mark failing tests in `test_posix.py`
* reapply patch
* mark failing tests
* skip flaky test
* Fix sqlite3 Connection initialization check
Add proper __init__ validation for sqlite3.Connection to ensure base class
__init__ is called before using connection methods. This fixes the
test_connection_constructor_call_check test case.
Changes:
- Modified Connection.py_new to detect subclassing
- For base Connection class, initialization happens immediately in py_new
- For subclassed Connection, db is initialized as None
- Added __init__ method that performs actual database initialization
- Updated _db_lock error message to match CPython: 'Base Connection.__init__ not called.'
This ensures CPython compatibility where attempting to use a Connection
subclass instance without calling the base __init__ raises ProgrammingError.
* use Initializer trait
Add proper __init__ validation for sqlite3.Cursor to ensure base class
__init__ is called before using cursor methods. This fixes the
test_cursor_constructor_call_check test case.
Changes:
- Modified Cursor to initialize with inner=None in py_new
- Added explicit __init__ method that sets up CursorInner
- Updated close() method to check for uninitialized state
- Changed error message to match CPython: 'Base Cursor.__init__ not called.'
This ensures CPython compatibility where attempting to use a Cursor
instance without calling the base __init__ raises ProgrammingError.