Skip to content

Commit

Permalink
add limit for circular references data structures
Browse files Browse the repository at this point in the history
  • Loading branch information
synodriver committed Dec 17, 2023
2 parents e2c5faa + 0dc1597 commit b6d857f
Show file tree
Hide file tree
Showing 119 changed files with 29,205 additions and 186 deletions.
64 changes: 50 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,30 @@ jobs:
fail-fast: false

matrix:
os: [windows-2019, ubuntu-20.04, macos-11, macos-12]
python-version: ["2.7", "3.10", "3.9", "3.8", "3.7", "3.6", "pypy-2.7", "pypy-3.7", "pypy-3.8"]
lua-version: ["bundle", "lua5.3", "lua5.2", "luajit-5.1"]
os:
- windows-2019
- ubuntu-20.04
- macos-11
- macos-latest
python-version:
- "2.7"
- "3.12"
- "3.11"
- "3.10"
- "3.9"
- "3.8"
- "3.7"
- "3.6"
- "pypy-2.7"
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"
lua-version:
- "bundle"
- "lua5.3"
- "lua5.2"
- "luajit-5.1"

exclude:
- os: windows-2019
Expand All @@ -37,44 +58,59 @@ jobs:
lua-version: lua5.4
- os: macos-11
lua-version: luajit-5.1
- os: macos-12
- os: macos-latest
python-version: 2.7
- os: macos-12
- os: macos-latest
lua-version: lua5.2
- os: macos-12
- os: macos-latest
lua-version: lua5.3
- os: macos-12
- os: macos-latest
lua-version: lua5.4
- os: macos-12
- os: macos-latest
lua-version: luajit-5.1

runs-on: ${{ matrix.os }}

env:
CFLAGS_LTO: ${{ contains(matrix.lua-version, 'bundle') && (contains(matrix.os, 'windows') && '/LTCG' || '-flto') || '' }}
CFLAGS: ${{ contains(matrix.os, 'windows') && '/O2' || '-O2 -fPIC' }} -g
MACOSX_DEPLOYMENT_TARGET: "10.15"
MACOSX_DEPLOYMENT_TARGET: "11.0"
LUPA_WITH_LUA_DLOPEN: ${{ startsWith(matrix.os, 'windows') && 'false' || 'true' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Check out recursively
run: git submodule update --init --recursive

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
if: ${{ !startsWith(matrix.os, 'ubuntu') || startsWith(matrix.python-version, '3.') || startsWith(matrix.python-version, 'pypy') }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Set up Python2 (Linux)
if: ${{ matrix.python-version == '2.7' && startsWith(matrix.os, 'ubuntu') }}
run: |
sudo ln -fs python2 /usr/bin/python
sudo apt-get update
sudo apt-get install python-setuptools python2.7 python2.7-dev
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
sudo python2 get-pip.py
ls -l /usr/bin/pip* /usr/local/bin/pip*
which pip
- name: Set up Python packages
run: python -m pip install -U "pip<21" "setuptools<45" wheel && python -m pip install -U tox virtualenv -r requirements.txt
run: |
python -m pip install -U ${{ startsWith(matrix.python-version, '2.7') && '"pip<21" "setuptools<45"' || 'pip setuptools' }}
python -m pip install -U wheel tox virtualenv -r requirements.txt
- name: Set up Lua ${{ matrix.lua-version }}
if: ${{ contains(matrix.os, 'ubuntu') && !contains(matrix.lua-version, 'bundle') }}
run: sudo apt-get install lib${{ matrix.lua-version }}-dev

- name: Build wheel
run: python setup.py sdist ${{ contains(matrix.python-version, '3.') && 'build_ext -j5' || '' }} bdist_wheel ${{ contains(matrix.os, 'macos-12') && '--universal' || '' }}
run: python setup.py sdist ${{ contains(matrix.python-version, '3.') && 'build_ext -j6' || '' }} bdist_wheel
env:
SETUP_OPTIONS: ${{ !contains(matrix.lua-version, 'luajit') && (contains(matrix.lua-version, 'bundle') && '--use-bundle' || '--no-luajit') || '' }}
CFLAGS: ${{ env.CFLAGS }} ${{ env.CFLAGS_LTO }}
Expand All @@ -90,7 +126,7 @@ jobs:

- name: Upload wheels
if: ${{ contains(matrix.lua-version, 'bundle') }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels-${{ runner.os }}
path: dist/*.whl
Expand Down
79 changes: 54 additions & 25 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,27 @@ name: Wheel build
on:
release:
types: [created]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

permissions:
contents: write # to create GitHub release (softprops/action-gh-release)

jobs:
sdist:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Check out recursively
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -32,7 +40,7 @@ jobs:
files: dist/*.tar.gz

- name: Upload sdist
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz
Expand All @@ -49,31 +57,30 @@ jobs:
- manylinux2014_x86_64
- manylinux2014_i686
- manylinux_2_28_x86_64
- manylinux_2_28_i686
- manylinux_2_28_aarch64
- manylinux_2_24_i686
#- manylinux_2_28_aarch64
- musllinux_1_1_x86_64
- musllinux_1_1_aarch64
#- musllinux_1_1_aarch64
#- manylinux_2_24_ppc64le
#- manylinux_2_24_ppc64le
#- manylinux_2_24_s390x
pyversion: ["*"]

exclude:
- image: manylinux_2_28_aarch64
pyversion: "*"
- image: musllinux_1_1_aarch64
pyversion: "*"
include:
- image: manylinux2014_aarch64
pyversion: "cp36*"
- image: manylinux_2_28_aarch64
- image: manylinux_2_24_aarch64
pyversion: "cp37*"
- image: manylinux_2_28_aarch64
- image: manylinux_2_24_aarch64
pyversion: "cp38*"
- image: manylinux_2_28_aarch64
pyversion: "cp39*"
- image: manylinux_2_28_aarch64
pyversion: "cp310*"
- image: manylinux_2_28_aarch64
pyversion: "cp311*"
- image: manylinux_2_28_aarch64
pyversion: "cp312*"

- image: musllinux_1_1_aarch64
pyversion: "cp37*"
Expand All @@ -83,15 +90,19 @@ jobs:
pyversion: "cp39*"
- image: musllinux_1_1_aarch64
pyversion: "cp310*"
- image: musllinux_1_1_aarch64
pyversion: "cp311*"
- image: musllinux_1_1_aarch64
pyversion: "cp312*"

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Check out recursively
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -109,7 +120,7 @@ jobs:
files: wheelhouse_*/*-m*linux*.whl # manylinux / musllinux

- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.image }}
path: wheelhouse_*/*-m*linux*.whl # manylinux / musllinux
Expand All @@ -121,30 +132,46 @@ jobs:
fail-fast: false

matrix:
os: [macos-12, windows-latest]
os:
- macos-latest
- windows-latest
#os: [macos-11, windows-latest, macOS-M1]
#os: [macos-11, macOS-M1]
#os: [macos-11]
python_version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7-v7.3.3", "pypy-3.8-v7.3.7"]
pyversion:
- "2.7"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.7-v7.3.7"
- "pypy-3.8-v7.3.7"
- "pypy-3.9-v7.3.11"
- "pypy-3.10-v7.3.13"

exclude:
# outdated compilers and probably not worth supporting anymore
- os: windows-latest
python_version: 2.7
pyversion: 2.7

runs-on: ${{ matrix.os }}
env: { MACOSX_DEPLOYMENT_TARGET: 10.15 }
env:
MACOSX_DEPLOYMENT_TARGET: 11.0
LUPA_WITH_LUA_DLOPEN: ${{ startsWith(matrix.os, 'windows') && 'false' || 'true' }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Check out recursively
run: git submodule update --init --recursive

- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
python-version: ${{ matrix.pyversion }}

- name: Install MacOS dependencies
if: startsWith(matrix.os, 'mac')
Expand All @@ -156,7 +183,9 @@ jobs:
run: python -m pip install setuptools wheel -r requirements.txt

- name: Build wheels
run: USE_BUNDLE=true python setup.py --with-cython sdist ${{ contains(matrix.python-version, '3.') && 'build_ext -j5' || '' }} bdist_wheel ${{ contains(matrix.os, 'macos-12') && '--universal' || '' }}
run: |
set USE_BUNDLE=true
python setup.py --with-cython sdist ${{ contains(matrix.pyversion, '3.') && 'build_ext -j6' || '' }} bdist_wheel
- name: Release
uses: softprops/action-gh-release@v1
Expand All @@ -165,7 +194,7 @@ jobs:
files: dist/*.whl

- name: Upload wheels
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: wheels-${{ matrix.os }}
path: dist/*.whl
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ lupa/lua*.pyx

# Vim swapfiles
*.swp

# Track Lua source code
!third-party/**/*.c
39 changes: 37 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
Lupa change log
===============

2.0a1 (2022-??-??)
------------------
2.1 (2023-??-??)
----------------

* GH#248: 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.
See https://www.lua.org/manual/5.4/manual.html#pdf-load

* GH#246: 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.
(original patch by Richard Connon)

* The bundled Lua 5.1 was updated to 5.1.5 and Lua 5.2 to 5.2.4.
(patch by xxyzz)

* Built with Cython 3.0.6 for improved support of Python 3.12.


2.0 (2023-04-03)
----------------

* GH#217: Lua stack traces in Python exception messages are now reversed to
match the order of Python stack traces.
Expand All @@ -11,6 +32,9 @@ Lupa change log
Lua 5.4, LuaJIT 2.0 and LuaJIT 2.1 beta. Note that this is build specific
and may depend on the platform. A normal Python import cascade can be used.

* GH#211: A new option `max_memory` allows to limit the memory usage of Lua code.
(patch by Leo Developer)

* GH#171: Python references in Lua are now more safely reference counted
to prevent garbage collection glitches.
(patch by Guilherme Dantas)
Expand All @@ -30,6 +54,9 @@ Lupa change log
table index lookup from Python could crash Python.
(patch by Guilherme Dantas)

* GH#137: Passing ``None`` as a dict key into ``table_from()`` crashed.
(patch by Leo Developer)

* GH#176: A new function ``python.args(*args, **kwargs)`` was added
to help with building Python argument tuples and keyword argument dicts
for Python function calls from Lua code.
Expand All @@ -40,6 +67,14 @@ Lupa change log
* GH#179: Resolve some C compiler warnings about signed/unsigned comparisons.
(patch by Guilherme Dantas)

* Built with Cython 0.29.34.


1.14.1 (2022-11-16)
-------------------

* Rebuild with Cython 0.29.32 to support Python 3.11.


1.13 (2022-03-01)
-----------------
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ include MANIFEST.in
include CHANGES.rst INSTALL.rst LICENSE.txt README.rst
include logo/logo-220x200.png
recursive-include lupa *.py *.pyx *.pxd *.pxi *.c
recursive-include third-party *.c *.h
recursive-include third-party *
Loading

0 comments on commit b6d857f

Please sign in to comment.