-
Notifications
You must be signed in to change notification settings - Fork 233
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
Port wrapt to heap types and stable ABI #187
base: develop
Are you sure you want to change the base?
Conversation
I would need to make a last release with Python 2.7 support first. I keep forgetting to release 1.13 with all the wheel stuff. I should do that tomorrow I guess. :-) |
I'm unable to run any tests locally:
|
Not sure whether was same error, but tox on macOS has been broken for me for a while, but under Linux with GitHub actions has been working fine. So I wasn't sure if was some local issue in my setup. |
Actually, was also working find under macOS and Windows under GitHub actions, thus why figured my system was broken. |
My memory is obviously bad, tox runs fine for me locally so I obviously fixed the issue. This is before your changes though. Not tried those and they fail for all C extensions tests under GitHub actions as well. |
ab1c761
to
c584b0d
Compare
0c37cd2
to
c9530de
Compare
@GrahamDumpleton I figured out all the segfaults and got most tests passing. There are two failing tests for Python 3.10's annotation overrides left. |
I filed https://bugs.python.org/issue45319 for the |
#define WRAPT_HEAPTYPE_SUPPORT_OFFSET 1 | ||
#endif | ||
|
||
/* Instanes of heap types in Python < 3.8 don't hold strong ref to their |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fairly sure this is not the case:
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class C: pass
...
>>> import sys
>>> sys.getrefcount(C)
5
>>> x = [C() for _ in range(100)]
>>> sys.getrefcount(C)
105
In code:
https://github.com/python/cpython/blob/v3.6.15/Objects/typeobject.c#L946
https://github.com/python/cpython/blob/v3.6.15/Objects/typeobject.c#L1228
Port wrapt to use heap types and stable ABI. Python's stable ABI does not support static types and makes type struct opaque.
wrapt uses some features that are not supported by limited API in Python 3.8 and earlier. I modified the code to use unstable API for 3.6 to 3.8 and limited API + abi3 for 3.9+.