Skip to content

Commit

Permalink
Revert "Make the extension work for Python 3.8+."
Browse files Browse the repository at this point in the history
This reverts commit 3a9939d.

Reason for revert: pybind11 doesn't support `Py_LIMITED_API`;
as per pybind/pybind11#1755, it has
probably never worked and it will probably never work.

Change-Id: Ie603151d31ad07a77d469f0050270d416fe8d21b
Reviewed-on: https://code-review.googlesource.com/c/re2/+/61872
Reviewed-by: Paul Wankadia <[email protected]>
Reviewed-by: Alex Chernyakhovsky <[email protected]>
  • Loading branch information
junyer committed Sep 7, 2023
1 parent 3a9939d commit a807e8a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
type: number
jobs:
wheel-linux:
name: Linux ${{ matrix.os }}, ${{ matrix.arch.name }}
name: Linux ${{ matrix.os }}, ${{ matrix.arch.name }}, Python ${{ matrix.ver }}
runs-on: ${{ matrix.arch.runs-on }}
container:
image: quay.io/pypa/${{ matrix.os }}_${{ matrix.arch.python-name }}
Expand All @@ -19,16 +19,17 @@ jobs:
- { name: X64, python-name: x86_64, runs-on: [ubuntu-latest] }
- { name: ARM64, python-name: aarch64, runs-on: [self-hosted, linux, arm64] }
os: [manylinux2014, manylinux_2_28]
ver: ['3.8', '3.9', '3.10', '3.11']
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
# TODO(junyer): Use `v2` whenever a new release is tagged.
- uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51
- name: Prepare Python environment
- name: Prepare Python ${{ matrix.ver }} environment
run: |
ln -sf /usr/local/bin/python3.8 /usr/local/bin/python
ln -sf /usr/local/bin/python3.8 /usr/local/bin/python3
ln -sf /usr/local/bin/python${{ matrix.ver }} /usr/local/bin/python
ln -sf /usr/local/bin/python${{ matrix.ver }} /usr/local/bin/python3
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel auditwheel
python -m pip install --upgrade absl-py
Expand Down Expand Up @@ -57,7 +58,7 @@ jobs:
path: python/google_re2-*.whl
retention-days: 1
wheel-macos:
name: macOS ${{ matrix.os }}, ${{ matrix.arch.name }}
name: macOS ${{ matrix.os }}, ${{ matrix.arch.name }}, Python ${{ matrix.ver }}
runs-on: macos-${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -66,6 +67,7 @@ jobs:
- { name: X64, bazel-name: x86_64, python-name: x86_64 }
- { name: ARM64, bazel-name: arm64, python-name: arm64 }
os: [11, 12, 13]
ver: ['3.8', '3.9', '3.10', '3.11']
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BAZEL_CPU: darwin_${{ matrix.arch.bazel-name }}
Expand All @@ -79,8 +81,8 @@ jobs:
- uses: bazelbuild/setup-bazelisk@6244971d4f7ba9aca943c2f3ede2bbd813fcca51
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Prepare Python environment
python-version: ${{ matrix.ver }}
- name: Prepare Python ${{ matrix.ver }} environment
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel delocate
Expand All @@ -105,14 +107,15 @@ jobs:
path: python/google_re2-*.whl
retention-days: 1
wheel-windows:
name: Windows, ${{ matrix.arch.name }}
name: Windows, ${{ matrix.arch.name }}, Python ${{ matrix.ver }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch:
- { name: X86, bazel-name: x64_x86, python-name: win32 }
- { name: X64, bazel-name: x64, python-name: win_amd64 }
ver: ['3.8', '3.9', '3.10', '3.11']
env:
BAZELISK_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BAZEL_CPU: ${{ matrix.arch.bazel-name }}_windows
Expand All @@ -132,9 +135,9 @@ jobs:
shell: bash
- uses: actions/setup-python@v4
with:
python-version: '3.8'
python-version: ${{ matrix.ver }}
architecture: ${{ env.architecture }}
- name: Prepare Python environment
- name: Prepare Python ${{ matrix.ver }} environment
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel delvewheel
Expand Down Expand Up @@ -167,8 +170,8 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.8'
- name: Prepare Python environment
python-version: '3.x'
- name: Prepare Python 3.x environment
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build wheel
Expand Down
4 changes: 0 additions & 4 deletions python/_re2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// The extension works for Python 3.8+.
// See https://docs.python.org/3/c-api/stable.html for background.
#define Py_LIMITED_API 0x03080000

#include <memory>
#include <string>
#include <tuple>
Expand Down
3 changes: 0 additions & 3 deletions python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ def options():
bdist_wheel['plat_name'] = os.environ['PLAT_NAME']
except KeyError:
pass
# The extension works for Python 3.8+.
# See https://docs.python.org/3/c-api/stable.html for background.
bdist_wheel['py_limited_api'] = 'cp38'
return {'bdist_wheel': bdist_wheel}


Expand Down

0 comments on commit a807e8a

Please sign in to comment.