Skip to content

Conversation

@Tpt
Copy link
Contributor

@Tpt Tpt commented Sep 19, 2025

Significantly simplifies the parsing by avoiding to resolve pointers and fixes compatibility with LLD

I dropped the old code path, we can add it back if we want to maintain backward compatibility

Thanks to uniffi for the inspiration

@Tpt Tpt mentioned this pull request Sep 19, 2025
@Tpt Tpt force-pushed the elf-lld branch 3 times, most recently from 13c7df2 to 5ce2a1f Compare September 19, 2025 10:41
@Tpt Tpt force-pushed the elf-lld branch 2 times, most recently from 3d2f822 to c808cc4 Compare September 19, 2025 15:32
…ucing a ptr+len indirection

Significantly simplifies the parsing

I dropped the old code path, we can add it back if we want to maintain backward compatibility
@Tpt Tpt marked this pull request as ready for review September 19, 2025 15:38
Chunk::deserialize(&mut Deserializer::from_slice(chunk)).with_context(|| {
// We take the first valid utf8 bytes, it's quite likely to be the actual chunk
// We use a 4096 upper bound for security
let chunk = str::from_utf8(&chunk[..4096])
Copy link
Member

Choose a reason for hiding this comment

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

I guess this also breaks if the annotation is greater than 4096 chars?

Should we potentially store each static as a #[repr(C)] struct of u32 size and then the bytes, so that we still have a length?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a great idea. I'm going to implement it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess this also breaks if the annotation is greater than 4096 chars?

Yes, but it's only an error message so I am not sure it's a big deal

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in c2d6a41

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for identifying and fixing!

@davidhewitt davidhewitt added this pull request to the merge queue Sep 19, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 19, 2025
@Tpt
Copy link
Contributor Author

Tpt commented Sep 20, 2025

@davidhewitt There was an issue with the expected stub files. Fix: aa65fff

@davidhewitt davidhewitt added this pull request to the merge queue Sep 20, 2025
Merged via the queue into PyO3:main with commit ae64e57 Sep 20, 2025
42 of 43 checks passed
@Tpt Tpt deleted the elf-lld branch September 22, 2025 09:45
Sign up for free to 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.

2 participants