Skip to content

gh-76007: Deprecate zlib.__version__ attribute - #140130

Merged
vstinner merged 3 commits into
python:mainfrom
StanFromIreland:zlib-version
Oct 15, 2025
Merged

gh-76007: Deprecate zlib.__version__ attribute#140130
vstinner merged 3 commits into
python:mainfrom
StanFromIreland:zlib-version

Conversation

@StanFromIreland

@StanFromIrelandStanFromIreland commented Oct 14, 2025

Copy link
Copy Markdown
Member

Comment threadModules/zlibmodule.c Outdated
Comment threadModules/zlibmodule.c Outdated
Comment threadModules/zlibmodule.c Outdated

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Comment threadModules/zlibmodule.c
ZLIB_CRC32_COMBINE_METHODDEF
ZLIB_DECOMPRESS_METHODDEF
ZLIB_DECOMPRESSOBJ_METHODDEF
{"__getattr__", zlib_getattr, METH_VARARGS, "Module __getattr__"},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I tried to convert the function to Argument Clinic, but it failed, oh!

Error in file 'Modules/zlibmodule.c' on line 2019:
'__getattr__' is a special method and cannot be converted to Argument Clinic!

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I tried that too :-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Would this be a valid feature request for AC or it’s somehow impossible?

@StanFromIrelandStanFromIrelandOct 19, 2025

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I tried, and it is relatively straightforward (I based my implementation on METHOD_INIT's), here is a patch. I do not know if there was a reason for this not being done before, other than there not being a need, as it is explicitly in the unsupported list, maybe Victor knows more?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have no idea why it's not supported currently.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

What do you think about the patch?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You can propose it as a PR.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

I opened #140376

@vstinner
vstinner merged commit 46f11b3 into python:mainOct 15, 2025
49 checks passed
@vstinner

Copy link
Copy Markdown
Member

Merged, thanks. I also saw that version but forgot to deprecate it :-)

@StanFromIreland
StanFromIreland deleted the zlib-version branch October 15, 2025 12:21
StanFromIreland added a commit to StanFromIreland/cpython that referenced this pull request Dec 6, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@StanFromIreland@vstinner@merwok