Skip to content

Fortify usages of macros in cryptographic modules #136968

@picnixz

Description

@picnixz

Feature or enhancement

Proposal:

I love macros because I can reduce the number of duplicated code to write. But at the same, macros make the code harder to read, especially because of the lack of IntelliSense. Therefore, I suggest to convert macros in hashlib and hmac into regular functions. I will measure the performance impact but I honestly doubt it will change much the bottleneck in such calls is in the hash computation itself.

Because of the code being shared by all cryptographic modules, I really want to have a dedicated folder with utils inside because it starts becoming annoying to have to declare everything as static inline (even large functions) or as macros...

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

There is precedent here: PEP-670 but the scope of this project was the entire C API. Here, I really want to target internal functions that were either added recently or that I was really annoyed with these past few days.

Linked PRs

Metadata

Metadata

Assignees

Labels

extension-modulesC modules in the Modules dirtype-featureA feature request or enhancementtype-refactorCode refactoring (with no changes in behavior)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions