Skip to content

Python 3.14#3

Closed
mrjackv wants to merge 8 commits into
revng:basefrom
mrjackv:feature/python-3.14
Closed

Python 3.14#3
mrjackv wants to merge 8 commits into
revng:basefrom
mrjackv:feature/python-3.14

Conversation

@mrjackv
Copy link
Copy Markdown

@mrjackv mrjackv commented May 15, 2026

Note: this is just a rebase on top of the base branch, no changes have been made

mrjackv added 8 commits May 11, 2026 13:41
Add an additional `CMakeLists.txt` file which allows building nanobind
as a standalone project, installing `libnanobind.so` under `/lib` and
headers under `/include`.
Drop the use of `typeid` and `std::type_info` from the codebase, they
are now replaced with a thin shim through `shimTypeid<T>` and
`shim::type_info`.
Search and replace all uses of uses of `std::type_info` and
`typeid(...)` from the codebase and replace them with the shimmed
functions/classes implemented in the previous commit. This commit can
be regenerated during a rebase by running the following command:

```
find src include -type f \
    \( -name '*.h' -or -name '*.cpp' \) \
    -exec sed -i \
        -e 's;std::type_info;shim::type_info;g' \
        -e 's;typeid(\*ptr);typeidShim(*ptr);g' \
        -e 's;typeid(\([^)]\+\));typeidShim<\1>();g' {} \;
```
Drop the use of exceptions from the codebase. Where needed add an
`abort`.
Search and replace all exception-related code (`try`, `catch`, `throw`)
and replace their use with functions/classes implemented in the previous
commit. This commit can be regenerated during a rebase by running the
following command:

```
find src include -type f \
    \( -name '*.h' -or -name '*.cpp' \) \
    -exec sed -i \
        -e 's|try {|if (true) {|g' \
        -e 's|catch (.*&\s*\(.\+\)) {|if (false) { shim::exception_placeholder \1;|g' \
        -e 's|catch (.*) {|if (false) {|g' \
        -e 's|throw \(.*\);$|throwShim(\1);|g' {} \;
```
Add extra compiler flags that make the compiler stricter.
Remove the `hidden` attribute from the nanobind namespace, as it was
causing linking problems.
@aleclearmind
Copy link
Copy Markdown

Merged in a111828. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants