Skip to content
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

Changes for python 3.12 #259

Merged
merged 4 commits into from
Oct 7, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-10.15]
os: [ubuntu-latest, windows-latest, macos-latest]

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

- name: Build wheels
uses: pypa/cibuildwheel@v2.3.0
uses: pypa/cibuildwheel@v2.16.2
env:
CIBW_SKIP: pp*
CIBW_TEST_COMMAND: python -m unittest discover ephem
Expand All @@ -29,10 +29,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04]
os: [ubuntu-latest]

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

- name: Build wheels
uses: pypa/cibuildwheel@v1.12.0
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/github-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macos-10.15]
os: [ubuntu-latest, windows-latest, macos-latest]

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

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
Expand All @@ -30,7 +30,7 @@ jobs:
platforms: all

- name: Build wheels
uses: pypa/cibuildwheel@v2.12.1
uses: pypa/cibuildwheel@v2.16.2
env:
#CIBW_ARCHS_LINUX: auto aarch64 ppc64le s390x
CIBW_ARCHS_LINUX: auto aarch64 s390x
Expand All @@ -46,25 +46,25 @@ jobs:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/setup-python@v2
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'

- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz

upload_pypi:
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: artifact
path: dist
Expand Down
4 changes: 2 additions & 2 deletions ephem/doc/date.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Datetime objects
You can also ask a PyEphem date to convert itself the other direction
by calling its ``datetime()`` method.

>>> from datetime import date, datetime
>>> from datetime import date, datetime, timezone
>>> print(ephem.Date(datetime(2005, 4, 18, 22, 15)))
2005/4/18 22:15:00

Expand All @@ -138,7 +138,7 @@ Datetime objects
>>> d = datetime.utcnow()
>>> print(ephem.Date(d))
2015/12/14 15:42:14
>>> d = datetime.utcfromtimestamp(1450107734)
>>> d = datetime.fromtimestamp(1450107734, tz=timezone.utc)
>>> print(ephem.Date(d))
2015/12/14 15:42:14

Expand Down
7 changes: 6 additions & 1 deletion extensions/_libastro.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
#define PY_SSIZE_T_CLEAN
#include "Python.h"

#define PyUnicode_GetSize(o) PyUnicode_GET_SIZE(o)

#if PY_MAJOR_VERSION == 2
#define PyLong_AsLong PyInt_AsLong
#define PyLong_FromLong PyInt_FromLong
Expand All @@ -23,6 +25,9 @@
#define OB_REFCNT ob_base.ob_refcnt
#if PY_MINOR_VERSION == 0 || PY_MINOR_VERSION == 1 || PY_MINOR_VERSION == 2
#define PyUnicode_AsUTF8 _PyUnicode_AsString
# elif PY_MINOR_VERSION >= 3
#undef PyUnicode_GetSize
#define PyUnicode_GetSize PyUnicode_GET_LENGTH
#endif
#endif

Expand Down Expand Up @@ -180,7 +185,7 @@ static int scansexa(PyObject *o, double *dp) {
Py_DECREF(list);
return -1;
}
Py_ssize_t item_length = PyUnicode_GET_SIZE(item);
Py_ssize_t item_length = PyUnicode_GetSize(item);
if (item_length == 0) {
continue; /* accept empty string for 0 */
}
Expand Down