Lupa

Latest version: v2.2

Safety actively analyzes 683530 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 7

1.0

----------------

* NOTE: this release includes the major backwards incompatible changes listed
below. It is believed that they simplify the interaction between Python code
and Lua code by more strongly following idiomatic Lua on the Lua side.

* Instead of passing a wrapped ``python.none`` object into Lua, ``None``
return values are now mapped to ``nil``, making them more straight forward
to handle in Lua code. This makes the behaviour more consistent, as it
was previously somewhat arbitrary where ``none`` could appear and where a
``nil`` value was used. The only remaining exception is during iteration,
where the first returned value must not be ``nil`` in Lua, or otherwise
the loop terminates prematurely. To prevent this, any ``None`` value
that the iterator returns, or any first item in exploded tuples that is
``None``, is still mapped to ``python.none``. Any further values
returned in the same iteration will be mapped to ``nil`` if they are
``None``, not to ``none``. This means that only the first argument
needs to be manually checked for this special case. For the
``enumerate()`` iterator, the counter is never ``None`` and thus the
following unpacked items will never be mapped to ``python.none``.

* When ``unpack_returned_tuples=True``, iteration now also unpacks tuple
values, including ``enumerate()`` iteration, which yields a flat sequence
of counter and unpacked values.

* When calling bound Python methods from Lua as "obj:meth()", Lupa now
prevents Python from prepending the self argument a second time, so that
the Python method is now called as "obj.meth()". Previously, it was called
as "obj.meth(obj)". Note that this can be undesired when the object itself
is explicitly passed as first argument from Lua, e.g. when calling
"func(obj)" where "func" is "obj.meth", but these constellations should be
rare. As a work-around for this case, user code can wrap the bound method
in another function so that the final call comes from Python.

* garbage collection works for reference cycles that span both runtimes,
Python and Lua

* calling from Python into Lua and back into Python did not clean up the
Lua call arguments before the innermost call, so that they could leak
into the nested Python call or its return arguments

* support for Lua 5.2 (in addition to Lua 5.1 and LuaJIT 2.0)

* Lua tables support Python's "del" statement for item deletion
(patch by Jason Fried)

* Attribute lookup can use a more fine-grained control mechanism by
implementing explicit getter and setter functions for a LuaRuntime
(``attribute_handlers`` argument). Patch by Brian Moe.

* item assignments/lookups on Lua objects from Python no longer
special case double underscore names (as opposed to attribute lookups)

0.21

-----------------

* some garbage collection issues were cleaned up using new Cython features

* new ``LuaRuntime`` option ``unpack_returned_tuples`` which automatically
unpacks tuples returned from Python functions into separate Lua objects
(instead of returning a single Python tuple object)

* some internal wrapper classes were removed from the module API

* Windows build fixes

* Py3.x build fixes

* support for building with Lua 5.1 instead of LuaJIT (setup.py --no-luajit)

* no longer uses Cython by default when building from released sources (pass
``--with-cython`` to explicitly request a rebuild)

* requires Cython 0.20+ when building from unreleased sources

* built with Cython 0.20.1

0.20

-----------------

* fix "deallocating None" crash while iterating over Lua tables in
Python code

* support for filtering attribute access to Python objects for Lua
code

* fix: setting source encoding for Lua code was broken

0.19

-----------------

* fix serious resource leak when creating multiple LuaRuntime instances

* portability fix for binary module importing

0.18

-----------------

* fix iteration by returning ``Py_None`` object for ``None`` instead
of ``nil``, which would terminate the iteration

* when converting Python values to Lua, represent ``None`` as a
``Py_None`` object in places where ``nil`` has a special meaning,
but leave it as ``nil`` where it doesn't hurt

* support for counter start value in ``python.enumerate()``

* native implementation for ``python.enumerate()`` that is several
times faster

* much faster Lua iteration over Python objects

0.17

-----------------

* new helper function ``python.enumerate()`` in Lua that returns a Lua
iterator for a Python object and adds the 0-based index to each
item.

* new helper function ``python.iterex()`` in Lua that returns a Lua
iterator for a Python object and unpacks any tuples that the
iterator yields.

* new helper function ``python.iter()`` in Lua that returns a Lua
iterator for a Python object.

* reestablished the ``python.as_function()`` helper function for Lua
code as it can be needed in cases where Lua cannot determine how to
run a Python function.

Page 4 of 7

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.