[PR #134] [CLOSED] fix RuntimeError by terminating kwlist with NULL pointer #745

Open
opened 2026-01-29 20:50:39 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/google/brotli/pull/134
Author: @anthrotype
Created: 8/10/2015
Status: Closed

Base: masterHead: fix-osx


📝 Commits (1)

  • f5bb788 [brotlimodule.cc] fix RuntimeError on OS X: keyword list must be NULL terminated

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 python/brotlimodule.cc (+1 -1)

📄 Description

The <malloc.h> header is non-standard, and causes compilation error on OS X:

dec/decode.c:16:10: fatal error: 'malloc.h' file not found
#include <malloc.h>
         ^
1 error generated.
error: command 'clang' failed with exit status 1

Just including <stdlib.h> should be sufficient in this case.

I also realised that I broke the brotli.compress function in #131... at least on OS X, running the tests raises:

RuntimeError: More keyword list entries (10) than format specifiers (5)

That's because I forgot to terminate the kwlist array with NULL pointer.
Sorry about that.

Strangely enough this error doesn't occur on Windows.

That's one more reason to have continuous integration systems like Travis/Appveyor running tests on multiple platforms. As a bonus, we could have them automatically build Python wheels for both Win and Mac, and deploying them to Github Releases every time a new release is tagged.
I'll send a specific PR for that soon.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/google/brotli/pull/134 **Author:** [@anthrotype](https://github.com/anthrotype) **Created:** 8/10/2015 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix-osx` --- ### 📝 Commits (1) - [`f5bb788`](https://github.com/google/brotli/commit/f5bb788ccb0127deade32ef644e60b3b707d4142) [brotlimodule.cc] fix RuntimeError on OS X: keyword list must be NULL terminated ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `python/brotlimodule.cc` (+1 -1) </details> ### 📄 Description The `<malloc.h>` header is non-standard, and causes compilation error on OS X: ``` dec/decode.c:16:10: fatal error: 'malloc.h' file not found #include <malloc.h> ^ 1 error generated. error: command 'clang' failed with exit status 1 ``` Just including `<stdlib.h>` should be sufficient in this case. I also realised that I broke the `brotli.compress` function in #131... at least on OS X, running the tests raises: ``` RuntimeError: More keyword list entries (10) than format specifiers (5) ``` That's because I forgot to terminate the `kwlist` array with `NULL` pointer. Sorry about that. Strangely enough this error doesn't occur on Windows. That's one more reason to have continuous integration systems like Travis/Appveyor running tests on multiple platforms. As a bonus, we could have them automatically build Python wheels for both Win and Mac, and deploying them to Github Releases every time a new release is tagged. I'll send a specific PR for that soon. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 20:50:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#745