Skip to content

Commit 1bc544e

Browse files
committed
Updated Python extension:
- Update to pocketpy 2.0.6
1 parent cb4c3fe commit 1bc544e

File tree

2 files changed

+19871
-3
lines changed

2 files changed

+19871
-3
lines changed

code/build/template/include/extensions/[+python pocketpy.h]

+9-3
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
// clang-format off
1010

11-
#define PK_VERSION "2.0.4"
11+
#define PK_VERSION "2.0.6"
1212
#define PK_VERSION_MAJOR 2
1313
#define PK_VERSION_MINOR 0
14-
#define PK_VERSION_PATCH 4
14+
#define PK_VERSION_PATCH 6
1515

1616
/*************** feature settings ***************/
1717

@@ -202,6 +202,8 @@ typedef struct py_Callbacks {
202202
char* (*importfile)(const char*);
203203
/// Used by `print` to output a string.
204204
void (*print)(const char*);
205+
/// Used by `input` to get a character.
206+
int (*getchar)();
205207
} py_Callbacks;
206208

207209
#define PY_RAISE
@@ -321,6 +323,8 @@ PK_API void py_newstr(py_OutRef, const char*);
321323
PK_API char* py_newstrn(py_OutRef, int);
322324
/// Create a `str` object from a `c11_sv`.
323325
PK_API void py_newstrv(py_OutRef, c11_sv);
326+
/// Create a formatted `str` object.
327+
PK_API void py_newfstr(py_OutRef, const char*, ...);
324328
/// Create a `bytes` object with `n` UNINITIALIZED bytes.
325329
PK_API unsigned char* py_newbytes(py_OutRef, int n);
326330
/// Create a `None` object.
@@ -647,11 +651,13 @@ PK_API bool py_pusheval(const char* expr, py_GlobalRef module) PY_RAISE;
647651
PK_API py_GlobalRef py_newmodule(const char* path);
648652
/// Get a module by path.
649653
PK_API py_GlobalRef py_getmodule(const char* path);
654+
/// Reload an existing module.
655+
PK_API bool py_importlib_reload(py_GlobalRef module) PY_RAISE PY_RETURN;
650656

651657
/// Import a module.
652658
/// The result will be set to `py_retval()`.
653659
/// -1: error, 0: not found, 1: success
654-
PK_API int py_import(const char* path) PY_RAISE;
660+
PK_API int py_import(const char* path) PY_RAISE PY_RETURN;
655661

656662
/************* Errors *************/
657663

0 commit comments

Comments
 (0)