Commit Graph
313 Commits
Author SHA1 Message Date
Shahar Naveh 9ccf4c1872 Ruff auto-format (#6422) 2025-12-12 22:46:39 +09:00
Shahar Naveh a47b32816b Merge pull request #6417 from ShaharNaveh/regr-test-doc-leak
Add regression test for #4505
2025-12-12 21:12:02 +09:00
Jeong, YunWon 98fff96f1c __doc__ handing in the right way (#6390) 2025-12-10 20:04:09 +09:00
Jeong YunWon 8af105fc4f Make mergeable 2025-11-29 00:22:44 +09:00
Ashwin Naren f37ea52565 Ctypes
more pointer implementation

fix import

add more classes

ctypes overhall

updates

fix build

fix warnings, pass test

fix panic on improper library load

test on macos

formatting

tmp

minor updates
2025-11-28 23:27:24 +09:00
Jeong YunWon 6991a80e13 Add __main__.__cached__ 2025-11-15 23:09:31 +09:00
yt2b 1d23f6e8df Panic occurs when formatting with separator and some format specifier (#6213)
* Fix get_separator_interval

* Add extra tests

* Remove FormatType::Number from match arm
2025-10-24 21:41:28 +09:00
Jeong YunWon 50c557419e more match pattern 2025-08-26 21:48:46 +09:00
Lee Dogeon 44a8c9f0b3 Remove completed TODO of extra_tests/fstring.py (#6095) 2025-08-20 14:08:53 +09:00
Jeong, YunWon ddc08498cc Fix match mapping pattern (#6081) 2025-08-20 13:26:18 +09:00
Jack O'Connor 33ea50c2e9 Add return annotation to __annotations__ last (#6071)
Functions like `functools.singledispatch` are sensitive to the order of
items in the `__annotations__` map.

CPython puts returns last.
2025-08-08 23:31:12 +09:00
Jeong, YunWon 8ab7aa2c6b type.__dict__ (#5957) 2025-07-13 13:12:03 +09:00
yt2b f608df4a23 Formatting with width and separator doesn't work correctly (#5927)
* Fix add_magnitude_separators

* Add extra tests
2025-07-10 09:10:52 +09:00
Jeong YunWon 7ebe0182e4 More eval typecheck 2025-07-07 19:02:37 +09:00
yt2b 0a59c1cad3 Implement PyComplex's __format__ function (#5900)
* Add num-complex in rustpython-common

* Implement PyComplex's __format__ function

* Remove @unittest.expectedFailure

* Fix PyComplex's __format__ function

* Remove @unittest.expectedFailure

* Add extra tests

* Rename to ZeroPadding and AlignmentFlag
2025-07-04 22:35:28 +09:00
Jeong, YunWon d5d3507921 Add sys._getframemodulename (#5873) 2025-06-30 22:50:27 +09:00
Ashwin Naren 159769876f add test 2025-06-29 14:42:09 +09:00
Jeong, YunWon 52301ddbe5 Fix PyFunction doc behavior (#5827) 2025-06-23 22:37:51 +09:00
Jeong YunWon 3f1d39e5db Fix DictUpdate validation 2025-06-22 00:00:07 +09:00
largemouth 0dac02f443 chore: fix some typos in comment
Signed-off-by: largemouth <largemouth@aliyun.com>
2025-06-17 21:59:25 +09:00
Rex Ledesma 4e2e0b41c6 chore: add ruff format --check (#5774)
* chore: add `ruff format --check`

* fix tests
2025-05-12 14:20:01 +09:00
Hanif Ariffin 253cc4e846 Fix usize not using the same hash as PyInt when used as key into a di… (#5756)
* Fix usize not using the same hash as PyInt when used as key into a dictionary

* Fix test that unexpectedly succeed!

* Update extra_tests/snippets/builtin_object.py
2025-05-01 14:55:19 +09:00
Ashwin Naren 8dc1718002 Match statements rewrite (#5628) 2025-04-10 14:00:54 +09:00
2230d6c751 Fix not throwing the same error as CPython in test_pathlib.test_expanduser (#5578)
* Fix not throwing the same error as CPython when trying to expanduser of a non-existent user

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>

* add pwd test

* Skip pwd test on windows

---------

Signed-off-by: Hanif Ariffin <hanif.ariffin.4326@gmail.com>
Co-authored-by: Jeong YunWon <jeong@youknowone.org>
Co-authored-by: Jeong, YunWon <69878+youknowone@users.noreply.github.com>
2025-04-05 15:33:33 +09:00
ivan-shrimp 3ad8fd711f fix expression list order
don't emit a no-op when unpacking a single element

assume positional args stored as tuple in extended call
2025-03-31 18:00:19 +09:00
Jeong, YunWon cd89aa51f0 Fix _ctypes.Array base and metaclass (#5620) 2025-03-27 19:45:04 +09:00
Ashwin Naren 01d470ff77 _ctypes pt. 4 (#5582)
* correct error type when symbol is not found

* restype get/set

* base of PyCSimple for PyCArray

* PyCSimple::to_arg

* par down ctypes

* nt._LOAD_LIBRARY_SEARCH_DEFAULT_DIRS

* arguments for ctypes function

* force failure to import ctypes
2025-03-25 09:09:29 +09:00
Ashwin Naren 8e22c399df partially fix sys.getwindowsversion() (#5595) 2025-03-14 11:38:35 +09:00
Ashwin Naren 40e3f49ab7 _ctypes pt. 3 (#5530)
* Initial CFuncPtr implementation

* function calling via libffi

* working no-arg function call

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-03-03 15:53:04 +09:00
Ashwin Naren 235adafa0b tests
Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-25 17:19:53 +09:00
Ashwin Naren e2b0fe4266 _ctypes pt. 2 (#5524)
* add __version__

* add more types/constants

* shared library and ExternalLibs implementation

* FreeLibrary for windows

* fixed PyCSimple

* LoadLibrary and FreeLibrary for non-windows

* fault-tolerant float equality

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-20 10:50:10 +09:00
Ashwin Naren fde87a340c Initial _ctypes implementation (#5519)
* initial _ctypes implementation with _CData, get_errno, and set_errno

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-15 16:03:58 +09:00
Ashwin Naren a46ce8ec3a Mark version 3.13.0 (#5495)
* bump to 3.13.1
* fix some tests
* strip left whitespace from doc
* remove specific difflib test that was causing issues
* fix test_enum

Signed-off-by: Ashwin Naren <arihant2math@gmail.com>
2025-02-13 14:11:01 +09:00
Jeong, YunWon 8f5cc6174c fix windows sleep 2025-02-07 07:53:28 +09:00
Shubham Patil 38593fbd85 Check operand types in bool or, and, xor to be PyInt (#5461)
* Added Tests for Bitwise or, and, xor type error

* Sync binary operator order comment with actual implementation

* Check operand types in bool or, and, xor to be PyInt

PyNumber methods are expected to type check both arguments.

Dispatch is not done by inverting parameter order for __r<op>__ (example __ror__) when calls are handled via PyNumberMethods
2024-12-30 16:44:27 +09:00
Oskar Skog 3dced01af0 Move os.system from posix.rs to os.rs
Fixes #5100
2024-12-06 12:19:34 +09:00
Jonathan Rotter 7996a10116 await in list comprehension (#5334)
* check if comprehension element contains await

* force execution to pause in async gen
2024-05-27 16:54:56 +09:00
toofooboo 41979f0823 chore: fix some typos in comments (#5243)
Signed-off-by: toofooboo <cmaker@foxmail.com>
2024-04-19 21:10:22 +09:00
Moreal bf985c8ac6 Fix None.__ne__ bug 2024-04-14 13:07:13 +09:00
Evan Rittenhouse 1ab133dae8 None.__ne__(None) should be NotImplemented (#5124) 2024-01-08 15:03:57 +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
Jeong, YunWonandCPython developers af884cb284 First step for Python 3.12 support (#5078)
* Mark 3.12

* Update importlib from Python 3.12.0

* Update test_importlib from Python3.12

* Mark failings tests from importlib

* Update test.support from Python3.12

* Fix unsupported parser feature

* mark failing test

* Update functools from Python 3.12

* manual type annotation

* slice behavior changed in 3.12

* empty unittest.main returns non-zero

* test_decimal from CPython 3.12

* Mark failing tests

* Update test_unicode from CPython 3.12

* Update test_functools from Python 3.12

* Update enum from Python 3.12

* enum

* Doc format changed

* Update test_module from CPython

---------

Co-authored-by: CPython developers <>
2023-10-22 19:19:05 -07:00
Junho LeeandJeong YunWon d4be55c2ea Add command line parameter -P (#4611)
* Add command line parameter -P

* Modify the value of safe_path to be set

---------

Co-authored-by: Jeong YunWon <jeong@youknowone.org>
2023-08-30 19:32:27 +09:00
Dan NäsmanandDimitrisJim 1cdc5d3294 Add get_int_max_str_digits and set_int_max_str_digits in sys. (#5014)
---------

Co-authored-by: DimitrisJim <d.f.hilliard@gmail.com>
2023-06-17 23:46:22 +03:00
Jeong, YunWon 3d2c51962b Update parser (#5012) 2023-06-18 02:38:42 +09:00
Jim Fasarakis-Hilliard 5c81649b19 Return SyntaxError with null byte input in eval. (#5013)
* Return SyntaxError with null byte input in eval.

* Special case MacOS for now, add a note for future sanity.
2023-06-17 16:58:28 +03:00
Jim Fasarakis-Hilliard 3a2a1d1b74 Remove unecessary unsafe, remove generated file in extra_snippets. (#4998) 2023-06-11 06:03:01 +03:00
Patrick 0e24cf48c6 Fix abc error message (#4987)
* Print correct error message for abc instantiation

* Update dataclasses abc test
2023-05-23 16:43:52 +09:00
Patrick He 8312831bc9 fix python linting errors 2023-05-19 14:05:36 -04:00
Patrick He 2786831d32 add test 2023-05-19 13:34:33 -04:00