diff options
author | Jason Madden <jamadden@gmail.com> | 2023-01-27 16:24:34 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 16:24:34 -0600 |
commit | ae570c56dbee9070b02eb2124f0b991cce52f4db (patch) | |
tree | 8a63f02b3cb9995ef4f02f1cdabb3272513386d0 | |
parent | 880825b7f02c4e22d64eef2e16a015c6a629fdcd (diff) | |
parent | 616df6049cca1d94f783447ad164e331b3044ead (diff) | |
download | greenlet-ae570c56dbee9070b02eb2124f0b991cce52f4db.tar.gz |
Merge pull request #341 from python-greenlet/issue302
Stop using 'const PyObject*', per @vstinner
-rw-r--r-- | .github/workflows/tests.yml | 15 | ||||
-rw-r--r-- | CHANGES.rst | 4 | ||||
-rw-r--r-- | src/greenlet/greenlet_refs.hpp | 14 | ||||
-rw-r--r-- | src/greenlet/platform/switch_aarch64_gcc.h | 11 |
4 files changed, 34 insertions, 10 deletions
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de68d5b..27c91e0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,7 +42,8 @@ jobs: run: | python -m pip install -U pip setuptools wheel python -m pip install -U twine - - name: Install greenlet + - name: Install greenlet (non-Mac) + if: ${{ ! startsWith(runner.os, 'Mac') }} run: | python setup.py bdist_wheel python -m pip install -U -e ".[test,docs]" @@ -53,6 +54,18 @@ jobs: # process-wide effects), we test with Ofast here, because we # expect that some people will compile it themselves with that setting. CPPFLAGS: "-Ofast -UNDEBUG" + - name: Install greenlet (Mac) + if: startsWith(runner.os, 'Mac') + run: | + python setup.py bdist_wheel + python -m pip install -U -e ".[test,docs]" + env: + # Unlike the above, we are actually distributing these + # wheels, so they need to be built for production use. + CPPFLAGS: "-O3" + # Build for both architectures + ARCHFLAGS: "-arch x86_64 -arch arm64" + - name: Check greenlet build run: | ls -l dist diff --git a/CHANGES.rst b/CHANGES.rst index 88c0f36..75eaf15 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -8,7 +8,9 @@ - Fix calling ``greenlet.settrace()`` with the same tracer object that was currently active. See `issue 332 <https://github.com/python-greenlet/greenlet/issues/332>`_. -- Various compilation and standards conformance fixes. See #335, #336, #300. +- Various compilation and standards conformance fixes. See #335, #336, + #300, #302. + 2.0.1 (2022-11-07) diff --git a/src/greenlet/greenlet_refs.hpp b/src/greenlet/greenlet_refs.hpp index 160b9e4..36f2991 100644 --- a/src/greenlet/greenlet_refs.hpp +++ b/src/greenlet/greenlet_refs.hpp @@ -225,7 +225,7 @@ namespace greenlet { inline OwnedObject PyRequireAttr(const ImmortalObject& name) const; inline OwnedObject PyCall(const BorrowedObject& arg) const; inline OwnedObject PyCall(PyGreenlet* arg) const ; - inline OwnedObject PyCall(const PyObject* arg) const ; + inline OwnedObject PyCall(PyObject* arg) const ; // PyObject_Call(this, args, kwargs); inline OwnedObject PyCall(const BorrowedObject args, const BorrowedObject kwargs) const; @@ -714,11 +714,11 @@ namespace greenlet { template<typename T, TypeChecker TC> inline OwnedObject PyObjectPointer<T, TC>::PyCall(PyGreenlet* arg) const { - return this->PyCall(reinterpret_cast<const PyObject*>(arg)); + return this->PyCall(reinterpret_cast<PyObject*>(arg)); } template<typename T, TypeChecker TC> - inline OwnedObject PyObjectPointer<T, TC>::PyCall(const PyObject* arg) const + inline OwnedObject PyObjectPointer<T, TC>::PyCall(PyObject* arg) const { assert(this->p); return OwnedObject::consuming(PyObject_CallFunctionObjArgs(this->p, arg, NULL)); @@ -845,16 +845,16 @@ namespace greenlet { this->PyAddObject(name, new_object.borrow()); } - void PyAddObject(const char* name, const PyTypeObject& type) + void PyAddObject(const char* name, PyTypeObject& type) { - this->PyAddObject(name, reinterpret_cast<const PyObject*>(&type)); + this->PyAddObject(name, reinterpret_cast<PyObject*>(&type)); } - void PyAddObject(const char* name, const PyObject* new_object) + void PyAddObject(const char* name, PyObject* new_object) { Py_INCREF(new_object); try { - Require(PyModule_AddObject(this->p, name, const_cast<PyObject*>(new_object))); + Require(PyModule_AddObject(this->p, name, new_object)); } catch (const PyErrOccurred&) { Py_DECREF(p); diff --git a/src/greenlet/platform/switch_aarch64_gcc.h b/src/greenlet/platform/switch_aarch64_gcc.h index 0b9d556..31e09b9 100644 --- a/src/greenlet/platform/switch_aarch64_gcc.h +++ b/src/greenlet/platform/switch_aarch64_gcc.h @@ -26,7 +26,7 @@ slp_switch(void) { int err; void *fp; - register long *stackref, stsizediff; + long *stackref, stsizediff; __asm__ volatile ("" : : : REGS_TO_SAVE); __asm__ volatile ("str x29, %0" : "=m"(fp) : : ); __asm__ ("mov %0, sp" : "=r" (stackref)); @@ -59,6 +59,15 @@ slp_switch(void) stack space), and the simplest is to call a function that returns an unknown value (which happens to be zero), so the saved/restored value is unused. */ + /* XXX: This line produces warnings: + + value size does not match register size specified by the + constraint and modifier + + The suggested fix is to change %0 to %w0. + + TODO: Validate and change that. + */ __asm__ volatile ("mov %0, #0" : "=r" (err)); } __asm__ volatile ("ldr x29, %0" : : "m" (fp) :); |