Python-checkins
Threads by month
- ----- 2025 -----
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
January 2025
- 1 participants
- 181 discussions
[3.13] gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (GH-128464) (#128478)
by erlend-aasland 04 Jan '25
by erlend-aasland 04 Jan '25
04 Jan '25
https://github.com/python/cpython/commit/883cb23dd14bcc60921a53cc51c30fda22…
commit: 883cb23dd14bcc60921a53cc51c30fda223b9ca6
branch: 3.13
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T11:09:25Z
summary:
[3.13] gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (GH-128464) (#128478)
(cherry picked from commit a4e773c540cfd3a9c2bb3b5033d2f79ef50962c8)
Co-authored-by: Erlend E. Aasland <erlend(a)python.org>
files:
A Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
M Lib/test/test_clinic.py
M Tools/clinic/libclinic/cpp.py
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index a7ba7f3d99860e..e210103a80f399 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -731,6 +731,16 @@ def test_cloned_forced_text_signature_illegal(self):
err = "Cannot use @text_signature when cloning a function"
self.expect_failure(block, err, lineno=11)
+ def test_ignore_preprocessor_in_comments(self):
+ for dsl in "clinic", "python":
+ raw = dedent(f"""\
+ /*[{dsl} input]
+ # CPP directives, valid or not, should be ignored in C comments.
+ #
+ [{dsl} start generated code]*/
+ """)
+ self.clinic.parse(raw)
+
class ParseFileUnitTest(TestCase):
def expect_parsing_failure(
diff --git a/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst b/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
new file mode 100644
index 00000000000000..9657e138e9911b
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
@@ -0,0 +1,2 @@
+Fix a bug where Argument Clinic's C pre-processor parser tried to parse
+pre-processor directives inside C comments. Patch by Erlend Aasland.
diff --git a/Tools/clinic/libclinic/cpp.py b/Tools/clinic/libclinic/cpp.py
index e115d65a88e1b6..3cfe99b712641d 100644
--- a/Tools/clinic/libclinic/cpp.py
+++ b/Tools/clinic/libclinic/cpp.py
@@ -132,6 +132,9 @@ def pop_stack() -> TokenAndCondition:
if line_comment:
line = before.rstrip()
+ if self.in_comment:
+ return
+
if not line.startswith('#'):
return
1
0
gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (#128464)
by erlend-aasland 04 Jan '25
by erlend-aasland 04 Jan '25
04 Jan '25
https://github.com/python/cpython/commit/a4e773c540cfd3a9c2bb3b5033d2f79ef5…
commit: a4e773c540cfd3a9c2bb3b5033d2f79ef50962c8
branch: main
author: Erlend E. Aasland <erlend(a)python.org>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T11:46:04+01:00
summary:
gh-128152: Argument Clinic: ignore pre-processor directives inside C comments (#128464)
files:
A Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
M Lib/test/test_clinic.py
M Tools/clinic/libclinic/cpp.py
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 11054963b6ff03..b45b9ee89ee3de 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -740,6 +740,16 @@ def test_cloned_forced_text_signature_illegal(self):
err = "Cannot use @text_signature when cloning a function"
self.expect_failure(block, err, lineno=11)
+ def test_ignore_preprocessor_in_comments(self):
+ for dsl in "clinic", "python":
+ raw = dedent(f"""\
+ /*[{dsl} input]
+ # CPP directives, valid or not, should be ignored in C comments.
+ #
+ [{dsl} start generated code]*/
+ """)
+ self.clinic.parse(raw)
+
class ParseFileUnitTest(TestCase):
def expect_parsing_failure(
diff --git a/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst b/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
new file mode 100644
index 00000000000000..9657e138e9911b
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2025-01-03-23-51-07.gh-issue-128152.IhzElS.rst
@@ -0,0 +1,2 @@
+Fix a bug where Argument Clinic's C pre-processor parser tried to parse
+pre-processor directives inside C comments. Patch by Erlend Aasland.
diff --git a/Tools/clinic/libclinic/cpp.py b/Tools/clinic/libclinic/cpp.py
index e115d65a88e1b6..3cfe99b712641d 100644
--- a/Tools/clinic/libclinic/cpp.py
+++ b/Tools/clinic/libclinic/cpp.py
@@ -132,6 +132,9 @@ def pop_stack() -> TokenAndCondition:
if line_comment:
line = before.rstrip()
+ if self.in_comment:
+ return
+
if not line.startswith('#'):
return
1
0
https://github.com/python/cpython/commit/03ede5afe2d10c04e05f159fd353ee5869…
commit: 03ede5afe2d10c04e05f159fd353ee5869ae2cdb
branch: main
author: sobolevn <mail(a)sobolevn.me>
committer: sobolevn <mail(a)sobolevn.me>
date: 2025-01-04T13:31:01+03:00
summary:
Add `check-readthedocs` pre-commit hook (#128453)
files:
M .pre-commit-config.yaml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 107f3b255735f4..af6accd89b5bd4 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -55,6 +55,7 @@ repos:
hooks:
- id: check-dependabot
- id: check-github-workflows
+ - id: check-readthedocs
- repo: https://github.com/rhysd/actionlint
rev: v1.7.4
1
0
04 Jan '25
https://github.com/python/cpython/commit/513a4efa75bf78c9d629ddabc9516fb058…
commit: 513a4efa75bf78c9d629ddabc9516fb058787289
branch: main
author: Kumar Aditya <kumaraditya(a)python.org>
committer: kumaraditya303 <kumaraditya(a)python.org>
date: 2025-01-04T14:18:22+05:30
summary:
gh-128002: fix many thread safety issues in asyncio (#128147)
* Makes `_asyncio.Task` and `_asyncio.Future` thread-safe by adding critical sections
* Add assertions to check for thread safety checking locking of object by critical sections in internal functions
* Make `_asyncio.all_tasks` thread safe when eager tasks are used
* Add a thread safety test
files:
A Lib/test/test_asyncio/test_free_threading.py
M Modules/_asynciomodule.c
M Modules/clinic/_asynciomodule.c.h
diff --git a/Lib/test/test_asyncio/test_free_threading.py b/Lib/test/test_asyncio/test_free_threading.py
new file mode 100644
index 00000000000000..90bddbf3a9dda1
--- /dev/null
+++ b/Lib/test/test_asyncio/test_free_threading.py
@@ -0,0 +1,82 @@
+import asyncio
+import unittest
+from threading import Thread
+from unittest import TestCase
+
+from test.support import threading_helper
+
+threading_helper.requires_working_threading(module=True)
+
+def tearDownModule():
+ asyncio._set_event_loop_policy(None)
+
+
+class TestFreeThreading:
+ def test_all_tasks_race(self) -> None:
+ async def main():
+ loop = asyncio.get_running_loop()
+ future = loop.create_future()
+
+ async def coro():
+ await future
+
+ tasks = set()
+
+ async with asyncio.TaskGroup() as tg:
+ for _ in range(100):
+ tasks.add(tg.create_task(coro()))
+
+ all_tasks = self.all_tasks(loop)
+ self.assertEqual(len(all_tasks), 101)
+
+ for task in all_tasks:
+ self.assertEqual(task.get_loop(), loop)
+ self.assertFalse(task.done())
+
+ current = self.current_task()
+ self.assertEqual(current.get_loop(), loop)
+ self.assertSetEqual(all_tasks, tasks | {current})
+ future.set_result(None)
+
+ def runner():
+ with asyncio.Runner() as runner:
+ loop = runner.get_loop()
+ loop.set_task_factory(self.factory)
+ runner.run(main())
+
+ threads = []
+
+ for _ in range(10):
+ thread = Thread(target=runner)
+ threads.append(thread)
+
+ with threading_helper.start_threads(threads):
+ pass
+
+
+class TestPyFreeThreading(TestFreeThreading, TestCase):
+ all_tasks = staticmethod(asyncio.tasks._py_all_tasks)
+ current_task = staticmethod(asyncio.tasks._py_current_task)
+
+ def factory(self, loop, coro, context=None):
+ return asyncio.tasks._PyTask(coro, loop=loop, context=context)
+
+
+(a)unittest.skipUnless(hasattr(asyncio.tasks, "_c_all_tasks"), "requires _asyncio")
+class TestCFreeThreading(TestFreeThreading, TestCase):
+ all_tasks = staticmethod(getattr(asyncio.tasks, "_c_all_tasks", None))
+ current_task = staticmethod(getattr(asyncio.tasks, "_c_current_task", None))
+
+ def factory(self, loop, coro, context=None):
+ return asyncio.tasks._CTask(coro, loop=loop, context=context)
+
+
+class TestEagerPyFreeThreading(TestPyFreeThreading):
+ def factory(self, loop, coro, context=None):
+ return asyncio.tasks._PyTask(coro, loop=loop, context=context, eager_start=True)
+
+
+(a)unittest.skipUnless(hasattr(asyncio.tasks, "_c_all_tasks"), "requires _asyncio")
+class TestEagerCFreeThreading(TestCFreeThreading, TestCase):
+ def factory(self, loop, coro, context=None):
+ return asyncio.tasks._CTask(coro, loop=loop, context=context, eager_start=True)
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index 74db4c74af905a..b8b184af04a7cb 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -364,6 +364,8 @@ future_ensure_alive(FutureObj *fut)
static int
future_schedule_callbacks(asyncio_state *state, FutureObj *fut)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
if (fut->fut_callback0 != NULL) {
/* There's a 1st callback */
@@ -481,6 +483,8 @@ future_init(FutureObj *fut, PyObject *loop)
static PyObject *
future_set_result(asyncio_state *state, FutureObj *fut, PyObject *res)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
if (future_ensure_alive(fut)) {
return NULL;
}
@@ -503,6 +507,8 @@ future_set_result(asyncio_state *state, FutureObj *fut, PyObject *res)
static PyObject *
future_set_exception(asyncio_state *state, FutureObj *fut, PyObject *exc)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
PyObject *exc_val = NULL;
if (fut->fut_state != STATE_PENDING) {
@@ -569,6 +575,8 @@ future_set_exception(asyncio_state *state, FutureObj *fut, PyObject *exc)
static PyObject *
create_cancelled_error(asyncio_state *state, FutureObj *fut)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
PyObject *exc;
if (fut->fut_cancelled_exc != NULL) {
/* transfer ownership */
@@ -588,6 +596,8 @@ create_cancelled_error(asyncio_state *state, FutureObj *fut)
static void
future_set_cancelled_error(asyncio_state *state, FutureObj *fut)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
PyObject *exc = create_cancelled_error(state, fut);
if (exc == NULL) {
return;
@@ -599,6 +609,8 @@ future_set_cancelled_error(asyncio_state *state, FutureObj *fut)
static int
future_get_result(asyncio_state *state, FutureObj *fut, PyObject **result)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
if (fut->fut_state == STATE_CANCELLED) {
future_set_cancelled_error(state, fut);
return -1;
@@ -632,6 +644,8 @@ static PyObject *
future_add_done_callback(asyncio_state *state, FutureObj *fut, PyObject *arg,
PyObject *ctx)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
if (!future_is_alive(fut)) {
PyErr_SetString(PyExc_RuntimeError, "uninitialized Future object");
return NULL;
@@ -706,6 +720,8 @@ future_add_done_callback(asyncio_state *state, FutureObj *fut, PyObject *arg,
static PyObject *
future_cancel(asyncio_state *state, FutureObj *fut, PyObject *msg)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
+
fut->fut_log_tb = 0;
if (fut->fut_state != STATE_PENDING) {
@@ -787,6 +803,7 @@ FutureObj_traverse(FutureObj *fut, visitproc visit, void *arg)
}
/*[clinic input]
+@critical_section
_asyncio.Future.result
Return the result this future represents.
@@ -798,7 +815,7 @@ the future is done and has an exception set, this exception is raised.
static PyObject *
_asyncio_Future_result_impl(FutureObj *self)
-/*[clinic end generated code: output=f35f940936a4b1e5 input=49ecf9cf5ec50dc5]*/
+/*[clinic end generated code: output=f35f940936a4b1e5 input=61d89f48e4c8b670]*/
{
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
PyObject *result;
@@ -827,6 +844,7 @@ _asyncio_Future_result_impl(FutureObj *self)
}
/*[clinic input]
+@critical_section
_asyncio.Future.exception
cls: defining_class
@@ -842,7 +860,7 @@ InvalidStateError.
static PyObject *
_asyncio_Future_exception_impl(FutureObj *self, PyTypeObject *cls)
-/*[clinic end generated code: output=ce75576b187c905b input=3faf15c22acdb60d]*/
+/*[clinic end generated code: output=ce75576b187c905b input=647d1fd1fc403301]*/
{
if (!future_is_alive(self)) {
asyncio_state *state = get_asyncio_state_by_cls(cls);
@@ -873,6 +891,7 @@ _asyncio_Future_exception_impl(FutureObj *self, PyTypeObject *cls)
}
/*[clinic input]
+@critical_section
_asyncio.Future.set_result
cls: defining_class
@@ -888,7 +907,7 @@ InvalidStateError.
static PyObject *
_asyncio_Future_set_result_impl(FutureObj *self, PyTypeObject *cls,
PyObject *result)
-/*[clinic end generated code: output=99afbbe78f99c32d input=d5a41c1e353acc2e]*/
+/*[clinic end generated code: output=99afbbe78f99c32d input=4069306f03a3b6ee]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
ENSURE_FUTURE_ALIVE(state, self)
@@ -896,6 +915,7 @@ _asyncio_Future_set_result_impl(FutureObj *self, PyTypeObject *cls,
}
/*[clinic input]
+@critical_section
_asyncio.Future.set_exception
cls: defining_class
@@ -911,7 +931,7 @@ InvalidStateError.
static PyObject *
_asyncio_Future_set_exception_impl(FutureObj *self, PyTypeObject *cls,
PyObject *exception)
-/*[clinic end generated code: output=0a5e8b5a52f058d6 input=a245cd49d3df939b]*/
+/*[clinic end generated code: output=0a5e8b5a52f058d6 input=b6eab43a389bc966]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
ENSURE_FUTURE_ALIVE(state, self)
@@ -919,6 +939,7 @@ _asyncio_Future_set_exception_impl(FutureObj *self, PyTypeObject *cls,
}
/*[clinic input]
+@critical_section
_asyncio.Future.add_done_callback
cls: defining_class
@@ -937,7 +958,7 @@ scheduled with call_soon.
static PyObject *
_asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
PyObject *fn, PyObject *context)
-/*[clinic end generated code: output=922e9a4cbd601167 input=599261c521458cc2]*/
+/*[clinic end generated code: output=922e9a4cbd601167 input=37d97f941beb7b3e]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
if (context == NULL) {
@@ -953,6 +974,7 @@ _asyncio_Future_add_done_callback_impl(FutureObj *self, PyTypeObject *cls,
}
/*[clinic input]
+@critical_section
_asyncio.Future.remove_done_callback
cls: defining_class
@@ -967,7 +989,7 @@ Returns the number of callbacks removed.
static PyObject *
_asyncio_Future_remove_done_callback_impl(FutureObj *self, PyTypeObject *cls,
PyObject *fn)
-/*[clinic end generated code: output=2da35ccabfe41b98 input=c7518709b86fc747]*/
+/*[clinic end generated code: output=2da35ccabfe41b98 input=3afbc9f6a673091b]*/
{
PyObject *newlist;
Py_ssize_t len, i, j=0;
@@ -1076,6 +1098,7 @@ _asyncio_Future_remove_done_callback_impl(FutureObj *self, PyTypeObject *cls,
}
/*[clinic input]
+@critical_section
_asyncio.Future.cancel
cls: defining_class
@@ -1092,7 +1115,7 @@ return True.
static PyObject *
_asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
PyObject *msg)
-/*[clinic end generated code: output=074956f35904b034 input=bba8f8b786941a94]*/
+/*[clinic end generated code: output=074956f35904b034 input=44ab4003da839970]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
ENSURE_FUTURE_ALIVE(state, self)
@@ -1100,6 +1123,7 @@ _asyncio_Future_cancel_impl(FutureObj *self, PyTypeObject *cls,
}
/*[clinic input]
+@critical_section
_asyncio.Future.cancelled
Return True if the future was cancelled.
@@ -1107,7 +1131,7 @@ Return True if the future was cancelled.
static PyObject *
_asyncio_Future_cancelled_impl(FutureObj *self)
-/*[clinic end generated code: output=145197ced586357d input=943ab8b7b7b17e45]*/
+/*[clinic end generated code: output=145197ced586357d input=9b8644819a675416]*/
{
if (future_is_alive(self) && self->fut_state == STATE_CANCELLED) {
Py_RETURN_TRUE;
@@ -1118,6 +1142,7 @@ _asyncio_Future_cancelled_impl(FutureObj *self)
}
/*[clinic input]
+@critical_section
_asyncio.Future.done
Return True if the future is done.
@@ -1128,7 +1153,7 @@ future was cancelled.
static PyObject *
_asyncio_Future_done_impl(FutureObj *self)
-/*[clinic end generated code: output=244c5ac351145096 input=28d7b23fdb65d2ac]*/
+/*[clinic end generated code: output=244c5ac351145096 input=7204d3cc63bef7f3]*/
{
if (!future_is_alive(self) || self->fut_state == STATE_PENDING) {
Py_RETURN_FALSE;
@@ -1139,6 +1164,7 @@ _asyncio_Future_done_impl(FutureObj *self)
}
/*[clinic input]
+@critical_section
_asyncio.Future.get_loop
cls: defining_class
@@ -1149,17 +1175,24 @@ Return the event loop the Future is bound to.
static PyObject *
_asyncio_Future_get_loop_impl(FutureObj *self, PyTypeObject *cls)
-/*[clinic end generated code: output=f50ea6c374d9ee97 input=163c2c498b45a1f0]*/
+/*[clinic end generated code: output=f50ea6c374d9ee97 input=f3ce629bfd9f45c1]*/
{
asyncio_state *state = get_asyncio_state_by_cls(cls);
ENSURE_FUTURE_ALIVE(state, self)
return Py_NewRef(self->fut_loop);
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._asyncio_future_blocking
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_blocking(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__asyncio_future_blocking_get_impl(FutureObj *self)
+/*[clinic end generated code: output=a558a2c51e38823b input=58da92efc03b617d]*/
{
- if (future_is_alive(fut) && fut->fut_blocking) {
+ if (future_is_alive(self) && self->fut_blocking) {
Py_RETURN_TRUE;
}
else {
@@ -1167,31 +1200,47 @@ FutureObj_get_blocking(FutureObj *fut, void *Py_UNUSED(ignored))
}
}
+/*[clinic input]
+@critical_section
+@setter
+_asyncio.Future._asyncio_future_blocking
+[clinic start generated code]*/
+
static int
-FutureObj_set_blocking(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored))
+_asyncio_Future__asyncio_future_blocking_set_impl(FutureObj *self,
+ PyObject *value)
+/*[clinic end generated code: output=0686d1cb024a7453 input=3fd4a5f95df788b7]*/
+
{
- if (future_ensure_alive(fut)) {
+ if (future_ensure_alive(self)) {
return -1;
}
- if (val == NULL) {
+ if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
return -1;
}
- int is_true = PyObject_IsTrue(val);
+ int is_true = PyObject_IsTrue(value);
if (is_true < 0) {
return -1;
}
- fut->fut_blocking = is_true;
+ self->fut_blocking = is_true;
return 0;
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._log_traceback
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_log_traceback(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__log_traceback_get_impl(FutureObj *self)
+/*[clinic end generated code: output=2724433b238593c7 input=91e5144ea4117d8e]*/
{
- asyncio_state *state = get_asyncio_state_by_def((PyObject *)fut);
- ENSURE_FUTURE_ALIVE(state, fut)
- if (fut->fut_log_tb) {
+ asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
+ ENSURE_FUTURE_ALIVE(state, self)
+ if (self->fut_log_tb) {
Py_RETURN_TRUE;
}
else {
@@ -1199,14 +1248,21 @@ FutureObj_get_log_traceback(FutureObj *fut, void *Py_UNUSED(ignored))
}
}
+/*[clinic input]
+@critical_section
+@setter
+_asyncio.Future._log_traceback
+[clinic start generated code]*/
+
static int
-FutureObj_set_log_traceback(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignored))
+_asyncio_Future__log_traceback_set_impl(FutureObj *self, PyObject *value)
+/*[clinic end generated code: output=9ce8e19504f42f54 input=30ac8217754b08c2]*/
{
- if (val == NULL) {
+ if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
return -1;
}
- int is_true = PyObject_IsTrue(val);
+ int is_true = PyObject_IsTrue(value);
if (is_true < 0) {
return -1;
}
@@ -1215,31 +1271,44 @@ FutureObj_set_log_traceback(FutureObj *fut, PyObject *val, void *Py_UNUSED(ignor
"_log_traceback can only be set to False");
return -1;
}
- fut->fut_log_tb = is_true;
+ self->fut_log_tb = is_true;
return 0;
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._loop
+[clinic start generated code]*/
static PyObject *
-FutureObj_get_loop(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__loop_get_impl(FutureObj *self)
+/*[clinic end generated code: output=5ba31563eecfeedf input=0337130bc5781670]*/
{
- if (!future_is_alive(fut)) {
+ if (!future_is_alive(self)) {
Py_RETURN_NONE;
}
- return Py_NewRef(fut->fut_loop);
+ return Py_NewRef(self->fut_loop);
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._callbacks
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_callbacks(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__callbacks_get_impl(FutureObj *self)
+/*[clinic end generated code: output=b40d360505fcc583 input=7a466649530c01bb]*/
{
- asyncio_state *state = get_asyncio_state_by_def((PyObject *)fut);
- ENSURE_FUTURE_ALIVE(state, fut)
+ asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
+ ENSURE_FUTURE_ALIVE(state, self)
Py_ssize_t len = 0;
- if (fut->fut_callback0 != NULL) {
+ if (self->fut_callback0 != NULL) {
len++;
}
- if (fut->fut_callbacks != NULL) {
- len += PyList_GET_SIZE(fut->fut_callbacks);
+ if (self->fut_callbacks != NULL) {
+ len += PyList_GET_SIZE(self->fut_callbacks);
}
if (len == 0) {
@@ -1252,22 +1321,22 @@ FutureObj_get_callbacks(FutureObj *fut, void *Py_UNUSED(ignored))
}
Py_ssize_t i = 0;
- if (fut->fut_callback0 != NULL) {
+ if (self->fut_callback0 != NULL) {
PyObject *tup0 = PyTuple_New(2);
if (tup0 == NULL) {
Py_DECREF(callbacks);
return NULL;
}
- PyTuple_SET_ITEM(tup0, 0, Py_NewRef(fut->fut_callback0));
- assert(fut->fut_context0 != NULL);
- PyTuple_SET_ITEM(tup0, 1, Py_NewRef(fut->fut_context0));
+ PyTuple_SET_ITEM(tup0, 0, Py_NewRef(self->fut_callback0));
+ assert(self->fut_context0 != NULL);
+ PyTuple_SET_ITEM(tup0, 1, Py_NewRef(self->fut_context0));
PyList_SET_ITEM(callbacks, i, tup0);
i++;
}
- if (fut->fut_callbacks != NULL) {
- for (Py_ssize_t j = 0; j < PyList_GET_SIZE(fut->fut_callbacks); j++) {
- PyObject *cb = PyList_GET_ITEM(fut->fut_callbacks, j);
+ if (self->fut_callbacks != NULL) {
+ for (Py_ssize_t j = 0; j < PyList_GET_SIZE(self->fut_callbacks); j++) {
+ PyObject *cb = PyList_GET_ITEM(self->fut_callbacks, j);
Py_INCREF(cb);
PyList_SET_ITEM(callbacks, i, cb);
i++;
@@ -1277,68 +1346,110 @@ FutureObj_get_callbacks(FutureObj *fut, void *Py_UNUSED(ignored))
return callbacks;
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._result
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_result(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__result_get_impl(FutureObj *self)
+/*[clinic end generated code: output=6877e8ce97333873 input=624f8e28e67f2636]*/
+
{
- asyncio_state *state = get_asyncio_state_by_def((PyObject *)fut);
- ENSURE_FUTURE_ALIVE(state, fut)
- if (fut->fut_result == NULL) {
+ asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
+ ENSURE_FUTURE_ALIVE(state, self)
+ if (self->fut_result == NULL) {
Py_RETURN_NONE;
}
- return Py_NewRef(fut->fut_result);
+ return Py_NewRef(self->fut_result);
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._exception
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_exception(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__exception_get_impl(FutureObj *self)
+/*[clinic end generated code: output=32f2c93b9e021a9b input=1828a1fcac929710]*/
{
- asyncio_state *state = get_asyncio_state_by_def((PyObject *)fut);
- ENSURE_FUTURE_ALIVE(state, fut)
- if (fut->fut_exception == NULL) {
+ asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
+ ENSURE_FUTURE_ALIVE(state, self)
+ if (self->fut_exception == NULL) {
Py_RETURN_NONE;
}
- return Py_NewRef(fut->fut_exception);
+ return Py_NewRef(self->fut_exception);
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._source_traceback
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_source_traceback(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__source_traceback_get_impl(FutureObj *self)
+/*[clinic end generated code: output=d4f12b09af22f61b input=3c831fbde5da90d0]*/
{
- if (!future_is_alive(fut) || fut->fut_source_tb == NULL) {
+ if (!future_is_alive(self) || self->fut_source_tb == NULL) {
Py_RETURN_NONE;
}
- return Py_NewRef(fut->fut_source_tb);
+ return Py_NewRef(self->fut_source_tb);
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._cancel_message
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_cancel_message(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__cancel_message_get_impl(FutureObj *self)
+/*[clinic end generated code: output=52ef6444f92cedac input=54c12c67082e4eea]*/
{
- if (fut->fut_cancel_msg == NULL) {
+ if (self->fut_cancel_msg == NULL) {
Py_RETURN_NONE;
}
- return Py_NewRef(fut->fut_cancel_msg);
+ return Py_NewRef(self->fut_cancel_msg);
}
+/*[clinic input]
+@critical_section
+@setter
+_asyncio.Future._cancel_message
+[clinic start generated code]*/
+
static int
-FutureObj_set_cancel_message(FutureObj *fut, PyObject *msg,
- void *Py_UNUSED(ignored))
+_asyncio_Future__cancel_message_set_impl(FutureObj *self, PyObject *value)
+/*[clinic end generated code: output=0854b2f77bff2209 input=f461d17f2d891fad]*/
{
- if (msg == NULL) {
+ if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
return -1;
}
- Py_INCREF(msg);
- Py_XSETREF(fut->fut_cancel_msg, msg);
+ Py_INCREF(value);
+ Py_XSETREF(self->fut_cancel_msg, value);
return 0;
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Future._state
+[clinic start generated code]*/
+
static PyObject *
-FutureObj_get_state(FutureObj *fut, void *Py_UNUSED(ignored))
+_asyncio_Future__state_get_impl(FutureObj *self)
+/*[clinic end generated code: output=622f560a3fa69c63 input=7c5ad023a93423ff]*/
{
- asyncio_state *state = get_asyncio_state_by_def((PyObject *)fut);
+ asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
PyObject *ret = NULL;
- ENSURE_FUTURE_ALIVE(state, fut)
+ ENSURE_FUTURE_ALIVE(state, self)
- switch (fut->fut_state) {
+ switch (self->fut_state) {
case STATE_PENDING:
ret = &_Py_ID(PENDING);
break;
@@ -1364,6 +1475,7 @@ FutureObj_repr(FutureObj *fut)
}
/*[clinic input]
+@critical_section
_asyncio.Future._make_cancelled_error
Create the CancelledError to raise if the Future is cancelled.
@@ -1374,7 +1486,7 @@ it erases the context exception value.
static PyObject *
_asyncio_Future__make_cancelled_error_impl(FutureObj *self)
-/*[clinic end generated code: output=a5df276f6c1213de input=ac6effe4ba795ecc]*/
+/*[clinic end generated code: output=a5df276f6c1213de input=ccb90df8c3c18bcd]*/
{
asyncio_state *state = get_asyncio_state_by_def((PyObject *)self);
return create_cancelled_error(state, self);
@@ -1455,23 +1567,16 @@ static PyMethodDef FutureType_methods[] = {
{NULL, NULL} /* Sentinel */
};
-#define FUTURE_COMMON_GETSETLIST \
- {"_state", (getter)FutureObj_get_state, NULL, NULL}, \
- {"_asyncio_future_blocking", (getter)FutureObj_get_blocking, \
- (setter)FutureObj_set_blocking, NULL}, \
- {"_loop", (getter)FutureObj_get_loop, NULL, NULL}, \
- {"_callbacks", (getter)FutureObj_get_callbacks, NULL, NULL}, \
- {"_result", (getter)FutureObj_get_result, NULL, NULL}, \
- {"_exception", (getter)FutureObj_get_exception, NULL, NULL}, \
- {"_log_traceback", (getter)FutureObj_get_log_traceback, \
- (setter)FutureObj_set_log_traceback, NULL}, \
- {"_source_traceback", (getter)FutureObj_get_source_traceback, \
- NULL, NULL}, \
- {"_cancel_message", (getter)FutureObj_get_cancel_message, \
- (setter)FutureObj_set_cancel_message, NULL},
-
static PyGetSetDef FutureType_getsetlist[] = {
- FUTURE_COMMON_GETSETLIST
+ _ASYNCIO_FUTURE__STATE_GETSETDEF
+ _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF
+ _ASYNCIO_FUTURE__LOOP_GETSETDEF
+ _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF
+ _ASYNCIO_FUTURE__RESULT_GETSETDEF
+ _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF
+ _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF
+ _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF
+ _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF
{NULL} /* Sentinel */
};
@@ -1550,19 +1655,13 @@ FutureIter_dealloc(futureiterobject *it)
}
static PySendResult
-FutureIter_am_send(futureiterobject *it,
- PyObject *Py_UNUSED(arg),
- PyObject **result)
+FutureIter_am_send_lock_held(futureiterobject *it, PyObject **result)
{
- /* arg is unused, see the comment on FutureIter_send for clarification */
-
PyObject *res;
FutureObj *fut = it->future;
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(fut);
*result = NULL;
- if (fut == NULL) {
- return PYGEN_ERROR;
- }
if (fut->fut_state == STATE_PENDING) {
if (!fut->fut_blocking) {
@@ -1575,18 +1674,29 @@ FutureIter_am_send(futureiterobject *it,
return PYGEN_ERROR;
}
- it->future = NULL;
res = _asyncio_Future_result_impl(fut);
if (res != NULL) {
- Py_DECREF(fut);
*result = res;
return PYGEN_RETURN;
}
- Py_DECREF(fut);
return PYGEN_ERROR;
}
+static PySendResult
+FutureIter_am_send(futureiterobject *it,
+ PyObject *Py_UNUSED(arg),
+ PyObject **result)
+{
+ /* arg is unused, see the comment on FutureIter_send for clarification */
+ PySendResult res;
+ Py_BEGIN_CRITICAL_SECTION(it->future);
+ res = FutureIter_am_send_lock_held(it, result);
+ Py_END_CRITICAL_SECTION();
+ return res;
+}
+
+
static PyObject *
FutureIter_iternext(futureiterobject *it)
{
@@ -1807,7 +1917,11 @@ TaskStepMethWrapper_call(TaskStepMethWrapper *o,
return NULL;
}
asyncio_state *state = get_asyncio_state_by_def((PyObject *)o);
- return task_step(state, o->sw_task, o->sw_arg);
+ PyObject *res;
+ Py_BEGIN_CRITICAL_SECTION(o->sw_task);
+ res = task_step(state, o->sw_task, o->sw_arg);
+ Py_END_CRITICAL_SECTION();
+ return res;
}
static int
@@ -2150,10 +2264,17 @@ TaskObj_traverse(TaskObj *task, visitproc visit, void *arg)
return 0;
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Task._log_destroy_pending
+[clinic start generated code]*/
+
static PyObject *
-TaskObj_get_log_destroy_pending(TaskObj *task, void *Py_UNUSED(ignored))
+_asyncio_Task__log_destroy_pending_get_impl(TaskObj *self)
+/*[clinic end generated code: output=e6c2a47d029ac93b input=17127298cd4c720b]*/
{
- if (task->task_log_destroy_pending) {
+ if (self->task_log_destroy_pending) {
Py_RETURN_TRUE;
}
else {
@@ -2161,25 +2282,40 @@ TaskObj_get_log_destroy_pending(TaskObj *task, void *Py_UNUSED(ignored))
}
}
+/*[clinic input]
+@critical_section
+@setter
+_asyncio.Task._log_destroy_pending
+[clinic start generated code]*/
+
static int
-TaskObj_set_log_destroy_pending(TaskObj *task, PyObject *val, void *Py_UNUSED(ignored))
+_asyncio_Task__log_destroy_pending_set_impl(TaskObj *self, PyObject *value)
+/*[clinic end generated code: output=7ebc030bb92ec5ce input=49b759c97d1216a4]*/
{
- if (val == NULL) {
+ if (value == NULL) {
PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
return -1;
}
- int is_true = PyObject_IsTrue(val);
+ int is_true = PyObject_IsTrue(value);
if (is_true < 0) {
return -1;
}
- task->task_log_destroy_pending = is_true;
+ self->task_log_destroy_pending = is_true;
return 0;
}
+
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Task._must_cancel
+[clinic start generated code]*/
+
static PyObject *
-TaskObj_get_must_cancel(TaskObj *task, void *Py_UNUSED(ignored))
+_asyncio_Task__must_cancel_get_impl(TaskObj *self)
+/*[clinic end generated code: output=70e79b900996c363 input=2d04529fb23feedf]*/
{
- if (task->task_must_cancel) {
+ if (self->task_must_cancel) {
Py_RETURN_TRUE;
}
else {
@@ -2187,21 +2323,36 @@ TaskObj_get_must_cancel(TaskObj *task, void *Py_UNUSED(ignored))
}
}
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Task._coro
+[clinic start generated code]*/
+
static PyObject *
-TaskObj_get_coro(TaskObj *task, void *Py_UNUSED(ignored))
+_asyncio_Task__coro_get_impl(TaskObj *self)
+/*[clinic end generated code: output=a2726012ab5fd531 input=323c31a272020624]*/
{
- if (task->task_coro) {
- return Py_NewRef(task->task_coro);
+ if (self->task_coro) {
+ return Py_NewRef(self->task_coro);
}
Py_RETURN_NONE;
}
+
+/*[clinic input]
+@critical_section
+@getter
+_asyncio.Task._fut_waiter
+[clinic start generated code]*/
+
static PyObject *
-TaskObj_get_fut_waiter(TaskObj *task, void *Py_UNUSED(ignored))
+_asyncio_Task__fut_waiter_get_impl(TaskObj *self)
+/*[clinic end generated code: output=c4f966b847fefcdf input=4d1005d725e72db7]*/
{
- if (task->task_fut_waiter) {
- return Py_NewRef(task->task_fut_waiter);
+ if (self->task_fut_waiter) {
+ return Py_NewRef(self->task_fut_waiter);
}
Py_RETURN_NONE;
@@ -2217,6 +2368,7 @@ TaskObj_repr(TaskObj *task)
/*[clinic input]
+@critical_section
_asyncio.Task._make_cancelled_error
Create the CancelledError to raise if the Task is cancelled.
@@ -2227,7 +2379,7 @@ it erases the context exception value.
static PyObject *
_asyncio_Task__make_cancelled_error_impl(TaskObj *self)
-/*[clinic end generated code: output=55a819e8b4276fab input=52c0e32de8e2f840]*/
+/*[clinic end generated code: output=55a819e8b4276fab input=2d3213be0cb02390]*/
{
FutureObj *fut = (FutureObj*)self;
return _asyncio_Future__make_cancelled_error_impl(fut);
@@ -2235,6 +2387,7 @@ _asyncio_Task__make_cancelled_error_impl(TaskObj *self)
/*[clinic input]
+@critical_section
_asyncio.Task.cancel
msg: object = None
@@ -2263,7 +2416,7 @@ This also increases the task's count of cancellation requests.
static PyObject *
_asyncio_Task_cancel_impl(TaskObj *self, PyObject *msg)
-/*[clinic end generated code: output=c66b60d41c74f9f1 input=7bb51bf25974c783]*/
+/*[clinic end generated code: output=c66b60d41c74f9f1 input=6125d45b9a6a5abd]*/
{
self->task_log_tb = 0;
@@ -2308,6 +2461,7 @@ _asyncio_Task_cancel_impl(TaskObj *self, PyObject *msg)
}
/*[clinic input]
+@critical_section
_asyncio.Task.cancelling
Return the count of the task's cancellation requests.
@@ -2318,13 +2472,14 @@ and may be decremented using .uncancel().
static PyObject *
_asyncio_Task_cancelling_impl(TaskObj *self)
-/*[clinic end generated code: output=803b3af96f917d7e input=b625224d310cbb17]*/
+/*[clinic end generated code: output=803b3af96f917d7e input=5ef89b1b38f080ee]*/
/*[clinic end generated code]*/
{
return PyLong_FromLong(self->task_num_cancels_requested);
}
/*[clinic input]
+@critical_section
_asyncio.Task.uncancel
Decrement the task's count of cancellation requests.
@@ -2337,7 +2492,7 @@ Returns the remaining number of cancellation requests.
static PyObject *
_asyncio_Task_uncancel_impl(TaskObj *self)
-/*[clinic end generated code: output=58184d236a817d3c input=68f81a4b90b46be2]*/
+/*[clinic end generated code: output=58184d236a817d3c input=cb3220b0e5afd61d]*/
/*[clinic end generated code]*/
{
if (self->task_num_cancels_requested > 0) {
@@ -2451,12 +2606,13 @@ _asyncio_Task_set_exception(TaskObj *self, PyObject *exception)
}
/*[clinic input]
+@critical_section
_asyncio.Task.get_coro
[clinic start generated code]*/
static PyObject *
_asyncio_Task_get_coro_impl(TaskObj *self)
-/*[clinic end generated code: output=bcac27c8cc6c8073 input=d2e8606c42a7b403]*/
+/*[clinic end generated code: output=bcac27c8cc6c8073 input=a47f81427e39fe0c]*/
{
if (self->task_coro) {
return Py_NewRef(self->task_coro);
@@ -2477,12 +2633,13 @@ _asyncio_Task_get_context_impl(TaskObj *self)
}
/*[clinic input]
+@critical_section
_asyncio.Task.get_name
[clinic start generated code]*/
static PyObject *
_asyncio_Task_get_name_impl(TaskObj *self)
-/*[clinic end generated code: output=0ecf1570c3b37a8f input=a4a6595d12f4f0f8]*/
+/*[clinic end generated code: output=0ecf1570c3b37a8f input=92a8f30c85034249]*/
{
if (self->task_name) {
if (PyLong_CheckExact(self->task_name)) {
@@ -2499,6 +2656,7 @@ _asyncio_Task_get_name_impl(TaskObj *self)
}
/*[clinic input]
+@critical_section
_asyncio.Task.set_name
value: object
@@ -2506,8 +2664,8 @@ _asyncio.Task.set_name
[clinic start generated code]*/
static PyObject *
-_asyncio_Task_set_name(TaskObj *self, PyObject *value)
-/*[clinic end generated code: output=138a8d51e32057d6 input=a8359b6e65f8fd31]*/
+_asyncio_Task_set_name_impl(TaskObj *self, PyObject *value)
+/*[clinic end generated code: output=f88ff4c0d64a9a6f input=e8d400ad64bad799]*/
{
if (!PyUnicode_CheckExact(value)) {
value = PyObject_Str(value);
@@ -2618,12 +2776,10 @@ static PyMethodDef TaskType_methods[] = {
};
static PyGetSetDef TaskType_getsetlist[] = {
- FUTURE_COMMON_GETSETLIST
- {"_log_destroy_pending", (getter)TaskObj_get_log_destroy_pending,
- (setter)TaskObj_set_log_destroy_pending, NULL},
- {"_must_cancel", (getter)TaskObj_get_must_cancel, NULL, NULL},
- {"_coro", (getter)TaskObj_get_coro, NULL, NULL},
- {"_fut_waiter", (getter)TaskObj_get_fut_waiter, NULL, NULL},
+ _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF
+ _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF
+ _ASYNCIO_TASK__CORO_GETSETDEF
+ _ASYNCIO_TASK__FUT_WAITER_GETSETDEF
{NULL} /* Sentinel */
};
@@ -2738,6 +2894,8 @@ gen_status_from_result(PyObject **result)
static PyObject *
task_step_impl(asyncio_state *state, TaskObj *task, PyObject *exc)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(task);
+
int clear_exc = 0;
PyObject *result = NULL;
PyObject *coro;
@@ -2867,6 +3025,8 @@ task_step_impl(asyncio_state *state, TaskObj *task, PyObject *exc)
static PyObject *
task_step_handle_result_impl(asyncio_state *state, TaskObj *task, PyObject *result)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(task);
+
int res;
PyObject *o;
@@ -2897,8 +3057,10 @@ task_step_handle_result_impl(asyncio_state *state, TaskObj *task, PyObject *resu
if (wrapper == NULL) {
goto fail;
}
+ Py_BEGIN_CRITICAL_SECTION(result);
tmp = future_add_done_callback(state,
(FutureObj*)result, wrapper, task->task_context);
+ Py_END_CRITICAL_SECTION();
Py_DECREF(wrapper);
if (tmp == NULL) {
goto fail;
@@ -3140,7 +3302,10 @@ task_eager_start(asyncio_state *state, TaskObj *task)
int retval = 0;
- PyObject *stepres = task_step_impl(state, task, NULL);
+ PyObject *stepres;
+ Py_BEGIN_CRITICAL_SECTION(task);
+ stepres = task_step_impl(state, task, NULL);
+ Py_END_CRITICAL_SECTION();
if (stepres == NULL) {
PyObject *exc = PyErr_GetRaisedException();
_PyErr_ChainExceptions1(exc);
@@ -3177,16 +3342,20 @@ task_eager_start(asyncio_state *state, TaskObj *task)
}
static PyObject *
-task_wakeup(TaskObj *task, PyObject *o)
+task_wakeup_lock_held(TaskObj *task, PyObject *o)
{
+ _Py_CRITICAL_SECTION_ASSERT_OBJECT_LOCKED(task);
+
PyObject *result;
assert(o);
asyncio_state *state = get_asyncio_state_by_def((PyObject *)task);
if (Future_CheckExact(state, o) || Task_CheckExact(state, o)) {
PyObject *fut_result = NULL;
- int res = future_get_result(state, (FutureObj*)o, &fut_result);
-
+ int res;
+ Py_BEGIN_CRITICAL_SECTION(o);
+ res = future_get_result(state, (FutureObj*)o, &fut_result);
+ Py_END_CRITICAL_SECTION();
switch(res) {
case -1:
assert(fut_result == NULL);
@@ -3220,6 +3389,16 @@ task_wakeup(TaskObj *task, PyObject *o)
return result;
}
+static PyObject *
+task_wakeup(TaskObj *task, PyObject *o)
+{
+ PyObject *res;
+ Py_BEGIN_CRITICAL_SECTION(task);
+ res = task_wakeup_lock_held(task, o);
+ Py_END_CRITICAL_SECTION();
+ return res;
+}
+
/*********************** Functions **************************/
@@ -3564,62 +3743,41 @@ static PyObject *
_asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
/*[clinic end generated code: output=0e107cbb7f72aa7b input=43a1b423c2d95bfa]*/
{
-
asyncio_state *state = get_asyncio_state(module);
- PyObject *tasks = PySet_New(NULL);
- if (tasks == NULL) {
- return NULL;
- }
if (loop == Py_None) {
loop = _asyncio_get_running_loop_impl(module);
if (loop == NULL) {
- Py_DECREF(tasks);
return NULL;
}
} else {
Py_INCREF(loop);
}
- // First add eager tasks to the set so that we don't miss
+ // First add eager tasks to the list so that we don't miss
// any tasks which graduates from eager to non-eager
- PyObject *eager_iter = PyObject_GetIter(state->eager_tasks);
- if (eager_iter == NULL) {
- Py_DECREF(tasks);
+ // We first add all the tasks to `tasks` list and then filter
+ // out the tasks which are done and return it as a set.
+ PyObject *tasks = PyList_New(0);
+ if (tasks == NULL) {
Py_DECREF(loop);
return NULL;
}
- PyObject *item;
- while ((item = PyIter_Next(eager_iter)) != NULL) {
- if (add_one_task(state, tasks, item, loop) < 0) {
- Py_DECREF(tasks);
- Py_DECREF(loop);
- Py_DECREF(item);
- Py_DECREF(eager_iter);
- return NULL;
- }
- Py_DECREF(item);
- }
- Py_DECREF(eager_iter);
-
- if (PyErr_Occurred()) {
+ if (PyList_Extend(tasks, state->eager_tasks) < 0) {
Py_DECREF(tasks);
Py_DECREF(loop);
return NULL;
}
-
int err = 0;
ASYNCIO_STATE_LOCK(state);
struct llist_node *node;
+
llist_for_each_safe(node, &state->asyncio_tasks_head) {
TaskObj *task = llist_data(node, TaskObj, task_node);
- Py_INCREF(task);
- if (add_one_task(state, tasks, (PyObject *)task, loop) < 0) {
- Py_DECREF(task);
+ if (PyList_Append(tasks, (PyObject *)task) < 0) {
Py_DECREF(tasks);
Py_DECREF(loop);
err = 1;
break;
}
- Py_DECREF(task);
}
ASYNCIO_STATE_UNLOCK(state);
if (err) {
@@ -3631,8 +3789,9 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
Py_DECREF(loop);
return NULL;
}
+ PyObject *item;
while ((item = PyIter_Next(scheduled_iter)) != NULL) {
- if (add_one_task(state, tasks, item, loop) < 0) {
+ if (PyList_Append(tasks, item) < 0) {
Py_DECREF(tasks);
Py_DECREF(loop);
Py_DECREF(item);
@@ -3642,14 +3801,27 @@ _asyncio_all_tasks_impl(PyObject *module, PyObject *loop)
Py_DECREF(item);
}
Py_DECREF(scheduled_iter);
- Py_DECREF(loop);
-
- if (PyErr_Occurred()) {
+ // All the tasks are now in the list, now filter the tasks which are done
+ PyObject *res = PySet_New(NULL);
+ if (res == NULL) {
Py_DECREF(tasks);
+ Py_DECREF(loop);
return NULL;
}
- return tasks;
+ for (Py_ssize_t i = 0; i < PyList_GET_SIZE(tasks); i++) {
+ PyObject *task = PyList_GET_ITEM(tasks, i);
+ if (add_one_task(state, res, task, loop) < 0) {
+ Py_DECREF(res);
+ Py_DECREF(tasks);
+ Py_DECREF(loop);
+ return NULL;
+ }
+ }
+
+ Py_DECREF(tasks);
+ Py_DECREF(loop);
+ return res;
}
static int
diff --git a/Modules/clinic/_asynciomodule.c.h b/Modules/clinic/_asynciomodule.c.h
index 32045804c35004..3a37cdd9b5fa83 100644
--- a/Modules/clinic/_asynciomodule.c.h
+++ b/Modules/clinic/_asynciomodule.c.h
@@ -6,6 +6,7 @@ preserve
# include "pycore_gc.h" // PyGC_Head
# include "pycore_runtime.h" // _Py_ID()
#endif
+#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION()
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords()
PyDoc_STRVAR(_asyncio_Future___init____doc__,
@@ -98,7 +99,13 @@ _asyncio_Future_result_impl(FutureObj *self);
static PyObject *
_asyncio_Future_result(FutureObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Future_result_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future_result_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Future_exception__doc__,
@@ -121,11 +128,18 @@ _asyncio_Future_exception_impl(FutureObj *self, PyTypeObject *cls);
static PyObject *
_asyncio_Future_exception(FutureObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
+ PyObject *return_value = NULL;
+
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "exception() takes no arguments");
- return NULL;
+ goto exit;
}
- return _asyncio_Future_exception_impl(self, cls);
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future_exception_impl(self, cls);
+ Py_END_CRITICAL_SECTION();
+
+exit:
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Future_set_result__doc__,
@@ -170,7 +184,9 @@ _asyncio_Future_set_result(FutureObj *self, PyTypeObject *cls, PyObject *const *
goto exit;
}
result = args[0];
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Future_set_result_impl(self, cls, result);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -218,7 +234,9 @@ _asyncio_Future_set_exception(FutureObj *self, PyTypeObject *cls, PyObject *cons
goto exit;
}
exception = args[0];
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Future_set_exception_impl(self, cls, exception);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -286,7 +304,9 @@ _asyncio_Future_add_done_callback(FutureObj *self, PyTypeObject *cls, PyObject *
}
context = args[1];
skip_optional_kwonly:
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Future_add_done_callback_impl(self, cls, fn, context);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -333,7 +353,9 @@ _asyncio_Future_remove_done_callback(FutureObj *self, PyTypeObject *cls, PyObjec
goto exit;
}
fn = args[0];
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Future_remove_done_callback_impl(self, cls, fn);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -399,7 +421,9 @@ _asyncio_Future_cancel(FutureObj *self, PyTypeObject *cls, PyObject *const *args
}
msg = args[0];
skip_optional_pos:
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Future_cancel_impl(self, cls, msg);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -420,7 +444,13 @@ _asyncio_Future_cancelled_impl(FutureObj *self);
static PyObject *
_asyncio_Future_cancelled(FutureObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Future_cancelled_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future_cancelled_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Future_done__doc__,
@@ -441,7 +471,13 @@ _asyncio_Future_done_impl(FutureObj *self);
static PyObject *
_asyncio_Future_done(FutureObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Future_done_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future_done_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Future_get_loop__doc__,
@@ -459,11 +495,319 @@ _asyncio_Future_get_loop_impl(FutureObj *self, PyTypeObject *cls);
static PyObject *
_asyncio_Future_get_loop(FutureObj *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
{
+ PyObject *return_value = NULL;
+
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) {
PyErr_SetString(PyExc_TypeError, "get_loop() takes no arguments");
- return NULL;
+ goto exit;
}
- return _asyncio_Future_get_loop_impl(self, cls);
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future_get_loop_impl(self, cls);
+ Py_END_CRITICAL_SECTION();
+
+exit:
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__asyncio_future_blocking_DOCSTR)
+# define _asyncio_Future__asyncio_future_blocking_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF)
+# undef _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF
+# define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, (setter)_asyncio_Future__asyncio_future_blocking_set, _asyncio_Future__asyncio_future_blocking_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, NULL, _asyncio_Future__asyncio_future_blocking_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__asyncio_future_blocking_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__asyncio_future_blocking_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__asyncio_future_blocking_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__asyncio_future_blocking_DOCSTR)
+# define _asyncio_Future__asyncio_future_blocking_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF)
+# undef _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF
+# define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", (getter)_asyncio_Future__asyncio_future_blocking_get, (setter)_asyncio_Future__asyncio_future_blocking_set, _asyncio_Future__asyncio_future_blocking_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__ASYNCIO_FUTURE_BLOCKING_GETSETDEF {"_asyncio_future_blocking", NULL, (setter)_asyncio_Future__asyncio_future_blocking_set, NULL},
+#endif
+
+static int
+_asyncio_Future__asyncio_future_blocking_set_impl(FutureObj *self,
+ PyObject *value);
+
+static int
+_asyncio_Future__asyncio_future_blocking_set(FutureObj *self, PyObject *value, void *Py_UNUSED(context))
+{
+ int return_value;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__asyncio_future_blocking_set_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__log_traceback_DOCSTR)
+# define _asyncio_Future__log_traceback_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF)
+# undef _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF
+# define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, (setter)_asyncio_Future__log_traceback_set, _asyncio_Future__log_traceback_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, NULL, _asyncio_Future__log_traceback_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__log_traceback_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__log_traceback_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__log_traceback_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__log_traceback_DOCSTR)
+# define _asyncio_Future__log_traceback_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF)
+# undef _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF
+# define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", (getter)_asyncio_Future__log_traceback_get, (setter)_asyncio_Future__log_traceback_set, _asyncio_Future__log_traceback_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__LOG_TRACEBACK_GETSETDEF {"_log_traceback", NULL, (setter)_asyncio_Future__log_traceback_set, NULL},
+#endif
+
+static int
+_asyncio_Future__log_traceback_set_impl(FutureObj *self, PyObject *value);
+
+static int
+_asyncio_Future__log_traceback_set(FutureObj *self, PyObject *value, void *Py_UNUSED(context))
+{
+ int return_value;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__log_traceback_set_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__loop_DOCSTR)
+# define _asyncio_Future__loop_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__LOOP_GETSETDEF)
+# undef _ASYNCIO_FUTURE__LOOP_GETSETDEF
+# define _ASYNCIO_FUTURE__LOOP_GETSETDEF {"_loop", (getter)_asyncio_Future__loop_get, (setter)_asyncio_Future__loop_set, _asyncio_Future__loop_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__LOOP_GETSETDEF {"_loop", (getter)_asyncio_Future__loop_get, NULL, _asyncio_Future__loop_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__loop_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__loop_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__loop_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__callbacks_DOCSTR)
+# define _asyncio_Future__callbacks_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__CALLBACKS_GETSETDEF)
+# undef _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF
+# define _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF {"_callbacks", (getter)_asyncio_Future__callbacks_get, (setter)_asyncio_Future__callbacks_set, _asyncio_Future__callbacks_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__CALLBACKS_GETSETDEF {"_callbacks", (getter)_asyncio_Future__callbacks_get, NULL, _asyncio_Future__callbacks_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__callbacks_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__callbacks_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__callbacks_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__result_DOCSTR)
+# define _asyncio_Future__result_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__RESULT_GETSETDEF)
+# undef _ASYNCIO_FUTURE__RESULT_GETSETDEF
+# define _ASYNCIO_FUTURE__RESULT_GETSETDEF {"_result", (getter)_asyncio_Future__result_get, (setter)_asyncio_Future__result_set, _asyncio_Future__result_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__RESULT_GETSETDEF {"_result", (getter)_asyncio_Future__result_get, NULL, _asyncio_Future__result_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__result_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__result_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__result_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__exception_DOCSTR)
+# define _asyncio_Future__exception_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__EXCEPTION_GETSETDEF)
+# undef _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF
+# define _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF {"_exception", (getter)_asyncio_Future__exception_get, (setter)_asyncio_Future__exception_set, _asyncio_Future__exception_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__EXCEPTION_GETSETDEF {"_exception", (getter)_asyncio_Future__exception_get, NULL, _asyncio_Future__exception_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__exception_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__exception_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__exception_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__source_traceback_DOCSTR)
+# define _asyncio_Future__source_traceback_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF)
+# undef _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF
+# define _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF {"_source_traceback", (getter)_asyncio_Future__source_traceback_get, (setter)_asyncio_Future__source_traceback_set, _asyncio_Future__source_traceback_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__SOURCE_TRACEBACK_GETSETDEF {"_source_traceback", (getter)_asyncio_Future__source_traceback_get, NULL, _asyncio_Future__source_traceback_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__source_traceback_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__source_traceback_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__source_traceback_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__cancel_message_DOCSTR)
+# define _asyncio_Future__cancel_message_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF)
+# undef _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF
+# define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, (setter)_asyncio_Future__cancel_message_set, _asyncio_Future__cancel_message_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, NULL, _asyncio_Future__cancel_message_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__cancel_message_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__cancel_message_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__cancel_message_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__cancel_message_DOCSTR)
+# define _asyncio_Future__cancel_message_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF)
+# undef _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF
+# define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", (getter)_asyncio_Future__cancel_message_get, (setter)_asyncio_Future__cancel_message_set, _asyncio_Future__cancel_message_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__CANCEL_MESSAGE_GETSETDEF {"_cancel_message", NULL, (setter)_asyncio_Future__cancel_message_set, NULL},
+#endif
+
+static int
+_asyncio_Future__cancel_message_set_impl(FutureObj *self, PyObject *value);
+
+static int
+_asyncio_Future__cancel_message_set(FutureObj *self, PyObject *value, void *Py_UNUSED(context))
+{
+ int return_value;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__cancel_message_set_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Future__state_DOCSTR)
+# define _asyncio_Future__state_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_FUTURE__STATE_GETSETDEF)
+# undef _ASYNCIO_FUTURE__STATE_GETSETDEF
+# define _ASYNCIO_FUTURE__STATE_GETSETDEF {"_state", (getter)_asyncio_Future__state_get, (setter)_asyncio_Future__state_set, _asyncio_Future__state_DOCSTR},
+#else
+# define _ASYNCIO_FUTURE__STATE_GETSETDEF {"_state", (getter)_asyncio_Future__state_get, NULL, _asyncio_Future__state_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Future__state_get_impl(FutureObj *self);
+
+static PyObject *
+_asyncio_Future__state_get(FutureObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__state_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Future__make_cancelled_error__doc__,
@@ -484,7 +828,13 @@ _asyncio_Future__make_cancelled_error_impl(FutureObj *self);
static PyObject *
_asyncio_Future__make_cancelled_error(FutureObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Future__make_cancelled_error_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Future__make_cancelled_error_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task___init____doc__,
@@ -575,6 +925,131 @@ _asyncio_Task___init__(PyObject *self, PyObject *args, PyObject *kwargs)
return return_value;
}
+#if !defined(_asyncio_Task__log_destroy_pending_DOCSTR)
+# define _asyncio_Task__log_destroy_pending_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF)
+# undef _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF
+# define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, (setter)_asyncio_Task__log_destroy_pending_set, _asyncio_Task__log_destroy_pending_DOCSTR},
+#else
+# define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, NULL, _asyncio_Task__log_destroy_pending_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Task__log_destroy_pending_get_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task__log_destroy_pending_get(TaskObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__log_destroy_pending_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Task__log_destroy_pending_DOCSTR)
+# define _asyncio_Task__log_destroy_pending_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF)
+# undef _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF
+# define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", (getter)_asyncio_Task__log_destroy_pending_get, (setter)_asyncio_Task__log_destroy_pending_set, _asyncio_Task__log_destroy_pending_DOCSTR},
+#else
+# define _ASYNCIO_TASK__LOG_DESTROY_PENDING_GETSETDEF {"_log_destroy_pending", NULL, (setter)_asyncio_Task__log_destroy_pending_set, NULL},
+#endif
+
+static int
+_asyncio_Task__log_destroy_pending_set_impl(TaskObj *self, PyObject *value);
+
+static int
+_asyncio_Task__log_destroy_pending_set(TaskObj *self, PyObject *value, void *Py_UNUSED(context))
+{
+ int return_value;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__log_destroy_pending_set_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Task__must_cancel_DOCSTR)
+# define _asyncio_Task__must_cancel_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_TASK__MUST_CANCEL_GETSETDEF)
+# undef _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF
+# define _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF {"_must_cancel", (getter)_asyncio_Task__must_cancel_get, (setter)_asyncio_Task__must_cancel_set, _asyncio_Task__must_cancel_DOCSTR},
+#else
+# define _ASYNCIO_TASK__MUST_CANCEL_GETSETDEF {"_must_cancel", (getter)_asyncio_Task__must_cancel_get, NULL, _asyncio_Task__must_cancel_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Task__must_cancel_get_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task__must_cancel_get(TaskObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__must_cancel_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Task__coro_DOCSTR)
+# define _asyncio_Task__coro_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_TASK__CORO_GETSETDEF)
+# undef _ASYNCIO_TASK__CORO_GETSETDEF
+# define _ASYNCIO_TASK__CORO_GETSETDEF {"_coro", (getter)_asyncio_Task__coro_get, (setter)_asyncio_Task__coro_set, _asyncio_Task__coro_DOCSTR},
+#else
+# define _ASYNCIO_TASK__CORO_GETSETDEF {"_coro", (getter)_asyncio_Task__coro_get, NULL, _asyncio_Task__coro_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Task__coro_get_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task__coro_get(TaskObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__coro_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
+#if !defined(_asyncio_Task__fut_waiter_DOCSTR)
+# define _asyncio_Task__fut_waiter_DOCSTR NULL
+#endif
+#if defined(_ASYNCIO_TASK__FUT_WAITER_GETSETDEF)
+# undef _ASYNCIO_TASK__FUT_WAITER_GETSETDEF
+# define _ASYNCIO_TASK__FUT_WAITER_GETSETDEF {"_fut_waiter", (getter)_asyncio_Task__fut_waiter_get, (setter)_asyncio_Task__fut_waiter_set, _asyncio_Task__fut_waiter_DOCSTR},
+#else
+# define _ASYNCIO_TASK__FUT_WAITER_GETSETDEF {"_fut_waiter", (getter)_asyncio_Task__fut_waiter_get, NULL, _asyncio_Task__fut_waiter_DOCSTR},
+#endif
+
+static PyObject *
+_asyncio_Task__fut_waiter_get_impl(TaskObj *self);
+
+static PyObject *
+_asyncio_Task__fut_waiter_get(TaskObj *self, void *Py_UNUSED(context))
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__fut_waiter_get_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
PyDoc_STRVAR(_asyncio_Task__make_cancelled_error__doc__,
"_make_cancelled_error($self, /)\n"
"--\n"
@@ -593,7 +1068,13 @@ _asyncio_Task__make_cancelled_error_impl(TaskObj *self);
static PyObject *
_asyncio_Task__make_cancelled_error(TaskObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Task__make_cancelled_error_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task__make_cancelled_error_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task_cancel__doc__,
@@ -670,7 +1151,9 @@ _asyncio_Task_cancel(TaskObj *self, PyObject *const *args, Py_ssize_t nargs, PyO
}
msg = args[0];
skip_optional_pos:
+ Py_BEGIN_CRITICAL_SECTION(self);
return_value = _asyncio_Task_cancel_impl(self, msg);
+ Py_END_CRITICAL_SECTION();
exit:
return return_value;
@@ -694,7 +1177,13 @@ _asyncio_Task_cancelling_impl(TaskObj *self);
static PyObject *
_asyncio_Task_cancelling(TaskObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Task_cancelling_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task_cancelling_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task_uncancel__doc__,
@@ -717,7 +1206,13 @@ _asyncio_Task_uncancel_impl(TaskObj *self);
static PyObject *
_asyncio_Task_uncancel(TaskObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Task_uncancel_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task_uncancel_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task_get_stack__doc__,
@@ -905,7 +1400,13 @@ _asyncio_Task_get_coro_impl(TaskObj *self);
static PyObject *
_asyncio_Task_get_coro(TaskObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Task_get_coro_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task_get_coro_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task_get_context__doc__,
@@ -939,7 +1440,13 @@ _asyncio_Task_get_name_impl(TaskObj *self);
static PyObject *
_asyncio_Task_get_name(TaskObj *self, PyObject *Py_UNUSED(ignored))
{
- return _asyncio_Task_get_name_impl(self);
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task_get_name_impl(self);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
}
PyDoc_STRVAR(_asyncio_Task_set_name__doc__,
@@ -950,6 +1457,21 @@ PyDoc_STRVAR(_asyncio_Task_set_name__doc__,
#define _ASYNCIO_TASK_SET_NAME_METHODDEF \
{"set_name", (PyCFunction)_asyncio_Task_set_name, METH_O, _asyncio_Task_set_name__doc__},
+static PyObject *
+_asyncio_Task_set_name_impl(TaskObj *self, PyObject *value);
+
+static PyObject *
+_asyncio_Task_set_name(TaskObj *self, PyObject *value)
+{
+ PyObject *return_value = NULL;
+
+ Py_BEGIN_CRITICAL_SECTION(self);
+ return_value = _asyncio_Task_set_name_impl(self, value);
+ Py_END_CRITICAL_SECTION();
+
+ return return_value;
+}
+
PyDoc_STRVAR(_asyncio__get_running_loop__doc__,
"_get_running_loop($module, /)\n"
"--\n"
@@ -1566,4 +2088,4 @@ _asyncio_all_tasks(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
exit:
return return_value;
}
-/*[clinic end generated code: output=e5d95a0ec229ffcd input=a9049054013a1b77]*/
+/*[clinic end generated code: output=408e156476ced07f input=a9049054013a1b77]*/
1
0
[3.13] gh-128354: Consistently use LIBS over LDFLAGS in library build… (#128465)
by erlend-aasland 03 Jan '25
by erlend-aasland 03 Jan '25
03 Jan '25
https://github.com/python/cpython/commit/855af3bbc62e89aeeb6af1e22061cf0635…
commit: 855af3bbc62e89aeeb6af1e22061cf06354ad99a
branch: 3.13
author: Zanie Blue <contact(a)zanie.dev>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T00:50:13Z
summary:
[3.13] gh-128354: Consistently use LIBS over LDFLAGS in library build… (#128465)
(cherry picked from commit b75ed951d4de8ba85349d80c8e7f097b3cd6052f)
files:
M configure
M configure.ac
diff --git a/configure b/configure
index b093689aeb1e4b..c66333c721d841 100755
--- a/configure
+++ b/configure
@@ -13467,7 +13467,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -13593,7 +13593,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -14363,7 +14363,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -14436,7 +14436,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -14547,8 +14547,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
@@ -14787,8 +14787,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
- LIBS="$LIBMPDEC_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBMPDEC_CFLAGS"
+ LIBS="$LIBS $LIBMPDEC_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15055,7 +15055,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
ac_fn_c_check_header_compile "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
if test "x$ac_cv_header_sqlite3_h" = xyes
@@ -15935,7 +15935,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16001,7 +16001,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
for ac_header in gdbm.h
do :
ac_fn_c_check_header_compile "$LINENO" "gdbm.h" "ac_cv_header_gdbm_h" "$ac_includes_default"
@@ -20278,7 +20278,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -20407,7 +20407,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -20626,7 +20626,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -20708,7 +20708,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -20854,7 +20854,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -20936,7 +20936,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -24862,7 +24862,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -24941,7 +24941,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -25093,7 +25093,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -25174,7 +25174,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -25282,7 +25282,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
diff --git a/configure.ac b/configure.ac
index ea557fba25df96..c53e55fbba2a5f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3744,7 +3744,7 @@ AS_VAR_IF([have_uuid], [missing], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
AC_CHECK_HEADERS([uuid/uuid.h], [
PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
@@ -3978,7 +3978,7 @@ AS_VAR_IF([have_libffi], [missing], [
PKG_CHECK_MODULES([LIBFFI], [libffi], [have_libffi=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
AC_CHECK_HEADER([ffi.h], [
AC_CHECK_LIB([ffi], [ffi_call], [
have_libffi=yes
@@ -4012,8 +4012,8 @@ AS_VAR_IF([have_libffi], [yes], [
AS_VAR_IF([ac_cv_lib_dl_dlopen], [yes], [AS_VAR_APPEND([LIBFFI_LIBS], [" -ldl"])])
WITH_SAVE_ENV([
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
PY_CHECK_FUNC([ffi_prep_cif_var], [@%:@include <ffi.h>])
PY_CHECK_FUNC([ffi_prep_closure_loc], [@%:@include <ffi.h>])
@@ -4051,8 +4051,8 @@ AS_VAR_IF(
AS_VAR_IF([with_system_libmpdec], [yes],
[WITH_SAVE_ENV([
- CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
- LIBS="$LIBMPDEC_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBMPDEC_CFLAGS"
+ LIBS="$LIBS $LIBMPDEC_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
@@ -4185,7 +4185,7 @@ WITH_SAVE_ENV([
dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
dnl hence CPPFLAGS instead of CFLAGS.
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
AC_CHECK_HEADER([sqlite3.h], [
have_sqlite3=yes
@@ -4288,7 +4288,7 @@ AS_CASE([$ac_sys_system],
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
@@ -4330,7 +4330,7 @@ AC_ARG_VAR([GDBM_CFLAGS], [C compiler flags for gdbm])
AC_ARG_VAR([GDBM_LIBS], [additional linker flags for gdbm])
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
AC_CHECK_HEADERS([gdbm.h], [
AC_CHECK_LIB([gdbm], [gdbm_open], [
have_gdbm=yes
@@ -5288,7 +5288,7 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
AC_CHECK_HEADERS([zlib.h], [
PY_CHECK_LIB([z], [gzread], [have_zlib=yes], [have_zlib=no])
], [have_zlib=no])
@@ -5312,7 +5312,7 @@ PY_CHECK_EMSCRIPTEN_PORT([BZIP2], [-sUSE_BZIP2])
PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
AC_CHECK_HEADERS([bzlib.h], [
AC_CHECK_LIB([bz2], [BZ2_bzCompress], [have_bzip2=yes], [have_bzip2=no])
], [have_bzip2=no])
@@ -5326,7 +5326,7 @@ PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
AC_CHECK_HEADERS([lzma.h], [
AC_CHECK_LIB([lzma], [lzma_easy_encoder], [have_liblzma=yes], [have_liblzma=no])
], [have_liblzma=no])
@@ -6318,7 +6318,7 @@ AS_VAR_IF([with_readline], [readline], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
AC_CHECK_HEADERS([readline/readline.h], [
AC_CHECK_LIB([readline], [readline], [
LIBREADLINE=readline
@@ -6339,7 +6339,7 @@ AS_VAR_IF([with_readline], [edit], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
AC_CHECK_HEADERS([editline/readline.h], [
AC_CHECK_LIB([edit], [readline], [
LIBREADLINE=edit
@@ -6363,7 +6363,7 @@ AS_VAR_IF([with_readline], [no], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
m4_define([readline_includes], [
1
0
[3.12] gh-128354: Consistently use LIBS over LDFLAGS in library build… (#128466)
by erlend-aasland 03 Jan '25
by erlend-aasland 03 Jan '25
03 Jan '25
https://github.com/python/cpython/commit/f2cc565b99b4371db7d6a9a4773baa1174…
commit: f2cc565b99b4371db7d6a9a4773baa1174fb3e69
branch: 3.12
author: Zanie Blue <contact(a)zanie.dev>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T00:47:08Z
summary:
[3.12] gh-128354: Consistently use LIBS over LDFLAGS in library build… (#128466)
(cherry picked from commit b75ed951d4de8ba85349d80c8e7f097b3cd6052f)
files:
M configure
M configure.ac
diff --git a/configure b/configure
index d6c6cde4165fb7..be04b13700b4ea 100755
--- a/configure
+++ b/configure
@@ -13296,7 +13296,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -13422,7 +13422,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -14185,7 +14185,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -14258,7 +14258,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -14365,8 +14365,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
@@ -15019,7 +15019,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
ac_fn_c_check_header_compile "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
if test "x$ac_cv_header_sqlite3_h" = xyes
@@ -15899,7 +15899,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15965,7 +15965,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
for ac_header in gdbm.h
do :
ac_fn_c_check_header_compile "$LINENO" "gdbm.h" "ac_cv_header_gdbm_h" "$ac_includes_default"
@@ -19812,7 +19812,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -19941,7 +19941,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -20160,7 +20160,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -20242,7 +20242,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -20388,7 +20388,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -20470,7 +20470,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -24670,7 +24670,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -24749,7 +24749,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -24901,7 +24901,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -24982,7 +24982,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -25090,7 +25090,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
diff --git a/configure.ac b/configure.ac
index 4dfce49e1585cb..6c5649bffda6db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3630,7 +3630,7 @@ AS_VAR_IF([have_uuid], [missing], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
AC_CHECK_HEADERS([uuid/uuid.h], [
PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
@@ -3857,7 +3857,7 @@ AS_VAR_IF([have_libffi], [missing], [
PKG_CHECK_MODULES([LIBFFI], [libffi], [have_libffi=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
AC_CHECK_HEADER([ffi.h], [
AC_CHECK_LIB([ffi], [ffi_call], [
have_libffi=yes
@@ -3888,8 +3888,8 @@ AS_VAR_IF([have_libffi], [yes], [
AS_VAR_IF([ac_cv_lib_dl_dlopen], [yes], [AS_VAR_APPEND([LIBFFI_LIBS], [" -ldl"])])
WITH_SAVE_ENV([
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
PY_CHECK_FUNC([ffi_prep_cif_var], [@%:@include <ffi.h>])
PY_CHECK_FUNC([ffi_prep_closure_loc], [@%:@include <ffi.h>])
@@ -4056,7 +4056,7 @@ WITH_SAVE_ENV([
dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
dnl hence CPPFLAGS instead of CFLAGS.
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
AC_CHECK_HEADER([sqlite3.h], [
have_sqlite3=yes
@@ -4159,7 +4159,7 @@ AS_CASE([$ac_sys_system],
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
@@ -4201,7 +4201,7 @@ AC_ARG_VAR([GDBM_CFLAGS], [C compiler flags for gdbm])
AC_ARG_VAR([GDBM_LIBS], [additional linker flags for gdbm])
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
AC_CHECK_HEADERS([gdbm.h], [
AC_CHECK_LIB([gdbm], [gdbm_open], [
have_gdbm=yes
@@ -5080,7 +5080,7 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
AC_CHECK_HEADERS([zlib.h], [
PY_CHECK_LIB([z], [gzread], [have_zlib=yes], [have_zlib=no])
], [have_zlib=no])
@@ -5104,7 +5104,7 @@ PY_CHECK_EMSCRIPTEN_PORT([BZIP2], [-sUSE_BZIP2])
PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
AC_CHECK_HEADERS([bzlib.h], [
AC_CHECK_LIB([bz2], [BZ2_bzCompress], [have_bzip2=yes], [have_bzip2=no])
], [have_bzip2=no])
@@ -5118,7 +5118,7 @@ PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
AC_CHECK_HEADERS([lzma.h], [
AC_CHECK_LIB([lzma], [lzma_easy_encoder], [have_liblzma=yes], [have_liblzma=no])
], [have_liblzma=no])
@@ -6127,7 +6127,7 @@ AS_VAR_IF([with_readline], [readline], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
AC_CHECK_HEADERS([readline/readline.h], [
AC_CHECK_LIB([readline], [readline], [
LIBREADLINE=readline
@@ -6148,7 +6148,7 @@ AS_VAR_IF([with_readline], [edit], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
AC_CHECK_HEADERS([editline/readline.h], [
AC_CHECK_LIB([edit], [readline], [
LIBREADLINE=edit
@@ -6172,7 +6172,7 @@ AS_VAR_IF([with_readline], [no], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
m4_define([readline_includes], [
1
0
[3.13] gh-128456: Use '-reorder-functions=cdsort' for BOLT builds (GH-128457) (#128461)
by erlend-aasland 03 Jan '25
by erlend-aasland 03 Jan '25
03 Jan '25
https://github.com/python/cpython/commit/b923f4879e5ed7e546e2d549f308969dde…
commit: b923f4879e5ed7e546e2d549f308969dde301eee
branch: 3.13
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T00:49:21+01:00
summary:
[3.13] gh-128456: Use '-reorder-functions=cdsort' for BOLT builds (GH-128457) (#128461)
'hfsort+' is deprecated in favor of 'cdsort'.
(cherry picked from commit 4974bbdb290b61a2d8860de490fde1228c296753)
Co-authored-by: Zanie Blue <contact(a)zanie.dev>
files:
M configure
M configure.ac
diff --git a/configure b/configure
index 8401e07ba86c10..b093689aeb1e4b 100755
--- a/configure
+++ b/configure
@@ -9340,7 +9340,7 @@ printf "%s\n" "$BOLT_INSTRUMENT_FLAGS" >&6; }
printf %s "checking BOLT_APPLY_FLAGS... " >&6; }
if test -z "${BOLT_APPLY_FLAGS}"
then
- BOLT_APPLY_FLAGS=" -update-debug-sections -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot "
+ BOLT_APPLY_FLAGS=" -update-debug-sections -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot "
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BOLT_APPLY_FLAGS" >&5
diff --git a/configure.ac b/configure.ac
index 4a341b2735c1ed..ea557fba25df96 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2237,7 +2237,7 @@ then
[m4_normalize("
-update-debug-sections
-reorder-blocks=ext-tsp
- -reorder-functions=hfsort+
+ -reorder-functions=cdsort
-split-functions
-icf=1
-inline-all
1
0
[3.12] gh-128456: Use '-reorder-functions=cdsort' for BOLT builds (GH-128457) (#128462)
by erlend-aasland 03 Jan '25
by erlend-aasland 03 Jan '25
03 Jan '25
https://github.com/python/cpython/commit/d56e50229e3499c8405dd9c7b1b26009e1…
commit: d56e50229e3499c8405dd9c7b1b26009e19ba4c2
branch: 3.12
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-04T00:49:05+01:00
summary:
[3.12] gh-128456: Use '-reorder-functions=cdsort' for BOLT builds (GH-128457) (#128462)
'hfsort+' is deprecated in favor of 'cdsort'.
(cherry picked from commit 4974bbdb290b61a2d8860de490fde1228c296753)
Co-authored-by: Zanie Blue <contact(a)zanie.dev>
files:
M configure
M configure.ac
diff --git a/configure b/configure
index c14d27ede2b173..d6c6cde4165fb7 100755
--- a/configure
+++ b/configure
@@ -9170,7 +9170,7 @@ printf "%s\n" "$BOLT_INSTRUMENT_FLAGS" >&6; }
printf %s "checking BOLT_APPLY_FLAGS... " >&6; }
if test -z "${BOLT_APPLY_FLAGS}"
then
- BOLT_APPLY_FLAGS=" -update-debug-sections -reorder-blocks=ext-tsp -reorder-functions=hfsort+ -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot "
+ BOLT_APPLY_FLAGS=" -update-debug-sections -reorder-blocks=ext-tsp -reorder-functions=cdsort -split-functions -icf=1 -inline-all -split-eh -reorder-functions-use-hot-size -peepholes=none -jump-tables=aggressive -inline-ap -indirect-call-promotion=all -dyno-stats -use-gnu-stack -frame-opt=hot "
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $BOLT_APPLY_FLAGS" >&5
diff --git a/configure.ac b/configure.ac
index bc8c357e99667e..4dfce49e1585cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2127,7 +2127,7 @@ then
[m4_normalize("
-update-debug-sections
-reorder-blocks=ext-tsp
- -reorder-functions=hfsort+
+ -reorder-functions=cdsort
-split-functions
-icf=1
-inline-all
1
0
https://github.com/python/cpython/commit/f1574859d7d6cd259f867194762f04b72e…
commit: f1574859d7d6cd259f867194762f04b72ef2c340
branch: main
author: Sam Gross <colesbury(a)gmail.com>
committer: colesbury <colesbury(a)gmail.com>
date: 2025-01-03T21:48:47Z
summary:
gh-125985: Fix `cmodule_function()` scaling benchmark (#128460)
Add a separate benchmark that measures the effect of
`_PyObject_LookupSpecial()` on scaling.
In the process of cleaning up the scaling benchmarks for inclusion, I
unintentionally changed the "cmodule_function" benchmark to pass an
`int` to `math.floor()` instead of a `float`, which causes it to use the
`_PyObject_LookupSpecial()` code path. `_PyObject_LookupSpecial()` has
its own scaling issues that we want to measure separately from calling a
function on a C module.
files:
M Tools/ftscalingbench/ftscalingbench.py
diff --git a/Tools/ftscalingbench/ftscalingbench.py b/Tools/ftscalingbench/ftscalingbench.py
index 767aeae9349070..364c465bc91b0b 100644
--- a/Tools/ftscalingbench/ftscalingbench.py
+++ b/Tools/ftscalingbench/ftscalingbench.py
@@ -54,8 +54,16 @@ def object_cfunction():
@register_benchmark
def cmodule_function():
- for i in range(1000 * WORK_SCALE):
- math.floor(i * i)
+ N = 1000 * WORK_SCALE
+ for i in range(N):
+ math.cos(i / N)
+
+@register_benchmark
+def object_lookup_special():
+ # round() uses `_PyObject_LookupSpecial()` internally.
+ N = 1000 * WORK_SCALE
+ for i in range(N):
+ round(i / N)
@register_benchmark
def mult_constant():
@@ -206,7 +214,7 @@ def benchmark(func):
color = "\x1b[33m" # yellow
reset_color = "\x1b[0m"
- print(f"{color}{func.__name__:<18} {round(factor, 1):>4}x {direction}{reset_color}")
+ print(f"{color}{func.__name__:<25} {round(factor, 1):>4}x {direction}{reset_color}")
def determine_num_threads_and_affinity():
if sys.platform != "linux":
1
0
gh-128354: Consistently use LIBS over LDFLAGS in library build checks (#128359)
by erlend-aasland 03 Jan '25
by erlend-aasland 03 Jan '25
03 Jan '25
https://github.com/python/cpython/commit/b75ed951d4de8ba85349d80c8e7f097b3c…
commit: b75ed951d4de8ba85349d80c8e7f097b3cd6052f
branch: main
author: Zanie Blue <contact(a)zanie.dev>
committer: erlend-aasland <erlend.aasland(a)protonmail.com>
date: 2025-01-03T21:51:06+01:00
summary:
gh-128354: Consistently use LIBS over LDFLAGS in library build checks (#128359)
files:
M configure
M configure.ac
diff --git a/configure b/configure
index 08fec03bef42dc..aa88c74c61156c 100755
--- a/configure
+++ b/configure
@@ -14044,7 +14044,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -14186,7 +14186,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
for ac_header in uuid/uuid.h
do :
ac_fn_c_check_header_compile "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
@@ -15084,7 +15084,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -15166,7 +15166,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
ac_fn_c_check_header_compile "$LINENO" "ffi.h" "ac_cv_header_ffi_h" "$ac_includes_default"
if test "x$ac_cv_header_ffi_h" = xyes
then :
@@ -15286,8 +15286,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
@@ -15439,9 +15439,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CPPFLAGS="$LIBFFI_CFLAGS $CPPFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
- LIBS="$LIBFFI_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
if test "$cross_compiling" = yes
then :
ac_cv_ffi_complex_double_supported=no
@@ -15614,8 +15613,8 @@ save_LDFLAGS=$LDFLAGS
save_LIBS=$LIBS
- CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
- LIBS="$LIBMPDEC_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBMPDEC_CFLAGS"
+ LIBS="$LIBS $LIBMPDEC_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -15885,7 +15884,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
ac_fn_c_check_header_compile "$LINENO" "sqlite3.h" "ac_cv_header_sqlite3_h" "$ac_includes_default"
if test "x$ac_cv_header_sqlite3_h" = xyes
@@ -16875,7 +16874,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -16942,7 +16941,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
for ac_header in gdbm.h
do :
ac_fn_c_check_header_compile "$LINENO" "gdbm.h" "ac_cv_header_gdbm_h" "$ac_includes_default"
@@ -21492,7 +21491,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -21639,7 +21638,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
for ac_header in zlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default"
@@ -21876,7 +21875,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -21968,7 +21967,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
for ac_header in bzlib.h
do :
ac_fn_c_check_header_compile "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
@@ -22124,7 +22123,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -22216,7 +22215,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
for ac_header in lzma.h
do :
ac_fn_c_check_header_compile "$LINENO" "lzma.h" "ac_cv_header_lzma_h" "$ac_includes_default"
@@ -26370,7 +26369,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -26459,7 +26458,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
for ac_header in readline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
@@ -26621,7 +26620,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -26712,7 +26711,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
for ac_header in editline/readline.h
do :
ac_fn_c_check_header_compile "$LINENO" "editline/readline.h" "ac_cv_header_editline_readline_h" "$ac_includes_default"
@@ -26830,7 +26829,7 @@ save_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
diff --git a/configure.ac b/configure.ac
index ecaf0fa9c43d49..9e131ed1a2dc98 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3701,7 +3701,7 @@ AS_VAR_IF([have_uuid], [missing], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBUUID_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBUUID_LIBS"
+ LIBS="$LIBS $LIBUUID_LIBS"
AC_CHECK_HEADERS([uuid/uuid.h], [
PY_CHECK_LIB([uuid], [uuid_generate_time], [have_uuid=yes])
PY_CHECK_LIB([uuid], [uuid_generate_time_safe],
@@ -3971,7 +3971,7 @@ AS_VAR_IF([have_libffi], [missing], [
PKG_CHECK_MODULES([LIBFFI], [libffi], [have_libffi=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBFFI_LIBS"
+ LIBS="$LIBS $LIBFFI_LIBS"
AC_CHECK_HEADER([ffi.h], [
AC_CHECK_LIB([ffi], [ffi_call], [
have_libffi=yes
@@ -4005,8 +4005,8 @@ AS_VAR_IF([have_libffi], [yes], [
AS_VAR_IF([ac_cv_lib_dl_dlopen], [yes], [AS_VAR_APPEND([LIBFFI_LIBS], [" -ldl"])])
WITH_SAVE_ENV([
- CFLAGS="$LIBFFI_CFLAGS $CFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
+ CFLAGS="$CFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
PY_CHECK_FUNC([ffi_prep_cif_var], [@%:@include <ffi.h>])
PY_CHECK_FUNC([ffi_prep_closure_loc], [@%:@include <ffi.h>])
@@ -4021,9 +4021,8 @@ AS_VAR_IF([have_libffi], [yes], [
#
AC_CACHE_CHECK([libffi has complex type support], [ac_cv_ffi_complex_double_supported],
[WITH_SAVE_ENV([
- CPPFLAGS="$LIBFFI_CFLAGS $CPPFLAGS"
- LDFLAGS="$LIBFFI_LIBS $LDFLAGS"
- LIBS="$LIBFFI_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBFFI_CFLAGS"
+ LIBS="$LIBS $LIBFFI_LIBS"
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <complex.h>
#include <ffi.h>
@@ -4086,8 +4085,8 @@ AS_VAR_IF(
AS_VAR_IF([with_system_libmpdec], [yes],
[WITH_SAVE_ENV([
- CPPFLAGS="$LIBMPDEC_CFLAGS $CPPFLAGS"
- LIBS="$LIBMPDEC_LIBS $LIBS"
+ CPPFLAGS="$CPPFLAGS $LIBMPDEC_CFLAGS"
+ LIBS="$LIBS $LIBMPDEC_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
@@ -4220,7 +4219,7 @@ WITH_SAVE_ENV([
dnl bpo-45774/GH-29507: The CPP check in AC_CHECK_HEADER can fail on FreeBSD,
dnl hence CPPFLAGS instead of CFLAGS.
CPPFLAGS="$CPPFLAGS $LIBSQLITE3_CFLAGS"
- LIBS="$LIBSQLITE3_LIBS $LIBS"
+ LIBS="$LIBS $LIBSQLITE3_LIBS"
AC_CHECK_HEADER([sqlite3.h], [
have_sqlite3=yes
@@ -4323,7 +4322,7 @@ AS_CASE([$ac_sys_system],
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $TCLTK_CFLAGS"
- LIBS="$TCLTK_LIBS $LDFLAGS"
+ LIBS="$LIBS $TCLTK_LIBS"
AC_LINK_IFELSE([
AC_LANG_PROGRAM([
@@ -4365,7 +4364,7 @@ AC_ARG_VAR([GDBM_CFLAGS], [C compiler flags for gdbm])
AC_ARG_VAR([GDBM_LIBS], [additional linker flags for gdbm])
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $GDBM_CFLAGS"
- LDFLAGS="$GDBM_LIBS $LDFLAGS"
+ LIBS="$LIBS $GDBM_LIBS"
AC_CHECK_HEADERS([gdbm.h], [
AC_CHECK_LIB([gdbm], [gdbm_open], [
have_gdbm=yes
@@ -5310,7 +5309,7 @@ PKG_CHECK_MODULES([ZLIB], [zlib >= 1.2.0], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
- LDFLAGS="$LDFLAGS $ZLIB_LIBS"
+ LIBS="$LIBS $ZLIB_LIBS"
AC_CHECK_HEADERS([zlib.h], [
PY_CHECK_LIB([z], [gzread], [have_zlib=yes], [have_zlib=no])
], [have_zlib=no])
@@ -5334,7 +5333,7 @@ PY_CHECK_EMSCRIPTEN_PORT([BZIP2], [-sUSE_BZIP2])
PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $BZIP2_CFLAGS"
- LDFLAGS="$LDFLAGS $BZIP2_LIBS"
+ LIBS="$LIBS $BZIP2_LIBS"
AC_CHECK_HEADERS([bzlib.h], [
AC_CHECK_LIB([bz2], [BZ2_bzCompress], [have_bzip2=yes], [have_bzip2=no])
], [have_bzip2=no])
@@ -5348,7 +5347,7 @@ PKG_CHECK_MODULES([BZIP2], [bzip2], [have_bzip2=yes], [
PKG_CHECK_MODULES([LIBLZMA], [liblzma], [have_liblzma=yes], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBLZMA_LIBS"
+ LIBS="$LIBS $LIBLZMA_LIBS"
AC_CHECK_HEADERS([lzma.h], [
AC_CHECK_LIB([lzma], [lzma_easy_encoder], [have_liblzma=yes], [have_liblzma=no])
], [have_liblzma=no])
@@ -6342,7 +6341,7 @@ AS_VAR_IF([with_readline], [readline], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBREADLINE_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBREADLINE_LIBS"
+ LIBS="$LIBS $LIBREADLINE_LIBS"
AC_CHECK_HEADERS([readline/readline.h], [
AC_CHECK_LIB([readline], [readline], [
LIBREADLINE=readline
@@ -6363,7 +6362,7 @@ AS_VAR_IF([with_readline], [edit], [
], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $LIBEDIT_CFLAGS"
- LDFLAGS="$LDFLAGS $LIBEDIT_LIBS"
+ LIBS="$LIBS $LIBEDIT_LIBS"
AC_CHECK_HEADERS([editline/readline.h], [
AC_CHECK_LIB([edit], [readline], [
LIBREADLINE=edit
@@ -6387,7 +6386,7 @@ AS_VAR_IF([with_readline], [no], [
WITH_SAVE_ENV([
CPPFLAGS="$CPPFLAGS $READLINE_CFLAGS"
- LIBS="$READLINE_LIBS $LIBS"
+ LIBS="$LIBS $READLINE_LIBS"
LIBS_SAVE=$LIBS
m4_define([readline_includes], [
1
0