39 Commits

Author SHA1 Message Date
hantianfeng
2c4ea54f12 Added PyCore::setOptions(), added numeric_as_object option 2024-05-28 14:14:43 +08:00
tianfenghan
8bdde38815 Fix PyFn ctor 2024-03-07 10:59:32 +08:00
Yurun
1df79c9512 Fix python config (#45)
* Fix configuration initialization for Python>=3.8

* Fix
2024-02-20 12:50:40 +08:00
tianfenghan
07a3e60a39 Added PyCore::fileno() 2024-02-18 15:34:04 +08:00
tianfenghan
22a539212f Fix PyObject::__toString() for python bytes 2024-02-18 13:30:39 +08:00
tianfenghan
5c87947b80 Refactor, Implement arrayaccess/iterator/countable in object base class 2024-01-22 18:43:54 +08:00
tianfenghan
4fa62b2bfa Fix incorrect behavior, enum must not be converted to integer 2024-01-22 12:51:38 +08:00
tianfenghan
21030f8c71 PyCore::next() may return any type 2024-01-16 11:22:30 +08:00
he426100
7a2b74aaee adapt phpunit for windows (#36)
Co-authored-by: he426100 <{ID}+{username}@users.noreply.github.com>
2024-01-15 11:28:33 +08:00
tianfenghan
26e834ad08 Fix crash when dict/set has undefined behavior 2023-12-28 17:30:37 +08:00
tianfenghan
bfe59ea3bf Optimize iter 2023-12-28 12:32:42 +08:00
he426100
84f0b2dd88 fix core dump when "new PyType" (#30)
* fix core dump when "new PyType"

* add test code

---------

Co-authored-by: 弄月 <{ID}+{username}@users.noreply.github.com>
2023-12-26 18:37:06 +08:00
Song Yeung
51773302b5 fix core dump when key wasn’t string. (#23)
* fix core dump when key wasn’t string.

* add test code
2023-12-26 10:25:16 +08:00
he426100
23d143f5a3 修正只有kwargs没有args时报错 (#28)
* 修正只有kwargs没有args时报错

* 添加单元测试

* fix

* update

* Update core.cc

---------

Co-authored-by: 弄月 <{ID}+{username}@users.noreply.github.com>
Co-authored-by: Tianfeng.Han <rango@swoole.com>
2023-12-26 10:12:16 +08:00
tianfenghan
99fb7ebabb update doc, add dict iter tests 2023-12-25 11:34:18 +08:00
tianfenghan
c2e65445c5 When a py exception is thrown, a null pointer must be returned 2023-12-21 15:52:45 +08:00
tianfenghan
922552e511 Fix 8.1 tests 2023-12-21 15:26:23 +08:00
tianfenghan
6b9a55f638 Make function calls fail when an exception is caught 2023-12-21 15:23:43 +08:00
tianfenghan
f62c4a1f17 Closure and object can be directly passed to Python as callable, without the need for PyCore::Fn() wrapping 2023-12-21 14:15:38 +08:00
tianfenghan
145d2907c0 Add PyCore::object, PyObject supports passing a value parameter 2023-12-21 13:24:17 +08:00
tianfenghan
f8e0b6b3df Add PyCore::bytes(), Fix memory leaks 2023-12-20 18:14:52 +08:00
tianfenghan
903a03162b refactor type cast 2023-12-18 16:57:09 +08:00
tianfenghan
9c14f8c9ac Refactor exception handling 2023-12-11 14:14:13 +08:00
tianfenghan
a04e25c956 Fix PyCore::eval() 2023-12-08 20:19:23 +08:00
Tianfeng.Han
fa2a39c632 Merge pull request #16 from caiyili/py-eval
feat: eval 支持传入外界变量
2023-12-08 19:43:32 +08:00
tianfenghan
a5cdb26bcd Update doc, add matplotlib.pyplot example 2023-12-08 14:37:24 +08:00
tianfenghan
a95f73bb4e Remove useless code 2023-12-08 13:31:08 +08:00
tianfenghan
f060d43ad7 Clear the zval saved in pyobject when ZendMM is destroyed 2023-12-08 11:52:34 +08:00
caiyili
d0b8c7aa9b feat: eval 支持传入外界变量 2023-12-07 19:44:41 +08:00
caiyili
ec83fbd73a merge: merge origin main branch 2023-12-07 14:51:09 +08:00
tianfenghan
577e6406fe Use PyCore::__callStatic instead of php extension functions 2023-12-07 14:43:38 +08:00
tianfenghan
226a44c4b3 Bytes 和 ByteArray 直接作为 PHP 的字符串 2023-12-07 12:49:02 +08:00
caiyili
27cbdad946 merge: merge main branch & fix conflicts 2023-12-07 12:33:13 +08:00
tianfenghan
68dbd59359 fix bytes type crash, Add callable fn 2023-12-07 12:32:14 +08:00
caiyili
ae7323b87b 1. eval 每次生成一个新的 PyModule
2. eval 返回新创建的 PyModule
3. 修改测试用例,增加对eval代码块中函数调用的用例
4. 新加了一个生成随机字符串的函数
2023-12-07 12:23:36 +08:00
caiyili
dc142f088b merge: merge main branch 2023-12-06 16:24:04 +08:00
caiyili
4a0372df7c 1. eval 函数支持获取 python 代码的结果
2. 增加了单元测试 EvalTest.php
3. 补充了 eval 函数的 stub
2023-12-06 16:02:01 +08:00
tianfenghan
f9c1f47142 增加 Iter,PyCore::iter(), PyCore::next() 2023-12-06 11:21:01 +08:00
tianfenghan
9336c2c025 init 2023-12-04 17:20:01 +08:00