Compare commits

...

2 Commits

Author SHA1 Message Date
blueloveTH
55b7db54a2 add __or__ for type 2024-11-21 13:55:09 +08:00
BLUELOVETH
b5a443efa1
Update README.md 2024-11-21 10:43:02 +08:00
2 changed files with 9 additions and 2 deletions

View File

@ -186,9 +186,10 @@ And these are the results of the primes benchmark on Intel i5-12400F, WSL (Ubunt
| | Description | | | Description |
|-----------------------------------------------------------------|--------------------------------------------------------------------------| |-----------------------------------------------------------------|--------------------------------------------------------------------------|
| [TIC-80](https://github.com/nesbox/TIC-80) | TIC-80 is a fantasy computer for making, playing and sharing tiny games. | | [TIC-80](https://github.com/nesbox/TIC-80) | TIC-80 is a fantasy computer for making, playing and sharing tiny games. |
| [MiniPythonIDE](https://github.com/CU-Production/MiniPythonIDE) | A python ide base on pocketpy | | [py-js](https://github.com/shakfu/py-js) | Python3 externals for Max / MSP. |
| [py-js](https://github.com/shakfu/py-js) | Python3 externals for Max / MSP |
| [crescent](https://github.com/chukobyte/crescent) | Crescent is a cross-platform 2D fighting and beat-em-up game engine. | | [crescent](https://github.com/chukobyte/crescent) | Crescent is a cross-platform 2D fighting and beat-em-up game engine. |
| [orxpy](https://github.com/hcarty/orx) | Python extension for orx engine. |
| [CANopenTerm](https://canopenterm.de/python-api) | Open-source software tool for CANopen CC networks and devices. |
Submit a pull request to add your project here. Submit a pull request to add your project here.

View File

@ -93,6 +93,11 @@ static bool type__getitem__(int argc, py_Ref argv) {
return true; return true;
} }
static bool type__or__(int argc, py_Ref argv) {
py_assign(py_retval(), argv);
return true;
}
static bool type__module__(int argc, py_Ref argv) { static bool type__module__(int argc, py_Ref argv) {
PY_CHECK_ARGC(1); PY_CHECK_ARGC(1);
py_TypeInfo* ti = pk__type_info(py_totype(argv)); py_TypeInfo* ti = pk__type_info(py_totype(argv));
@ -127,6 +132,7 @@ void pk_object__register() {
py_bindmagic(tp_type, __repr__, type__repr__); py_bindmagic(tp_type, __repr__, type__repr__);
py_bindmagic(tp_type, __new__, type__new__); py_bindmagic(tp_type, __new__, type__new__);
py_bindmagic(tp_type, __getitem__, type__getitem__); py_bindmagic(tp_type, __getitem__, type__getitem__);
py_bindmagic(tp_type, __or__, type__or__);
py_bindproperty(tp_type, "__module__", type__module__, NULL); py_bindproperty(tp_type, "__module__", type__module__, NULL);
py_bindproperty(tp_type, "__base__", type__base__, NULL); py_bindproperty(tp_type, "__base__", type__base__, NULL);