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

Commit45c6c48

Browse files
gh-134885: zstd: Use Py_XSETREF (GH-134886)
1 parentb367e27 commit45c6c48

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fix possible crash in the:mod:`compression.zstd` module related to setting
2+
parameter types. Patch by Jelle Zijlstra.

‎Modules/_zstd/_zstdmodule.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,10 @@ _zstd_set_parameter_types_impl(PyObject *module, PyObject *c_parameter_type,
514514
returnNULL;
515515
}
516516

517-
Py_XDECREF(mod_state->CParameter_type);
518-
Py_INCREF(c_parameter_type);
519-
mod_state->CParameter_type= (PyTypeObject*)c_parameter_type;
520-
521-
Py_XDECREF(mod_state->DParameter_type);
522-
Py_INCREF(d_parameter_type);
523-
mod_state->DParameter_type= (PyTypeObject*)d_parameter_type;
517+
Py_XSETREF(
518+
mod_state->CParameter_type, (PyTypeObject*)Py_NewRef(c_parameter_type));
519+
Py_XSETREF(
520+
mod_state->DParameter_type, (PyTypeObject*)Py_NewRef(d_parameter_type));
524521

525522
Py_RETURN_NONE;
526523
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp