FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-122584: Import mimalloc headers in a C++ context by mdboom · Pull Request #122587 · python/cpython · GitHub

/ cpython Public

gh-122584: Import mimalloc headers in a C++ context - #122587

Merged
mdboom merged 1 commit into
python:mainfrom
mdboom:cpp-compile-mimalloc
Aug 15, 2024
Merged

gh-122584: Import mimalloc headers in a C++ context#122587
mdboom merged 1 commit into
python:mainfrom
mdboom:cpp-compile-mimalloc

Conversation

mdboom commented Aug 1, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

The vendored mimalloc headers are designed to be used in a C++ context if imported from C++. Therefore, we should switch the context back to C++ when using a C++ compiler here. This seems like the most future-proof fix, because otherwise we would need to be careful what context we import pycore_mimalloc.h from.

colesbury commented Aug 1, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

This seems like an okay workaround , but I think the underlying problems is that we really shouldn't be including headers under an extern "C". I've raised this issue before:

It can (and has) caused problems with system headers too.

vstinner 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Nice workaround.

I tried modifying the 123 header files in Include/internal/ to move #include outside extern "C" { ... }. It's a lot of work, it will be hard to maintain in the future, I don't think that it's worth it.

cdce8p commented Aug 12, 2024

Copy link
Copy Markdown
Contributor

What's the status here? This would also resolve one of the remaining issues with making mypyc compatible with 3.13. Would be great if it could be included in 3.13.0rc2. #121489 (comment)

mdboom merged commit 1dad23e into python:main Aug 15, 2024

Copy link
Copy Markdown

Thanks @mdboom for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 15, 2024
…22587)

(cherry picked from commit 1dad23e)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>

bedevere-app Bot commented Aug 15, 2024

Copy link
Copy Markdown

GH-123035 is a backport of this pull request to the 3.13 branch.

bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 15, 2024
hauntsaninja pushed a commit that referenced this pull request Aug 16, 2024
#123035)

gh-122584: Import mimalloc headers in a C++ context (GH-122587)
(cherry picked from commit 1dad23e)

Co-authored-by: Michael Droettboom <mdboom@gmail.com>
blhsing pushed a commit to blhsing/cpython that referenced this pull request Aug 22, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL