13658 Commits

Author SHA1 Message Date
Jeong YunWon
8816cd41d5 0.3.1 0.3.1 2024-04-10 17:39:57 +09:00
Jeong, YunWon
4b190eb412 Merge pull request #5221 from youknowone/update-indexmap
Update indexmap
2024-04-09 12:50:42 +09:00
Jeong YunWon
9f24841f6d remove -u from macOS/windows 2024-04-09 11:18:14 +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, YunWon
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
f541ca9dda Require cpu resource to test_search_anchor_at_beginning (#5218)
cherry-pick python/cpython#117616

Co-authored-by: CPython Developers <>
2024-04-09 01:01:46 +09:00
Jeong, YunWon
6a64af1066 Merge pull request #5213 from youknowone/vm-finalize
Add vm.finalize and enter/run docs
2024-04-08 01:43:48 +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
ae72316629 Merge pull request #5209 from Poppro/itertools-batched
Add itertools.batched Support
2024-04-06 19:26:02 +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 Harloff
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
f6569313d7 Move test_itertools to CPython 3.12 Spec 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
e349b0f18b Merge pull request #5125 from qingshi163/sre-dev
Update Sre Engine Implementing to CPython 3.12
2024-03-30 18:50:00 +09:00
Jeong, YunWon
34ffa93945 Remove commented out code 2024-03-30 18:49:33 +09:00
Jeong, YunWon
7be6308248 Merge pull request #5206 from dchiquito/fix-test-zipfile
Increase threshold for zipfile test_many_opens
2024-03-28 17:03:47 +09:00
Kangzhi Shi
57e7f4db95 bump string.py mark passed tests 2024-03-22 14:59:19 +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
Kangzhi Shi
ebe555203a Replace Lib/sre_* from CPython 2024-03-22 14:54:02 +09:00
Kangzhi Shi
280337a305 Add Lib/re/* from CPython 3.12 2024-03-22 14:54:02 +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
df363c0ba7 Skip typing test which causes other failures (#5207) 2024-03-22 10:26:40 +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
0a24e106ba Increase threshold for zipfile test_many_opens
It turns out that there are many other tests that can impact
test_many_opens by leaving unclosed file handles. Rather than fix them
all, it is easier to simply increase the threshold for the problematic
test.
2024-03-21 13:37:46 -04:00
Daniel Chiquito
e6c73883ea Revert test skip 2024-03-21 13:36:28 -04:00
Daniel Chiquito
e315077630 Add TODO: RUSTPYTHON to skip reason 2024-03-21 11:31:03 -04: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
Daniel Chiquito
5ee5531f32 Properly unload modules between tests (#5192)
There seems to have been a bug in the libregrtest code which unloaded
modules between tests. The previous state was calculated using
`sys.modules.keys()`, which is actually a mutable object that is updated
as the underlying `sys.modules` is updated. The result was that modules
were not unloaded between tests, which is the root cause for
`test_unittest` failing when run after `test_import` and
`test_importlib`.

This code is copied from 3.12. Ideally all of `libregrtest` should
probably be updated as it seems wildly out of date, but that's a lot
more work.
2024-03-21 21:51:57 +09:00
Jeong, YunWon
3737f2a091 make adding a single module simpler for interpreter users (#4792) 2024-03-21 21:48:29 +09:00
Daniel Chiquito
ac78517044 Skip TestScander.test_uninstantiable (#5204)
This test was marked as an expected failure. Because the garbage
collector is missing, that meant that the `os.scandir` object went
unclosed. This object was squatting on the file descriptors of all the
files contained in the test directory, which was breaking test_zipfile.
2024-03-21 14:44:03 +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
Nikita Sobolev
426e582ba0 Remove incorrect @expectedFailures from test_cmd_line (#5201)
After you suggestion in https://github.com/python/cpython/issues/116504#issuecomment-1999239012 I went to take a look at `test_cmd_line` in RustPython (it was so long ago I contributed to this amazing project, so may thing had changed!), and I've noticed this.

This is a problem, here' the simplest demo:

```python
import unittest

class TestMe(unittest.TestCase):
    @unittest.expectedFailure
    def test_me(self):
        def run():
            raise ValueError

        with self.subTest(run=run):
            run()

if __name__ == '__main__':
    unittest.main()
```

This works as expected:

```
» ./python.exe ex.py
x
----------------------------------------------------------------------
Ran 1 test in 0.001s

OK (expected failures=1)
```

This does not:

```python
import unittest

class TestMe(unittest.TestCase):
    def test_me(self):
        @unittest.expectedFailure
        def run():
            raise ValueError

        with self.subTest(run=run):
            run()

if __name__ == '__main__':
    unittest.main()
```

Produces:

```
» ./python.exe ex.py
E
======================================================================
ERROR: test_me (__main__.TestMe.test_me) (run=<function TestMe.test_me.<locals>.run at 0x1057a2150>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/ex.py", line 10, in test_me
    run()
    ~~~^^
  File "/Users/sobolev/Desktop/cpython2/ex.py", line 7, in run
    raise ValueError
ValueError

----------------------------------------------------------------------
Ran 1 test in 0.001s

FAILED (errors=1)
```

So, I propose to remove these decorators, let's only keep `TODO` comments to indicate separate failures.
2024-03-15 22:15:45 +09:00
Kirill Podoprigora
92c8b371ae Update colorsys.py and test_colorsys.py to 3.12 (#5198) 2024-03-13 15:22:57 +09:00
Kirill Podoprigora
d8f2bd04ac Update cgitb.py to 3.12 (#5197) 2024-03-13 15:22:24 +09:00
Kirill Podoprigora
855fa1411f Update ftplib and test_ftplib to 3.12 (#5196) 2024-03-13 07:35:16 +09:00
Kirill Podoprigora
4e7b3bc8f2 Update pprint.py and test_pprint.py to 3.12 (#5195) 2024-03-12 22:36:10 +09:00
Kirill Podoprigora
83d1ad8a2c Update test_operator.py to 3.12 (#5194) 2024-03-12 22:35:21 +09:00
Kirill Podoprigora
7f02324dce Update Lib/test/test_hmac.py to 3.12 version (#5188) 2024-03-11 22:04:35 +09:00