Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Mark all extensions as free-threading safe#28819

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ianthomas23 merged 2 commits intomatplotlib:mainfromQuLogic:freethread
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions.github/workflows/cibuildwheel.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -148,8 +148,6 @@ jobs:
package-dir: dist/${{ needs.build_sdist.outputs.SDIST_NAME }}
env:
CIBW_BUILD: "cp313-* cp313t-*"
# No free-threading wheels for NumPy; musllinux skipped for main builds also.
CIBW_SKIP: "cp313t-win_amd64 *-musllinux_aarch64"
CIBW_BUILD_FRONTEND:
"pip; args: --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple"
CIBW_FREE_THREADED_SUPPORT: true
Expand Down
22 changes: 22 additions & 0 deletionsdoc/users/next_whats_new/freethreading.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
Preliminary support for free-threaded CPython 3.13
--------------------------------------------------

Matplotlib 3.10 has preliminary support for the free-threaded build of CPython 3.13. See
https://py-free-threading.github.io, `PEP 703 <https://peps.python.org/pep-0703/>`_ and
the `CPython 3.13 release notes
<https://docs.python.org/3.13/whatsnew/3.13.html#free-threaded-cpython>`_ for more detail
about free-threaded Python.

Support for free-threaded Python does not mean that Matplotlib is wholly thread safe. We
expect that use of a Figure within a single thread will work, and though input data is
usually copied, modification of data objects used for a plot from another thread may
cause inconsistencies in cases where it is not. Use of any global state (such as the
``pyplot`` module) is highly discouraged and unlikely to work consistently. Also note
that most GUI toolkits expect to run on the main thread, so interactive usage may be
limited or unsupported from other threads.

If you are interested in free-threaded Python, for example because you have a
multiprocessing-based workflow that you are interested in running with Python threads, we
encourage testing and experimentation. If you run into problems that you suspect are
because of Matplotlib, please open an issue, checking first if the bug also occurs in the
“regular” non-free-threaded CPython 3.13 build.
2 changes: 1 addition & 1 deletionsrc/_backend_agg_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -185,7 +185,7 @@ PyRendererAgg_draw_gouraud_triangles(RendererAgg *self,
self->draw_gouraud_triangles(gc, points, colors, trans);
}

PYBIND11_MODULE(_backend_agg, m)
PYBIND11_MODULE(_backend_agg, m, py::mod_gil_not_used())
{
py::class_<RendererAgg>(m, "RendererAgg", py::buffer_protocol())
.def(py::init<unsigned int, unsigned int, double>(),
Expand Down
2 changes: 1 addition & 1 deletionsrc/_c_internal_utils.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -196,7 +196,7 @@ mpl_SetProcessDpiAwareness_max(void)
#endif
}

PYBIND11_MODULE(_c_internal_utils, m)
PYBIND11_MODULE(_c_internal_utils, m, py::mod_gil_not_used())
{
m.def(
"display_is_valid", &mpl_display_is_valid,
Expand Down
3 changes: 2 additions & 1 deletionsrc/_image_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -200,7 +200,8 @@ image_resample(py::array input_array,
}


PYBIND11_MODULE(_image, m) {
PYBIND11_MODULE(_image, m, py::mod_gil_not_used())
{
py::enum_<interpolation_e>(m, "_InterpolationType")
.value("NEAREST", NEAREST)
.value("BILINEAR", BILINEAR)
Expand Down
2 changes: 1 addition & 1 deletionsrc/_path_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -368,7 +368,7 @@ Py_is_sorted_and_has_non_nan(py::object obj)
return result;
}

PYBIND11_MODULE(_path, m)
PYBIND11_MODULE(_path, m, py::mod_gil_not_used())
{
m.def("point_in_path", &Py_point_in_path,
"x"_a, "y"_a, "radius"_a, "path"_a, "trans"_a);
Expand Down
3 changes: 2 additions & 1 deletionsrc/_qhull_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -276,7 +276,8 @@ delaunay(const CoordArray& x, const CoordArray& y, int verbose)
return delaunay_impl(npoints, x.data(), y.data(), verbose == 0);
}

PYBIND11_MODULE(_qhull, m) {
PYBIND11_MODULE(_qhull, m, py::mod_gil_not_used())
{
m.doc() = "Computing Delaunay triangulations.\n";

m.def("delaunay", &delaunay, "x"_a, "y"_a, "verbose"_a,
Expand Down
2 changes: 1 addition & 1 deletionsrc/_tkagg.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -333,7 +333,7 @@ load_tkinter_funcs()
}
#endif // end not Windows

PYBIND11_MODULE(_tkagg, m)
PYBIND11_MODULE(_tkagg, m, py::mod_gil_not_used())
{
try {
load_tkinter_funcs();
Expand Down
2 changes: 1 addition & 1 deletionsrc/ft2font_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -952,7 +952,7 @@ PyFT2Font_fname(PyFT2Font *self)
}
}

PYBIND11_MODULE(ft2font, m)
PYBIND11_MODULE(ft2font, m, py::mod_gil_not_used())
{
if (FT_Init_FreeType(&_ft2Library)) { // initialize library
throw std::runtime_error("Could not initialize the freetype2 library");
Expand Down
3 changes: 2 additions & 1 deletionsrc/tri/_tri_wrapper.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,7 +2,8 @@

using namespace pybind11::literals;

PYBIND11_MODULE(_tri, m) {
PYBIND11_MODULE(_tri, m, py::mod_gil_not_used())
{
py::class_<Triangulation>(m, "Triangulation", py::is_final())
.def(py::init<const Triangulation::CoordinateArray&,
const Triangulation::CoordinateArray&,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp