bpo-39573: Porting to Python 3.10: Py_SET_SIZE() macro by vstinner · Pull Request #20610 · python/cpython · GitHub

github.com

Tin mới

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

: Porting to Python 3.10: Py_SET_SIZE() macro

awaiting core review

awaiting core review

Build broken on Python 3.10 MagicStack/immutables#46

View reviewed changes

Learn more about hiding disruptive comments

The reason will be displayed to describe this comment to others. Learn more.

numpy/numpy#16417 (comment)

I am not sure, that code come from @eric-wieser via numpy/numpy#16417 (comment)

MAINT: make Py_SET_SIZE and Py_SET_TYPE macros a bit safer numpy/numpy#16501

https://github.com/pythoncapi/pythoncapi_compat/blob/219cdd858595fb5d478117b0ef4758fedc3d2365/pythoncapi_compat.h#L29

In the meanwhile, I created the backport compatiblity header file :-) It defines a static inline function which returns void: https://github.com/pythoncapi/pythoncapi_compat/blob/219cdd858595fb5d478117b0ef4758fedc3d2365/

View reviewed changes

use Py_SET_TYPE for compat with python 3.10 psycopg/psycopg2#1131

[C API] Avoid accessing PyObject and PyVarObject members directly: add Py_SET_TYPE() and Py_IS_TYPE(), disallow Py_TYPE(obj)=type #83754