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

gh-132983: Clean-ups for_zstd#133670

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
AA-Turner merged 16 commits intopython:mainfromAA-Turner:zstd-clean
May 9, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
16 commits
Select commitHold shift + click to select a range
0c3c667
zstd: replace star import with explicit names
AA-TurnerMay 8, 2025
e02f66c
zstd: factor common parts of set_zstd_error()
AA-TurnerMay 8, 2025
686ae61
zstd: Remove ZSTD_versionString from error messages
AA-TurnerMay 8, 2025
7ea1ac1
zstd: Simplify version_info setup
AA-TurnerMay 8, 2025
9774338
zstd: Replace _compressionLevel_values with ZSTD_CLEVEL_DEFAULT
AA-TurnerMay 8, 2025
d1dea98
zstd: Remove _ZSTD_CStreamSizes, replace _ZSTD_DStreamSizes with ZSTD…
AA-TurnerMay 8, 2025
ac1e39c
zstd: Remove _ZSTD_CONFIG
AA-TurnerMay 8, 2025
1a54bf3
zstd: Replace add_parameters and ADD_INT_PREFIX_MACRO with PyModule_A…
AA-TurnerMay 8, 2025
9cb7a3d
Merge branch 'main' into zstd-clean
AA-TurnerMay 8, 2025
663e666
Revert "zstd: factor common parts of set_zstd_error()"
AA-TurnerMay 8, 2025
dd1380d
Use PyModule_Add
AA-TurnerMay 9, 2025
fcd6561
Check failure cases for int macros
AA-TurnerMay 9, 2025
06a4723
Remove ERR_SET_PLEDGED_INPUT_SIZE
AA-TurnerMay 9, 2025
ef2634d
Use PyLong_FromSize_t
AA-TurnerMay 9, 2025
ff28bf2
Use runtime version
AA-TurnerMay 9, 2025
3d3dbf7
Calculate zstd_version_info in Python
AA-TurnerMay 9, 2025
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
PrevPrevious commit
Calculate zstd_version_info in Python
  • Loading branch information
@AA-Turner
AA-Turner committedMay 9, 2025
commit3d3dbf7e0cfafa10973ace36d570d7e4eccf31f8
9 changes: 7 additions & 2 deletionsLib/compression/zstd/__init__.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -28,10 +28,15 @@

import _zstd
import enum
from _zstd import (get_frame_size, zstd_version, zstd_version_info,
ZstdCompressor, ZstdDecompressor, ZstdDict, ZstdError)
from _zstd import (ZstdCompressor, ZstdDecompressor, ZstdDict, ZstdError,
get_frame_size, zstd_version)
from compression.zstd._zstdfile import ZstdFile, open, _nbytes

# zstd_version_number is (MAJOR * 100 * 100 + MINOR * 100 + RELEASE)
zstd_version_info = (*divmod(_zstd.zstd_version_number // 100, 100),
_zstd.zstd_version_number % 100)
"""Version number of the runtime zstd library as a tuple of integers."""

COMPRESSION_LEVEL_DEFAULT = _zstd.ZSTD_CLEVEL_DEFAULT
"""The default compression level for Zstandard, currently '3'."""

Expand Down
16 changes: 6 additions & 10 deletionsModules/_zstd/_zstdmodule.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -563,19 +563,15 @@ add_vars_to_module(PyObject *m)
return -1; \
}

/*zstd_version, str */
if (PyModule_AddStringConstant(m, "zstd_version",
ZSTD_versionString()) < 0) {
/*zstd_version_number, int */
if (PyModule_AddIntConstant(m, "zstd_version_number",
ZSTD_versionNumber()) < 0) {
return -1;
}

/* zstd_version_info, tuple of (int, int, int) */
const unsigned version = ZSTD_versionNumber();
const uint8_t v_major = version / 100 / 100;
const uint8_t v_minor = (version / 100) % 100;
const uint8_t v_release = version % 100;
if (PyModule_Add(m, "zstd_version_info",
Py_BuildValue("BBB", v_major, v_minor, v_release)) < 0) {
/* zstd_version, str */
if (PyModule_AddStringConstant(m, "zstd_version",
ZSTD_versionString()) < 0) {
return -1;
}

Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp