749 Commits

Author SHA1 Message Date
Md Kaif
7fd7e2db15
fix(float): abs(-0.0) should return 0.0 (#534)
abs(-0.0) returns -0.0 instead of 0.0, and math.fabs(-0.0) does the
same. Both come from the idiom (x < 0) ? -x : x. Since -0.0 < 0 is
false, the negative zero is returned unchanged.

The idiom appears twice, once in dmath_fabs and once open-coded in
float__abs__. Fix dmath_fabs by clearing the sign bit, the same way
dmath_copysign just above it works, and make float__abs__ call the
shared helper instead of repeating the comparison.

abs(-0.0) == 0.0 is true even with the bug, because -0.0 == 0.0 under
IEEE 754, so the added tests compare str(...) to check the sign.
2026-07-21 19:36:08 +08:00
Md Kaif
005550e92a
fix(str): zfill should preserve a leading sign (#533)
zfill writes the padding zeros before the whole string, so a leading
+ or - ends up in the middle of the result instead of staying in front.
For example "-5".zfill(4) gave '00-5' where CPython gives '-005'.

CPython inserts the padding after the sign character, and the sign
counts toward the requested width. Write the sign first, then the
zeros, then the rest of the string. delta is still computed before
this, so the total length is unchanged.

The existing tests only covered unsigned strings, which is why this
went unnoticed. Added three asserts alongside them.
2026-07-21 19:09:11 +08:00
thermalPasteMilkshake
e144785436
re-checking (#531) 2026-07-11 10:25:27 +08:00
felfoldy
21248a0baf
Add inspect.signature (#526)
* Add inspect.signature tests

* Implement inspect.signature
2026-07-06 12:00:58 +08:00
Rob McMullen
ea82f56373
Fixed missing '\u85' line separator from str.splitlines (#524)
Very thanks! Your contribution is professional and exceptional.
2026-07-01 11:43:16 +08:00
Rob McMullen
664ce091f8
Added str.splitlines (#523)
* uses same algorithm as CPython, supports all CPython eol characters
  in https://docs.python.org/3/library/stdtypes.html#str.splitlines
2026-06-28 21:56:47 +08:00
Steve Chen
894ace2963
Fix JSON integer and float serialization. (#519)
* Fix JSON integer and float serialization.

* Simplify float serialization round-trip fix

* fix round trip check

* fix lexer EOF OOB read and list.sort comparator signature

* revert

* fix cases

* Update os.c

* add `long_v1`

---------

Co-authored-by: blueloveTH <blueloveTH@foxmail.com>
2026-06-18 11:39:41 +08:00
blueloveTH
338547dc8d Update 723_msgpack.py 2026-06-18 09:27:39 +08:00
blueloveTH
8c4ed3bc34 fix a bug of str 2026-06-02 20:42:03 +08:00
BLUELOVETH
c624833cfb
Add more gc control to improve performance (#510)
* add more gc control

* fix

* Update gc.c

* Update ceval.c

* [no ci] Update 711_gc.py
2026-04-29 13:55:41 +08:00
blueloveTH
826b6f40f9 Update 930_deterministic_float.py 2026-04-23 11:06:38 +08:00
blueloveTH
33b26ebd95 Update 930_deterministic_float.py
temp fix

Update math.c
2026-04-22 18:31:23 +08:00
BLUELOVETH
f67b24450b
Merge pull request #504 from pocketpy/test-math-py34
[no ci] Add math tests from python 3.4
2026-04-22 18:15:10 +08:00
blueloveTH
5d30381e19 fix #498 2026-04-17 11:10:55 +08:00
blueloveTH
9a57b281e8 add := fix #446 2026-03-28 17:53:39 +08:00
blueloveTH
35917fc5f4 fix #468 2026-03-04 14:30:35 +08:00
Tanisha Vasudeva
1d33267092
feat: implement dict.popitem() method (#443) (#467)
* Added popitem()

* fix

---------

Co-authored-by: blueloveTH <blueloveTH@foxmail.com>
2026-03-03 14:55:56 +08:00
blueloveTH
440acd82f8 refactor chunked_array2d 2026-02-23 00:35:00 +08:00
blueloveTH
9f1ac4d6c3 fix dmath 2026-02-21 21:30:33 +08:00
blueloveTH
b07db073fd remove colorcvt 2026-02-21 21:12:52 +08:00
blueloveTH
aaf611eff3 up 2026-02-21 21:08:33 +08:00
blueloveTH
d5b711f50c fix #447 2026-02-05 11:27:12 +08:00
blueloveTH
cbbe319520 fix #458 2026-02-05 11:20:11 +08:00
killcerr
82b4fff934
fix #440 (#457)
* fix #440

* fix #440

* fix #440

* fix #440

* fix #440

* fix #440

* fix #440

* add test

* add test
2026-02-02 21:45:11 +08:00
blueloveTH
2fa14c5884 fix #455 2026-01-30 14:42:45 +08:00
blueloveTH
cf965a1957 fix #456 2026-01-30 14:40:05 +08:00
blueloveTH
48b70c944e fix #426 2026-01-26 17:50:03 +08:00
blueloveTH
2281b9bb44 fix #424 2026-01-26 17:24:29 +08:00
blueloveTH
979addecf9 improve extend and choice 2026-01-14 16:49:02 +08:00
blueloveTH
9ef38d605b fix bool-int ops 2026-01-14 16:14:08 +08:00
blueloveTH
9e4636b619 improve math tests 2026-01-07 16:59:10 +08:00
blueloveTH
a1bfebd30c Update 300_import.py 2026-01-06 15:18:04 +08:00
blueloveTH
3e182d5c6b add tests for .pyc 2026-01-06 15:11:39 +08:00
BLUELOVETH
5f7bf4924b
Support running compiled bytecodes (#421) 2026-01-05 19:40:21 +08:00
blueloveTH
1e2135e153 discard '_' 2025-12-25 18:12:04 +08:00
blueloveTH
8ff3f44179 fix https://github.com/pocketpy/pocketpy/issues/394 2025-12-25 17:42:24 +08:00
blueloveTH
ecdea105d6 fix https://github.com/pocketpy/pocketpy/issues/408 2025-12-25 17:40:07 +08:00
blueloveTH
e23fd85ebd add bin 2025-12-19 16:36:43 +08:00
blueloveTH
2eb84b562e add stdc module 2025-12-16 17:10:45 +08:00
blueloveTH
6cad72453b fix error of "A() takes no arguments" 2025-12-09 14:45:08 +08:00
blueloveTH
5c7fb79a14 support del slice for list 2025-12-09 13:43:33 +08:00
zhs628
fc991ab697
Increase coverage 2025 12 01 (#412)
* 通过引发py_call错误覆盖相关调用者的ok==false分支

* Revert "通过引发py_call错误覆盖相关调用者的ok==false分支"

This reverts commit 36dc0b5d81a02a83dfdeca2d4d6d265f5f793b4b.

* add test

* rename test files

* fix bugs

* fix bugs
2025-12-04 21:01:29 +08:00
blueloveTH
0b91c2968b add picoterm.sscanf 2025-11-27 14:41:13 +08:00
blueloveTH
6f9b7943d4 add wcwidth and wcswidth 2025-11-27 11:31:14 +08:00
blueloveTH
bfe471dc12 small refactor 2025-11-24 11:41:37 +08:00
BLUELOVETH
c45a5df1e8
add setup_gc_debug_callback (#406)
* [no ci] backup

* [no ci] backup

* [no ci] fix

* [no ci] fix

* [no ci] fix

* [no ci] fix

* [no ci] fix

* [no ci] fix

* [no ci] fix

* [no ci] fix

---------

Co-authored-by: 张皓晟 <2067144018@qq.com>
2025-11-23 16:30:22 +08:00
blueloveTH
4827e6dea3 add picoterm module 2025-11-23 00:14:14 +08:00
blueloveTH
b0b3bdef86 fix some bug 2025-11-11 16:09:33 +08:00
Daniel Saier
e39e63191f
Add support for some missing escape sequences (#399) 2025-10-08 21:56:54 +08:00
blueloveTH
0251f924c3 fix leak and improve pickle 2025-10-08 21:09:14 +08:00