7338 Commits
Author SHA1 Message Date
Jeong YunWon 8816cd41d5 0.3.1 2024-04-10 17:39:57 +09:00
Jeong YunWon a0b6c36928 Update indexmap 2024-04-09 11:17:25 +09:00
Jeong, YunWon 3f691de7a3 Update chrono (#5220) 2024-04-09 04:13:39 +09:00
Jeong, YunWon 247572863a rustpython_vm::import::import_source (#5214)
* rustpython_vm::import::import_source

* always print exceptions when panic by expect_pyresult

if users want simple panic, Result::expect could be used.
2024-04-09 02:37:30 +09:00
Jeong, YunWonandognevnydemon 5a5ac35f36 Update a few deps (#5217)
Co-authored-by: ognevnydemon <maksapple2306@gmail.com>
2024-04-09 02:12:15 +09:00
Jeong, YunWon 220594f263 always print exceptions when panic by expect_pyresult (#5215)
if users want simple panic, Result::expect could be used.
2024-04-09 01:04:27 +09:00
Jeong YunWon 35141266c1 vm.enter_and_expect 2024-04-08 00:43:17 +09:00
Jeong YunWon 6adb72727e Add vm.finalize and enter/run docs 2024-04-08 00:14:28 +09:00
Jeong, YunWon 6eed8f42c7 split vm.import and vm.import_from (#5212) 2024-04-08 00:07:38 +09:00
Jeong YunWon 90ab0e33a2 apply rustfmt 2024-04-06 19:15:15 +09:00
Hunter Harloff 9f7eb08fca Change to overflow error 2024-04-06 19:14:58 +09:00
Hunter Harloff 6a53ec3c5d Handle usize > usize::MAX case 2024-04-06 19:14:58 +09:00
Hunter HarloffandJeong, YunWon c5550cd466 Simplify Optional Syntax
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2024-04-06 19:14:58 +09:00
Hunter Harloff 880036c0ae CPython Compliance: throw ValueError before TypeError 2024-04-06 19:14:58 +09:00
Hunter Harloff da53eeea57 Add itertools.batched Support 2024-04-06 19:14:58 +09:00
Jeong, YunWon 34ffa93945 Remove commented out code 2024-03-30 18:49:33 +09:00
Jeong YunWon f5fbb5b06f replace sre-engine to rustpython-sre_engine 2024-03-22 14:59:19 +09:00
Kangzhi Shi d9375b9fe1 impl re.template(),
template_compile template_expand subx
2024-03-22 14:59:19 +09:00
Kangzhi Shi 1e3d57817c Replace re_test.py from CPython 3.12 and mark failed tests 2024-03-22 14:59:09 +09:00
Jeong, YunWon 02cec859e5 Merge pull request #5202 from youknowone/sre-engine
Import sre-engine repository to main RustPython
2024-03-22 14:53:25 +09:00
Jeong YunWon 1dd9a2fbe4 suppress clippy warnings 2024-03-22 11:28:49 +09:00
Daniel Chiquito 90724b32ec Implement new clippy lints (#5208)
* Implement new clippy lints

clippy was just updated and has a few minor issues with the code base.

* Forgotten lint hidden behind feature
2024-03-22 10:25:53 +09:00
Daniel Chiquito 85c427b842 Reset exception in WithCleanupFinish (#5203)
Context managers have an `__exit__` function that returns a boolean-like
object. If the object is truthy, then exceptions are suppressed.

If an exception was thrown while resolving that boolean, it would leak
and live on in the error stack, getting tacked on to all future
exceptions. This caused several mysterious test failures which would
only trigger after this very specific event was tested in `test_with`.

The solution is to move a call to `vm.set_exception()` before
attempting the `try_to_bool()` which threw the error.

Minimal example to reproduce the bug:
```py
import sys
import traceback

class cm(object):
    def __init__(self):
        pass

    def __enter__(self):
        return 3

    def __exit__(self, a, b, c):
        class Bool:
            def __bool__(self):
                1 // 0
        return Bool()

try:
    with cm():
        raise Exception("Should NOT see this")
except ZeroDivisionError:
    print("exception caught, as expected")

print("There should now be no exception")
traceback.print_exc()
print(sys.exc_info())
```
2024-03-22 00:12:01 +09:00
Jeong YunWon 12601d0b44 integrate sre_engine crate to workspace 2024-03-18 17:24:49 +09:00
Jeong YunWon b3a606d9df Add 'vm/sre_engine/' from commit '21fc2059b70ebd5bf4a7c524c40e7d4347e065dc'
git-subtree-dir: vm/sre_engine
git-subtree-mainline: 426e582ba0
git-subtree-split: 21fc2059b7
2024-03-18 17:05:07 +09:00
Jeong, YunWon a88c2fe000 Fix miri test failure (#5170) 2024-02-19 00:39:47 +09:00
Jeong, YunWon 1c93c1630b Merge pull request #5164 from dchiquito/frozenset-hash
Use CPython hash algorithm for frozenset
2024-02-10 14:55:24 +09:00
Jeong, YunWon ec9f2cedd1 Merge pull request #5165 from dchiquito/unused-collections-bool
Removed unused __bool__ methods
2024-02-10 12:00:55 +09:00
Ikko Eltociear Ashimine 61e40de32b Fix typo in slot.rs (#5162)
overriden -> overridden
2024-02-10 11:43:40 +09:00
Daniel Chiquito bf461cdebc Use CPython hash algorithm for frozenset
The original hash algorithm just XOR'd all the hashes of the elements of
the set, which is problematic. The CPython algorithm is required to pass
the tests.

- Replace `PyFrozenSet::hash` with CPython's algorithm
- Remove unused `hash_iter_unorded` functions
- Add `frozenset` benchmark
- Enable tests
- Lower performance expectations on effectiveness test
- Adjust `slot::hash_wrapper` so that it doesn't rehash the computed
  hash value in the process of converting PyInt to PyHash.
2024-02-09 21:02:40 -05:00
Daniel Chiquito ffc52ef87c Removed unused __bool__ methods
Python does not define `list().__bool__`, `dict().__bool__`, and
`str().__bool__`, and some tests were failing because they were
defined.
I could not find any references to them and deleting them doesn't
seem to break anything.
2024-02-09 20:58:17 -05:00
Daniel Chiquito 43d7c71a68 Fix integer rounding
The [docs](https://docs.python.org/3/library/functions.html#round)
specify that calling `round` with a negative precision removes
significant digits, so that `round(12345, -2) == 12300`. The
implementation was simply returning the original integer.

Additionally, `round(a, b)` is implemented as `(a / 10^b) * 10^b`, using
half-even rounding during the division.
2024-02-07 14:19:17 -05:00
Alin-Ioan Alexandru 3eda1cf3b4 Deprecation warning fix for __complex__ (#5152) 2024-01-25 14:54:06 +09:00
kenny the :/ aaae566231 Raise error on power with negative number (#5143) 2024-01-12 21:16:53 +09:00
NakanoMikuandJeong, YunWon 28f0fa48a4 Fix abc error messages (#5140)
Co-authored-by: Jeong, YunWon <jeong@youknowone.org>
2024-01-11 17:48:56 +09:00
Noa 602015fca1 Update nix and socket2 2024-01-09 20:53:58 +09:00
Evan Rittenhouse 1ab133dae8 None.__ne__(None) should be NotImplemented (#5124) 2024-01-08 15:03:57 +09:00
Jeong, YunWon 7236109d75 Merge pull request #5144 from youknowone/clippy
Fix 1.75 clippy warnings
2023-12-30 13:16:10 +09:00
Jeong YunWon 506c8a633e Fix redox and nightly 2023-12-30 12:53:57 +09:00
Jeong YunWon a309cb5d2c Fix 1.75 clippy warnings 2023-12-30 11:48:40 +09:00
Jeong, YunWon 4729ca3af0 Drop winapi from rustpython-vm 2023-12-28 23:44:47 +09:00
Jeong, YunWon cccfb08835 replace winbase winnt to windows-sys 2023-12-28 22:40:49 +09:00
Jeong, YunWon d01909a524 replace handleapi to windows-sys 2023-12-28 22:28:49 +09:00
Jeong, YunWon ee128eac7c replace errorhandling to windows-sys 2023-12-28 22:28:33 +09:00
Jeong, YunWon 6df9732965 replace wincon to windows-sys 2023-12-28 22:28:33 +09:00
Jeong, YunWon 8a84a479f1 remove processthreadsapi 2023-12-28 22:28:33 +09:00
Jeong, YunWon 7513017e21 replace sysinfoapi to windows-sys 2023-12-28 22:28:33 +09:00
Jeong, YunWon adf0788895 bump up windows{-sys} 2023-12-28 22:28:33 +09:00
Jeong, YunWon fc91cd8bc7 clean up winapi features (#5141) 2023-12-28 21:51:26 +09:00
ChenyG dc4f6994fb Support slice hash (#5123)
* make slice object hashable

* Update test_slice.py from CPython v3.12

* remove TODO

* remove outdated tests
2023-11-25 13:11:17 +09:00