diff --git a/lupa-2.0.tar.gz b/lupa-2.0.tar.gz deleted file mode 100644 index 2f0d7e1..0000000 --- a/lupa-2.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:ad3fef486be7adddd349fe9a9c393789061312cf98ebc533b489be34f484cb79 -size 6278066 diff --git a/lupa-2.5.tar.gz b/lupa-2.5.tar.gz new file mode 100644 index 0000000..b46b7c2 --- /dev/null +++ b/lupa-2.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c6a89f2b7b08a3040d7ed2a1eeccba37a31ddc92fa199339c53a2ae3c48c34 +size 7235982 diff --git a/no-bundle.patch b/no-bundle.patch deleted file mode 100644 index 999e740..0000000 --- a/no-bundle.patch +++ /dev/null @@ -1,19 +0,0 @@ -Index: lupa-2.0/setup.py -=================================================================== ---- lupa-2.0.orig/setup.py -+++ lupa-2.0/setup.py -@@ -365,10 +365,11 @@ if not configs and not option_no_bundle: - or (get_machine() != "x86_64" and 'luajit' in os.path.basename(lua_bundle_path.rstrip(os.sep))) - ) - ] --if not configs and not option_use_bundle: -- configs = find_lua_build(no_luajit=option_no_luajit) - if not configs: -- configs = no_lua_error() -+ configs = [ -+ (find_lua_build(no_luajit=option_no_luajit) if not option_use_bundle else {}) -+ or no_lua_error() -+ ] - - - # check if Cython is installed, and use it if requested or necessary diff --git a/noexcept.patch b/noexcept.patch deleted file mode 100644 index fb74824..0000000 --- a/noexcept.patch +++ /dev/null @@ -1,418 +0,0 @@ -Index: lupa-2.0/lupa/_lupa.pyx -=================================================================== ---- lupa-2.0.orig/lupa/_lupa.pyx -+++ lupa-2.0/lupa/_lupa.pyx -@@ -685,7 +685,7 @@ cdef int check_lua_stack(lua_State* L, i - return 0 - - --cdef int get_object_length_from_lua(lua_State* L) nogil: -+cdef int get_object_length_from_lua(lua_State* L) noexcept nogil: - cdef size_t length = lua.lua_objlen(L, lua.lua_upvalueindex(1)) - lua.lua_pushlightuserdata(L, length) - return 1 -@@ -789,10 +789,10 @@ cdef tuple _fix_args_kwargs(tuple args): - ################################################################################ - # fast, re-entrant runtime locking - --cdef inline bint lock_runtime(LuaRuntime runtime) with gil: -+cdef inline bint lock_runtime(LuaRuntime runtime) noexcept with gil: - return lock_lock(runtime._lock, pythread.PyThread_get_thread_ident(), True) - --cdef inline void unlock_runtime(LuaRuntime runtime) nogil: -+cdef inline void unlock_runtime(LuaRuntime runtime) noexcept nogil: - unlock_lock(runtime._lock) - - -@@ -967,7 +967,7 @@ cdef _LuaObject new_lua_object(LuaRuntim - init_lua_object(obj, runtime, L, n) - return obj - --cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n): -+cdef void init_lua_object(_LuaObject obj, LuaRuntime runtime, lua_State* L, int n) noexcept: - obj._runtime = runtime - obj._state = L - lua.lua_pushvalue(L, n) -@@ -1353,7 +1353,7 @@ cdef class _LuaIter: - - # type conversions and protocol adaptations - --cdef int py_asfunc_call(lua_State *L) nogil: -+cdef int py_asfunc_call(lua_State *L) noexcept nogil: - if (lua.lua_gettop(L) == 1 and lua.lua_islightuserdata(L, 1) - and lua.lua_topointer(L, 1) == unpack_wrapped_pyfunction): - # special case: unpack_python_argument_or_jump() calls this to find out the Python object -@@ -1363,7 +1363,7 @@ cdef int py_asfunc_call(lua_State *L) no - lua.lua_insert(L, 1) - return py_object_call(L) - --cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) nogil: -+cdef py_object* unpack_wrapped_pyfunction(lua_State* L, int n) noexcept nogil: - cdef lua.lua_CFunction cfunction = lua.lua_tocfunction(L, n) - if cfunction is py_asfunc_call: - lua.lua_pushvalue(L, n) -@@ -1458,7 +1458,7 @@ cdef object py_from_lua(LuaRuntime runti - return new_lua_function(runtime, L, n) - return new_lua_object(runtime, L, n) - --cdef py_object* unpack_userdata(lua_State *L, int n) nogil: -+cdef py_object* unpack_userdata(lua_State *L, int n) noexcept nogil: - """ - Like luaL_checkudata(), unpacks a userdata object and validates that - it's a wrapped Python object. Returns NULL on failure. -@@ -1627,7 +1627,7 @@ cdef bint py_to_lua_custom(LuaRuntime ru - - return 1 # values pushed - --cdef inline int _isascii(unsigned char* s): -+cdef inline int _isascii(unsigned char* s) noexcept: - cdef unsigned char c = 0 - while s[0]: - c |= s[0] -@@ -1663,7 +1663,7 @@ cdef int raise_lua_error(LuaRuntime runt - raise LuaError(error_message) - - --cdef bint _looks_like_traceback_line(unicode line): -+cdef bint _looks_like_traceback_line(unicode line) except -1: - # Lua tracebacks look like this (using tabs as indentation): - # stack traceback: - # [C]: in function 'error' -@@ -1825,7 +1825,7 @@ cdef tuple unpack_multiple_lua_results(L - - # bounded memory allocation - --cdef void* _lua_alloc_restricted(void* ud, void* ptr, size_t old_size, size_t new_size) nogil: -+cdef void* _lua_alloc_restricted(void* ud, void* ptr, size_t old_size, size_t new_size) noexcept nogil: - # adapted from https://stackoverflow.com/a/9672205 - # print(ud, ptr, old_size, new_size) - cdef MemoryStatus* memory_status = ud -@@ -1855,7 +1855,7 @@ cdef void* _lua_alloc_restricted(void* u - memory_status.used += new_size - old_size - return new_ptr - --cdef int _lua_panic(lua_State *L) nogil: -+cdef int _lua_panic(lua_State *L) noexcept nogil: - cdef const char* msg = lua.lua_tostring(L, -1) - if msg == NULL: - msg = "error object is not a string" -@@ -1896,7 +1896,7 @@ cdef class _PyReference: - cdef int _ref - - --cdef int py_object_gc_with_gil(py_object *py_obj, lua_State* L) with gil: -+cdef int py_object_gc_with_gil(py_object *py_obj, lua_State* L) noexcept with gil: - cdef _PyReference pyref - # originally, we just used: - #cpython.ref.Py_XDECREF(py_obj.obj) -@@ -1917,7 +1917,7 @@ cdef int py_object_gc_with_gil(py_object - finally: - py_obj.obj = NULL - --cdef int py_object_gc(lua_State* L) nogil: -+cdef int py_object_gc(lua_State* L) noexcept nogil: - if not lua.lua_isuserdata(L, 1): - return 0 - py_obj = unpack_userdata(L, 1) -@@ -1968,7 +1968,7 @@ cdef bint call_python(LuaRuntime runtime - - return py_function_result_to_lua(runtime, L, result) - --cdef int py_call_with_gil(lua_State* L, py_object *py_obj) with gil: -+cdef int py_call_with_gil(lua_State* L, py_object *py_obj) noexcept with gil: - cdef LuaRuntime runtime = None - cdef lua_State* stored_state = NULL - -@@ -1985,7 +1985,7 @@ cdef int py_call_with_gil(lua_State* L, - if stored_state is not NULL: - runtime._state = stored_state - --cdef int py_object_call(lua_State* L) nogil: -+cdef int py_object_call(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) # may not return on error! - result = py_call_with_gil(L, py_obj) - if result < 0: -@@ -1994,7 +1994,7 @@ cdef int py_object_call(lua_State* L) no - - # str() support for Python objects - --cdef int py_str_with_gil(lua_State* L, py_object* py_obj) with gil: -+cdef int py_str_with_gil(lua_State* L, py_object* py_obj) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2012,7 +2012,7 @@ cdef int py_str_with_gil(lua_State* L, p - try: runtime.store_raised_exception(L, b'error during Python str() call') - finally: return -1 - --cdef int py_object_str(lua_State* L) nogil: -+cdef int py_object_str(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) # may not return on error! - result = py_str_with_gil(L, py_obj) - if result < 0: -@@ -2072,7 +2072,7 @@ cdef int setattr_for_lua(LuaRuntime runt - return 0 - - --cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) with gil: -+cdef int py_object_getindex_with_gil(lua_State* L, py_object* py_obj) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2084,7 +2084,7 @@ cdef int py_object_getindex_with_gil(lua - try: runtime.store_raised_exception(L, b'error reading Python attribute/item') - finally: return -1 - --cdef int py_object_getindex(lua_State* L) nogil: -+cdef int py_object_getindex(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) # may not return on error! - result = py_object_getindex_with_gil(L, py_obj) - if result < 0: -@@ -2092,7 +2092,7 @@ cdef int py_object_getindex(lua_State* L - return result - - --cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) with gil: -+cdef int py_object_setindex_with_gil(lua_State* L, py_object* py_obj) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2104,7 +2104,7 @@ cdef int py_object_setindex_with_gil(lua - try: runtime.store_raised_exception(L, b'error writing Python attribute/item') - finally: return -1 - --cdef int py_object_setindex(lua_State* L) nogil: -+cdef int py_object_setindex(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) # may not return on error! - result = py_object_setindex_with_gil(L, py_obj) - if result < 0: -@@ -2124,12 +2124,12 @@ cdef lua.luaL_Reg *py_object_lib = [ - - ## # Python helper functions for Lua - --cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) nogil: -+cdef inline py_object* unpack_single_python_argument_or_jump(lua_State* L) noexcept nogil: - if lua.lua_gettop(L) > 1: - lua.luaL_argerror(L, 2, "invalid arguments") # never returns! - return unpack_python_argument_or_jump(L, 1) - --cdef inline py_object* unpack_python_argument_or_jump(lua_State* L, int n) nogil: -+cdef inline py_object* unpack_python_argument_or_jump(lua_State* L, int n) noexcept nogil: - cdef py_object* py_obj - - if lua.lua_isuserdata(L, n): -@@ -2144,7 +2144,7 @@ cdef inline py_object* unpack_python_arg - - return py_obj - --cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil: -+cdef int py_wrap_object_protocol_with_gil(lua_State* L, py_object* py_obj, int type_flags) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2153,41 +2153,41 @@ cdef int py_wrap_object_protocol_with_gi - try: runtime.store_raised_exception(L, b'error during type adaptation') - finally: return -1 - --cdef int py_wrap_object_protocol(lua_State* L, int type_flags) nogil: -+cdef int py_wrap_object_protocol(lua_State* L, int type_flags) noexcept nogil: - cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error! - result = py_wrap_object_protocol_with_gil(L, py_obj, type_flags) - if result < 0: - return lua.lua_error(L) # never returns! - return result - --cdef int py_as_attrgetter(lua_State* L) nogil: -+cdef int py_as_attrgetter(lua_State* L) noexcept nogil: - return py_wrap_object_protocol(L, 0) - --cdef int py_as_itemgetter(lua_State* L) nogil: -+cdef int py_as_itemgetter(lua_State* L) noexcept nogil: - return py_wrap_object_protocol(L, OBJ_AS_INDEX) - --cdef int py_as_function(lua_State* L) nogil: -+cdef int py_as_function(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error! - lua.lua_pushcclosure(L, py_asfunc_call, 1) - return 1 - - # iteration support for Python objects in Lua - --cdef int py_iter(lua_State* L) nogil: -+cdef int py_iter(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error! - result = py_iter_with_gil(L, py_obj, 0) - if result < 0: - return lua.lua_error(L) # never returns! - return result - --cdef int py_iterex(lua_State* L) nogil: -+cdef int py_iterex(lua_State* L) noexcept nogil: - cdef py_object* py_obj = unpack_single_python_argument_or_jump(L) # never returns on error! - result = py_iter_with_gil(L, py_obj, OBJ_UNPACK_TUPLE) - if result < 0: - return lua.lua_error(L) # never returns! - return result - --cdef int convert_to_lua_Integer(lua_State* L, int idx, lua.lua_Integer* integer) nogil: -+cdef int convert_to_lua_Integer(lua_State* L, int idx, lua.lua_Integer* integer) noexcept nogil: - cdef int isnum - cdef lua.lua_Integer temp - temp = lua.lua_tointegerx(L, idx, &isnum) -@@ -2198,7 +2198,7 @@ cdef int convert_to_lua_Integer(lua_Stat - lua.lua_pushfstring(L, "Could not convert %s to string", lua.luaL_typename(L, idx)) - return -1 - --cdef int py_enumerate(lua_State* L) nogil: -+cdef int py_enumerate(lua_State* L) noexcept nogil: - if lua.lua_gettop(L) > 2: - lua.luaL_argerror(L, 3, "invalid arguments") # never returns! - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) -@@ -2214,7 +2214,7 @@ cdef int py_enumerate(lua_State* L) nogi - return result - - --cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, lua.lua_Integer start) with gil: -+cdef int py_enumerate_with_gil(lua_State* L, py_object* py_obj, lua.lua_Integer start) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2224,7 +2224,7 @@ cdef int py_enumerate_with_gil(lua_State - try: runtime.store_raised_exception(L, b'error creating an iterator with enumerate()') - finally: return -1 - --cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) with gil: -+cdef int py_iter_with_gil(lua_State* L, py_object* py_obj, int type_flags) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_obj.runtime -@@ -2257,7 +2257,7 @@ cdef int py_push_iterator(LuaRuntime run - lua.lua_pushnil(L) - return 3 - --cdef int py_iter_next(lua_State* L) nogil: -+cdef int py_iter_next(lua_State* L) noexcept nogil: - # first value in the C closure: the Python iterator object - cdef py_object* py_obj = unpack_python_argument_or_jump(L, 1) # may not return on error! - result = py_iter_next_with_gil(L, py_obj) -@@ -2265,7 +2265,7 @@ cdef int py_iter_next(lua_State* L) nogi - return lua.lua_error(L) # never returns! - return result - --cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) with gil: -+cdef int py_iter_next_with_gil(lua_State* L, py_object* py_iter) noexcept with gil: - cdef LuaRuntime runtime - try: - runtime = py_iter.runtime -@@ -2302,7 +2302,7 @@ cdef class _PyArguments: - cdef tuple args - cdef dict kwargs - --cdef int py_args_with_gil(PyObject* runtime_obj, lua_State* L) with gil: -+cdef int py_args_with_gil(PyObject* runtime_obj, lua_State* L) noexcept with gil: - cdef _PyArguments pyargs - cdef LuaRuntime runtime - try: -@@ -2314,7 +2314,7 @@ cdef int py_args_with_gil(PyObject* runt - try: runtime.store_raised_exception(L, b'error while calling python.args()') - finally: return -1 - --cdef int py_args(lua_State* L) nogil: -+cdef int py_args(lua_State* L) noexcept nogil: - cdef PyObject* runtime - runtime = lua.lua_touserdata(L, lua.lua_upvalueindex(1)) - if not runtime: -@@ -2327,7 +2327,7 @@ cdef int py_args(lua_State* L) nogil: - - # overflow handler setter - --cdef int py_set_overflow_handler(lua_State* L) nogil: -+cdef int py_set_overflow_handler(lua_State* L) noexcept nogil: - if (not lua.lua_isnil(L, 1) - and not lua.lua_isfunction(L, 1) - and not unpack_python_argument_or_jump(L, 1)): -@@ -2352,7 +2352,7 @@ cdef lua.luaL_Reg *py_lib = [ - - # Setup helpers for library tables (removed from C-API in Lua 5.3). - --cdef void luaL_setfuncs(lua_State *L, const lua.luaL_Reg *l, int nup): -+cdef void luaL_setfuncs(lua_State *L, const lua.luaL_Reg *l, int nup) noexcept: - cdef int i - lua.luaL_checkstack(L, nup, "too many upvalues") - while l.name != NULL: -@@ -2364,7 +2364,7 @@ cdef void luaL_setfuncs(lua_State *L, co - lua.lua_pop(L, nup) - - --cdef int libsize(const lua.luaL_Reg *l): -+cdef int libsize(const lua.luaL_Reg *l) noexcept: - cdef int size = 0 - while l and l.name: - l += 1 -@@ -2373,7 +2373,7 @@ cdef int libsize(const lua.luaL_Reg *l): - - - cdef const char *luaL_findtable(lua_State *L, int idx, -- const char *fname, int size_hint): -+ const char *fname, int size_hint) noexcept: - cdef const char *end - if idx: - lua.lua_pushvalue(L, idx) -@@ -2400,7 +2400,7 @@ cdef const char *luaL_findtable(lua_Stat - return NULL - - --cdef void luaL_pushmodule(lua_State *L, const char *modname, int size_hint): -+cdef void luaL_pushmodule(lua_State *L, const char *modname, int size_hint) noexcept: - # XXX: "_LOADED" is the value of LUA_LOADED_TABLE, - # but it's absent in lua51 - luaL_findtable(L, lua.LUA_REGISTRYINDEX, "_LOADED", 1) -@@ -2416,7 +2416,7 @@ cdef void luaL_pushmodule(lua_State *L, - - - cdef void luaL_openlib(lua_State *L, const char *libname, -- const lua.luaL_Reg *l, int nup): -+ const lua.luaL_Reg *l, int nup) noexcept: - if libname: - luaL_pushmodule(L, libname, libsize(l)) - lua.lua_insert(L, -(nup + 1)) -@@ -2427,7 +2427,7 @@ cdef void luaL_openlib(lua_State *L, con - - # internal Lua functions meant to be called in protected mode - --cdef int get_from_lua_table(lua_State* L) nogil: -+cdef int get_from_lua_table(lua_State* L) noexcept nogil: - """Equivalent to the following Lua function: - function(t, k) return t[k] end - """ -Index: lupa-2.0/lupa/lock.pxi -=================================================================== ---- lupa-2.0.orig/lupa/lock.pxi -+++ lupa-2.0/lupa/lock.pxi -@@ -71,7 +71,7 @@ cdef class FastRLock: - return self._count > 0 and self._owner == pythread.PyThread_get_thread_ident() - - --cdef inline bint lock_lock(FastRLock lock, pythread_t current_thread, bint blocking) nogil: -+cdef inline bint lock_lock(FastRLock lock, pythread_t current_thread, bint blocking) noexcept nogil: - # Note that this function *must* hold the GIL when being called. - # We just use 'nogil' in the signature to make sure that no Python - # code execution slips in that might free the GIL -@@ -91,7 +91,7 @@ cdef inline bint lock_lock(FastRLock loc - lock, current_thread, - pythread.WAIT_LOCK if blocking else pythread.NOWAIT_LOCK) - --cdef bint _acquire_lock(FastRLock lock, pythread_t current_thread, int wait) nogil: -+cdef bint _acquire_lock(FastRLock lock, pythread_t current_thread, int wait) noexcept nogil: - # Note that this function *must* hold the GIL when being called. - # We just use 'nogil' in the signature to make sure that no Python - # code execution slips in that might free the GIL -@@ -119,7 +119,7 @@ cdef bint _acquire_lock(FastRLock lock, - lock._count = 1 - return 1 - --cdef inline void unlock_lock(FastRLock lock) nogil: -+cdef inline void unlock_lock(FastRLock lock) noexcept nogil: - # Note that this function *must* hold the GIL when being called. - # We just use 'nogil' in the signature to make sure that no Python - # code execution slips in that might free the GIL diff --git a/python-lupa.changes b/python-lupa.changes index 7aaddab..af7c0ef 100644 --- a/python-lupa.changes +++ b/python-lupa.changes @@ -1,3 +1,30 @@ +------------------------------------------------------------------- +Tue Jul 22 02:56:37 UTC 2025 - Steve Kowalik + +- Update to 2.5: + * Lua uses dlopen() again, which was lost in Lupa 2.3. + * Built with Cython 3.1.2. + * Failures in the test suite didn't set a non-zero process exit value. + * Removed support for Python 2.x. + * Built with Cython 3.0.11. + * A new method LuaRuntime.gccollect() was added to trigger the Lua garbage + collector. + * A new context manager LuaRuntime.nogc() was added to temporarily disable + the Lua garbage collector. + * The table_from() method gained a new keyword argument recursive=False. + * The LuaRuntime methods "eval", "execute" and "compile" gained new keyword + options mode and name that allow constraining the input type and + modifying the (chunk) name shown in error messages, following similar + arguments in the Lua load() function. + * Loading Lua modules did not work for the version specific Lua modules + introduced in Lupa 2.0. It turned out that it can only be enabled for one + of them in a given Python run, so it is now left to users to enable it + explicitly at need. + * Built with Cython 3.0.9 for improved support of Python 3.12/13. +- Drop patches, included upstream: + * no-bundle.patch + * noexcept.patch + ------------------------------------------------------------------- Mon Jun 2 07:58:20 UTC 2025 - Markéta Machová diff --git a/python-lupa.spec b/python-lupa.spec index b5ecc02..73b6d42 100644 --- a/python-lupa.spec +++ b/python-lupa.spec @@ -18,17 +18,12 @@ %{?sle15_python_module_pythons} Name: python-lupa -Version: 2.0 +Version: 2.5 Release: 0 Summary: Python wrapper around Lua and LuaJIT License: MIT -Group: Development/Languages/Python URL: https://github.com/scoder/lupa Source: https://files.pythonhosted.org/packages/source/l/lupa/lupa-%{version}.tar.gz -# PATCH-FIX-UPSTREAM no-bundle.patch gh#scoder/lupa@19279acda1ad -Patch1: no-bundle.patch -# PATCH-FIX-UPSTREAM noexcept.patch gh#scoder/lupa@fc0a1af99b74 -Patch2: noexcept.patch BuildRequires: %{python_module Cython} BuildRequires: %{python_module devel} BuildRequires: %{python_module pip}