Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: fix enums initialization in PyPy #507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/sync-repo-settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ branchProtectionRules:
- 'unit (3.10, cpp)'
- 'unit (3.10, python)'
- 'unit (3.10, upb)'
- 'unit (pypy3.10, python)'
- 'unit (3.11, python)'
- 'unit (3.11, upb)'
- 'unit (3.12, python)'
Expand Down
27 changes: 16 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
# See https://github.com/actions/setup-python?tab=readme-ov-file#basic-usage
# for the format of the entries in 'python'.
# See https://downloads.python.org/pypy/ for the current supported versions of PyPy.
python: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy3.10']
variant: ['cpp', 'python', 'upb']
# TODO(https://github.com/googleapis/proto-plus-python/issues/389):
# Remove the 'cpp' implementation once support for Protobuf 3.x is dropped.
Expand All @@ -56,6 +59,14 @@ jobs:
python: 3.12
- variant: "cpp"
python: 3.13
# In PyPy 3.10, we see the following warning
# UserWarning: Selected implementation upb is not available. Falling back to the python implementation.
- variant: "upb"
python: 'pypy3.10'
# In PyPy 3.10, we see the following warning
# UserWarning: PyPy does not work yet with cpp protocol buffers. Falling back to the python implementation.
- variant: "cpp"
python: 'pypy3.10'
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
Expand All @@ -66,22 +77,16 @@ jobs:
- name: Install nox
run: |
pip install nox
# Trim the Python version string
- name: Trim python version
run: |
PYTHON_VERSION_TRIMMED=${{ matrix.python }}
PYTHON_VERSION_TRIMMED=$(echo $PYTHON_VERSION_TRIMMED | cut -c1-4)
echo "PYTHON_VERSION_TRIMMED=$PYTHON_VERSION_TRIMMED" >> $GITHUB_ENV
- name: Run unit tests
env:
COVERAGE_FILE: .coverage-${{ matrix.variant }}-${{ env.PYTHON_VERSION_TRIMMED }}
COVERAGE_FILE: .coverage-${{ matrix.variant }}-${{ matrix.python }}
run: |
nox -s "unit-${{ env.PYTHON_VERSION_TRIMMED }}(implementation='${{ matrix.variant }}')"
nox -s "unit-${{ matrix.python }}(implementation='${{ matrix.variant }}')"
- name: Upload coverage results
uses: actions/upload-artifact@v4
with:
name: coverage-artifact-${{ matrix.variant }}-${{ env.PYTHON_VERSION_TRIMMED }}
path: .coverage-${{ matrix.variant }}-${{ env.PYTHON_VERSION_TRIMMED }}
name: coverage-artifact-${{ matrix.variant }}-${{ matrix.python }}
path: .coverage-${{ matrix.variant }}-${{ matrix.python }}
include-hidden-files: true
prerelease:
runs-on: ubuntu-22.04
Expand Down
1 change: 1 addition & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"3.8",
"3.9",
"3.10",
"pypy3.10",
"3.11",
"3.12",
"3.13",
Expand Down
2 changes: 2 additions & 0 deletions proto/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def __new__(mcls, name, bases, attrs):
if isinstance(attrs._member_names, list):
idx = attrs._member_names.index(pb_options)
attrs._member_names.pop(idx)
elif isinstance(attrs._member_names, set): # PyPy
attrs._member_names.discard(pb_options)
else: # Python 3.11.0b3
del attrs._member_names[pb_options]

Expand Down
Empty file.
Loading