Files
RustPython/Lib/test
Jiseok CHOI e096ce7bc7 Implement property.__name__ attribute (#6230)
* 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
2025-11-01 18:30:03 +09:00
..
2025-08-24 10:36:07 +03:00
2025-10-22 10:57:47 +03:00
2025-04-30 14:33:52 +09:00
2023-04-20 15:36:28 +09:00
2023-03-02 15:01:12 +09:00
2022-04-23 08:06:17 +09:00
2024-06-22 16:18:34 +09:00
2021-02-20 20:37:25 -05:00
2021-02-20 20:37:25 -05:00
2022-02-13 17:56:08 -05:00
2021-04-18 14:44:36 -04:00
2022-10-18 03:26:29 +09:00
2021-02-25 22:50:48 -05:00
2021-02-25 22:50:48 -05:00
2021-02-25 22:50:48 -05:00
2021-04-21 11:17:00 +02:00
2023-03-01 18:06:50 +09:00
2025-10-22 10:57:47 +03:00
2024-01-11 17:48:56 +09:00
2025-03-31 18:49:08 +09:00
2025-06-30 19:09:05 +09:00
2025-08-23 21:53:29 +03:00
2025-10-22 10:57:47 +03:00
2025-08-01 22:16:32 +09:00
2025-03-26 02:24:01 -05:00
2025-03-20 14:35:04 +09:00
2025-08-23 23:21:19 +03:00
2025-03-25 19:05:12 -05:00
2025-07-09 19:03:53 +09:00
2025-09-16 21:49:54 +09:00
2025-08-23 23:21:19 +03:00
2025-07-08 23:49:57 +09:00
2024-06-24 19:00:54 +09:00
2025-07-01 19:05:29 +09:00
2021-11-28 20:51:32 +08:00
2021-11-29 21:03:02 +08:00
2023-11-30 20:48:58 +08:00
2025-07-25 16:07:59 +02:00
2025-02-13 14:11:01 +09:00
2025-09-01 11:19:00 +03:00
2025-10-22 11:02:36 +03:00
2025-04-30 14:33:52 +09:00
2025-10-20 22:46:46 +09:00
2025-04-30 14:33:52 +09:00
2025-04-30 14:33:52 +09:00
2025-09-16 09:35:08 +09:00
2025-07-08 20:13:52 +09:00
2025-08-24 00:44:32 +03:00
2025-04-21 21:12:12 -07:00
2021-02-21 18:47:55 -05:00
2024-06-22 16:18:34 +09:00
2025-10-29 23:01:04 +09:00
2025-03-12 09:47:34 +09:00
2023-03-02 05:56:34 +09:00
2025-07-01 10:59:41 +09:00
2025-04-21 21:11:42 -07:00
2021-11-28 20:51:32 +08:00
2025-08-23 19:25:28 +03:00
2023-11-09 14:59:59 +08:00
2025-08-23 19:44:08 +03:00
2024-06-22 15:24:42 +09:00
2024-05-09 15:20:38 +09:00
2025-08-26 21:49:26 +09:00
2021-04-25 12:59:12 -04:00
2025-04-14 16:56:22 +09:00
2025-04-28 12:29:21 +09:00
2025-10-22 12:04:01 +03:00
2025-08-31 11:58:21 +03:00
2023-03-26 12:27:58 +09:00
2023-06-01 15:29:16 +09:00
2025-04-21 20:48:13 -07:00
2022-07-27 14:43:47 +09:00
2025-03-25 19:05:12 -05:00
2025-03-26 23:12:21 -05:00
2025-07-15 03:12:23 +09:00
2025-08-31 12:01:32 +03:00
2025-04-21 21:11:42 -07:00
2021-11-28 20:51:32 +08:00
2025-07-15 21:27:05 +09:00
2025-03-25 19:05:12 -05:00
2025-10-29 23:01:04 +09:00
2025-09-11 14:05:04 +09:00
2025-03-26 23:12:21 -05:00
2025-06-22 18:11:30 +09:00
2025-10-20 22:46:46 +09:00
2021-05-16 13:50:34 -04:00
2022-04-26 22:26:38 -04:00
2025-06-24 16:58:27 +09:00
2025-06-22 22:36:13 +09:00
2025-06-23 23:53:57 +09:00
2025-10-23 17:28:53 +09:00
2022-08-14 23:08:08 +09:00
2025-07-16 13:37:18 +03:00
2021-08-31 23:53:05 +09:00
2025-08-24 00:17:50 +03:00
2025-01-17 18:04:25 -08:00
2024-03-11 15:01:37 +09:00
2025-10-29 23:01:04 +09:00
2025-07-25 15:47:32 +02:00
2025-09-16 21:58:36 +09:00
2022-07-19 01:35:32 +09:00
2025-04-21 08:48:38 +09:00
2025-04-15 16:24:10 +09:00
2025-08-31 12:43:52 +03:00
2025-10-23 17:28:53 +09:00
2025-03-26 23:12:21 -05:00
2025-02-26 00:10:24 -06:00
2021-05-21 19:19:34 -04:00
2023-04-20 15:36:28 +09:00
2021-05-21 19:19:34 -04:00