From b75655e24896fc86f35dfad674c5e3a650ac5ec1 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Sun, 3 Dec 2023 11:44:24 +0100 Subject: [PATCH] Bump Python3.12, Cython 3.0.6, Godot 4.2.0 --- .github/workflows/build.yml | 2 +- meson_options.txt | 4 +- requirements.in | 2 +- requirements.txt | 128 +++++++++++++++------------ scripts/python_distrib.py | 15 +++- src/_pythonscript.pyx | 12 +-- src/godot/hazmat/extension_class.pxd | 20 ++--- 7 files changed, 104 insertions(+), 79 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e61c9f19..afe97b88 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ concurrency: # Global Settings env: - PYTHON_VERSION: "3.8" # Python to run the build, no the one shipped ! + PYTHON_VERSION: "3.12" # Python to run the build, no the one shipped ! BLEEDING_EDGE_GODOT: true diff --git a/meson_options.txt b/meson_options.txt index 566b27a2..03811f48 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,5 @@ -option('cpython_distrib_version', type: 'string', value: '3.11.5', description: 'Version of CPython to ship') +option('cpython_distrib_version', type: 'string', value: '3.12.0', description: 'Version of CPython to ship') option('gdextension_path', type: 'string', value: '', description: 'Use GDExtension API at this location instead of generating it from Godot binary') -option('godot_version', type: 'string', value: '4.1.1', description: 'Version of Godot to generate GDExtension API from') +option('godot_version', type: 'string', value: '4.2.0', description: 'Version of Godot to generate GDExtension API from') option('real_is_double', type: 'boolean', value: false, description: 'Built for Godot with 64bits floating point numbers (i.e. double) in builtins instead of 32bits (i.e. float)') option('classes_sample', type: 'boolean', value: false, description: 'Only bind a subset of Godot classes (useful for tests&debug for faster build time)') diff --git a/requirements.in b/requirements.in index 239142d9..51fd1d14 100644 --- a/requirements.in +++ b/requirements.in @@ -4,7 +4,7 @@ pip-tools~=6.12 # see: https://github.com/pallets/click/blob/030f53cf677ee1de534359c535d465eed0ec1d99/setup.py#L6 colorama~=0.4 ninja~=1.11 -cython~=0.29 +cython~=3.0 jinja2~=3.1 zstandard~=0.19 autopxd2~=2.3 diff --git a/requirements.txt b/requirements.txt index 19fcbe4f..7aa8cb76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt --resolver=backtracking requirements.in @@ -21,48 +21,65 @@ colorama==0.4.6 \ --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 # via -r requirements.in -cython==0.29.35 \ - --hash=sha256:05b7ede0b0eb1c6b9bd748fa67c5ebf3c3560d04d7c8a1486183ddd099de5a00 \ - --hash=sha256:0a9334d137bd42fca34b6b413063e19c194ba760846f34804ea1fb477cbe9a88 \ - --hash=sha256:156ae92bedcd8261b5259724e2dc4d8eb12ac29159359e34c8358b65d24430ac \ - --hash=sha256:247d585d8e49f002e522f3420751a4b3da0cf8532ef64d382e0bc9b4c840642c \ - --hash=sha256:27f58d0dd53a8ffb614814c725d3ee3f136e53178611f7f769ff358f69e50502 \ - --hash=sha256:2a2f2fb9b1c0a4a3890713127fba55a38d2cf1619b2570c43c92a93fee80111a \ - --hash=sha256:2e1e5d62f15ea4fa4a8bc76e4fcc2ea313a8afe70488b7b870716bcfb12b8246 \ - --hash=sha256:3cd717eee52072be8244bb07f0e4126f893214d2dfd1ba8b38b533e1ffec4f8a \ - --hash=sha256:3da42ef5b71674e4864b6afbe1bcacba75807684e22b6337f753cf297ae4e2d2 \ - --hash=sha256:402307ad6fd209816cf539680035ef79cce171288cb98f81f3f11ea8ef3afd99 \ - --hash=sha256:417703dc67c447089258ab4b3d217f9c03894574e4a0d6c50648a208bc8352bb \ - --hash=sha256:445e092708c26b357c97b3c68ea3eab31846fc9c1360bb150225f340c20322ec \ - --hash=sha256:511f3adfb2db4db2eb882f892525db18a3a21803830474d2fa8b7a1a0f406985 \ - --hash=sha256:516abc754f15b84d6a8e71c8abd90e10346ea86001563480f0be1b349d09c6b8 \ - --hash=sha256:520c50d1875627c111900d7184fd658e32967a3ef807dc2fbc252e384839cbcf \ - --hash=sha256:537bc1e0ed9bf7289c80f39a9a9359f5649068647631996313f77ba57afde40b \ - --hash=sha256:563a02ea675ed6321d6257df067c89f17b89a63487ef8b9ce0d598e88e7ff0bd \ - --hash=sha256:5a47974f3ebccf25702ffdd569904f7807ea1ef0830987c133877fabefdc4bab \ - --hash=sha256:5cdd65f7d85e15f1662c75d85d837c20d5c68acdd1029bfd08fb44c4422d7d9b \ - --hash=sha256:6c19e2ba027d2e9e2d88a08aa6007344be781ed99bc0924deb237ec52ca14c09 \ - --hash=sha256:6e381fa0bf08b3c26ec2f616b19ae852c06f5750f4290118bf986b6f85c8c527 \ - --hash=sha256:75541567a2de1f893d247a7f9aa300dff5662fb33822a5fb75bc9621369b8ef0 \ - --hash=sha256:8841158f274896702afe732571d37be22868a301275f952f6280547b25280538 \ - --hash=sha256:94859c3fd90767995b33d803edecad21e73749823db468d34f21e80451a11a99 \ - --hash=sha256:99477c1d4a105a562c05d43cc01905b6711f0a6a558d90f20c7aee0fb23d59d5 \ - --hash=sha256:9e54b4bee55fec952333126147b89c195ebe1d60e8e492ec778916ca5ca03151 \ - --hash=sha256:a1ad51612ff6cfe05cd58f584f01373d64906bb0c860a067c6441359ff10464f \ - --hash=sha256:acab11c834cbe8fb7b71f9f7b4c4655afd82ffadb1be93d5354a67702fcee69d \ - --hash=sha256:b63ea04db03190dc8b25d167598989be5c1fe9fc3121d7802c0aafc8a4ec383f \ - --hash=sha256:ba534e07543b44fb5ae37e56e61072ed1021b2d6ed643dbb92afa8239a04aa83 \ - --hash=sha256:be7e1f98a359408186025f84d28d243e4527acb976f06b8ae8441dc5db204280 \ - --hash=sha256:c17c876db737e1183d18d23db9cc31a9f565c113a32523c672af72f6497e382f \ - --hash=sha256:c1d7a9ff809fa9b4a9fe04df86c9f7f574ca31c2ad896462a97ea89523db286a \ - --hash=sha256:c38e2c1e94b596132454b29757536d5afa810011d8bcb86918cc6693d2302940 \ - --hash=sha256:c44bb47b314abc743705c7d038d351ffc3a34b95ab59b04b8cb27cf781b44ae8 \ - --hash=sha256:c4cd7de707938b8385cd1f88e1446228fbfe09af7822fa13877a4374c4881198 \ - --hash=sha256:db695a19968a54b9ac53048c723234b4f0db7409def0a5c5517237202e7a9b92 \ - --hash=sha256:e7b1901b03c37a082ba405e2cf73a57091e835c7af35f664f9dd1d855a992ad5 \ - --hash=sha256:ea1c166336188630cd3e48aea4bbe06ea1bab444624e31c78973fffcae1cf708 \ - --hash=sha256:ef2fc6f81aa8fb512535b01199fbe0d0ecafb8a29f261055e4b3f103c7bd6c75 \ - --hash=sha256:fb8c11cd3e2d5ab7c2da78c5698e527ecbe469437326811562a3fbf4c5780ae4 +cython==3.0.6 \ + --hash=sha256:05d15854b2b363b35c755d22015c1c2fc590b8128202f8c9eb85578461101d9c \ + --hash=sha256:0b94610fa49e36db068446cfd149a42e3246f38a4256bbe818512ac181446b4b \ + --hash=sha256:0ca8f379b47417bfad98faeb14bf8a3966fc92cf69f8aaf7635cf6885e50d001 \ + --hash=sha256:0d45a84a315bd84d1515cd3571415a0ee0709eb4e2cd4b13668ede928af344a7 \ + --hash=sha256:0fcdfbf6fc7d0bd683d55e617c3d5a5f25b28ce8b405bc1e89054fc7c52a97e5 \ + --hash=sha256:1074e84752cd0daf3226823ddbc37cca8bc45f61c94a1db2a34e641f2b9b0797 \ + --hash=sha256:11e1d9b153573c425846b627bef52b3b99cb73d4fbfbb136e500a878d4b5e803 \ + --hash=sha256:14b992f36ffa1294921fca5f6488ea192fadd75770dc64fa25975379382551e9 \ + --hash=sha256:16b3b02cc7b3bc42ee1a0118b1465ca46b0f3fb32d003e6f1a3a352a819bb9a3 \ + --hash=sha256:2262390f453eedf600e084b074144286576ed2a56bb7fbfe15ad8d9499eceb52 \ + --hash=sha256:25da0e51331ac12ff16cd858d1d836e092c984e1dc45d338166081d3802297c0 \ + --hash=sha256:267e34e9a96f98c379100ef4192994a311678fb5c9af34c83ba5230223577581 \ + --hash=sha256:2c77f97f462a40a319dda7e28c1669370cb26f9175f3e8f9bab99d2f8f3f2f09 \ + --hash=sha256:2ca2e90a75d405070f3c41e701bb8005892f14d42322f1d8fd00a61d660bbae7 \ + --hash=sha256:2d296b48e1410cab50220a28a834167f2d7ac6c0e7de12834d66e42248a1b0f6 \ + --hash=sha256:345d9112fde4ae0347d656f58591fd52017c61a19779c95423bb38735fe4a401 \ + --hash=sha256:399d185672c667b26eabbdca420c98564583798af3bc47670a8a09e9f19dd660 \ + --hash=sha256:3ac8b6734f2cad5640f2da21cd33cf88323547d07e445fb7453ab38ec5033b1f \ + --hash=sha256:4121c1160bc1bd8828546e8ce45906bd9ff27799d14747ce3fbbc9d67efbb1b8 \ + --hash=sha256:4975cdaf720d29288ec225b76b4f4471ff03f4f8b51841ba85d6587699ab2ad5 \ + --hash=sha256:49d5cae02d56e151e1481e614a1af9a0fe659358f2aa5eca7a18f05aa641db61 \ + --hash=sha256:519814b8f80869ee5f9ee2cb2363e5c310067c0298cbea291c556b22da1ef6ae \ + --hash=sha256:5921a175ea20779d4443ef99276cfa9a1a47de0e32d593be7679be741c9ed93b \ + --hash=sha256:7f19e99c6e334e9e30dfa844c3ca4ac09931b94dbba406c646bde54687aed758 \ + --hash=sha256:805a2c532feee09aeed064eaeb7b6ee35cbab650569d0a3756975f3cc4f246cf \ + --hash=sha256:85a7a406f78c2f297bf82136ff5deac3150288446005ed1e56552a9e3ac1469f \ + --hash=sha256:86e1e5a5c9157a547d0a769de59c98a1fc5e46cfad976f32f60423cc6de11052 \ + --hash=sha256:88be4fbc760de8f313df89ca8256098c0963c9ec72f3aa88538384b80ef1a6ef \ + --hash=sha256:8a05f79a0761fc76c42e945e5a9cb5d7986aa9e8e526fdf52bd9ca61a12d4567 \ + --hash=sha256:8d2d9e53bf021cc7a5c7b6b537b5b5a7ba466ba7348d498aa17499d0ad12637e \ + --hash=sha256:8dd5f5f3587909ff71f0562f50e00d4b836c948e56e8f74897b12f38a29e41b9 \ + --hash=sha256:97081932c8810bb99cb26b4b0402202a1764b58ee287c8b306071d2848148c24 \ + --hash=sha256:9a77a174c7fb13d80754c8bf9912efd3f3696d13285b2f568eca17324263b3f7 \ + --hash=sha256:9b853e0855e4b3d164c05b24718e5e2df369e5af54f47cb8d923c4f497dfc92c \ + --hash=sha256:9b89463ea330318461ca47d3e49b5f606e7e82446b6f37e5c19b60392439674c \ + --hash=sha256:9c0472c6394750469062deb2c166125b10411636f63a0418b5c36a60d0c9a96a \ + --hash=sha256:9cae02e26967ffb6503c6e91b77010acbadfb7189a5a11d6158d634fb0f73679 \ + --hash=sha256:9e31a9b18ec6ce57eb3479df920e6093596fe4ba8010dcc372720040386b4bdb \ + --hash=sha256:a38b9e7a252ec27dbc21ee8f00f09a896e88285eebb6ed99207b2ff1ea6af28e \ + --hash=sha256:a8e788e64b659bb8fe980bc37da3118e1f7285dec40c5fb293adabc74d4205f2 \ + --hash=sha256:b029d8c754ef867ab4d67fc2477dde9782bf0409cb8e4024a7d29cf5aff37530 \ + --hash=sha256:b24c1c38dad4bd85e142ccbe2f88122807f8d5a75352321e1e4baf2b293df7c6 \ + --hash=sha256:b3dda1e80eb577b9563cee6cf31923a7b88836b9f9be0043ec545b138b95d8e8 \ + --hash=sha256:b8640b7f6503292c358cef925df5a69adf230045719893ffe20ad98024fdf7ae \ + --hash=sha256:bca2542f1f34f0141475b13777df040c31f2073a055097734a0a793ac3a4fb72 \ + --hash=sha256:cb6a54543869a5b0ad009d86eb0ebc0879fab838392bfd253ad6d4f5e0f17d84 \ + --hash=sha256:ccbee314f8d15ee8ddbe270859dda427e1187123f2c7c41526d1f260eee6c8f7 \ + --hash=sha256:ce442c0be72ab014c305399d955b78c3d1e69d5a5ce24398122b605691b69078 \ + --hash=sha256:dc4b4e76c1414584bb55465dfb6f41dd6bd27fd53fb41ddfcaca9edf00c1f80e \ + --hash=sha256:dcdb9a177c7c385fe0c0709a9a6790b6508847d67dcac76bb65a2c7ea447efe5 \ + --hash=sha256:dfe8c7ac60363769ed8d91fca26398aaa9640368ab999a79b0ccb5e788d3bcf8 \ + --hash=sha256:e3ed0c125556324fa49b9e92bea13be7b158fcae6f72599d63c8733688257788 \ + --hash=sha256:e5548316497a3b8b2d9da575ea143476472db90dee73c67def061621940f78ae \ + --hash=sha256:e781b3880dfd0d4d37983c9d414bfd5f26c2141f6d763d20ef1964a0a4cb2405 \ + --hash=sha256:ea2e5a7c503b41618bfb10e4bc610f780ab1c729280531b5cabb24e05aa21cf2 \ + --hash=sha256:eebbf09089b4988b9f398ed46f168892e32fcfeec346b15954fdd818aa103456 \ + --hash=sha256:ef88c46e91e21772a5d3b6b1e70a6da5fe098154ad4768888129b1c05e93bba7 \ + --hash=sha256:fabb2d14dd71add618a7892c40ffec584d1dae1e477caa193778e52e06821d83 # via -r requirements.in jinja2==3.1.2 \ --hash=sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852 \ @@ -147,10 +164,6 @@ packaging==23.1 \ --hash=sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61 \ --hash=sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f # via build -pip==23.1.2 \ - --hash=sha256:0e7c86f486935893c708287b30bd050a36ac827ec7fe5e43fe7cb198dd835fba \ - --hash=sha256:3ef6ac33239e4027d9a5598a381b9d30880a1477e50039db2eac6e8a8f6d1b18 - # via pip-tools pip-tools==6.14.0 \ --hash=sha256:06366be0e08d86b416407333e998b4d305d5bd925151b08942ed149380ba3e47 \ --hash=sha256:c5ad042cd27c0b343b10db1db7f77a7d087beafbec59ae6df1bba4d3368dfe8c @@ -163,17 +176,6 @@ pyproject-hooks==1.0.0 \ --hash=sha256:283c11acd6b928d2f6a7c73fa0d01cb2bdc5f07c57a2eeb6e83d5e56b97976f8 \ --hash=sha256:f271b298b97f5955d53fb12b72c1fb1948c22c1a6b70b315c54cedaca0264ef5 # via build -setuptools==68.0.0 \ - --hash=sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f \ - --hash=sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235 - # via pip-tools -tomli==2.0.1 \ - --hash=sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc \ - --hash=sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f - # via - # build - # pip-tools - # pyproject-hooks wheel==0.40.0 \ --hash=sha256:cd1196f3faee2b31968d626e1731c94f99cbdb67cf5a46e4f5656cbee7738873 \ --hash=sha256:d236b20e7cb522daf2390fa84c55eea81c5c30190f90f29ae2ca1ad8355bf247 @@ -223,3 +225,13 @@ zstandard==0.21.0 \ --hash=sha256:fe6c821eb6870f81d73bf10e5deed80edcac1e63fbc40610e61f340723fd5f7c \ --hash=sha256:ff0852da2abe86326b20abae912d0367878dd0854b8931897d44cfeb18985472 # via -r requirements.in + +# The following packages are considered to be unsafe in a requirements file: +pip==23.1.2 \ + --hash=sha256:0e7c86f486935893c708287b30bd050a36ac827ec7fe5e43fe7cb198dd835fba \ + --hash=sha256:3ef6ac33239e4027d9a5598a381b9d30880a1477e50039db2eac6e8a8f6d1b18 + # via pip-tools +setuptools==68.0.0 \ + --hash=sha256:11e52c67415a381d10d6b462ced9cfb97066179f0e871399e006c4ab101fc85f \ + --hash=sha256:baf1fdb41c6da4cd2eae722e135500da913332ab3f2f5c7d33af9b492acb5235 + # via pip-tools diff --git a/scripts/python_distrib.py b/scripts/python_distrib.py index 0342009f..c3529647 100644 --- a/scripts/python_distrib.py +++ b/scripts/python_distrib.py @@ -12,6 +12,18 @@ PREBUILDS_BASE_URL = "https://github.com/indygreg/python-build-standalone/releases/download" PLATFORM_TO_PREBUILDS = { + "3.12.0": { + "linux-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.12.0+20231002-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst", + "windows-x86": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.12.0+20231002-i686-pc-windows-msvc-shared-pgo-full.tar.zst", + "windows-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.12.0+20231002-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst", + "macos-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.12.0+20231002-x86_64-apple-darwin-pgo+lto-full.tar.zst", + }, + "3.11.6": { + "linux-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.11.6+20231002-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst", + "windows-x86": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.11.6+20231002-i686-pc-windows-msvc-shared-pgo-full.tar.zst", + "windows-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.11.6+20231002-x86_64-pc-windows-msvc-shared-pgo-full.tar.zst", + "macos-x86_64": f"{PREBUILDS_BASE_URL}/20231002/cpython-3.11.6+20231002-x86_64-apple-darwin-pgo+lto-full.tar.zst", + }, "3.11.5": { "linux-x86_64": f"{PREBUILDS_BASE_URL}/20230826/cpython-3.11.5+20230826-x86_64-unknown-linux-gnu-pgo+lto-full.tar.zst", "windows-x86": f"{PREBUILDS_BASE_URL}/20230826/cpython-3.11.5+20230826-i686-pc-windows-msvc-shared-pgo-full.tar.zst", @@ -50,12 +62,13 @@ def fetch_prebuild( archive_name = archive_url.rsplit("/", 1)[1] archive_path = workdir / archive_name if not archive_path.exists() or force: - print(f"Downloading {archive_url}...") + print(f"Downloading {archive_url} ...") tmp_archive_path = archive_path.parent / f"{archive_path.name}.tmp" with urlopen(archive_url) as rep: with open(tmp_archive_path, "bw") as outfd: length = int(rep.headers.get("Content-Length")) # Poor's man progress bar + print(f"0Mo/{length//2**20}Mo", flush=True, end="\r") while True: if outfd.write(rep.read(2**20)) == 0: break diff --git a/src/_pythonscript.pyx b/src/_pythonscript.pyx index e8a5ffaa..c3b6ecf1 100644 --- a/src/_pythonscript.pyx +++ b/src/_pythonscript.pyx @@ -44,13 +44,13 @@ cdef PythonScriptLanguage _pythons_script_language = None cdef api GDExtensionObjectPtr _pythonscript_create_instance( void *p_userdata -) with gil: +) noexcept with gil: return NULL cdef api void _pythonscript_free_instance( void *p_userdata, GDExtensionClassInstancePtr p_instance -) with gil: +) noexcept with gil: pass @@ -96,7 +96,7 @@ cdef _testbench(): # print('OS.get_environment("foo")', OS.get_environment("foo")) -cdef api void _pythonscript_late_init() with gil: +cdef api void _pythonscript_late_init() noexcept with gil: # global _pythons_script_language # cdef GDExtensionObjectPtr singleton # cdef GDExtensionMethodBindPtr bind @@ -137,7 +137,7 @@ cdef api void _pythonscript_late_init() with gil: print(f"PYTHONPATH: {sys.path}") -cdef api void _pythonscript_early_init() with gil: +cdef api void _pythonscript_early_init() noexcept with gil: # Here is how we register Python into Godot: # # GDExtension API allows us to register "extension classes", those will be seen from @@ -193,7 +193,7 @@ cdef api void _pythonscript_early_init() with gil: # print(f"PYTHONPATH: {sys.path}") -cdef api void _pythonscript_initialize(int p_level) with gil: +cdef api void _pythonscript_initialize(int p_level) noexcept with gil: if p_level == GDEXTENSION_INITIALIZATION_SERVERS: import sys from godot._version import __version__ as pythonscript_version @@ -209,7 +209,7 @@ cdef api void _pythonscript_initialize(int p_level) with gil: pass -cdef api void _pythonscript_deinitialize(int p_level) with gil: +cdef api void _pythonscript_deinitialize(int p_level) noexcept with gil: # TODO: unregister the language once https://github.com/godotengine/godot/pull/67155 is merged if _pythons_script_language is not None: diff --git a/src/godot/hazmat/extension_class.pxd b/src/godot/hazmat/extension_class.pxd index 0eb0f538..331b9d81 100644 --- a/src/godot/hazmat/extension_class.pxd +++ b/src/godot/hazmat/extension_class.pxd @@ -22,12 +22,12 @@ cdef class ExtensionClassMethodSpec: cdef list arguments_type # List[Tuple[bytes, bytes]] -cdef inline list _get_extension_gc_protector(): +cdef inline list _get_extension_gc_protector() noexcept: import godot.hazmat return godot.hazmat.__dict__.setdefault("__extension_gc_protector", []) -cdef inline void unregister_extension_class(bytes class_name): +cdef inline void unregister_extension_class(bytes class_name) noexcept: cdef gd_string_name_t gdname pythonscript_gdstringname_new(&gdname, class_name) pythonscript_gdextension.classdb_unregister_extension_class( @@ -39,7 +39,7 @@ cdef inline void unregister_extension_class(bytes class_name): # Note we cannot free the spec given we don't know if the unregister operation has succeeded # TODO: correct me once https://github.com/godotengine/godot/pull/67121 is merged -cdef inline void _extension_class_to_string(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out) with gil: +cdef inline void _extension_class_to_string(GDExtensionClassInstancePtr p_instance, GDExtensionBool *r_is_valid, GDExtensionStringPtr p_out) noexcept with gil: cdef ExtensionClassSpec spec = p_instance pythonscript_gdextension.string_new_with_utf8_chars(p_out, spec.class_name) r_is_valid[0] = True @@ -50,7 +50,7 @@ cdef inline void register_extension_class_creation( bytes parent_class_name, GDExtensionClassCreateInstance create_instance_func, GDExtensionClassFreeInstance free_instance_func, -): +) noexcept: cdef ExtensionClassSpec spec = ExtensionClassSpec( class_name=class_name, parent_class_name=parent_class_name, @@ -92,7 +92,7 @@ cdef inline void register_extension_class_creation( pythonscript_gdstringname_delete(&gdname_parent) -cdef inline GDExtensionVariantType _extension_class_method_get_argument_type(void* p_method_userdata, int32_t p_argument) with gil: +cdef inline GDExtensionVariantType _extension_class_method_get_argument_type(void* p_method_userdata, int32_t p_argument) noexcept with gil: cdef ExtensionClassMethodSpec spec = p_method_userdata if p_argument == -1: @@ -101,7 +101,7 @@ cdef inline GDExtensionVariantType _extension_class_method_get_argument_type(voi return _type_name_to_gdnative_variant_type(spec.arguments_type[p_argument][1]) -cdef inline void _extension_class_method_get_argument_info(void* p_method_userdata, int32_t p_argument, GDExtensionPropertyInfo* r_info) with gil: +cdef inline void _extension_class_method_get_argument_info(void* p_method_userdata, int32_t p_argument, GDExtensionPropertyInfo* r_info) noexcept with gil: cdef ExtensionClassMethodSpec spec = p_method_userdata cdef bytes arg_name cdef bytes type_name @@ -123,7 +123,7 @@ cdef inline void _extension_class_method_get_argument_info(void* p_method_userda r_info.usage = PROPERTY_USAGE_DEFAULT -cdef inline GDExtensionVariantType _type_name_to_gdnative_variant_type(bytes type_name): +cdef inline GDExtensionVariantType _type_name_to_gdnative_variant_type(bytes type_name) noexcept: if type_name is None: return GDEXTENSION_VARIANT_TYPE_NIL elif type_name in (b"void", b"gd_variant_t", b"gd_object_t"): @@ -218,7 +218,7 @@ cdef inline GDExtensionVariantType _type_name_to_gdnative_variant_type(bytes typ return GDEXTENSION_VARIANT_TYPE_NIL -cdef inline GDExtensionClassMethodArgumentMetadata _extension_class_method_get_argument_metadata(void* p_method_userdata, int32_t p_argument) with gil: +cdef inline GDExtensionClassMethodArgumentMetadata _extension_class_method_get_argument_metadata(void* p_method_userdata, int32_t p_argument) noexcept with gil: cdef ExtensionClassMethodSpec spec = p_method_userdata cdef bytes type_name if p_argument == -1: @@ -257,7 +257,7 @@ cdef inline void _method_call_func( GDExtensionInt p_argument_count, GDExtensionVariantPtr r_return, GDExtensionCallError* r_error -) with gil: +) noexcept with gil: cdef ExtensionClassMethodSpec spec = p_method_userdata # TODO: finish me ! print(f"Pythonscript: `{spec.class_name.decode()}::{spec.method_name.decode()}` method call without ptrcall is not yet supported !!!") @@ -275,7 +275,7 @@ cdef inline void register_extension_class_method( list arguments_type # list default_arguments, # uint32_t argument_count, -): +) noexcept: cdef ExtensionClassMethodSpec method_spec = ExtensionClassMethodSpec( class_name=class_name, method_name=method_name,