Commit Graph
19 Commits
Author SHA1 Message Date
Shahar Naveh 0fdd061ed4 Update some tests & libs to 3.14.7 (#8595)
* test_memoryio

* test_ordered_dict

* more

* urllib

* test_compileall

* urllib test

* more

* test_descr

* test_enumerate
2026-08-26 14:38:10 +00:00
Changjoon 2da3a96d19 Short-circuit identity in rich_compare_bool for Eq/Ne (PyObject_RichCompareBool parity) (#7734)
* Short-circuit identity in rich_compare_bool for Eq/Ne (PyObject_RichCompareBool parity)

CPython distinguishes two comparison entry points (Objects/object.c):
- PyObject_RichCompare returns the raw __eq__ / __ne__ result; no
  identity short-circuit
- PyObject_RichCompareBool returns bool; identity implies equality
  (and inequality is false on identity), short-circuiting before
  dispatch

Collection membership / equality (x in [x], [nan] == [nan], set/dict
comparisons) go through the bool variant and rely on the short-circuit.
RustPython's rich_compare_bool skipped the identity check, so a buggy
or raising __eq__ propagated even when the operand was the same object.

Add an identity short-circuit at the top of rich_compare_bool for Eq
(returns true) and Ne (returns false). Ordering ops fall through to
_cmp because Python does not guarantee reflexivity for </<=/>/>=.
_cmp itself is untouched, so == / != operators continue to invoke
__eq__ / __ne__ exactly as before.

Unmasks test_dictviews.TestDictViews.test_compare_error.

Verified byte-identical with CPython 3.14.4 across 53 scenarios in 10
categories (collection membership / equality / ordering ops / NaN /
hash collision / dict views / list-set-dict ops). 14-module regression
sweep ~2,402 tests passes with no regressions.

* Route proxy comparisons through PyObject_RichCompare

The identity short-circuit added to rich_compare_bool exposed a latent
bug in three proxy types (weakref, weakproxy, mappingproxy): they were
delegating their __eq__ to the bool variant on referents, while CPython
uses PyObject_RichCompare so the referent's __eq__ runs even when the
referents share identity.

Fixes test_weak_keyed_cascading_deletes which depends on key __eq__
firing during dict deletion to trigger a side-effect that mutates the
key list.
2026-04-30 04:45:23 +09:00
Shahar Naveh 0b60910998 Update tests with deprecated get_c_recursion_limit (#7039) 2026-02-08 09:59:14 +09:00
ShaharNaveh 0648e975d9 Upsate test_dictviews 2025-07-25 16:07:59 +02:00
NakanoMiku 784b5f1b1c Edit test_dictviews
ExpectedFailure added at line 282
2023-11-30 21:58:26 +08:00
NakanoMiku 43ede611e3 Update test_dictviews.py from CPython v3.12.0 2023-11-30 20:53:15 +08:00
Andrey Maltsev f798d2df92 Update test_dictviews.py from Cpython v3.11.2 2023-04-02 13:47:49 +00:00
CPython developers 146c9ff316 Update test_dictviews from CPython 3.10.5 2022-07-18 03:54:49 +09:00
joohongpark 2da623eadf remove todo comment 2022-06-14 02:39:51 +09:00
joohongpark 115dfc8251 fix test_dictviews::test_dict_mixed_keys_items 2022-06-14 02:39:51 +09:00
rvsampson94 0fe8a06d65 Dict keys isdisjoint 2021-11-20 12:30:22 +09:00
zetwhite a401d8c190 make work dictview compare test 2021-10-24 16:54:33 +09:00
Jim Fasarakis-Hilliard 3ca29014c9 Merge pull request #3297 from DimitrisJim/dict_views_new
Unconstructible for dict view types, test clean up.
2021-10-14 17:53:25 +03:00
Jeong YunWon eb277d2191 Merge pull request #3301 from youknowone/half-3204
unskip tests
2021-10-14 23:12:21 +09:00
jfh 0e193f8ec3 Implement unconstructible for dict_views. 2021-10-14 17:10:16 +03:00
Aphek e732669224 Make it possible for rust functions to increase recursion depth (#3252)
Make it possible for rust functions to increase recursion depth
2021-10-13 08:12:12 +03:00
Padraic Fanning 34c6f7c7ca Clean up skips in test_dictviews 2021-10-10 19:11:25 -04:00
snowapril 98f2f871cd add annotations for making test success
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-09-06 18:55:23 +09:00
snowapril 4016eb95af add test_dictviews.py from cpython 3.8
Signed-off-by: snowapril <sinjihng@gmail.com>
2021-09-06 18:55:23 +09:00