Comments (3)
It is because List[UInt8]
gets constructed to a String
when pass into f.write()
. This constructor requires your list, t1
to have null terminator as last element (t1[-1] == 0
). If you run with mojo -D MOJO_ENABLE_ASSERTIONS
, your code will crash with Assert Error: expected last element of String buffer to be null terminator
.
from mojo.
Reproduces with latest nightly build: mojo 2024.6.2005 (6f19fd07).
from mojo.
thanks.
I already add a 0 when I need to write a bunch of bytes.
It also means that one can construct a String with invalid UTF8 code-point (or maybe I was lucky all this time :-) ), but I guess it's another debate.
Do I need to close this bug ?
from mojo.
Related Issues (20)
- [Docs] Vectorize docs are outdated HOT 1
- [BUG] `String.removesuffix("")` removes entire string
- [Crash] Segmentation fault after model ran successfully first time
- [BUG] `List` doesn't work at compile time. HOT 3
- return type is not working for a function HOT 2
- [BUG] trouble with Optional HOT 4
- [BUG] Optional / destructor called two times HOT 1
- [BUG] Redefinition of method with identical signatures when they're different
- [BUG] segfault on Struct recursive methods
- [BUG] User-defined `__setitem__` method is failing with a "must be mutable" error
- [BUG] FFI BUG
- [stdlib] Add missing comparison operator tests
- [BUG] numpy type problem
- [BUG] Storing a list iterator in a variable fails in a REPL/notebook environment
- [Feature Request] Make print default to `__repr__` not `format_to`
- [mojo-stdlib] Implicit conversions between SIMD values can lose data HOT 1
- [Docs] Clicking on Mojo logo in manual leads to "Page Not Found" error
- [Feature Request] Consistent naming of Traits using Gradable Adjectives
- [Feature Request] Simple float conversion
- [Feature Request] Rename `countl_zero` / `countr_zero` to `count_leading_zeros` / `count_trailing_zeros`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojo.